refactor: remove dead modules/lib/fs.nix
file
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
let
|
let
|
||||||
sane-lib = rec {
|
sane-lib = rec {
|
||||||
feeds = import ./feeds.nix { inherit lib; };
|
feeds = import ./feeds.nix { inherit lib; };
|
||||||
fs = import ./fs.nix { inherit lib sane-lib; };
|
|
||||||
merge = import ./merge.nix { inherit lib sane-lib; };
|
merge = import ./merge.nix { inherit lib sane-lib; };
|
||||||
path = import ./path.nix { inherit lib; };
|
path = import ./path.nix { inherit lib; };
|
||||||
types = import ./types.nix { inherit lib; };
|
types = import ./types.nix { inherit lib; };
|
||||||
|
@@ -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
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
Reference in New Issue
Block a user