Introduce createSourcesPhase in nsff, fix formatting, add comment

This commit is contained in:
Reinout Meliesie 2025-03-15 14:43:23 +01:00
parent 45791b4e34
commit f70c0d689a
Signed by: zedfrigg
GPG key ID: 3AFCC06481308BC6
2 changed files with 15 additions and 14 deletions

View file

@ -1,7 +1,4 @@
{ { pkgs , stdenv } :
pkgs ,
stdenv ,
} :
with pkgs ; with pkgs ;
with stdenv ; with stdenv ;
@ -13,6 +10,7 @@ mkDerivation {
phases = [ "createSourcesPhase" "installPhase" ] ; phases = [ "createSourcesPhase" "installPhase" ] ;
createSourcesPhase = '' createSourcesPhase = ''
# Same directory structure that `unpackPhase` would use
mkdir -p /build/source mkdir -p /build/source
cat <<- EOF > /build/source/journalctl-last-invocation cat <<- EOF > /build/source/journalctl-last-invocation

View file

@ -1,7 +1,4 @@
{ { pkgs , stdenv } :
pkgs ,
stdenv ,
} :
with pkgs ; with pkgs ;
with stdenv ; with stdenv ;
@ -10,18 +7,24 @@ mkDerivation {
pname = "nix-store-fuzzy-find" ; pname = "nix-store-fuzzy-find" ;
version = "2025-03-09" ; version = "2025-03-09" ;
phases = [ "installPhase" ] ; phases = [ "createSourcesPhase" "installPhase" ] ;
installPhase = '' createSourcesPhase = ''
mkdir -p $out/bin # Same directory structure that `unpackPhase` would use
mkdir -p /build/source
cat <<- EOF > $out/bin/nix-store-fuzzy-find cat <<- EOF > /build/source/nix-store-fuzzy-find
#!${bash}/bin/sh #!${bash}/bin/sh
exec ${findutils}/bin/find /nix/store -maxdepth 1 -type d -name "*-\$1-*" exec ${findutils}/bin/find /nix/store -maxdepth 1 -type d -name "*-\$1-*"
EOF EOF
'' ;
# TODO: Check if Nix does this for us installPhase = ''
chmod +x $out/bin/* mkdir -p $out/bin
cp /build/source/nix-store-fuzzy-find $out/bin/
chmod +x $out/bin/nix-store-fuzzy-find
'' ; '' ;
} }