From fd0b2987af4f0f2b6397f0704f03c7bd9f77ae1b Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Sat, 11 Nov 2023 23:00:19 +0100 Subject: [PATCH] nixos-hardware: omega --- flake.lock | 23 ++++++++++++++++++++--- flake.nix | 7 +++++++ hosts/omega/hardware.nix | 15 +++++++++------ modules/base/system.nix | 3 +++ 4 files changed, 39 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index 3b2e880..755875d 100644 --- a/flake.lock +++ b/flake.lock @@ -28,11 +28,11 @@ ] }, "locked": { - "lastModified": 1699368917, - "narHash": "sha256-nUtGIWf86BOkUbtksWtfglvCZ/otP0FTZlQH8Rzc7PA=", + "lastModified": 1699663185, + "narHash": "sha256-hI3CZPINBWstkMN+ptyzWibw5eRtFCiEvO7zR61bGBs=", "owner": "nix-community", "repo": "home-manager", - "rev": "6a8444467c83c961e2f5ff64fb4f422e303c98d3", + "rev": "691cbcc03af6ad1b5384c0e0e0b5f2298f58c5ce", "type": "github" }, "original": { @@ -77,6 +77,22 @@ "type": "github" } }, + "nixos-hardware": { + "locked": { + "lastModified": 1699701045, + "narHash": "sha256-mDzUXK7jNO/utInWpSWEX1NgEEunVIpJg+LyPsDTfy0=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "b689465d0c5d88e158e7d76094fca08cc0223aad", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixos-hardware", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1699291058, @@ -115,6 +131,7 @@ "home-manager-unstable": "home-manager-unstable", "impermanence": "impermanence", "nix-index-database": "nix-index-database", + "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable" } diff --git a/flake.nix b/flake.nix index 9f75ece..6e55fc7 100644 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,13 @@ nixpkgs-unstable = { url = "github:NixOS/nixpkgs/nixos-unstable"; }; + nixos-hardware = { + # nixos-hardware is a collection of NixOS modules covering hardware + # quirks. The modules are imported in each hosts' hardware.nix. See + # https://github.com/NixOS/nixos-hardware/blob/master/flake.nix for + # a list of available modules. + url = "github:NixOS/nixos-hardware/master"; + }; impermanence = { url = "github:nix-community/impermanence"; }; diff --git a/hosts/omega/hardware.nix b/hosts/omega/hardware.nix index 77423ac..b79bd61 100644 --- a/hosts/omega/hardware.nix +++ b/hosts/omega/hardware.nix @@ -1,8 +1,12 @@ -{ config, lib, pkgs, modulesPath, ... }: { - imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; +{ config, lib, pkgs, modulesPath, nixos-hardware, ... }: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + nixos-hardware.nixosModules.common-cpu-amd + nixos-hardware.nixosModules.common-cpu-amd-pstate + nixos-hardware.nixosModules.common-gpu-amd + nixos-hardware.nixosModules.common-pc + nixos-hardware.nixosModules.common-pc-ssd + ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; boot.initrd.kernelModules = [ "dm-snapshot" ]; @@ -48,5 +52,4 @@ networking.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/modules/base/system.nix b/modules/base/system.nix index 9dca3cf..d1e4d3a 100644 --- a/modules/base/system.nix +++ b/modules/base/system.nix @@ -29,6 +29,9 @@ }; nixpkgs.config.allowUnfree = true; + # Enable all firmware with a license allowing redistribution + hardware.enableRedistributableFirmware = true; + environment.systemPackages = with pkgs; [ bat clang