makeSetupHook: make "name" argument mandatory

It's very frustrating to try to read through a derivation graph full
of derivations that are all just called "hook", so let's try to avoid
that.
This commit is contained in:
Alyssa Ross 2023-01-18 16:30:55 +00:00
parent 0ae87d514f
commit 1fc2a79ee1
3 changed files with 18 additions and 1 deletions

View File

@ -278,6 +278,12 @@
relying on this should provide their own implementation.
</para>
</listitem>
<listitem>
<para>
Calling <literal>makeSetupHook</literal> without passing a
<literal>name</literal> argument is deprecated.
</para>
</listitem>
<listitem>
<para>
Qt 5.12 and 5.14 have been removed, as the corresponding

View File

@ -73,6 +73,8 @@ In addition to numerous new and upgraded packages, this release has the followin
- The EC2 image module previously detected and activated swap-formatted instance store devices and partitions in stage-1 (initramfs). This behaviour has been removed. Users relying on this should provide their own implementation.
- Calling `makeSetupHook` without passing a `name` argument is deprecated.
- Qt 5.12 and 5.14 have been removed, as the corresponding branches have been EOL upstream for a long time. This affected under 10 packages in nixpkgs, largely unmaintained upstream as well, however, out-of-tree package expressions may need to be updated manually.
- In `mastodon` it is now necessary to specify location of file with `PostgreSQL` database password. In `services.mastodon.database.passwordFile` parameter default value `/var/lib/mastodon/secrets/db-password` has been changed to `null`.

View File

@ -546,6 +546,7 @@ rec {
* # writes a Linux-exclusive setup hook where @bash@ myscript.sh is substituted for the
* # bash interpreter.
* myhellohookSub = makeSetupHook {
* name = "myscript-hook";
* deps = [ hello ];
* substitutions = { bash = "${pkgs.bash}/bin/bash"; };
* meta.platforms = lib.platforms.linux;
@ -553,13 +554,21 @@ rec {
*
* # setup hook with a package test
* myhellohookTested = makeSetupHook {
* name = "myscript-hook";
* deps = [ hello ];
* substitutions = { bash = "${pkgs.bash}/bin/bash"; };
* meta.platforms = lib.platforms.linux;
* passthru.tests.greeting = callPackage ./test { };
* } ./myscript.sh;
*/
makeSetupHook = { name ? "hook", deps ? [], substitutions ? {}, meta ? {}, passthru ? {} }: script:
makeSetupHook =
{ name ? lib.warn "calling makeSetupHook without passing a name is deprecated." "hook"
, deps ? []
, substitutions ? {}
, meta ? {}
, passthru ? {}
}:
script:
runCommand name
(substitutions // {
inherit meta;