Skip to content

Commit 098e13d

Browse files
authored
feat(modules.makeWrapper): extraPackages -> runtimePkgs (#539)
renamed extraPackages -> runtimePkgs and changed its type to accept a wlib.types.spec type instead. The option accepts a list of either packages or sets with a `.data` field and optional prefix, name, before, after fields. This will not be breaking for most users, but it may be breaking for those consuming the resulting config value for other purposes. If all you were doing was setting it, then this will not affect you, beyond renaming the option. The motivation was to allow fine-grained selection of if the value should be suffixed or prefixed to the path. In addition, the makeWrapper module saw some updates to its excluded_options feature, used at the import site in some modules, particularly zsh and fish. You can now disable options in either the top level OR the variants, whereas before, you could only exclude both.
1 parent f318ea7 commit 098e13d

6 files changed

Lines changed: 476 additions & 347 deletions

File tree

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
{
2+
self,
3+
tlib,
4+
pkgs,
5+
...
6+
}:
7+
8+
let
9+
inherit (tlib) test areEqual;
10+
11+
evalWith =
12+
excluded:
13+
self.lib.evalModule [
14+
{ inherit pkgs; }
15+
(
16+
{ pkgs, wlib, ... }:
17+
{
18+
imports = [ (import wlib.modules.makeWrapper // { excluded_options = excluded; }) ];
19+
config.package = pkgs.hello;
20+
config.wrapperVariants.test.enable = true;
21+
}
22+
)
23+
];
24+
25+
# Access a variant's submodule options via the option's valueMeta
26+
varOpts = r: r.options.wrapperVariants.valueMeta.attrs.test.configuration.options;
27+
28+
in
29+
test "excluded-options" {
30+
31+
flat =
32+
let
33+
r = evalWith { argv0 = true; };
34+
in
35+
{
36+
argv0-absent-top = areEqual false (r.options ? argv0);
37+
argv0-absent-variant = areEqual false (varOpts r ? argv0);
38+
flagSeparator-present-top = areEqual true (r.options ? flagSeparator);
39+
flagSeparator-present-variant = areEqual true (varOpts r ? flagSeparator);
40+
};
41+
42+
top-only =
43+
let
44+
r = evalWith { top.argv0 = true; };
45+
in
46+
{
47+
argv0-absent-top = areEqual false (r.options ? argv0);
48+
argv0-present-variant = areEqual true (varOpts r ? argv0);
49+
};
50+
51+
variants-only =
52+
let
53+
r = evalWith { wrapperVariants.argv0 = true; };
54+
in
55+
{
56+
wrapperVariants-option-present = areEqual true (r.options ? wrapperVariants);
57+
argv0-present-top = areEqual true (r.options ? argv0);
58+
argv0-absent-variant = areEqual false (varOpts r ? argv0);
59+
};
60+
61+
wrapperVariants-entire-attrset =
62+
let
63+
r = self.lib.evalModule [
64+
{ inherit pkgs; }
65+
(
66+
{ pkgs, wlib, ... }:
67+
{
68+
imports = [ (import wlib.modules.makeWrapper // { excluded_options.wrapperVariants = true; }) ];
69+
config.package = pkgs.hello;
70+
}
71+
)
72+
];
73+
in
74+
{
75+
wrapperVariants-option-present = areEqual false (r.options ? wrapperVariants);
76+
};
77+
78+
}

0 commit comments

Comments
 (0)