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.
mkMountConfig = path: opt: (let
mkMountConfig = path: opt: let
device = config.fileSystems."${path}".device;
underlying = cfg."${device}";
isBind = opt.mount.bind != null;
@@ -297,7 +297,7 @@ let
in {
fileSystems."${path}" = {
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
# we'll handle that stuff precisely.
@@ -325,13 +325,13 @@ let
wantedBy = opt.wantedBeforeBy;
inherit (opt.mount) mountConfig unitConfig;
}];
});
};
mkFsConfig = path: opt: lib.mkMerge [
(mkGeneratedConfig path opt)
(lib.mkIf (opt.mount != null) (mkMountConfig path opt))
];
mkFsConfig = path: opt: lib.mkMerge (
[ (mkGeneratedConfig path opt) ] ++
lib.optional (opt.mount != null) (mkMountConfig path opt)
);
# return all ancestors of this path.
# e.g. ancestorsOf "/foo/bar/baz" => [ "/" "/foo" "/foo/bar" ]
@@ -385,9 +385,8 @@ in {
let
configs = lib.mapAttrsToList mkFsConfig cfg;
take = f: {
systemd = f.systemd;
# systemd.mounts = f.systemd.mounts;
# systemd.services = f.systemd.services;
systemd.mounts = f.systemd.mounts;
systemd.services = f.systemd.services;
fileSystems = f.fileSystems;
};
in take (sane-lib.mkTypedMerge take configs);