Pattern match based on functional predicates.
x : The value to match against.
cases : A list of pairs, where each pair consists of a predicate function and a result value.
fmatch :: (a -> bool) -> [(a -> bool, b)] -> bfmatch "hello" (with builtins; [
[ isString "string" ]
[ isList "list" ]
])
=> [ "string" ]Set the value of each attribute given a list of paths.
value : The value to set.
xs : A list of paths to set the value for. : The paths can be strings or lists of strings.
fill { enable = true; } [ "a" [ "a" "b" ] ]
=> {
a = {
b = { enable = true; };
enable = true;
};
}Checks if the given attribute path exists in the attribute set.
Collects .nix files from given paths,
optionally recursing through subdirectories and applies filters.
Inspired by and adapted from https://github.com/yunfachi/nypkgs/blob/master/lib/umport.nix
paths
: Path or list of paths to search for .nix files (automatically coerced to list).
include
: Extra paths to add to results (bypasses normal filtering).
: Recursively expanded if recursive = true.
exclude
: Paths or files to exclude from results.
: Can be a list of paths or extended POSIX regular expressions.
: Regexes are matched against each component of the path.
: Explicitly excluded paths take precedence over include, but regexes do not.
recursive : Whether to search subdirectories.
filterDefault
: If true, only include default.nix in dirs that have one.
concatPaths :: {
paths: Path | [Path],
include?: Path | [Path],
exclude?: Path | [Path|String],
recursive?: Bool,
filterDefault?: Bool,
} -> [Path]concatPaths {
paths = [ ./src ./modules ];
exclude = [ ./modules/deprecated "^\\..*" ];
}
=> [ ./src/foo.nix ./modules/bar.nix ./modules/module/default.nix ]