From f616e094fa92095f00371f7e04e4f0bacf436b7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Tue, 14 Sep 2021 19:33:08 +0200 Subject: [PATCH] nix-index: wrap in a separate derivation --- .../package-management/nix-index/default.nix | 10 ++++------ .../package-management/nix-index/wrapper.nix | 19 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 3 ++- 3 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 pkgs/tools/package-management/nix-index/wrapper.nix diff --git a/pkgs/tools/package-management/nix-index/default.nix b/pkgs/tools/package-management/nix-index/default.nix index a8a2c2242fd5..10449a331f93 100644 --- a/pkgs/tools/package-management/nix-index/default.nix +++ b/pkgs/tools/package-management/nix-index/default.nix @@ -1,5 +1,5 @@ -{ lib, stdenv, rustPlatform, fetchFromGitHub, pkg-config, makeWrapper, openssl, curl -, nix, Security +{ lib, stdenv, rustPlatform, fetchFromGitHub, pkg-config, openssl, curl +, Security }: rustPlatform.buildRustPackage rec { @@ -15,7 +15,7 @@ rustPlatform.buildRustPackage rec { cargoSha256 = "161lz96a52s53rhhkxxhcg41bsmh8w6rv6nl8gwqmg3biszy7hah"; - nativeBuildInputs = [ pkg-config makeWrapper ]; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ openssl curl ] ++ lib.optional stdenv.isDarwin Security; @@ -26,14 +26,12 @@ rustPlatform.buildRustPackage rec { cp ./command-not-found.sh $out/etc/profile.d/command-not-found.sh substituteInPlace $out/etc/profile.d/command-not-found.sh \ --replace "@out@" "$out" - wrapProgram $out/bin/nix-index \ - --prefix PATH : "${lib.makeBinPath [ nix ]}" ''; meta = with lib; { description = "A files database for nixpkgs"; homepage = "https://github.com/bennofs/nix-index"; license = with licenses; [ bsd3 ]; - maintainers = [ maintainers.bennofs ]; + maintainers = with maintainers; [ bennofs ncfavier ]; }; } diff --git a/pkgs/tools/package-management/nix-index/wrapper.nix b/pkgs/tools/package-management/nix-index/wrapper.nix new file mode 100644 index 000000000000..2f2608fc7253 --- /dev/null +++ b/pkgs/tools/package-management/nix-index/wrapper.nix @@ -0,0 +1,19 @@ +{ lib, symlinkJoin, nix-index-unwrapped, makeWrapper, nix }: + +if nix == null then nix-index-unwrapped else +symlinkJoin { + inherit (nix-index-unwrapped) name; + + paths = [ nix-index-unwrapped ]; + + nativeBuildInputs = [ makeWrapper ]; + + postBuild = '' + wrapProgram $out/bin/nix-index \ + --prefix PATH : ${lib.makeBinPath [ nix ]} + ''; + + meta = nix-index-unwrapped.meta // { + hydraPlatforms = []; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2f755cf842c3..4a7d3d84f166 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -31763,9 +31763,10 @@ with pkgs; nix-info = callPackage ../tools/nix/info { }; nix-info-tested = nix-info.override { doCheck = true; }; - nix-index = callPackage ../tools/package-management/nix-index { + nix-index-unwrapped = callPackage ../tools/package-management/nix-index { inherit (darwin.apple_sdk.frameworks) Security; }; + nix-index = callPackage ../tools/package-management/nix-index/wrapper.nix { }; nix-linter = haskell.lib.justStaticExecutables (haskellPackages.nix-linter);