mirror of
https://github.com/Gerg-L/nixos.git
synced 2025-12-10 00:43:56 -05:00
messed with initrd and got zfs rollback working again
This commit is contained in:
parent
fd87459163
commit
8694fbce19
7 changed files with 31 additions and 13 deletions
|
|
@ -34,6 +34,6 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
_file = ./disko.nix;
|
|
||||||
};
|
};
|
||||||
|
_file = ./disko.nix;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,6 @@ _: {config, ...}: {
|
||||||
Option "OffTime" "0"
|
Option "OffTime" "0"
|
||||||
Option "BlankTime" "0"
|
Option "BlankTime" "0"
|
||||||
'';
|
'';
|
||||||
_file = ./prime.nix;
|
|
||||||
};
|
};
|
||||||
|
_file = ./prime.nix;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ _: {
|
||||||
ephemeral = true;
|
ephemeral = true;
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
privateNetwork = true;
|
privateNetwork = true;
|
||||||
hostBridge = "bridge0";
|
hostBridge = "br0";
|
||||||
localAddress = "192.168.1.11/24";
|
localAddress = "192.168.1.11/24";
|
||||||
bindMounts = {
|
bindMounts = {
|
||||||
"/var" = {
|
"/var" = {
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
_: {
|
_: {
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
|
pkgs,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
#link some stuff
|
#link some stuff
|
||||||
|
|
@ -21,6 +22,7 @@ _: {
|
||||||
"/efi22".options = ["nofail"];
|
"/efi22".options = ["nofail"];
|
||||||
"/efi0E".options = ["nofail"];
|
"/efi0E".options = ["nofail"];
|
||||||
};
|
};
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
zfs = {
|
zfs = {
|
||||||
devNodes = "/dev/disk/by-id/";
|
devNodes = "/dev/disk/by-id/";
|
||||||
|
|
@ -29,24 +31,34 @@ _: {
|
||||||
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
||||||
#disable hibernate and set cache max
|
#disable hibernate and set cache max
|
||||||
kernelParams = ["nohibernate" "zfs.zfs_arc_max=17179869184"];
|
kernelParams = ["nohibernate" "zfs.zfs_arc_max=17179869184"];
|
||||||
supportedFilesystems = ["zfs" "vfat"];
|
|
||||||
initrd = {
|
initrd = {
|
||||||
|
supportedFilesystems = ["zfs" "vfat"];
|
||||||
#module for multiple swap devices
|
#module for multiple swap devices
|
||||||
kernelModules = ["dm_mod"];
|
kernelModules = ["dm_mod"];
|
||||||
#keyboard module for zfs password
|
#keyboard module for zfs password
|
||||||
availableKernelModules = ["hid_generic"];
|
availableKernelModules = ["hid_generic"];
|
||||||
#wipe / and /var on boot
|
systemd.services.rollback = {
|
||||||
postDeviceCommands = lib.mkAfter ''
|
path = [pkgs.zfs];
|
||||||
#wipe everything
|
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/root@empty
|
||||||
zfs rollback -r rpool/var@empty
|
zfs rollback -r rpool/var@empty
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
};
|
||||||
plymouth.enable = false;
|
plymouth.enable = false;
|
||||||
loader = {
|
loader = {
|
||||||
generationsDir.copyKernels = true;
|
generationsDir.copyKernels = true;
|
||||||
#override default
|
#override default
|
||||||
systemd-boot.enable = false;
|
systemd-boot.enable = false;
|
||||||
|
|
||||||
efi.canTouchEfiVariables = false;
|
efi.canTouchEfiVariables = false;
|
||||||
grub = {
|
grub = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
|
|
@ -50,13 +50,13 @@ in {
|
||||||
lib.genAttrs names (
|
lib.genAttrs names (
|
||||||
name:
|
name:
|
||||||
lib.nixosSystem {
|
lib.nixosSystem {
|
||||||
inherit system;
|
|
||||||
modules =
|
modules =
|
||||||
builtins.attrValues self.nixosModules
|
builtins.attrValues self.nixosModules
|
||||||
++ importAll "${self}/hosts/${name}"
|
++ importAll "${self}/hosts/${name}"
|
||||||
++ [
|
++ [
|
||||||
{
|
{
|
||||||
networking.hostName = name;
|
networking.hostName = name;
|
||||||
|
nixpkgs = {inherit system;};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,13 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
systemd.services.efibootmgr = {
|
systemd.services.efibootmgr = {
|
||||||
serviceConfig.Type = "oneshot";
|
reloadIfChanged = false;
|
||||||
|
restartIfChanged = false;
|
||||||
|
stopIfChanged = false;
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
};
|
||||||
path = [pkgs.efibootmgr];
|
path = [pkgs.efibootmgr];
|
||||||
wantedBy = ["default.target"];
|
wantedBy = ["default.target"];
|
||||||
script = ''
|
script = ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue