sane.fs: cleanup

plumb systemd.{mounts,services} instead of the less detailed 'systemd'
This commit is contained in:
2024-08-02 08:01:38 +00:00
parent 9dbb2a6266
commit cf20230d96

View File

@@ -282,7 +282,7 @@ let
}; };
# given a mountEntry definition, evaluate its toplevel `config` output. # given a mountEntry definition, evaluate its toplevel `config` output.
mkMountConfig = path: opt: (let mkMountConfig = path: opt: let
device = config.fileSystems."${path}".device; device = config.fileSystems."${path}".device;
underlying = cfg."${device}"; underlying = cfg."${device}";
isBind = opt.mount.bind != null; isBind = opt.mount.bind != null;
@@ -297,7 +297,7 @@ let
in { in {
fileSystems."${path}" = { fileSystems."${path}" = {
device = ifBind opt.mount.bind; device = ifBind opt.mount.bind;
options = (if isBind then ["bind"] else []) options = (lib.optionals isBind [ "bind" ])
++ [ ++ [
# disable defaults: don't require this to be mount as part of local-fs.target # disable defaults: don't require this to be mount as part of local-fs.target
# we'll handle that stuff precisely. # we'll handle that stuff precisely.
@@ -325,13 +325,13 @@ let
wantedBy = opt.wantedBeforeBy; wantedBy = opt.wantedBeforeBy;
inherit (opt.mount) mountConfig unitConfig; inherit (opt.mount) mountConfig unitConfig;
}]; }];
}); };
mkFsConfig = path: opt: lib.mkMerge [ mkFsConfig = path: opt: lib.mkMerge (
(mkGeneratedConfig path opt) [ (mkGeneratedConfig path opt) ] ++
(lib.mkIf (opt.mount != null) (mkMountConfig path opt)) lib.optional (opt.mount != null) (mkMountConfig path opt)
]; );
# return all ancestors of this path. # return all ancestors of this path.
# e.g. ancestorsOf "/foo/bar/baz" => [ "/" "/foo" "/foo/bar" ] # e.g. ancestorsOf "/foo/bar/baz" => [ "/" "/foo" "/foo/bar" ]
@@ -385,9 +385,8 @@ in {
let let
configs = lib.mapAttrsToList mkFsConfig cfg; configs = lib.mapAttrsToList mkFsConfig cfg;
take = f: { take = f: {
systemd = f.systemd; systemd.mounts = f.systemd.mounts;
# systemd.mounts = f.systemd.mounts; systemd.services = f.systemd.services;
# systemd.services = f.systemd.services;
fileSystems = f.fileSystems; fileSystems = f.fileSystems;
}; };
in take (sane-lib.mkTypedMerge take configs); in take (sane-lib.mkTypedMerge take configs);