From 05d7747a9e673f938574396cb6004a321b171bee Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Wed, 26 Jun 2024 23:57:41 -0400 Subject: [PATCH] moved base hardware cofnig + sound to hardwareModules --- hardwareModules/default.nix | 22 +++++++++++++ hardwareModules/options.nix | 5 +++ .../sound/default.nix | 9 ++--- hosts/fallarbor/hardware.nix | 2 ++ hosts/lavaridge/hardware.nix | 2 ++ hosts/mandarin/hardware.nix | 2 ++ hosts/mauville/hardware.nix | 2 ++ hosts/petalburg/hardware.nix | 2 ++ hosts/rustboro/hardware.nix | 2 ++ nixosModules/apps/steam/default.nix | 5 +-- nixosModules/base/default.nix | 18 ---------- nixosModules/base/networking/default.nix | 33 +++++++++++-------- 12 files changed, 65 insertions(+), 39 deletions(-) rename {nixosModules/base => hardwareModules}/sound/default.nix (87%) diff --git a/hardwareModules/default.nix b/hardwareModules/default.nix index 987d566b..fd0fcf64 100644 --- a/hardwareModules/default.nix +++ b/hardwareModules/default.nix @@ -10,5 +10,27 @@ inputs: { ./laptop ./options.nix ./ssd + ./sound ]; + + config = lib.mkIf config.ar.hardware.enable { + hardware = { + bluetooth.enable = true; + + keyboard.qmk.enable = true; + + logitech.wireless = { + enable = true; + enableGraphical = true; + }; + + steam-hardware.enable = config.programs.steam.enable; + }; + + services.logind.extraConfig = '' + # Don't shutdown when power button is short-pressed + HandlePowerKey=suspend + HandlePowerKeyLongPress=poweroff + ''; + }; } diff --git a/hardwareModules/options.nix b/hardwareModules/options.nix index 4196d67e..9817032f 100644 --- a/hardwareModules/options.nix +++ b/hardwareModules/options.nix @@ -7,15 +7,20 @@ ... }: { options.ar.hardware = { + enable = lib.mkEnableOption "Enable base hardware configuration."; + cpu = { amd = lib.mkEnableOption "AMD CPU support."; intel = lib.mkEnableOption "Intel CPU support."; }; + gpu = { amd = lib.mkEnableOption "AMD GPU support."; intel = lib.mkEnableOption "Intel GPU support."; }; + laptop = lib.mkEnableOption "Laptop optimizations."; ssd = lib.mkEnableOption "SSD optimizations."; + sound = lib.mkEnableOption "Sound support."; }; } diff --git a/nixosModules/base/sound/default.nix b/hardwareModules/sound/default.nix similarity index 87% rename from nixosModules/base/sound/default.nix rename to hardwareModules/sound/default.nix index 014adf5d..24d56852 100644 --- a/nixosModules/base/sound/default.nix +++ b/hardwareModules/sound/default.nix @@ -1,11 +1,12 @@ { config, - inputs, lib, pkgs, ... }: { - config = lib.mkIf config.ar.base.enable { + config = lib.mkIf config.ar.hardware.ssd { + sound.enable = true; + hardware.pulseaudio = { enable = lib.mkForce false; package = pkgs.pulseaudioFull; @@ -14,14 +15,14 @@ services = { pipewire = { enable = true; + alsa = { enable = true; support32Bit = true; }; + pulse.enable = true; }; }; - - sound.enable = true; }; } diff --git a/hosts/fallarbor/hardware.nix b/hosts/fallarbor/hardware.nix index d2eb5767..b31ae153 100644 --- a/hosts/fallarbor/hardware.nix +++ b/hosts/fallarbor/hardware.nix @@ -47,9 +47,11 @@ }; ar.hardware = { + enable = true; cpu.intel = true; gpu.intel = true; laptop = true; ssd = true; + sound = true; }; } diff --git a/hosts/lavaridge/hardware.nix b/hosts/lavaridge/hardware.nix index bbee1927..7d14b515 100644 --- a/hosts/lavaridge/hardware.nix +++ b/hosts/lavaridge/hardware.nix @@ -34,9 +34,11 @@ }; ar.hardware = { + enable = true; cpu.amd = true; gpu.amd = true; laptop = true; ssd = true; + sound = true; }; } diff --git a/hosts/mandarin/hardware.nix b/hosts/mandarin/hardware.nix index bb460899..f1748ed3 100644 --- a/hosts/mandarin/hardware.nix +++ b/hosts/mandarin/hardware.nix @@ -14,9 +14,11 @@ hardware.enableAllFirmware = true; ar.hardware = { + enable = true; cpu.amd = true; gpu.amd = true; laptop = false; ssd = true; + sound = true; }; } diff --git a/hosts/mauville/hardware.nix b/hosts/mauville/hardware.nix index b116f58f..8beb1c8d 100644 --- a/hosts/mauville/hardware.nix +++ b/hosts/mauville/hardware.nix @@ -10,9 +10,11 @@ hardware.enableAllFirmware = true; ar.hardware = { + enable = true; cpu.amd = true; gpu.amd = true; laptop = false; ssd = true; + sound = true; }; } diff --git a/hosts/petalburg/hardware.nix b/hosts/petalburg/hardware.nix index a91f2195..ed892932 100644 --- a/hosts/petalburg/hardware.nix +++ b/hosts/petalburg/hardware.nix @@ -17,9 +17,11 @@ }; ar.hardware = { + enable = true; cpu.intel = true; gpu.intel = true; laptop = true; ssd = true; + sound = true; }; } diff --git a/hosts/rustboro/hardware.nix b/hosts/rustboro/hardware.nix index dc995665..4ee6c711 100644 --- a/hosts/rustboro/hardware.nix +++ b/hosts/rustboro/hardware.nix @@ -36,9 +36,11 @@ services.fwupd.enable = true; ar.hardware = { + enable = true; cpu.intel = true; gpu.intel = true; laptop = true; ssd = true; + sound = true; }; } diff --git a/nixosModules/apps/steam/default.nix b/nixosModules/apps/steam/default.nix index 2aaffa4b..b126e98c 100644 --- a/nixosModules/apps/steam/default.nix +++ b/nixosModules/apps/steam/default.nix @@ -5,16 +5,13 @@ ... }: { config = lib.mkIf config.ar.apps.steam.enable { - hardware.steam-hardware.enable = true; programs = { gamescope.enable = config.ar.desktop.steam.enable; steam = { enable = true; dedicatedServer.openFirewall = true; - extraCompatPackages = with pkgs; [ - proton-ge-bin - ]; + extraCompatPackages = with pkgs; [proton-ge-bin]; gamescopeSession.enable = config.ar.desktop.steam.enable; localNetworkGameTransfers.openFirewall = true; remotePlay.openFirewall = true; diff --git a/nixosModules/base/default.nix b/nixosModules/base/default.nix index d7e1f433..0282417b 100644 --- a/nixosModules/base/default.nix +++ b/nixosModules/base/default.nix @@ -10,7 +10,6 @@ ./nix ./nixpkgs ./plymouth - ./sound ./zramSwap ]; @@ -63,23 +62,6 @@ enableSSHSupport = true; }; - hardware = { - # Add support for logitech unifying receivers. - logitech.wireless = { - enable = true; - enableGraphical = true; - }; - keyboard.qmk.enable = true; - }; - - services = { - logind.extraConfig = '' - # Don't shutdown when power button is short-pressed - HandlePowerKey=suspend - HandlePowerKeyLongPress=poweroff - ''; - }; - security = { polkit.enable = true; rtkit.enable = true; diff --git a/nixosModules/base/networking/default.nix b/nixosModules/base/networking/default.nix index a88d2185..50bcee46 100644 --- a/nixosModules/base/networking/default.nix +++ b/nixosModules/base/networking/default.nix @@ -9,17 +9,12 @@ config = lib.mkIf config.ar.base.enable { age.secrets.wifi.file = ../../../secrets/wifi.age; - hardware = { - bluetooth.enable = true; - }; - networking.networkmanager = { enable = true; ensureProfiles = { - environmentFiles = [ - config.age.secrets.wifi.path - ]; + environmentFiles = [config.age.secrets.wifi.path]; + profiles = { "Dustin's A54" = { connection = { @@ -27,12 +22,14 @@ type = "wifi"; uuid = "fc221cbd-b6fd-44e0-8679-5998933b2fff"; }; - wifi.ssid = "Dustin's A54"; + wifi-security = { auth-alg = "open"; key-mgmt = "wpa-psk"; psk = "$DustinsA54PSK"; }; + + wifi.ssid = "Dustin's A54"; }; javapatron = { @@ -41,11 +38,13 @@ type = "wifi"; uuid = "bb61beaa-ec07-404c-bbce-5a08ae355de7"; }; - wifi.ssid = "javapatron"; + wifi-security = { auth-alg = "open"; key-mgmt = "wpa-psk"; }; + + wifi.ssid = "javapatron"; }; "Taproom Public WiFi" = { @@ -54,11 +53,13 @@ type = "wifi"; uuid = "d79280e9-4a22-4125-9583-eb7b80abfeb6"; }; - wifi.ssid = "Taproom Public WiFi"; + wifi-security = { auth-alg = "open"; key-mgmt = "wpa-psk"; }; + + wifi.ssid = "Taproom Public WiFi"; }; Stargate-Discovery = { @@ -66,12 +67,14 @@ id = "Stargate-Discovery"; type = "wifi"; }; - wifi.ssid = "Stargate-Discovery"; + wifi-security = { auth-alg = "open"; key-mgmt = "wpa-psk"; psk = "$StargateDiscoveryPSK"; }; + + wifi.ssid = "Stargate-Discovery"; }; wallace = { @@ -80,12 +83,14 @@ type = "wifi"; uuid = "6896b13d-9717-4a8d-8a08-2a97139bf833"; }; - wifi.ssid = "wallace"; + wifi-security = { auth-alg = "open"; key-mgmt = "wpa-psk"; psk = "$wallacePSK"; }; + + wifi.ssid = "wallace"; }; WeWorkWiFi = { @@ -95,12 +100,14 @@ password = "$WeWorkWiFiPassword"; phase2-auth = "mschapv2"; }; + connection = { id = "WeWorkWiFi"; type = "wifi"; }; - wifi.ssid = "WeWorkWiFi"; + wifi-security.key-mgmt = "wpa-eap"; + wifi.ssid = "WeWorkWiFi"; }; }; };