From f0c424b39af1e6abcf316c3cffd73120128d1b4e Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Wed, 7 Aug 2024 07:06:41 -0700 Subject: [PATCH] refactor: move some unlikely to be shared config into hosts --- flake.nix | 2 -- hosts/nixos/default.nix | 32 +++++++++++++++++++++++++++- modules/nixos/nvidia/default.nix | 15 ------------- modules/nixos/secureboot/default.nix | 17 --------------- 4 files changed, 31 insertions(+), 35 deletions(-) delete mode 100755 modules/nixos/nvidia/default.nix delete mode 100755 modules/nixos/secureboot/default.nix diff --git a/flake.nix b/flake.nix index 6fb25d0..a8ed344 100755 --- a/flake.nix +++ b/flake.nix @@ -48,10 +48,8 @@ system = "x86_64-linux"; modules = [ ./hosts/nixos - ./modules/nixos/secureboot.nix ./modules/nixos/gaming.nix ./modules/nixos/audio.nix - ./modules/nixos/nvidia.nix ./modules/nixos/networking.nix ./modules/common/fonts.nix diff --git a/hosts/nixos/default.nix b/hosts/nixos/default.nix index 24ff9ab..d89b862 100755 --- a/hosts/nixos/default.nix +++ b/hosts/nixos/default.nix @@ -2,7 +2,7 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ config, inputs, pkgs, ... }: +{ config, inputs, pkgs, lib, ... }: { imports = [ # Include the results of the hardware scan. @@ -19,6 +19,22 @@ }; }; + environment.systemPackages = [ + # For debugging and troubleshooting Secure Boot. + pkgs.sbctl + ]; + + # Lanzaboote currently replaces the systemd-boot module. + # This setting is usually set to true in configuration.nix + # generated at installation time. So we force it to false + # for now. + boot.loader.systemd-boot.enable = lib.mkForce false; + + boot.lanzaboote = { + enable = true; + pkiBundle = "/etc/secureboot"; + }; + networking.hostName = "nixos"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. @@ -69,6 +85,20 @@ package = pkgs.kdePackages.sddm; }; + hardware.nvidia = { + modesetting.enable = true; + powerManagement.enable = true; + powerManagement.finegrained = false; + open = false; + nvidiaSettings = true; + }; + + hardware.graphics.enable = true; + + hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; + + services.xserver.videoDrivers = [ "nvidia" ]; + # services.desktopManager.plasma6.enable = true; # Configure keymap in X11 diff --git a/modules/nixos/nvidia/default.nix b/modules/nixos/nvidia/default.nix deleted file mode 100755 index 789fb5f..0000000 --- a/modules/nixos/nvidia/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ config, ... }: { - hardware.nvidia = { - modesetting.enable = true; - powerManagement.enable = true; - powerManagement.finegrained = false; - open = false; - nvidiaSettings = true; - }; - - hardware.graphics.enable = true; - - hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable; - - services.xserver.videoDrivers = [ "nvidia" ]; -} diff --git a/modules/nixos/secureboot/default.nix b/modules/nixos/secureboot/default.nix deleted file mode 100755 index c5ccbac..0000000 --- a/modules/nixos/secureboot/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -({ pkgs, lib, ... }: { - environment.systemPackages = [ - # For debugging and troubleshooting Secure Boot. - pkgs.sbctl - ]; - - # Lanzaboote currently replaces the systemd-boot module. - # This setting is usually set to true in configuration.nix - # generated at installation time. So we force it to false - # for now. - boot.loader.systemd-boot.enable = lib.mkForce false; - - boot.lanzaboote = { - enable = true; - pkiBundle = "/etc/secureboot"; - }; -})