From f4f9112c05d198ca9723025dad95bd0c83a4a7b6 Mon Sep 17 00:00:00 2001 From: ShatteredMINT Date: Thu, 12 Dec 2024 22:23:40 +0100 Subject: [PATCH] make hardware configuration for each machine explicit --- configuration.nix | 5 ----- flake.nix | 2 ++ hardware/desk.nix | 56 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 hardware/desk.nix diff --git a/configuration.nix b/configuration.nix index 412a8c5..fa66761 100644 --- a/configuration.nix +++ b/configuration.nix @@ -5,11 +5,6 @@ { config, lib, pkgs, ... }: { - imports = - [ # Include the results of the hardware scan. - ./hardware-configuration.nix - ]; - nix.settings.experimental-features = [ "nix-command" "flakes" ]; nixpkgs.config.allowUnfree = true; diff --git a/flake.nix b/flake.nix index b14ba62..c19ab16 100644 --- a/flake.nix +++ b/flake.nix @@ -20,6 +20,8 @@ system = "x86_64-linux"; specialArgs = inputs; modules = [ + ./hardware/desk.nix + ./configuration.nix ./nvidia.nix ./plasma.nix diff --git a/hardware/desk.nix b/hardware/desk.nix new file mode 100644 index 0000000..ece2b12 --- /dev/null +++ b/hardware/desk.nix @@ -0,0 +1,56 @@ +# 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. +##test +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "NIX_DESK_POOL/root"; + fsType = "zfs"; + }; + + fileSystems."/nix" = + { device = "NIX_DESK_POOL/nix"; + fsType = "zfs"; + }; + + fileSystems."/var" = + { device = "NIX_DESK_POOL/var"; + fsType = "zfs"; + }; + + fileSystems."/home" = + { device = "NIX_DESK_POOL/home"; + fsType = "zfs"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/E943-DA32"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/7e1ada61-7a9b-4d28-b608-23d1ac7f4e29"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}