lib.fileset.toSource: Filesystem roots are not the same for `fileset` and `root` ("${toStringroot}"):
`root`: root "${toStringrootFilesystemRoot}"
@@ -170,7 +170,7 @@ If a directory does not recursively contain any file, it is omitted from the sto
lib.fileset.toSource: `root` (${toStringroot}) is a file, but it should be a directory instead. Potential solutions:
- If you want to import the file into the store _without_ a containing directory, use string interpolation or `builtins.path` instead of this function.
- If you want to import the file into the store _with_ a containing directory, set `root` to the containing directory, such as ${toString(dirOfroot)}, and set `fileset` to the file path.''
lib.fileset.toSource: `fileset` could contain files in ${toStringfileset._internalBase}, which is not under the `root` (${toStringroot}). Potential solutions:
- Set `root` to ${toStringfileset._internalBase} or any directory higher up. This changes the layout of the resulting store path.
@@ -264,9 +264,6 @@ If a directory does not recursively contain any file, it is omitted from the sto
filesets:
if!isListfilesetsthen
throw"lib.fileset.unions: Expected argument to be a list, but got a ${typeOffilesets}."
elseiffilesets==[]then
# TODO: This could be supported, but requires an extra internal representation for the empty file set, which would be special for not having a base path.
throw"lib.fileset.unions: Expected argument to be a list with at least one element, but it contains no elements."
else
pipefilesets[
# Annotate the elements with context, used by _coerceMany for better errors
expectFailure 'union ./. ./.''lib.fileset: Directly evaluating a file set is not supported. Use `lib.fileset.toSource` to turn it into a usable source instead.'
expectFailure '_emptyWithoutBase''lib.fileset: Directly evaluating a file set is not supported. Use `lib.fileset.toSource` to turn it into a usable source instead.'
# Past versions of the internal representation are supported
# Future versions of the internal representation are unsupported
expectFailure '_coerce "<tests>: value" { _type = "fileset"; _internalVersion = 3; }''<tests>: value is a file set created from a future version of the file set library with a different internal representation:
\s*- Internal version of the file set: 3
\s*- Internal version of the library: 2
expectFailure '_coerce "<tests>: value" { _type = "fileset"; _internalVersion = 4; }''<tests>: value is a file set created from a future version of the file set library with a different internal representation:
\s*- Internal version of the file set: 4
\s*- Internal version of the library: 3
\s*Make sure to update your Nixpkgs to have a newer version of `lib.fileset`.'
# _create followed by _coerce should give the inputs back without any validation
expectFailure 'toSource { root = ./.; fileset = unions null; }''lib.fileset.unions: Expected argument to be a list, but got a null.'
expectFailure 'toSource { root = ./.; fileset = unions [ ]; }''lib.fileset.unions: Expected argument to be a list with at least one element, but it contains no elements.'
# The tree of later arguments should not be evaluated if a former argument already includes all files
tree=()
checkFileset 'union ./. (_create ./. (abort "This should not be used!"))'
checkFileset 'unions [ ./. (_create ./. (abort "This should not be used!")) ]'
# unions doesn't include any files for an empty list or only empty values without a base