1
0
Fork 0

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

This means symlinks can never be ordinary inputs.
master
Michael Raitza 2021-02-19 20:28:59 +01:00
parent 5e28e35f94
commit 139fb213b9
1 changed files with 10 additions and 3 deletions

13
lib.nix
View File

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