mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
lib/types: add pathInStore
This commit is contained in:
parent
2e7efc14f2
commit
14d3e5685a
@ -461,6 +461,7 @@ rec {
|
|||||||
# - strings with context, e.g. "${pkgs.foo}" or (toString pkgs.foo)
|
# - strings with context, e.g. "${pkgs.foo}" or (toString pkgs.foo)
|
||||||
# - hardcoded store path literals (/nix/store/hash-foo) or strings without context
|
# - hardcoded store path literals (/nix/store/hash-foo) or strings without context
|
||||||
# ("/nix/store/hash-foo"). These get a context added to them using builtins.storePath.
|
# ("/nix/store/hash-foo"). These get a context added to them using builtins.storePath.
|
||||||
|
# If you don't need a *top-level* store path, consider using pathInStore instead.
|
||||||
package = mkOptionType {
|
package = mkOptionType {
|
||||||
name = "package";
|
name = "package";
|
||||||
descriptionClass = "noun";
|
descriptionClass = "noun";
|
||||||
@ -491,6 +492,14 @@ rec {
|
|||||||
merge = mergeEqualOption;
|
merge = mergeEqualOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pathInStore = mkOptionType {
|
||||||
|
name = "pathInStore";
|
||||||
|
description = "path in the Nix store";
|
||||||
|
descriptionClass = "noun";
|
||||||
|
check = x: isStringLike x && builtins.match "${builtins.storeDir}/[^.].*" (toString x) != null;
|
||||||
|
merge = mergeEqualOption;
|
||||||
|
};
|
||||||
|
|
||||||
listOf = elemType: mkOptionType rec {
|
listOf = elemType: mkOptionType rec {
|
||||||
name = "listOf";
|
name = "listOf";
|
||||||
description = "list of ${optionDescriptionPhrase (class: class == "noun" || class == "composite") elemType}";
|
description = "list of ${optionDescriptionPhrase (class: class == "noun" || class == "composite") elemType}";
|
||||||
|
@ -20,6 +20,11 @@ merging is handled.
|
|||||||
coerced to a string. Even if derivations can be considered as
|
coerced to a string. Even if derivations can be considered as
|
||||||
paths, the more specific `types.package` should be preferred.
|
paths, the more specific `types.package` should be preferred.
|
||||||
|
|
||||||
|
`types.pathInStore`
|
||||||
|
|
||||||
|
: A path that is contained in the Nix store. This can be a top-level store
|
||||||
|
path like `pkgs.hello` or a descendant like `"${pkgs.hello}/bin/hello"`.
|
||||||
|
|
||||||
`types.package`
|
`types.package`
|
||||||
|
|
||||||
: A top-level store path. This can be an attribute set pointing
|
: A top-level store path. This can be an attribute set pointing
|
||||||
|
Loading…
Reference in New Issue
Block a user