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; hostname = config.instance.hostname;
host-filesystems = config.fudo.hosts.${hostname}.encrypted-filesystems; 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 filesystemsToMountpointLists = mapAttrsToList
(fs: fsOpts: fsOpts.mountpoints); (fs: fsOpts: fsOpts.mountpoints);
concatMapAttrs = f: as: concatMap (i: i) (mapAttrsToList f as);
in { in {
config = { config = {
users.groups = let users.groups = let
@ -18,8 +20,10 @@ in {
(nameValuePair mpOpts.group { (nameValuePair mpOpts.group {
members = mpOpts.users; members = mpOpts.users;
}); });
mountpointListsToGroups = mapConcat mountpointListToGroups =
(mps: mapAttrsToList mountpointToGroups mps); concatMapAttrs mountpointToGroups;
mountpointListsToGroups =
concatMap mountpointListToGroups;
in listToAttrs in listToAttrs
(mountpointListsToGroups (mountpointListsToGroups
(filesystemsToMountpointLists host-filesystems)); (filesystemsToMountpointLists host-filesystems));

View File

@ -31,8 +31,13 @@ let
in { in {
config = { config = {
boot = mkIf (initrd-cfg != null) { boot = mkIf (initrd-cfg != null) {
kernelParams = [ kernelParams = let
"ip=${initrd-cfg.ip}" 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 = { initrd = {
network = { network = {