diff --git a/lib/tests/modules.sh b/lib/tests/modules.sh index beb191aed0c14..8c0aeae12bb21 100755 --- a/lib/tests/modules.sh +++ b/lib/tests/modules.sh @@ -164,11 +164,11 @@ checkConfigError 'In attrTag, each tag value must be an option, but tag int was checkConfigOutput '".*/store/0lz9p8xhf89kb1c1kk6jxrzskaiygnlh-bash-5.2-p15.drv"' config.pathInStore.ok1 ./types.nix checkConfigOutput '".*/store/0fb3ykw9r5hpayd05sr0cizwadzq1d8q-bash-5.2-p15"' config.pathInStore.ok2 ./types.nix checkConfigOutput '".*/store/0fb3ykw9r5hpayd05sr0cizwadzq1d8q-bash-5.2-p15/bin/bash"' config.pathInStore.ok3 ./types.nix +checkConfigOutput '".*/store/\.links"' config.pathInStore.ok4 ./types.nix checkConfigError 'A definition for option .* is not of type .path in the Nix store.. Definition values:\n\s*- In .*: ""' config.pathInStore.bad1 ./types.nix checkConfigError 'A definition for option .* is not of type .path in the Nix store.. Definition values:\n\s*- In .*: ".*/store"' config.pathInStore.bad2 ./types.nix checkConfigError 'A definition for option .* is not of type .path in the Nix store.. Definition values:\n\s*- In .*: ".*/store/"' config.pathInStore.bad3 ./types.nix -checkConfigError 'A definition for option .* is not of type .path in the Nix store.. Definition values:\n\s*- In .*: ".*/store/.links"' config.pathInStore.bad4 ./types.nix -checkConfigError 'A definition for option .* is not of type .path in the Nix store.. Definition values:\n\s*- In .*: "/foo/bar"' config.pathInStore.bad5 ./types.nix +checkConfigError 'A definition for option .* is not of type .path in the Nix store.. Definition values:\n\s*- In .*: "/foo/bar"' config.pathInStore.bad4 ./types.nix # Check boolean option. checkConfigOutput '^false$' config.enable ./declare-enable.nix diff --git a/lib/tests/modules/types.nix b/lib/tests/modules/types.nix index 7c43a6819e0e8..fb32a99be24bc 100644 --- a/lib/tests/modules/types.nix +++ b/lib/tests/modules/types.nix @@ -15,10 +15,10 @@ in pathInStore.ok1 = "${storeDir}/0lz9p8xhf89kb1c1kk6jxrzskaiygnlh-bash-5.2-p15.drv"; pathInStore.ok2 = "${storeDir}/0fb3ykw9r5hpayd05sr0cizwadzq1d8q-bash-5.2-p15"; pathInStore.ok3 = "${storeDir}/0fb3ykw9r5hpayd05sr0cizwadzq1d8q-bash-5.2-p15/bin/bash"; + pathInStore.ok4 = "${storeDir}/.links"; pathInStore.bad1 = ""; pathInStore.bad2 = "${storeDir}"; pathInStore.bad3 = "${storeDir}/"; - pathInStore.bad4 = "${storeDir}/.links"; # technically true, but not reasonable - pathInStore.bad5 = "/foo/bar"; + pathInStore.bad4 = "/foo/bar"; }; } diff --git a/lib/types.nix b/lib/types.nix index e74775d0a27ad..14c9bd38dd074 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -577,7 +577,7 @@ rec { name = "pathInStore"; description = "path in the Nix store"; descriptionClass = "noun"; - check = x: isStringLike x && builtins.match "${builtins.storeDir}/[^.].*" (toString x) != null; + check = x: isStringLike x && builtins.match "${builtins.storeDir}/.+" (toString x) != null; merge = mergeEqualOption; };