nix/packages/nh/default.nix
2025-04-05 02:14:48 -05:00

71 lines
1.4 KiB
Nix

{
stdenv,
lib,
rustPlatform,
installShellFiles,
makeBinaryWrapper,
darwin,
fetchFromGitHub,
nix-update-script,
nvd,
nix-output-monitor,
}:
let
version = "4.0.0-beta.11";
runtimeDeps = [
nvd
nix-output-monitor
];
in
rustPlatform.buildRustPackage {
inherit version;
pname = "nh";
src = fetchFromGitHub {
owner = "viperML";
repo = "nh";
tag = "v${version}";
hash = "sha256-ILEarFQp89V6RWr5GRU/ip9dB1SEqUFQGs1QMPrk9TQ=";
};
strictDeps = true;
nativeBuildInputs = [
installShellFiles
makeBinaryWrapper
];
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.SystemConfiguration
];
preFixup = ''
mkdir completions
$out/bin/nh completions bash > completions/nh.bash
$out/bin/nh completions zsh > completions/nh.zsh
$out/bin/nh completions fish > completions/nh.fish
installShellCompletion completions/*
'';
postFixup = ''
wrapProgram $out/bin/nh \
--prefix PATH : ${lib.makeBinPath runtimeDeps}
'';
useFetchCargoVendor = true;
cargoHash = "sha256-GnRLUV5dyQgcjBBQXzjW0dvfHqIrlBlIup4b7oL8InI=";
passthru.updateScript = nix-update-script { };
meta = {
description = "Yet another nix cli helper";
homepage = "https://github.com/viperML/nh";
license = lib.licenses.eupl12;
mainProgram = "nh";
maintainers = with lib.maintainers; [
drupol
viperML
];
};
}