uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
25
lib/tests/modules/functionTo/list-order.nix
Normal file
25
lib/tests/modules/functionTo/list-order.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
inherit (lib) types;
|
||||
in {
|
||||
options = {
|
||||
fun = lib.mkOption {
|
||||
type = types.functionTo (types.listOf types.str);
|
||||
};
|
||||
|
||||
result = lib.mkOption {
|
||||
type = types.str;
|
||||
default = toString (config.fun {
|
||||
a = "a";
|
||||
b = "b";
|
||||
c = "c";
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
config.fun = lib.mkMerge [
|
||||
(input: lib.mkAfter [ input.a ])
|
||||
(input: [ input.b ])
|
||||
];
|
||||
}
|
||||
27
lib/tests/modules/functionTo/merging-attrs.nix
Normal file
27
lib/tests/modules/functionTo/merging-attrs.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{ lib, config, ... }:
|
||||
let
|
||||
inherit (lib) types;
|
||||
in {
|
||||
options = {
|
||||
fun = lib.mkOption {
|
||||
type = types.functionTo (types.attrsOf types.str);
|
||||
};
|
||||
|
||||
result = lib.mkOption {
|
||||
type = types.str;
|
||||
default = toString (lib.attrValues (config.fun {
|
||||
a = "a";
|
||||
b = "b";
|
||||
c = "c";
|
||||
}));
|
||||
};
|
||||
};
|
||||
|
||||
config.fun = lib.mkMerge [
|
||||
(input: { inherit (input) a; })
|
||||
(input: { inherit (input) b; })
|
||||
(input: {
|
||||
b = lib.mkForce input.c;
|
||||
})
|
||||
];
|
||||
}
|
||||
24
lib/tests/modules/functionTo/merging-list.nix
Normal file
24
lib/tests/modules/functionTo/merging-list.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{ lib, config, ... }:
|
||||
let
|
||||
inherit (lib) types;
|
||||
in {
|
||||
options = {
|
||||
fun = lib.mkOption {
|
||||
type = types.functionTo (types.listOf types.str);
|
||||
};
|
||||
|
||||
result = lib.mkOption {
|
||||
type = types.str;
|
||||
default = toString (config.fun {
|
||||
a = "a";
|
||||
b = "b";
|
||||
c = "c";
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
config.fun = lib.mkMerge [
|
||||
(input: [ input.a ])
|
||||
(input: [ input.b ])
|
||||
];
|
||||
}
|
||||
61
lib/tests/modules/functionTo/submodule-options.nix
Normal file
61
lib/tests/modules/functionTo/submodule-options.nix
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{ lib, config, options, ... }:
|
||||
let
|
||||
inherit (lib) types;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
|
||||
# fun.<function-body>.a
|
||||
({ ... }: {
|
||||
options = {
|
||||
fun = lib.mkOption {
|
||||
type = types.functionTo (types.submodule {
|
||||
options.a = lib.mkOption { default = "a"; };
|
||||
});
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
# fun.<function-body>.b
|
||||
({ ... }: {
|
||||
options = {
|
||||
fun = lib.mkOption {
|
||||
type = types.functionTo (types.submodule {
|
||||
options.b = lib.mkOption { default = "b"; };
|
||||
});
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
options = {
|
||||
result = lib.mkOption
|
||||
{
|
||||
type = types.str;
|
||||
default = lib.concatStringsSep " " (lib.attrValues (config.fun (throw "shouldn't use input param")));
|
||||
};
|
||||
|
||||
optionsResult = lib.mkOption
|
||||
{
|
||||
type = types.str;
|
||||
default = lib.concatStringsSep " "
|
||||
(lib.concatLists
|
||||
(lib.mapAttrsToList
|
||||
(k: v:
|
||||
if k == "_module"
|
||||
then [ ]
|
||||
else [ (lib.showOption v.loc) ]
|
||||
)
|
||||
(
|
||||
(options.fun.type.getSubOptions [ "fun" ])
|
||||
)
|
||||
)
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
config.fun = lib.mkMerge
|
||||
[
|
||||
(input: { b = "bee"; })
|
||||
];
|
||||
}
|
||||
17
lib/tests/modules/functionTo/trivial.nix
Normal file
17
lib/tests/modules/functionTo/trivial.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{ lib, config, ... }:
|
||||
let
|
||||
inherit (lib) types;
|
||||
in {
|
||||
options = {
|
||||
fun = lib.mkOption {
|
||||
type = types.functionTo types.str;
|
||||
};
|
||||
|
||||
result = lib.mkOption {
|
||||
type = types.str;
|
||||
default = config.fun "input";
|
||||
};
|
||||
};
|
||||
|
||||
config.fun = input: "input is ${input}";
|
||||
}
|
||||
18
lib/tests/modules/functionTo/wrong-type.nix
Normal file
18
lib/tests/modules/functionTo/wrong-type.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
{ lib, config, ... }:
|
||||
let
|
||||
inherit (lib) types;
|
||||
in {
|
||||
options = {
|
||||
fun = lib.mkOption {
|
||||
type = types.functionTo types.str;
|
||||
};
|
||||
|
||||
result = lib.mkOption {
|
||||
type = types.str;
|
||||
default = config.fun 0;
|
||||
};
|
||||
};
|
||||
|
||||
config.fun = input: input + 1;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue