diff options
Diffstat (limited to 'doc/build-helpers/special')
-rw-r--r-- | doc/build-helpers/special/fhs-environments.section.md | 2 | ||||
-rw-r--r-- | doc/build-helpers/special/makesetuphook.section.md | 38 |
2 files changed, 29 insertions, 11 deletions
diff --git a/doc/build-helpers/special/fhs-environments.section.md b/doc/build-helpers/special/fhs-environments.section.md index 918d1e8c2951d..b87bb97278576 100644 --- a/doc/build-helpers/special/fhs-environments.section.md +++ b/doc/build-helpers/special/fhs-environments.section.md @@ -57,4 +57,4 @@ You can create a simple environment using a `shell.nix` like this: Running `nix-shell` on it would drop you into a shell inside an FHS env where those libraries and binaries are available in FHS-compliant paths. Applications that expect an FHS structure (i.e. proprietary binaries) can run inside this environment without modification. You can build a wrapper by running your binary in `runScript`, e.g. `./bin/start.sh`. Relative paths work as expected. -Additionally, the FHS builder links all relocated gsettings-schemas (the glib setup-hook moves them to `share/gsettings-schemas/${name}/glib-2.0/schemas`) to their standard FHS location. This means you don't need to wrap binaries with `wrapGAppsHook`. +Additionally, the FHS builder links all relocated gsettings-schemas (the glib setup-hook moves them to `share/gsettings-schemas/${name}/glib-2.0/schemas`) to their standard FHS location. This means you don't need to wrap binaries with `wrapGApps*` hook. diff --git a/doc/build-helpers/special/makesetuphook.section.md b/doc/build-helpers/special/makesetuphook.section.md index e83164b7eb701..179d8d456372c 100644 --- a/doc/build-helpers/special/makesetuphook.section.md +++ b/doc/build-helpers/special/makesetuphook.section.md @@ -9,22 +9,40 @@ pkgs.makeSetupHook { name = "something-hook"; propagatedBuildInputs = [ pkgs.commandsomething ]; depsTargetTargetPropagated = [ pkgs.libsomething ]; -} ./script.sh +} ./script.sh; ``` ### setup hook that depends on the hello package and runs hello and @shell@ is substituted with path to bash {#sec-pkgs.makeSetupHook-usage-example} ```nix -pkgs.makeSetupHook { +pkgs.makeSetupHook + { name = "run-hello-hook"; - propagatedBuildInputs = [ pkgs.hello ]; - substitutions = { shell = "${pkgs.bash}/bin/bash"; }; - passthru.tests.greeting = callPackage ./test { }; - meta.platforms = lib.platforms.linux; -} (writeScript "run-hello-hook.sh" '' - #!@shell@ - hello -'') + # Put dependencies here if they have hooks or necessary dependencies propagated + # otherwise prefer direct paths to executables. + propagatedBuildInputs = [ + pkgs.hello + pkgs.cowsay + ]; + substitutions = { + shell = "${pkgs.bash}/bin/bash"; + cowsay = "${pkgs.cowsay}/bin/cowsay"; + }; + } + ( + writeScript "run-hello-hook.sh" '' + #!@shell@ + # the direct path to the executable has to be here because + # this will be run when the file is sourced + # at which point '$PATH' has not yet been populated with inputs + @cowsay@ cow + + _printHelloHook() { + hello + } + preConfigureHooks+=(_printHelloHook) + '' + ); ``` ## Attributes {#sec-pkgs.makeSetupHook-attributes} |