messed with initrd and got zfs rollback working again

This commit is contained in:
Gerg-L 2023-08-04 23:43:13 -04:00
parent fd87459163
commit 8694fbce19
7 changed files with 31 additions and 13 deletions

View file

@ -34,6 +34,6 @@
];
};
};
_file = ./disko.nix;
};
_file = ./disko.nix;
}

View file

@ -23,6 +23,6 @@ _: {config, ...}: {
Option "OffTime" "0"
Option "BlankTime" "0"
'';
_file = ./prime.nix;
};
_file = ./prime.nix;
}

View file

@ -22,7 +22,7 @@ _: {
ephemeral = true;
autoStart = true;
privateNetwork = true;
hostBridge = "bridge0";
hostBridge = "br0";
localAddress = "192.168.1.11/24";
bindMounts = {
"/var" = {

View file

@ -1,6 +1,7 @@
_: {
config,
lib,
pkgs,
...
}: {
#link some stuff
@ -21,6 +22,7 @@ _: {
"/efi22".options = ["nofail"];
"/efi0E".options = ["nofail"];
};
boot = {
zfs = {
devNodes = "/dev/disk/by-id/";
@ -29,24 +31,34 @@ _: {
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
#disable hibernate and set cache max
kernelParams = ["nohibernate" "zfs.zfs_arc_max=17179869184"];
supportedFilesystems = ["zfs" "vfat"];
initrd = {
supportedFilesystems = ["zfs" "vfat"];
#module for multiple swap devices
kernelModules = ["dm_mod"];
#keyboard module for zfs password
availableKernelModules = ["hid_generic"];
#wipe / and /var on boot
postDeviceCommands = lib.mkAfter ''
#wipe everything
systemd.services.rollback = {
path = [pkgs.zfs];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
unitConfig.DefaultDependencies = "no";
wantedBy = ["initrd.target"];
after = ["zfs-import.target"];
before = ["sysroot.mount"];
script = ''
zfs rollback -r rpool/root@empty
zfs rollback -r rpool/var@empty
'';
};
};
plymouth.enable = false;
loader = {
generationsDir.copyKernels = true;
#override default
systemd-boot.enable = false;
efi.canTouchEfiVariables = false;
grub = {
enable = true;

View file

@ -50,13 +50,13 @@ in {
lib.genAttrs names (
name:
lib.nixosSystem {
inherit system;
modules =
builtins.attrValues self.nixosModules
++ importAll "${self}/hosts/${name}"
++ [
{
networking.hostName = name;
nixpkgs = {inherit system;};
}
];
}

View file

@ -70,7 +70,13 @@
};
};
systemd.services.efibootmgr = {
serviceConfig.Type = "oneshot";
reloadIfChanged = false;
restartIfChanged = false;
stopIfChanged = false;
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
path = [pkgs.efibootmgr];
wantedBy = ["default.target"];
script = ''