nh,nh-unwrapped: split into two packages (#463477)

This commit is contained in:
Aleksana
2025-11-25 10:46:10 +00:00
committed by GitHub
2 changed files with 72 additions and 55 deletions
+62
View File
@@ -0,0 +1,62 @@
{
stdenv,
lib,
rustPlatform,
installShellFiles,
fetchFromGitHub,
nix-update-script,
buildPackages,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "nh-unwrapped";
version = "4.2.0";
src = fetchFromGitHub {
owner = "nix-community";
repo = "nh";
tag = "v${finalAttrs.version}";
hash = "sha256-6n5SVO8zsdVTD691lri7ZcO4zpqYFU8GIvjI6dbxkA8=";
};
strictDeps = true;
nativeBuildInputs = [
installShellFiles
];
postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (
let
emulator = stdenv.hostPlatform.emulator buildPackages;
in
''
mkdir completions
for shell in bash zsh fish; do
NH_NO_CHECKS=1 ${emulator} $out/bin/nh completions $shell > completions/nh.$shell
done
installShellCompletion completions/*
cargo xtask man --out-dir gen
installManPage gen/nh.1
''
);
cargoHash = "sha256-cxZsePgraYevuYQSi3hTU2EsiDyn1epSIcvGi183fIU=";
passthru.updateScript = nix-update-script { };
env.NH_REV = finalAttrs.src.tag;
meta = {
changelog = "https://github.com/nix-community/nh/blob/${finalAttrs.version}/CHANGELOG.md";
description = "Yet another nix cli helper";
homepage = "https://github.com/nix-community/nh";
license = lib.licenses.eupl12;
mainProgram = "nh";
maintainers = with lib.maintainers; [
NotAShelf
viperML
];
};
})
+10 -55
View File
@@ -1,75 +1,30 @@
{
stdenv,
lib,
rustPlatform,
installShellFiles,
symlinkJoin,
makeBinaryWrapper,
fetchFromGitHub,
nix-update-script,
nh-unwrapped,
nix-output-monitor,
buildPackages,
}:
let
unwrapped = nh-unwrapped;
runtimeDeps = [
nix-output-monitor
];
in
rustPlatform.buildRustPackage (finalAttrs: {
symlinkJoin {
pname = "nh";
version = "4.2.0";
inherit (unwrapped) version meta;
src = fetchFromGitHub {
owner = "nix-community";
repo = "nh";
tag = "v${finalAttrs.version}";
hash = "sha256-6n5SVO8zsdVTD691lri7ZcO4zpqYFU8GIvjI6dbxkA8=";
};
strictDeps = true;
paths = [
unwrapped
];
nativeBuildInputs = [
installShellFiles
makeBinaryWrapper
];
postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (
let
emulator = stdenv.hostPlatform.emulator buildPackages;
in
''
mkdir completions
for shell in bash zsh fish; do
NH_NO_CHECKS=1 ${emulator} $out/bin/nh completions $shell > completions/nh.$shell
done
installShellCompletion completions/*
cargo xtask man --out-dir gen
installManPage gen/nh.1
''
);
postFixup = ''
postBuild = ''
wrapProgram $out/bin/nh \
--prefix PATH : ${lib.makeBinPath runtimeDeps}
'';
cargoHash = "sha256-cxZsePgraYevuYQSi3hTU2EsiDyn1epSIcvGi183fIU=";
passthru.updateScript = nix-update-script { };
env.NH_REV = finalAttrs.src.tag;
meta = {
changelog = "https://github.com/nix-community/nh/blob/${finalAttrs.version}/CHANGELOG.md";
description = "Yet another nix cli helper";
homepage = "https://github.com/nix-community/nh";
license = lib.licenses.eupl12;
mainProgram = "nh";
maintainers = with lib.maintainers; [
NotAShelf
viperML
];
};
})
}