Skip to content

Instantly share code, notes, and snippets.

@byrongibson
Last active July 13, 2021 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save byrongibson/ff2a6befdf53b94d9ea50fc8441fd35d to your computer and use it in GitHub Desktop.
Save byrongibson/ff2a6befdf53b94d9ea50fc8441fd35d to your computer and use it in GitHub Desktop.
boot section of configurtion.nix, troubleshooting mirroredBoots with / on tmpfs
# Use EFI boot loader with Grub.
# https://nixos.org/manual/nixos/stable/index.html#sec-installation-partitioning-UEFI
boot = {
supportedFilesystems = [ "vfat" "zfs" ];
initrd = {
network.ssh.enable = true;
supportedFilesystems = [ "vfat" "zfs" ];
};
zfs = {
requestEncryptionCredentials = true; # enable if using ZFS encryption, ZFS will prompt for password during boot
};
loader = {
systemd-boot.enable = true;
efi = {
canTouchEfiVariables = true; # must be disabled if efiInstallAsRemovable=true
#efiSysMountPoint = "/boot/efi"; # using the default /boot for this config
};
grub = {
version = 2;
enable = true;
device = "nodev"; # "/dev/sdx", or "nodev" for efi only
efiSupport = true;
#efiInstallAsRemovable = true; # grub will use efibootmgr
zfsSupport = true;
copyKernels = true; # https://nixos.wiki/wiki/NixOS_on_ZFS
# mirroredBoots on z11pa-d8
# https://discourse.nixos.org/t/nixos-on-mirrored-ssd-boot-swap-native-encrypted-zfs/9215/5
mirroredBoots = [
{
devices = [ "nodev" ];
path = "/boot1";
}
{
devices = [ "nodev" ];
path = "/boot2";
}
];
};
};
};
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/hardware/network/broadcom-43xx.nix")
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "usb_storage" "usbhid" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "tmpfs";
fsType = "tmpfs";
options = [ "defaults" "size=2G" "mode=755" ];
};
fileSystems."/nix" =
{ device = "rpool/local/nix";
fsType = "zfs";
};
fileSystems."/opt" =
{ device = "rpool/local/opt";
fsType = "zfs";
};
fileSystems."/home" =
{ device = "rpool/safe/home";
fsType = "zfs";
};
fileSystems."/persist" =
{ device = "rpool/safe/persist";
fsType = "zfs";
};
fileSystems."/boot1" =
{ device = "/dev/disk/by-uuid/D3E7-4DDA";
fsType = "vfat";
};
fileSystems."/boot2" =
{ device = "/dev/disk/by-uuid/D172-570E";
fsType = "vfat";
};
swapDevices = [ ];
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
networking.hostName = "z11pa-d8";
networking.hostId = "d83ce250";
# prevents "multiple pools with same name" problem during boot
# https://discourse.nixos.org/t/nixos-on-mirrored-ssd-boot-swap-native-encrypted-zfs/9215/5
boot.zfs.devNodes = "/dev/disk/by-partuuid";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment