Files
roowho2/nix/package.nix
h7x4 6b94e42ed4
Some checks failed
Build and test / check (push) Successful in 1m6s
Build and test / build (push) Failing after 1m29s
Build and test / test (push) Failing after 1m50s
Build and test / docs (push) Successful in 2m52s
Cargo.toml: enable uucore logind integration, add systemd compile flag
2026-01-09 15:42:05 +09:00

53 lines
1.2 KiB
Nix

{
lib
, rustPlatform
, stdenv
, buildPackages
, installShellFiles
, versionCheckHook
, systemdLibs
, cargoToml
, cargoLock
, src
}:
rustPlatform.buildRustPackage {
pname = "roowho2";
inherit (cargoToml.package) version;
inherit src;
cargoLock.lockFile = cargoLock;
buildType = "releaselto";
RUSTFLAGS = "-Zhigher-ranked-assumptions";
buildFeatures = lib.optionals stdenv.hostPlatform.isLinux [
"systemd"
];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
systemdLibs
];
nativeBuildInputs = [ installShellFiles ];
postInstall = let
emulator = stdenv.hostPlatform.emulator buildPackages;
installShellCompletions = lib.mapCartesianProduct ({ shell, command }: ''
(
export PATH="$out/bin:$PATH"
"${emulator}" "${command}" --completions=${shell} > "$TMP/${command}.${shell}"
)
installShellCompletion "--${shell}" --cmd "${command}" "$TMP/${command}.${shell}"
'') {
shell = [ "bash" "zsh" "fish" ];
command = [ "rwho" "ruptime" ];
};
in lib.concatStringsSep "\n" installShellCompletions;
meta = with lib; {
license = licenses.mit;
platforms = platforms.linux ++ platforms.darwin;
};
}