Loading lib/fileset/internal.nix +28 −27 Original line number Diff line number Diff line Loading @@ -432,8 +432,8 @@ rec { # but builtins.path doesn't call the filter function on the `path` argument itself, # meaning this function can never receive "/" as an argument pathSlash = path + "/"; include = in ( # Same as `hasPrefix pathSlash baseString`, but more efficient. # With base /foo/bar we need to include /foo: # hasPrefix "/foo/" "/foo/bar/" Loading @@ -452,17 +452,18 @@ rec { # inTree (split "/" (removePrefix "/foo/" "/foo/bar/baz")) # == inTree (split "/" "bar/baz") # == inTree [ "bar" "baz" ] inTree (split "/" (substring baseLength (-1) path)); in inTree (split "/" (substring baseLength (-1) path)) ) # This is a way have an additional check in case the above is true without any significant performance cost && ( # This relies on the fact that Nix only distinguishes path types "directory", "regular", "symlink" and "unknown", # so everything except "unknown" is allowed, seems reasonable to rely on that if include && type == "unknown" then throw '' type != "unknown" || throw '' lib.fileset.toSource: `fileset` contains a file that cannot be added to the store: ${path} This file is neither a regular file nor a symlink, the only file types supported by the Nix store. Therefore the file set cannot be added to the Nix store as is. Make sure to not include that file to avoid this error.'' else include; ); in # Special case because the code below assumes that the _internalBase is always included in the result # which shouldn't be done when we have no files at all in the base Loading Loading
lib/fileset/internal.nix +28 −27 Original line number Diff line number Diff line Loading @@ -432,8 +432,8 @@ rec { # but builtins.path doesn't call the filter function on the `path` argument itself, # meaning this function can never receive "/" as an argument pathSlash = path + "/"; include = in ( # Same as `hasPrefix pathSlash baseString`, but more efficient. # With base /foo/bar we need to include /foo: # hasPrefix "/foo/" "/foo/bar/" Loading @@ -452,17 +452,18 @@ rec { # inTree (split "/" (removePrefix "/foo/" "/foo/bar/baz")) # == inTree (split "/" "bar/baz") # == inTree [ "bar" "baz" ] inTree (split "/" (substring baseLength (-1) path)); in inTree (split "/" (substring baseLength (-1) path)) ) # This is a way have an additional check in case the above is true without any significant performance cost && ( # This relies on the fact that Nix only distinguishes path types "directory", "regular", "symlink" and "unknown", # so everything except "unknown" is allowed, seems reasonable to rely on that if include && type == "unknown" then throw '' type != "unknown" || throw '' lib.fileset.toSource: `fileset` contains a file that cannot be added to the store: ${path} This file is neither a regular file nor a symlink, the only file types supported by the Nix store. Therefore the file set cannot be added to the Nix store as is. Make sure to not include that file to avoid this error.'' else include; ); in # Special case because the code below assumes that the _internalBase is always included in the result # which shouldn't be done when we have no files at all in the base Loading