mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-08 14:03:29 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
72 lines
1.8 KiB
Nix
72 lines
1.8 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchFromGitHub,
|
|
nix-update-script,
|
|
nixosTests,
|
|
rustPlatform,
|
|
sonic-server,
|
|
testers,
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "sonic-server";
|
|
version = "1.4.9";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "valeriansaliou";
|
|
repo = "sonic";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-PTujR3ciLRvbpiqStNMx3W5fkUdW2dsGmCj/iFRTKJM=";
|
|
};
|
|
|
|
cargoHash = "sha256-bH9u38gvH6QEySQ3XFXEHBiSqKKtB+kjcZRLjx4Z6XM=";
|
|
|
|
nativeBuildInputs = [
|
|
rustPlatform.bindgenHook
|
|
];
|
|
|
|
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-faligned-allocation";
|
|
|
|
postPatch = ''
|
|
substituteInPlace src/main.rs \
|
|
--replace-fail "./config.cfg" "$out/etc/sonic/config.cfg"
|
|
'';
|
|
|
|
postInstall = ''
|
|
install -Dm444 -t $out/etc/sonic config.cfg
|
|
install -Dm444 -t $out/lib/systemd/system debian/sonic.service
|
|
|
|
substituteInPlace $out/lib/systemd/system/sonic.service \
|
|
--replace-fail /usr/bin/sonic $out/bin/sonic \
|
|
--replace-fail /etc/sonic.cfg $out/etc/sonic/config.cfg
|
|
'';
|
|
|
|
# Found argument '--test-threads' which wasn't expected, or isn't valid in this context
|
|
doCheck = false;
|
|
|
|
passthru = {
|
|
tests = {
|
|
inherit (nixosTests) sonic-server;
|
|
version = testers.testVersion {
|
|
command = "sonic --version";
|
|
package = sonic-server;
|
|
};
|
|
};
|
|
updateScript = nix-update-script { };
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Fast, lightweight and schema-less search backend";
|
|
homepage = "https://github.com/valeriansaliou/sonic";
|
|
changelog = "https://github.com/valeriansaliou/sonic/releases/tag/v${version}";
|
|
license = licenses.mpl20;
|
|
platforms = platforms.unix;
|
|
mainProgram = "sonic";
|
|
maintainers = with maintainers; [
|
|
pleshevskiy
|
|
anthonyroussel
|
|
];
|
|
};
|
|
}
|