2023-03-25 19:31:05 +03:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
|
|
zfs_arc_max = toString (6 * 1024 * 1024 * 1024);
|
|
|
|
in {
|
|
|
|
boot = {
|
2023-10-13 19:51:59 +03:00
|
|
|
zfs.enableUnstable = false; # For now, unstable zfs will downgrade kernel
|
2023-09-16 00:49:54 +03:00
|
|
|
kernelPackages = pkgs.linuxPackages_lqx;
|
|
|
|
|
2023-03-25 19:31:05 +03:00
|
|
|
initrd = {
|
2023-03-26 19:24:28 +03:00
|
|
|
supportedFilesystems = [ "zfs" ];
|
2023-03-25 19:31:05 +03:00
|
|
|
luks.devices = {
|
|
|
|
"cryptroot" = {
|
|
|
|
preLVM = true;
|
|
|
|
keyFile = "/keyfile0.bin";
|
|
|
|
allowDiscards = true;
|
2023-03-26 19:24:28 +03:00
|
|
|
bypassWorkqueues = true;
|
2023-03-25 19:31:05 +03:00
|
|
|
fallbackToPassword = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
secrets = {
|
|
|
|
"keyfile0.bin" = "/etc/secrets/keyfile0.bin";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
loader = {
|
2023-03-26 19:24:28 +03:00
|
|
|
grub = {
|
2023-03-25 19:31:05 +03:00
|
|
|
enable = true;
|
2023-03-27 15:50:40 +03:00
|
|
|
device = "nodev";
|
|
|
|
copyKernels = true;
|
2023-03-26 19:24:28 +03:00
|
|
|
efiSupport = true;
|
|
|
|
enableCryptodisk = true;
|
2023-03-27 15:50:40 +03:00
|
|
|
useOSProber = false;
|
2023-03-26 19:24:28 +03:00
|
|
|
zfsSupport = true;
|
2023-05-13 01:01:57 +03:00
|
|
|
gfxmodeEfi = "2560x1440";
|
2023-03-27 15:50:40 +03:00
|
|
|
# efiInstallAsRemovable = true;
|
|
|
|
# theme = pkgs.;
|
2023-03-25 19:31:05 +03:00
|
|
|
};
|
2023-03-27 15:50:40 +03:00
|
|
|
systemd-boot.enable = lib.mkForce false;
|
2023-03-26 19:24:28 +03:00
|
|
|
efi.canTouchEfiVariables = true;
|
|
|
|
efi.efiSysMountPoint = "/efi";
|
2023-03-25 19:31:05 +03:00
|
|
|
generationsDir.copyKernels = true;
|
|
|
|
};
|
|
|
|
|
2023-03-27 15:50:40 +03:00
|
|
|
binfmt.emulatedSystems = [ "aarch64-linux" ];
|
2023-03-25 19:31:05 +03:00
|
|
|
kernelParams = [
|
|
|
|
"zfs.metaslab_lba_weighting_enabled=0"
|
|
|
|
"zfs.zfs_arc_max=${zfs_arc_max}"
|
2023-10-01 23:39:11 +03:00
|
|
|
"amd_pstate=active"
|
2023-11-11 03:11:02 +03:00
|
|
|
"retbleed=off" # big performance impact
|
2023-03-25 19:31:05 +03:00
|
|
|
];
|
2023-05-13 01:01:57 +03:00
|
|
|
tmp.useTmpfs = true;
|
|
|
|
tmp.tmpfsSize = "32G";
|
2023-03-27 20:57:06 +03:00
|
|
|
|
|
|
|
supportedFilesystems = [ "ntfs" ];
|
2023-03-25 19:31:05 +03:00
|
|
|
};
|
2023-03-26 19:24:28 +03:00
|
|
|
|
|
|
|
persist = {
|
|
|
|
enable = true;
|
2023-04-08 17:57:02 +03:00
|
|
|
cache.clean.enable = true;
|
2023-03-26 19:24:28 +03:00
|
|
|
};
|
|
|
|
|
2023-04-08 17:57:02 +03:00
|
|
|
fileSystems."/" = lib.mkForce {
|
|
|
|
device = "none";
|
|
|
|
options = [ "defaults" "size=4G" "mode=755" ];
|
|
|
|
fsType = "tmpfs";
|
|
|
|
};
|
|
|
|
|
2023-03-26 19:24:28 +03:00
|
|
|
fileSystems."/home".neededForBoot = true;
|
|
|
|
fileSystems."/persist".neededForBoot = true;
|
|
|
|
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
|
|
|
zfs rollback -r rpool/nixos/root@empty
|
|
|
|
zfs rollback -r rpool/user/home@empty
|
|
|
|
'';
|
2023-03-25 19:31:05 +03:00
|
|
|
}
|