nixpkgs-suyu/doc/builders/special/makesetuphook.section.md
pennae 052bb41410 doc: assign ids to many headings
without stable ids on headings we cannot generate stable links to these
headings. nrd complains about this, but the current docbook workflow
does not.

a few generated ids remain, mostly in examples and footnotes. most of
the examples are generated by nixdoc (which has since gained MD export
functions, and the MD export does generate IDs).
2023-03-27 22:39:11 +02:00

1.1 KiB

pkgs.makeSetupHook

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

Usage

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

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

  • 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