summary refs log tree commit diff
path: root/doc/builders/special/makesetuphook.section.md
blob: eb042412137b8aef2aa16fbb0aec9b2221e41c6f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# pkgs.makeSetupHook {#sec-pkgs.makeSetupHook}

`pkgs.makeSetupHook` is a builder that produces hooks that go in to `nativeBuildInputs`

## Usage {#sec-pkgs.makeSetupHook-usage}

```nix
pkgs.makeSetupHook {
  name = "something-hook";
  propagatedBuildInputs = [ pkgs.commandsomething ];
  depsTargetTargetPropagated = [ pkgs.libsomething ];
} ./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 {
    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
'')
```

## Attributes {#sec-pkgs.makeSetupHook-attributes}

* `name` Set the name of the hook.
* `propagatedBuildInputs` Runtime dependencies (such as binaries) of the hook.
* `depsTargetTargetPropagated` Non-binary dependencies.
* `meta`
* `passthru`
* `substitutions` Variables for `substituteAll`