nix-index: wrap in a separate derivation

This commit is contained in:
Naïm Favier 2021-09-14 19:33:08 +02:00 committed by Benno Fünfstück
parent a38e53b8d7
commit f616e094fa
3 changed files with 25 additions and 7 deletions

View file

@ -1,5 +1,5 @@
{ lib, stdenv, rustPlatform, fetchFromGitHub, pkg-config, makeWrapper, openssl, curl { lib, stdenv, rustPlatform, fetchFromGitHub, pkg-config, openssl, curl
, nix, Security , Security
}: }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage rec {
@ -15,7 +15,7 @@ rustPlatform.buildRustPackage rec {
cargoSha256 = "161lz96a52s53rhhkxxhcg41bsmh8w6rv6nl8gwqmg3biszy7hah"; cargoSha256 = "161lz96a52s53rhhkxxhcg41bsmh8w6rv6nl8gwqmg3biszy7hah";
nativeBuildInputs = [ pkg-config makeWrapper ]; nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl curl ] buildInputs = [ openssl curl ]
++ lib.optional stdenv.isDarwin Security; ++ 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 cp ./command-not-found.sh $out/etc/profile.d/command-not-found.sh
substituteInPlace $out/etc/profile.d/command-not-found.sh \ substituteInPlace $out/etc/profile.d/command-not-found.sh \
--replace "@out@" "$out" --replace "@out@" "$out"
wrapProgram $out/bin/nix-index \
--prefix PATH : "${lib.makeBinPath [ nix ]}"
''; '';
meta = with lib; { meta = with lib; {
description = "A files database for nixpkgs"; description = "A files database for nixpkgs";
homepage = "https://github.com/bennofs/nix-index"; homepage = "https://github.com/bennofs/nix-index";
license = with licenses; [ bsd3 ]; license = with licenses; [ bsd3 ];
maintainers = [ maintainers.bennofs ]; maintainers = with maintainers; [ bennofs ncfavier ];
}; };
} }

View file

@ -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 = [];
};
}

View file

@ -31763,9 +31763,10 @@ with pkgs;
nix-info = callPackage ../tools/nix/info { }; nix-info = callPackage ../tools/nix/info { };
nix-info-tested = nix-info.override { doCheck = true; }; 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; inherit (darwin.apple_sdk.frameworks) Security;
}; };
nix-index = callPackage ../tools/package-management/nix-index/wrapper.nix { };
nix-linter = haskell.lib.justStaticExecutables (haskellPackages.nix-linter); nix-linter = haskell.lib.justStaticExecutables (haskellPackages.nix-linter);