···159 # but this is not fully specified, so let's tie this too much to the currently implemented concept of store paths.
160 # Similar reasoning applies to the validity of the name part.
161 # We care more about discerning store path-ness on realistic values. Making it airtight would be fragile and slow.
162- && match ".{32}-.+" (elemAt components storeDirLength) != null;
000000163164in
165# No rec! Add dependencies on this file at the top.
···159 # but this is not fully specified, so let's tie this too much to the currently implemented concept of store paths.
160 # Similar reasoning applies to the validity of the name part.
161 # We care more about discerning store path-ness on realistic values. Making it airtight would be fragile and slow.
162+ && match ".{32}-.+" (elemAt components storeDirLength) != null
163+ # alternatively match content‐addressed derivations, which _currently_ do
164+ # not have a store directory prefix.
165+ # This is a workaround for https://github.com/NixOS/nix/issues/12361 which
166+ # was needed during the experimental phase of ca-derivations and should be
167+ # removed once the issue has been resolved.
168+ || match "[0-9a-z]{52}" (head components) != null;
169170in
171# No rec! Add dependencies on this file at the top.
+10
lib/path/tests/unit.nix
···137 expected = true;
138 };
1390000000000140 # Test examples from the lib.path.subpath.isValid documentation
141 testSubpathIsValidExample1 = {
142 expr = subpath.isValid null;