about summary refs log tree commit diff
path: root/pkgs/by-name/nh
diff options
context:
space:
mode:
authorPol Dellaiera <pol.dellaiera@protonmail.com>2023-12-05 14:03:11 +0100
committerPol Dellaiera <pol.dellaiera@protonmail.com>2023-12-05 19:48:24 +0100
commitb62d471f62a2042394869922010a713aaa5a3486 (patch)
tree52e293f6b6477164c2ec181fbfbbc6ebcb80f7f3 /pkgs/by-name/nh
parentb735b9b29fbc88910611adc005408f55288e39f0 (diff)
nh: init at 3.4.12
Diffstat (limited to 'pkgs/by-name/nh')
-rw-r--r--pkgs/by-name/nh/nh/package.nix59
1 files changed, 59 insertions, 0 deletions
diff --git a/pkgs/by-name/nh/nh/package.nix b/pkgs/by-name/nh/nh/package.nix
new file mode 100644
index 0000000000000..c32b16876dd88
--- /dev/null
+++ b/pkgs/by-name/nh/nh/package.nix
@@ -0,0 +1,59 @@
+{ lib
+, rustPlatform
+, installShellFiles
+, makeWrapper
+, fetchFromGitHub
+, nvd
+, use-nom ? true
+, nix-output-monitor ? null
+}:
+
+assert use-nom -> nix-output-monitor != null;
+
+let
+  version = "3.4.12";
+  runtimeDeps = [ nvd ] ++ lib.optionals use-nom [ nix-output-monitor ];
+in
+rustPlatform.buildRustPackage {
+  inherit version;
+  pname = "nh";
+
+  src = fetchFromGitHub {
+    owner = "ViperML";
+    repo = "nh";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-V5TQ/1loQnegDjfLh61DxBWEQZivYEBq2kQpT0fn2cQ=";
+  };
+
+  strictDeps = true;
+
+  nativeBuildInputs = [
+    installShellFiles
+    makeWrapper
+  ];
+
+  preFixup = ''
+    mkdir completions
+    $out/bin/nh completions --shell bash > completions/nh.bash
+    $out/bin/nh completions --shell zsh > completions/nh.zsh
+    $out/bin/nh completions --shell fish > completions/nh.fish
+
+    installShellCompletion completions/*
+  '';
+
+  postFixup = ''
+    wrapProgram $out/bin/nh \
+      --prefix PATH : ${lib.makeBinPath runtimeDeps} \
+      ${lib.optionalString use-nom "--set-default NH_NOM 1"}
+  '';
+
+  cargoHash = "sha256-Ul4DM8WmKvKG32zBXzpdzHZknpTQAVvrxFcEd/C1buA=";
+
+  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 ];
+  };
+}