From 0d316fe7d242649bf5ca39707e1997bb7c19abe8 Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Wed, 22 Nov 2023 18:54:05 +0100 Subject: [PATCH] merge normal and hardware configuration --- configuration.nix | 49 +++++++++++++++++++++++++++++--------- flake.nix | 4 +--- hardware-configuration.nix | 16 ------------- 3 files changed, 39 insertions(+), 30 deletions(-) delete mode 100644 hardware-configuration.nix diff --git a/configuration.nix b/configuration.nix index e3e78b9..37c6231 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,14 +1,32 @@ -{ pkgs, config, ... }: { +{ pkgs, config, lib, modulesPath, ... }: { imports = [ - ./hardware-configuration.nix + (modulesPath + "/installer/scan/not-detected.nix") ./modules/disk-config.nix ./modules/agenix.nix ./modules/custom.nix ]; - boot.loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = true; + boot = { + kernelModules = [ "kvm-intel" ]; + extraModulePackages = [ ]; + + initrd = { + availableKernelModules = [ + "ahci" + "xhci_pci" + "nvme" + "usbhid" + "usb_storage" + "sd_mod" + "sdhci_pci" + ]; + kernelModules = [ ]; + }; + + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; }; time.timeZone = "Europe/Amsterdam"; @@ -88,7 +106,10 @@ }; }; - nixpkgs.config.allowUnfree = true; + nixpkgs = { + config.allowUnfree = true; + hostPlatform = "x86_64-linux"; + }; environment.systemPackages = with pkgs; [ neofetch @@ -102,12 +123,15 @@ file ]; - networking.firewall.enable = false; + networking = { + firewall.enable = false; + useDHCP = false; - networking.nftables = { - enable = true; - checkRuleset = true; - ruleset = builtins.readFile ./nftables.conf; + nftables = { + enable = true; + checkRuleset = true; + ruleset = builtins.readFile ./nftables.conf; + }; }; system.stateVersion = "23.05"; @@ -158,4 +182,7 @@ }; virtualisation.libvirtd.enable = true; + + hardware.cpu.intel.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/flake.nix b/flake.nix index 566dce8..a3151c5 100644 --- a/flake.nix +++ b/flake.nix @@ -51,9 +51,7 @@ disko.nixosModules.disko agenix.nixosModules.default ./configuration.nix - { - networking.hostName = machine.name; - } + { networking.hostName = machine.name; } ]; }); diff --git a/hardware-configuration.nix b/hardware-configuration.nix deleted file mode 100644 index 056148a..0000000 --- a/hardware-configuration.nix +++ /dev/null @@ -1,16 +0,0 @@ -# TODO: merge with configuration.nix -{ config, lib, modulesPath, ... }: { - imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - - boot.initrd.availableKernelModules = - [ "ahci" "xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ]; - boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; - boot.extraModulePackages = [ ]; - - networking.useDHCP = false; - - nixpkgs.hostPlatform = "x86_64-linux"; - hardware.cpu.intel.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; -}