Moved to systemd for initrd, added integration for vmWithDisko
This commit is contained in:
1 parent
3c20190709
commit
affa333969
7 files changed
+26
-5
No files matched your search
@@ -16,5 +16,8 @@ in
|
||||
systemd-boot.editor = false;
|
||||
efi.canTouchEfiVariables = true;
|
||||
};
|
||||
|
||||
# Initrd
|
||||
boot.initrd.systemd.enable = true;
|
||||
};
|
||||
}
|
||||
@@ -20,5 +20,7 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable { disko.devices = profile.disko.devices; };
|
||||
config = mkIf cfg.enable {
|
||||
disko.devices = profile.disko.devices;
|
||||
};
|
||||
}
|
||||
@@ -47,7 +47,7 @@ in
|
||||
"network-online.target"
|
||||
];
|
||||
serviceConfig = {
|
||||
type = "oneshot";
|
||||
Type = "oneshot";
|
||||
};
|
||||
script = ''
|
||||
ADCLI_JOIN_USER=$(cat ${cfg.join.userFile})
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -39,5 +39,6 @@ in
|
||||
];
|
||||
sops.secrets = cfg.secrets;
|
||||
modules.impermanence.directories = [ "/etc/sops" ];
|
||||
virtualisation.vmVariantWithDisko.sops.age.sshKeyPaths = [ "/tmp/shared/sops_ed25519_key" ];
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user