1# pkgs.makeSetupHook {#sec-pkgs.makeSetupHook} 2 3`pkgs.makeSetupHook` is a build helper that produces hooks that go in to `nativeBuildInputs` 4 5## Usage {#sec-pkgs.makeSetupHook-usage} 6 7```nix 8pkgs.makeSetupHook { 9 name = "something-hook"; 10 propagatedBuildInputs = [ pkgs.commandsomething ]; 11 depsTargetTargetPropagated = [ pkgs.libsomething ]; 12} ./script.sh 13``` 14 15### setup hook that depends on the hello package and runs hello and @shell@ is substituted with path to bash {#sec-pkgs.makeSetupHook-usage-example} 16 17```nix 18pkgs.makeSetupHook 19 { 20 name = "run-hello-hook"; 21 # Put dependencies here if they have hooks or necessary dependencies propagated 22 # otherwise prefer direct paths to executables. 23 propagatedBuildInputs = [ 24 pkgs.hello 25 pkgs.cowsay 26 ]; 27 substitutions = { 28 shell = "${pkgs.bash}/bin/bash"; 29 cowsay = "${pkgs.cowsay}/bin/cowsay"; 30 }; 31 } 32 ( 33 writeScript "run-hello-hook.sh" '' 34 #!@shell@ 35 # the direct path to the executable has to be here because 36 # this will be run when the file is sourced 37 # at which point '$PATH' has not yet been populated with inputs 38 @cowsay@ cow 39 40 _printHelloHook() { 41 hello 42 } 43 preConfigureHooks+=(_printHelloHook) 44 '' 45 ) 46``` 47 48## Attributes {#sec-pkgs.makeSetupHook-attributes} 49 50* `name` Set the name of the hook. 51* `propagatedBuildInputs` Runtime dependencies (such as binaries) of the hook. 52* `depsTargetTargetPropagated` Non-binary dependencies. 53* `meta` 54* `passthru` 55* `substitutions` Variables for `substituteAll`