Make pkg expressions more idiomatic, store scripts in separate files
This commit is contained in:
parent
6d0534b319
commit
a2f66ba293
4 changed files with 47 additions and 36 deletions
|
|
@ -1,30 +1,31 @@
|
|||
{ pkgs, stdenvNoCC }:
|
||||
{
|
||||
# Build tools.
|
||||
installShellFiles, stdenvNoCC,
|
||||
|
||||
# Packages.
|
||||
findutils, zsh,
|
||||
}:
|
||||
|
||||
with pkgs;
|
||||
with stdenvNoCC;
|
||||
|
||||
mkDerivation {
|
||||
pname = "nix-store-fuzzy-find";
|
||||
version = "2026-04-29";
|
||||
name = "nix-store-fuzzy-find";
|
||||
|
||||
phases = [ "createSourcesPhase" "installPhase" ];
|
||||
src = ./.;
|
||||
|
||||
createSourcesPhase = ''
|
||||
# Same directory structure that `unpackPhase` would use.
|
||||
mkdir -p /build/source
|
||||
|
||||
cat <<- EOF > /build/source/nix-store-fuzzy-find
|
||||
#!${bash}/bin/sh
|
||||
|
||||
exec ${findutils}/bin/find /nix/store -maxdepth 1 -type d -name "*-\$1-*"
|
||||
EOF
|
||||
'';
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
buildInputs = [ zsh ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
runHook preInstall
|
||||
|
||||
cp /build/source/nix-store-fuzzy-find $out/bin/
|
||||
installBin nix-store-fuzzy-find
|
||||
|
||||
chmod +x $out/bin/nix-store-fuzzy-find
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
preFixup = ''
|
||||
substituteInPlace $out/bin/nix-store-fuzzy-find \
|
||||
--replace-fail find ${findutils}/bin/find
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue