Moved to systemd for initrd, added integration for vmWithDisko
This commit is contained in:
parent
3c20190709
commit
affa333969
@ -40,7 +40,7 @@
|
||||
requiredBy = [ "mnt-nas.mount" ];
|
||||
after = [ "network-online.target" ];
|
||||
requires = [ "network-online.target" ];
|
||||
serviceConfig.type = "oneshot";
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
. ${config.sops.secrets."smb-credentials".path}
|
||||
echo $password | ${pkgs.krb5}/bin/kinit $username
|
||||
|
@ -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" ];
|
||||
};
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
main = {
|
||||
type = "disk";
|
||||
device = "/dev/sda";
|
||||
imageSize = "32G"; # For test VMs
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user