# 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 + "/installer/scan/not-detected.nix")
    ];

  boot = {
    kernelPackages = pkgs.linuxPackages_5_15;
    kernelModules = [ "kvm-amd" ];
    extraModulePackages = [ ];
    supportedFilesystems = [ "zfs" ];
    zfs = {
      requestEncryptionCredentials = true;
      extraPools = [ "zroot" ];
    };

    initrd = {
      availableKernelModules = [ "ahci" "ohci_pci" "ehci_pci" "pata_atiixp" "usb_storage" "usbhid" "sd_mod" "sr_mod" ];
      supportedFilesystems = [ "zfs" ];
      kernelModules = [ ];
    };

    loader = {
      efi = {
        canTouchEfiVariables = false;
      };

      grub = {
        efiSupport = false;
        device = "/dev/sda";
        mirroredBoots = [
          {
            devices = [ "/dev/sdb" ];
            path = "/boot-fallback";
          }
        ];
      };

      #   systemd-boot.enable = true;
      #   generic-extlinux-compatible.enable = true;
      #   efi.canTouchEfiVariables = true;
    };
  };


  fileSystems."/" =
    {
      device = "zroot/public/root";
      fsType = "zfs";
    };

  fileSystems."/boot" =
    {
      device = "/dev/disk/by-uuid/66BD-AE42";
      fsType = "vfat";
    };

  fileSystems."/boot-fallback" =
    {
      device = "/dev/disk/by-uuid/66C2-95D6";
      fsType = "vfat";
    };

  fileSystems."/nix" =
    {
      device = "zroot/public/nix";
      fsType = "zfs";
    };

  fileSystems."/data" =
    {
      device = "zroot/public/data";
      fsType = "zfs";
    };

  fileSystems."/persist/host" =
    {
      device = "zroot/public/persist/host";
      fsType = "zfs";
    };

  fileSystems."/persist/user" =
    {
      device = "zroot/public/persist/user";
      fsType = "zfs";
    };

  fileSystems."/nix-homelab" =
    {
      device = "zroot/public/nix-homelab";
      fsType = "zfs";
    };

  swapDevices =
    [{ device = "/dev/disk/by-uuid/25f7eb2d-c6f0-40a2-8ce3-35d27f7ed58c"; }
      { device = "/dev/disk/by-uuid/67c231a5-78e7-4a88-a13e-21df4c5ffe19"; }];

  hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
