Skip to content

Instantly share code, notes, and snippets.

@byrongibson
Created June 29, 2021 19:21
Show Gist options
  • Select an option

  • Save byrongibson/c0c27c49bc335b481d3dded86fd24d10 to your computer and use it in GitHub Desktop.

Select an option

Save byrongibson/c0c27c49bc335b481d3dded86fd24d10 to your computer and use it in GitHub Desktop.

Revisions

  1. byrongibson created this gist Jun 29, 2021.
    63 changes: 63 additions & 0 deletions hardware-configuration.nix
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,63 @@
    # 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 = [ ];

    # https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/#step-4-1-configure-disks
    # need tmpfs permissions set to 755 or some software like openssh will complain.
    # Tmpfs size can be whatever you want it to be, based on your available RAM.
    # size=512M is sufficient, or 1GB or 2GB if you need more headroom.
    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."/boot" =
    { device = "/dev/disk/by-uuid/9F0B-2D34";
    fsType = "vfat";
    };

    # No swap. If you must have swap, put it on a separate non-ZFS
    # partition.
    # https://nixos.wiki/wiki/NixOS_on_ZFS#Caveats
    swapDevices = [ ];

    # Default
    powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";

    # machine-specific properties
    networking.hostId = "5d20fed3";
    boot.zfs.devNodes = "/dev/disk/by-id/ata-WDC_WDS100T2B0B-00YS70_1831C1800343-part2";
    }