diff --git a/pkgs/by-name/nh/nh-unwrapped/package.nix b/pkgs/by-name/nh/nh-unwrapped/package.nix new file mode 100644 index 000000000000..862d32fd7960 --- /dev/null +++ b/pkgs/by-name/nh/nh-unwrapped/package.nix @@ -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 + ]; + }; +}) diff --git a/pkgs/by-name/nh/nh/package.nix b/pkgs/by-name/nh/nh/package.nix index b834c35c9d21..29032d5ce713 100644 --- a/pkgs/by-name/nh/nh/package.nix +++ b/pkgs/by-name/nh/nh/package.nix @@ -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 - ]; - }; -}) +}