diff --git a/modules/lib/fs.nix b/modules/lib/fs.nix index ee5c8732d..eeeda4b42 100644 --- a/modules/lib/fs.nix +++ b/modules/lib/fs.nix @@ -15,11 +15,12 @@ in rec { (p: ((fs."${p}" or {}).symlink or null) != null) (sane-path.walk "/" logical); firstSymlink = builtins.head symlinkedPrefixes; - firstSymlinkDest = "${firstSymlink}".symlink.target; + firstSymlinkDest = fs."${firstSymlink}".symlink.target; firstSymlinkParent = sane-path.parent firstSymlink; firstSymlinkDestAbs = if lib.hasPrefix "/" firstSymlinkDest then firstSymlinkDest else + # TODO: path canonicalization (for i.e. relative symlinks) sane-path.join [ firstSymlinkParent firstSymlinkDest ]; in if symlinkedPrefixes != [] then diff --git a/modules/programs/default.nix b/modules/programs/default.nix index db0cb5509..95bc4e192 100644 --- a/modules/programs/default.nix +++ b/modules/programs/default.nix @@ -47,7 +47,7 @@ let removeStorePaths = paths: lib.filter (p: !(lib.hasPrefix "/nix/store" p)) paths; # derefSymlinks: [ str ] -> [ str ]: for each path which is a symlink (or a child of a symlink'd dir), dereference one layer of symlink. else, drop it from the list. - derefSymlinks' = paths: builtins.map (fs-lib.derefSymlinkOrNull fs) paths; + derefSymlinks' = paths: builtins.map (fs-lib.derefSymlinkOrNull config.sane.fs) paths; derefSymlinks = paths: lib.filter (p: p != null) (derefSymlinks' paths); # expandSymlinksOnce: [ str ] -> [ str ], returning all the original paths plus dereferencing any symlinks and adding their targets to this list. expandSymlinksOnce = paths: lib.unique (paths ++ removeStorePaths (derefSymlinks paths));