diff --git a/modules/lib/default.nix b/modules/lib/default.nix index d336fc1ea..a6f54ce93 100644 --- a/modules/lib/default.nix +++ b/modules/lib/default.nix @@ -3,7 +3,6 @@ let sane-lib = rec { feeds = import ./feeds.nix { inherit lib; }; - fs = import ./fs.nix { inherit lib sane-lib; }; merge = import ./merge.nix { inherit lib sane-lib; }; path = import ./path.nix { inherit lib; }; types = import ./types.nix { inherit lib; }; diff --git a/modules/lib/fs.nix b/modules/lib/fs.nix deleted file mode 100644 index ce4b41dae..000000000 --- a/modules/lib/fs.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ lib, sane-lib, ... }: - -let - sane-path = sane-lib.path; -in rec { - # Type: derefSymlinkOrNull :: config.sane.fs.type -> str -> (str|null) - # the returned path is always absolute (even if the original symlink was relative), - # and in canonical form. - derefSymlinkOrNull = fs: logical: let - symlinkedPrefixes = lib.filter - (p: ((fs."${p}" or {}).symlink or null) != null) - (sane-path.walk "/" logical); - firstSymlink = builtins.head symlinkedPrefixes; - firstSymlinkDest = fs."${firstSymlink}".symlink.target; - firstSymlinkParent = sane-path.parent firstSymlink; - firstSymlinkDestAbs = if lib.hasPrefix "/" firstSymlinkDest then - firstSymlinkDest - else - sane-path.join [ firstSymlinkParent firstSymlinkDest ]; - in - if symlinkedPrefixes != [] then - sane-path.realpath firstSymlinkDestAbs - else - null - ; - derefSymlink = fs: logical: - if derefSymlinkOrNull fs logical != null then - derefSymlinkOrNull fs logical - else - logical - ; -} -