bscpkgs/garlic/stages/nix-setup.nix
2020-09-22 17:39:26 +02:00

30 lines
451 B
Nix

{
stdenv
}:
{
program
, nixsetup
}:
stdenv.mkDerivation {
name = "nixsetup";
preferLocalBuild = true;
phases = [ "installPhase" ];
dontPatchShebangs = true;
installPhase = ''
cat > $out <<EOF
#!/bin/sh
# We need to enter the nix namespace first, in order to have /nix
# available, so we use this hack:
if [ ! -e /nix ]; then
exec ${nixsetup} \$0
fi
exec ${program}
EOF
chmod +x $out
'';
}