From 90916b08d399fc248e65e832c3921d3709901d64 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sat, 6 Jul 2024 18:10:37 -0400 Subject: [PATCH] remove hardwareModules infavor of upstream nixhw --- flake.nix | 4 --- hardwareModules/cpu/amd/default.nix | 20 ----------- hardwareModules/cpu/default.nix | 12 ------- hardwareModules/cpu/intel/default.nix | 14 -------- hardwareModules/default.nix | 36 ------------------- hardwareModules/gpu/amd/default.nix | 28 --------------- hardwareModules/gpu/default.nix | 12 ------- hardwareModules/gpu/intel/default.nix | 40 --------------------- hardwareModules/laptop/default.nix | 51 --------------------------- hardwareModules/options.nix | 26 -------------- hardwareModules/sound/default.nix | 28 --------------- hardwareModules/ssd/default.nix | 10 ------ 12 files changed, 281 deletions(-) delete mode 100644 hardwareModules/cpu/amd/default.nix delete mode 100644 hardwareModules/cpu/default.nix delete mode 100644 hardwareModules/cpu/intel/default.nix delete mode 100644 hardwareModules/default.nix delete mode 100644 hardwareModules/gpu/amd/default.nix delete mode 100644 hardwareModules/gpu/default.nix delete mode 100644 hardwareModules/gpu/intel/default.nix delete mode 100644 hardwareModules/laptop/default.nix delete mode 100644 hardwareModules/options.nix delete mode 100644 hardwareModules/sound/default.nix delete mode 100644 hardwareModules/ssd/default.nix diff --git a/flake.nix b/flake.nix index 3832cd4a..2ad4af69 100644 --- a/flake.nix +++ b/flake.nix @@ -75,9 +75,6 @@ homeManagerModules.default = import ./homeManagerModules inputs self; - nixosModules.hardware = - import ./hardwareModules inputs; - nixosModules.nixos = import ./nixosModules inputs; @@ -102,7 +99,6 @@ inputs.nixvim.nixosModules.nixvim inputs.nur.nixosModules.nur inputs.raffauflabs.nixosModules.raffauflabs - self.nixosModules.hardware self.nixosModules.nixos { diff --git a/hardwareModules/cpu/amd/default.nix b/hardwareModules/cpu/amd/default.nix deleted file mode 100644 index dc5a5801..00000000 --- a/hardwareModules/cpu/amd/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: { - config = lib.mkIf config.ar.hardware.cpu.amd { - boot = { - kernelModules = ["kvm-amd"]; - kernelParams = - lib.optional (config.ar.hardware.laptop) "amd_pstate=active"; - }; - - hardware = { - cpu.amd.updateMicrocode = true; - }; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - }; -} diff --git a/hardwareModules/cpu/default.nix b/hardwareModules/cpu/default.nix deleted file mode 100644 index 88ef1b23..00000000 --- a/hardwareModules/cpu/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - config, - inputs, - lib, - pkgs, - ... -}: { - imports = [ - ./amd - ./intel - ]; -} diff --git a/hardwareModules/cpu/intel/default.nix b/hardwareModules/cpu/intel/default.nix deleted file mode 100644 index d81fe2f0..00000000 --- a/hardwareModules/cpu/intel/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: { - config = lib.mkIf config.ar.hardware.cpu.intel { - boot.kernelModules = ["kvm-intel"]; - hardware.cpu.intel.updateMicrocode = true; - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - powerManagement.powertop.enable = config.ar.hardware.laptop; - services.thermald.enable = config.ar.hardware.laptop; - }; -} diff --git a/hardwareModules/default.nix b/hardwareModules/default.nix deleted file mode 100644 index fd0fcf64..00000000 --- a/hardwareModules/default.nix +++ /dev/null @@ -1,36 +0,0 @@ -inputs: { - config, - pkgs, - lib, - ... -}: { - imports = [ - ./cpu - ./gpu - ./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/gpu/amd/default.nix b/hardwareModules/gpu/amd/default.nix deleted file mode 100644 index d27b9c7d..00000000 --- a/hardwareModules/gpu/amd/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: { - config = lib.mkIf config.ar.hardware.gpu.amd { - boot = { - initrd.kernelModules = ["amdgpu"]; - - kernelModules = ["amdgpu"]; - # Disable AMD Backlight Management. - # ABM severely degrades display quality for miniscule power efficiency gains. - kernelParams = ["amdgpu.abmlevel=0"]; - }; - - hardware.amdgpu = { - initrd.enable = true; - - amdvlk = { - enable = true; - support32Bit.enable = true; - }; - - opencl.enable = true; - }; - }; -} diff --git a/hardwareModules/gpu/default.nix b/hardwareModules/gpu/default.nix deleted file mode 100644 index 88ef1b23..00000000 --- a/hardwareModules/gpu/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - config, - inputs, - lib, - pkgs, - ... -}: { - imports = [ - ./amd - ./intel - ]; -} diff --git a/hardwareModules/gpu/intel/default.nix b/hardwareModules/gpu/intel/default.nix deleted file mode 100644 index c03c9542..00000000 --- a/hardwareModules/gpu/intel/default.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: { - config = lib.mkIf config.ar.hardware.gpu.intel { - boot.initrd.kernelModules = ["i915"]; - - environment.sessionVariables = { - LIBVA_DRIVER_NAME = "iHD"; - VDPAU_DRIVER = "va_gl"; - }; - - hardware = { - enableAllFirmware = true; - intel-gpu-tools.enable = true; - - opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; - - extraPackages = with pkgs; [ - intel-media-driver # LIBVA_DRIVER_NAME=iHD - (intel-vaapi-driver.override {enableHybridCodec = true;}) - libvdpau-va-gl - ]; - - extraPackages32 = with pkgs.driversi686Linux; [ - intel-media-driver # LIBVA_DRIVER_NAME=iHD - (intel-vaapi-driver.override {enableHybridCodec = true;}) - libvdpau-va-gl - ]; - }; - }; - - services.xserver.videoDrivers = ["modesetting"]; - }; -} diff --git a/hardwareModules/laptop/default.nix b/hardwareModules/laptop/default.nix deleted file mode 100644 index 9b11b7f1..00000000 --- a/hardwareModules/laptop/default.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: let - pp-adjuster = pkgs.writeShellScriptBin "pp-adjuster" '' - current_profile=$(${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} get | tr -d '[:space:]') - if [ "$current_profile" == "power-saver" ]; then - ${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} set balanced - elif [ "$current_profile" == "balanced" ]; then - ${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} set performance - elif [ "$current_profile" == "performance" ]; then - ${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} set power-saver - fi - new_profile=$(${lib.getExe' pkgs.power-profiles-daemon "powerprofilesctl"} get | tr -d '[:space:]') - ${lib.getExe pkgs.libnotify} "Power profile set to $new_profile." - ''; -in { - config = lib.mkIf config.ar.hardware.laptop { - environment.systemPackages = - lib.optional (config.services.power-profiles-daemon.enable) - pp-adjuster; - - services = { - power-profiles-daemon.enable = true; - upower.enable = true; - - tlp = { - enable = !config.services.power-profiles-daemon.enable; - settings = { - BAY_POWEROFF_ON_AC = 0; - BAY_POWEROFF_ON_BAT = 1; - CPU_BOOST_ON_AC = 1; - CPU_BOOST_ON_BAT = 0; - CPU_ENERGY_PERF_POLICY_ON_AC = "balance_performance"; - CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; - CPU_HWP_DYN_BOOST_ON_AC = 1; - CPU_HWP_DYN_BOOST_ON_BAT = 0; - PCIE_ASPM_ON_AC = "default"; - PCIE_ASPM_ON_BAT = "powersupersave"; - PLATFORM_PROFILE_ON_AC = "balanced"; - PLATFORM_PROFILE_ON_BAT = "low-power"; - RESTORE_DEVICE_STATE_ON_STARTUP = 1; - TLP_DEFAULT_MODE = "AC"; - TLP_PERSISTENT_DEFAULT = 0; - }; - }; - }; - }; -} diff --git a/hardwareModules/options.nix b/hardwareModules/options.nix deleted file mode 100644 index 9817032f..00000000 --- a/hardwareModules/options.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - config, - inputs, - lib, - pkgs, - self, - ... -}: { - 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/hardwareModules/sound/default.nix b/hardwareModules/sound/default.nix deleted file mode 100644 index f11f0738..00000000 --- a/hardwareModules/sound/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: { - config = lib.mkIf config.ar.hardware.sound { - sound.enable = true; - - hardware.pulseaudio = { - enable = lib.mkForce false; - package = pkgs.pulseaudioFull; - }; - - services = { - pipewire = { - enable = true; - - alsa = { - enable = true; - support32Bit = true; - }; - - pulse.enable = true; - }; - }; - }; -} diff --git a/hardwareModules/ssd/default.nix b/hardwareModules/ssd/default.nix deleted file mode 100644 index 1242a7f3..00000000 --- a/hardwareModules/ssd/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: { - config = lib.mkIf config.ar.hardware.ssd { - services.fstrim.enable = true; - }; -}