Merge pull request #6272 from NixOS/types-path-better-error
types.nix: better error message for non-paths
This commit is contained in:
commit
e6f1e1e5db
@ -103,7 +103,8 @@ rec {
|
|||||||
path = mkOptionType {
|
path = mkOptionType {
|
||||||
name = "path";
|
name = "path";
|
||||||
# Hacky: there is no ‘isPath’ primop.
|
# Hacky: there is no ‘isPath’ primop.
|
||||||
check = x: builtins.substring 0 1 (toString x) == "/";
|
# need to check isString first because otherwise toString throws an error.
|
||||||
|
check = x: builtins.isString x && builtins.substring 0 1 (toString x) == "/";
|
||||||
merge = mergeOneOption;
|
merge = mergeOneOption;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ in
|
|||||||
environment = {
|
environment = {
|
||||||
|
|
||||||
systemPackages = mkOption {
|
systemPackages = mkOption {
|
||||||
type = types.listOf types.path;
|
type = types.listOf types.package;
|
||||||
default = [];
|
default = [];
|
||||||
example = literalExample "[ pkgs.firefox pkgs.thunderbird ]";
|
example = literalExample "[ pkgs.firefox pkgs.thunderbird ]";
|
||||||
description = ''
|
description = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user