|
12 | 12 | (modulesPath + "/installer/scan/not-detected.nix") |
13 | 13 | ]; |
14 | 14 |
|
15 | | - boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "vmd" "nvme" "usb_storage" "sd_mod" "sdhci_pci"]; |
| 15 | + boot.initrd.availableKernelModules = ["xhci_pci" "thunderbolt" "vmd" "nvme" "usbhid" "usb_storage" "sd_mod" "sdhci_pci"]; |
16 | 16 | boot.initrd.kernelModules = []; |
17 | 17 | boot.kernelModules = ["kvm-intel"]; |
18 | 18 | boot.extraModulePackages = []; |
19 | | - boot.supportedFilesystems = ["btrfs"]; |
20 | 19 |
|
21 | 20 | boot.initrd.postDeviceCommands = lib.mkAfter '' |
22 | | - mkdir /btrfs_tmp |
23 | | - mount /dev/disk/by-label/NIXOS /btrfs_tmp |
24 | | - if [[ -e /btrfs_tmp/root ]]; then |
25 | | - mkdir -p /btrfs_tmp/old_roots |
26 | | - timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S") |
27 | | - mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp" |
28 | | - fi |
29 | | -
|
30 | | - delete_subvolume_recursively() { |
31 | | - IFS=$'\n' |
32 | | - for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do |
33 | | - delete_subvolume_recursively "/btrfs_tmp/$i" |
34 | | - done |
35 | | - btrfs subvolume delete "$1" |
36 | | - } |
37 | | -
|
38 | | - for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do |
39 | | - delete_subvolume_recursively "$i" |
40 | | - done |
41 | | -
|
42 | | - btrfs subvolume create /btrfs_tmp/root |
43 | | - umount /btrfs_tmp |
| 21 | + zfs rollback -r zpool/root@blank |
44 | 22 | ''; |
| 23 | + boot.loader.efi.canTouchEfiVariables = true; |
| 24 | + |
| 25 | + boot.loader.grub = { |
| 26 | + enable = true; |
| 27 | + zfsSupport = true; |
| 28 | + efiSupport = true; |
| 29 | + mirroredBoots = [ |
| 30 | + { |
| 31 | + devices = ["nodev"]; |
| 32 | + path = "/boot"; |
| 33 | + } |
| 34 | + ]; |
| 35 | + }; |
45 | 36 |
|
46 | 37 | fileSystems."/" = { |
47 | | - device = "/dev/disk/by-label/NIXOS"; |
48 | | - fsType = "btrfs"; |
49 | | - options = ["subvol=root" "defaults" "noatime" "compress=lzo" "discard=async"]; |
| 38 | + device = "zpool/root"; |
| 39 | + fsType = "zfs"; |
50 | 40 | }; |
51 | 41 |
|
52 | | - fileSystems."/nix" = { |
53 | | - device = "/dev/disk/by-label/NIXOS"; |
54 | | - fsType = "btrfs"; |
55 | | - options = ["subvol=nix" "defaults" "noatime" "compress=lzo" "discard=async"]; |
| 42 | + fileSystems."/persist" = { |
| 43 | + device = "zpool/persist"; |
| 44 | + fsType = "zfs"; |
56 | 45 | neededForBoot = true; |
57 | 46 | }; |
58 | 47 |
|
59 | | - fileSystems."/persist" = { |
60 | | - device = "/dev/disk/by-label/NIXOS"; |
61 | | - fsType = "btrfs"; |
62 | | - options = ["subvol=persist" "defaults" "noatime" "compress=lzo" "discard=async"]; |
| 48 | + fileSystems."/nix" = { |
| 49 | + device = "zpool/nix"; |
| 50 | + fsType = "zfs"; |
63 | 51 | neededForBoot = true; |
64 | 52 | }; |
65 | 53 |
|
66 | 54 | fileSystems."/boot" = { |
67 | 55 | device = "/dev/disk/by-uuid/4482-0D39"; |
68 | 56 | fsType = "vfat"; |
69 | | - options = ["fmask=0077" "dmask=0077"]; |
| 57 | + options = ["fmask=0022" "dmask=0022"]; |
70 | 58 | }; |
71 | 59 |
|
| 60 | + services.zfs.autoScrub.enable = true; |
| 61 | + |
72 | 62 | swapDevices = [ |
73 | 63 | {device = "/dev/disk/by-uuid/87b51a1c-cd2b-4246-918b-5f17bc632e00";} |
74 | 64 | ]; |
75 | 65 |
|
76 | | - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking |
77 | | - # (the default) this is the recommended approach. When using systemd-networkd it's |
78 | | - # still possible to use this option, but it's recommended to use it in conjunction |
79 | | - # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. |
80 | 66 | networking.useDHCP = lib.mkDefault true; |
81 | | - # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true; |
82 | 67 |
|
83 | 68 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; |
84 | 69 | hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; |
|
0 commit comments