Working mounted encrypted file system! Neat.

This commit is contained in:
niten 2021-10-18 08:40:35 -07:00
parent eef580d596
commit 3d5d7e389e
2 changed files with 14 additions and 5 deletions

View File

@ -5,11 +5,13 @@ let
hostname = config.instance.hostname;
host-filesystems = config.fudo.hosts.${hostname}.encrypted-filesystems;
optionalOrDefault = tst: str: default: if tst then str else default;
optionalOrDefault = str: default: if (str != null) then str else default;
filesystemsToMountpointLists = mapAttrsToList
(fs: fsOpts: fsOpts.mountpoints);
concatMapAttrs = f: as: concatMap (i: i) (mapAttrsToList f as);
in {
config = {
users.groups = let
@ -18,8 +20,10 @@ in {
(nameValuePair mpOpts.group {
members = mpOpts.users;
});
mountpointListsToGroups = mapConcat
(mps: mapAttrsToList mountpointToGroups mps);
mountpointListToGroups =
concatMapAttrs mountpointToGroups;
mountpointListsToGroups =
concatMap mountpointListToGroups;
in listToAttrs
(mountpointListsToGroups
(filesystemsToMountpointLists host-filesystems));

View File

@ -31,8 +31,13 @@ let
in {
config = {
boot = mkIf (initrd-cfg != null) {
kernelParams = [
"ip=${initrd-cfg.ip}"
kernelParams = let
site = config.instance.site;
site-gateway = site.gateway-v4;
netmask =
nixpkgs.lib.fudo.ip.maskFromV32Network site.network;
in [
"ip=${initrd-cfg.ip}:${site-gateway}:${netmask}:${hostname}:${initrd-cfg.interface}"
];
initrd = {
network = {