doc: Fix missing pre/post hooks everywhere

This commit is contained in:
Niklas Hambüchen 2024-06-10 10:45:36 +02:00
parent 2795c506fe
commit ee6c2bd2eb
10 changed files with 51 additions and 4 deletions

View file

@ -38,7 +38,11 @@ let
changedHello = pkgs.hello.overrideAttrs (_: {
doCheck = false;
patchPhase = ''
runHook prePatch
sed -i 's/Hello, world!/Hello, Nix!/g' src/hello.c
runHook postPatch
'';
});
in

View file

@ -102,6 +102,8 @@ stdenvNoCC.mkDerivation {
];
installPhase = ''
runHook preInstall
cd ..
export NIX_STATE_DIR=$(mktemp -d)
@ -143,5 +145,7 @@ stdenvNoCC.mkDerivation {
) libsets}
echo '```' >> "$out/index.md"
runHook postInstall
'';
}

View file

@ -118,7 +118,13 @@ pkgs.stdenv.mkDerivation {
runHook postBuild
'';
installPhase = "mv gulpdist $out";
installPhase = ''
runHook preInstall
mv gulpdist $out
runHook postInstall
'';
}
```

View file

@ -192,6 +192,7 @@ pkgs.buildEmscriptenPackage {
cp *.json $out/share
cp *.rng $out/share
cp README.md $doc/share/${name}
runHook postInstall
'';

View file

@ -69,9 +69,13 @@ script to run it using a JRE. You can use `makeWrapper` for this:
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
makeWrapper ${jre}/bin/java $out/bin/foo \
--add-flags "-cp $out/share/java/foo.jar org.foo.Main"
runHook postInstall
'';
}
```

View file

@ -690,7 +690,11 @@ The configure phase can sometimes fail because it makes many assumptions which m
```nix
{
configurePhase = ''
runHook preConfigure
ln -s $node_modules node_modules
runHook postConfigure
'';
}
```
@ -700,8 +704,12 @@ or if you need a writeable node_modules directory:
```nix
{
configurePhase = ''
runHook preConfigure
cp -r $node_modules node_modules
chmod +w node_modules
runHook postConfigure
'';
}
```

View file

@ -59,7 +59,11 @@ Such a Lisp can be now used e.g. to compile your sources:
```nix
{
buildPhase = ''
runHook preBuild
${sbcl'}/bin/sbcl --load my-build-file.lisp
runHook postBuild
'';
}
```

View file

@ -103,7 +103,13 @@ stdenv.mkDerivation (finalAttrs: {
# The helper provides a configure snippet that will prepare all dependencies
# in the correct place, where SwiftPM expects them.
configurePhase = generated.configure;
configurePhase = ''
runHook preConfigure
${generated.configure}
runHook postConfigure
'';
installPhase = ''
runHook preInstall
@ -168,11 +174,17 @@ with a writable copy:
```nix
{
configurePhase = generated.configure ++ ''
configurePhase = ''
runHook preConfigure
${generated.configure}
# Replace the dependency symlink with a writable copy.
swiftpmMakeMutable swift-crypto
# Now apply a patch.
patch -p1 -d .build/checkouts/swift-crypto -i ${./some-fix.patch}
runHook postConfigure
'';
}
```

View file

@ -113,9 +113,13 @@ stdenv.mkDerivation {
"bar.lua"
];
installPhase = ''
runHook preInstall
mkdir $out/share
cp foo.py $out/share
cp bar.lua $out/share
runHook postInstall
'';
}
```

View file

@ -261,7 +261,7 @@ stdenv.mkDerivation (finalAttrs: {
util-linux
qemu
];
checkPhase = ''[elided]'';
# `checkPhase` elided
})
```