Browse Source

Treat all symlinks in sources as to-be-built files

This means symlinks can never be ordinary inputs.
master
Michael Raitza 7 months ago
parent
commit
139fb213b9
  1. 13
      lib.nix

13
lib.nix

@ -2,7 +2,7 @@
let
lib = pkgs.lib;
inherit (builtins) baseNameOf dirOf length genList pathExists isString match
replaceStrings;
replaceStrings readDir;
inherit (lib) take splitString last foldl foldr head tail removePrefix
hasSuffix removeSuffix flatten crossLists reverseList all any unique hasPrefix
cleanSourceWith;
@ -99,7 +99,14 @@ let
# Filter non-existant sources and build them with resolver.
# Recreate the source directory structure.
nonExistantSrcs = builtins.filter (x: !builtins.pathExists x) srcs;
nonExistantSrcs = builtins.filter (x: let
isLink = x: let
base = baseNameOf x;
parent = dirOf x;
type = (readDir parent).${base} or null;
in (type == "symlink");
in !pathExists x || isLink x) srcs;
builtSrcs = map (s: let
relPath = removePrefix (root + "/") s;
filePath = resolver s;
@ -113,7 +120,7 @@ let
srcFilter = path:
if srcs == []
then true
else (any (x: (hasPrefix x path)) srcs);
else (any (x: (hasPrefix x path)) (builtins.filter pathExists srcs));
# Allow all directories lying on the way to specified srcs.
_srcs = (augmentedSrcs root srcs);

Loading…
Cancel
Save