Moved to systemd for initrd, added integration for vmWithDisko

This commit is contained in:
Jan-Bulthuis committed 2025-06-11 11:58:54 +02:00
1 parent 3c20190709
commit affa333969
7 files changed
+26 -5

No files matched your search

+3
View File
@@ -16,5 +16,8 @@ in
systemd-boot.editor = false;
efi.canTouchEfiVariables = true;
};
# Initrd
boot.initrd.systemd.enable = true;
};
}
+3 -1
View File
@@ -20,5 +20,7 @@ in
};
};
config = mkIf cfg.enable { disko.devices = profile.disko.devices; };
config = mkIf cfg.enable {
disko.devices = profile.disko.devices;
};
}
+1 -1
View File
@@ -47,7 +47,7 @@ in
"network-online.target"
];
serviceConfig = {
type = "oneshot";
Type = "oneshot";
};
script = ''
ADCLI_JOIN_USER=$(cat ${cfg.join.userFile})
+16 -2
View File
@@ -24,18 +24,32 @@ in
resetScript = mkOption {
type = types.lines;
description = ''
Script to run on boot that resets the root partition.
Script to run in order to reset the system to a clean state.
'';
};
};
config = mkIf cfg.enable {
# Filesystem setup
fileSystems."/persist".neededForBoot = true;
boot.initrd.postResumeCommands = mkAfter cfg.resetScript;
# boot.initrd.postResumeCommands = mkAfter cfg.resetScript;
# TODO: Reduce dependency on the root filesystem being ZFS?
boot.initrd.systemd.services.impermanence-rollback = {
description = "Rollback filesystem to clean state.";
wantedBy = [ "initrd.target" ];
after = [ "zfs-import.target" ];
before = [ "sysroot.mount" ];
unitConfig.DefaultDependencies = "no";
serviceConfig.Type = "oneshot";
script = cfg.resetScript;
};
# For home-manager persistence
programs.fuse.userAllowOther = true;
# For testing purposes with VM
virtualisation.vmVariantWithDisko.virtualisation.fileSystems."/persist".neededForBoot = true;
environment.persistence."/persist/system" = {
enable = true;
hideMounts = true;
+1
View File
@@ -39,5 +39,6 @@ in
];
sops.secrets = cfg.secrets;
modules.impermanence.directories = [ "/etc/sops" ];
virtualisation.vmVariantWithDisko.sops.age.sshKeyPaths = [ "/tmp/shared/sops_ed25519_key" ];
};
}