From 9c32ed314c2e8526623dae29b6a8a4b1aa2e4a6e Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Tue, 14 Mar 2023 13:50:59 +0100 Subject: [PATCH] Refactor Systems --- modules/hardware/bluetooth/default.nix | 19 +++++++++++++++ modules/hardware/rgb/default.nix | 19 +++++++++++++++ modules/programs/steam/default.nix | 21 ++++++++++++++++ systems/aarch64-linux/yokai/default.nix | 31 ++++++++++++------------ systems/aarch64-linux/yokai/hardware.nix | 13 ---------- systems/x86_64-linux/kami/default.nix | 23 ++++++------------ systems/x86_64-linux/oni/default.nix | 30 +++++++++++++---------- systems/x86_64-linux/oni/hardware.nix | 15 +----------- 8 files changed, 101 insertions(+), 70 deletions(-) create mode 100644 modules/hardware/bluetooth/default.nix create mode 100644 modules/hardware/rgb/default.nix create mode 100644 modules/programs/steam/default.nix diff --git a/modules/hardware/bluetooth/default.nix b/modules/hardware/bluetooth/default.nix new file mode 100644 index 0000000..b611f97 --- /dev/null +++ b/modules/hardware/bluetooth/default.nix @@ -0,0 +1,19 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +#with lib.internal; +let cfg = config.custom.hardware.bluetooth; +in +{ + options.custom.hardware.bluetooth = with types; { + enable = mkBoolOpt false "Whether or not to enable bluetooth"; + }; + + config = mkIf cfg.enable { + + hardware.bluetooth.enable = true; + hardware.bluetooth.hsphfpd.enable = !config.services.pipewire.wireplumber.enable; + hardware.bluetooth.powerOnBoot = true; + + }; +} diff --git a/modules/hardware/rgb/default.nix b/modules/hardware/rgb/default.nix new file mode 100644 index 0000000..8ae11f7 --- /dev/null +++ b/modules/hardware/rgb/default.nix @@ -0,0 +1,19 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +#with lib.internal; +let cfg = config.custom.hardware.rgb; +in +{ + options.custom.hardware.rgb = with types; { + enable = mkBoolOpt false "Whether or not to enable openrgb"; + motherboard = mkOpt str "intel" "Which motherboard to use"; # Move to common CPU module at some point + }; + + config = mkIf cfg.enable { + + services.hardware.openrgb.enable = true; + services.hardware.openrgb.motherboard = cfg.motherboard; + + }; +} diff --git a/modules/programs/steam/default.nix b/modules/programs/steam/default.nix new file mode 100644 index 0000000..2922e47 --- /dev/null +++ b/modules/programs/steam/default.nix @@ -0,0 +1,21 @@ +{ options, config, pkgs, lib, ... }: + +with lib; +#with lib.internal; +let cfg = config.custom.programs.steam; +in +{ + options.custom.programs.steam = with types; { + enable = mkBoolOpt false "Whether or not to enable Steam."; + }; + + config = mkIf cfg.enable { + hardware.steam-hardware.enable = true; + + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; + }; + }; +} diff --git a/systems/aarch64-linux/yokai/default.nix b/systems/aarch64-linux/yokai/default.nix index 483d95b..6442339 100644 --- a/systems/aarch64-linux/yokai/default.nix +++ b/systems/aarch64-linux/yokai/default.nix @@ -6,21 +6,6 @@ with lib; imports = [ ./hardware.nix ]; networking.networkmanager.enable = true; - - custom.system.boot.uboot.enable = true; - custom.system.xdg.enable = true; - custom.system.fonts.enable = true; - custom.system.locale.enable = true; - custom.system.locale.layout = "us"; - custom.system.ssh.enable = true; - custom.nix.enable = true; - custom.hardware.audio.enable = true; - custom.hardware.printing.enable = true; - custom.desktop.plasma.enable = true; - - custom.user.jopejoe1.enable =true; - custom.user.root.enable =true; - networking.hostName = "yokai"; time.timeZone = "Europe/Berlin"; @@ -32,4 +17,20 @@ with lib; xwayland.enable = true; }; + # System + custom.system.boot.uboot.enable = true; + custom.system.xdg.enable = true; + custom.system.fonts.enable = true; + custom.system.locale.enable = true; + custom.system.locale.layout = "us"; + custom.system.ssh.enable = true; + custom.nix.enable = true; + custom.hardware.audio.enable = true; + custom.hardware.printing.enable = true; + custom.desktop.plasma.enable = true; + custom.hardware.bluetooth.enable = true; + + # User + custom.user.jopejoe1.enable = true; + custom.user.root.enable = true; } diff --git a/systems/aarch64-linux/yokai/hardware.nix b/systems/aarch64-linux/yokai/hardware.nix index 25a871f..6f112e7 100644 --- a/systems/aarch64-linux/yokai/hardware.nix +++ b/systems/aarch64-linux/yokai/hardware.nix @@ -5,17 +5,6 @@ (modulesPath + "/installer/scan/not-detected.nix") ]; - hardware.nvidia.prime = { - offload.enable = false; - sync.enable = true; - - # Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA - intelBusId = "PCI:0:2:0"; - - # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA - nvidiaBusId = "PCI:1:0:0"; - }; - boot = { kernelPackages = pkgs.linuxPackages_zen; @@ -49,6 +38,4 @@ # high-resolution display hardware.video.hidpi.enable = lib.mkDefault true; - - hardware.bluetooth.enable = true; } diff --git a/systems/x86_64-linux/kami/default.nix b/systems/x86_64-linux/kami/default.nix index 10f8b50..35e4147 100644 --- a/systems/x86_64-linux/kami/default.nix +++ b/systems/x86_64-linux/kami/default.nix @@ -29,7 +29,6 @@ #boot.kernelParams = [ "module_blacklist=i915" ]; environment.systemPackages = with pkgs; [ - git prismlauncher libsForQt5.discover knossos @@ -40,16 +39,9 @@ carla ]; - services.hardware.openrgb.enable = true; - services.hardware.openrgb.motherboard = "intel"; - hardware.nvidia.modesetting.enable = true; - hardware.steam-hardware.enable = true; services.flatpak.enable = true; - hardware.bluetooth.enable = true; - hardware.bluetooth.hsphfpd.enable = false; # Conflicts with wireplumber - hardware.bluetooth.powerOnBoot = true; programs = { dconf.enable = true; @@ -57,16 +49,11 @@ sysdig.enable = true; xwayland.enable = true; kdeconnect.enable = true; - steam = { - enable = true; - remotePlay.openFirewall = true; - dedicatedServer.openFirewall = true; - }; }; # Migrated Stuff - custom.user.jopejoe1.enable =true; - custom.user.root.enable =true; + custom.user.jopejoe1.enable = true; + custom.user.root.enable = true; custom.system.locale.enable = true; custom.system.locale.layout = "de"; custom.nix.enable = true; @@ -78,6 +65,12 @@ custom.hardware.printing.enable = true; custom.system.ssh.enable = true; + custom.hardware.rgb.enable = true; + custom.hardware.rgb.motherboard = "intel"; + custom.hardware.bluetooth.enable = true; + custom.programs.steam.enable = true; + + # Currently broken #custom.system.dns.enable = true; } diff --git a/systems/x86_64-linux/oni/default.nix b/systems/x86_64-linux/oni/default.nix index d6eb08d..90e0206 100644 --- a/systems/x86_64-linux/oni/default.nix +++ b/systems/x86_64-linux/oni/default.nix @@ -6,6 +6,18 @@ with lib; imports = [ ./hardware.nix ]; networking.networkmanager.enable = true; + networking.hostName = "oni"; + time.timeZone = "Europe/Berlin"; + hardware.opengl.enable = true; + + programs = { + dconf.enable = true; + droidcam.enable = true; + sysdig.enable = true; + xwayland.enable = true; + }; + + # System custom.system.boot.uefi.enable = true; custom.system.xdg.enable = true; @@ -18,19 +30,11 @@ with lib; custom.hardware.printing.enable = true; custom.desktop.plasma.enable = true; + custom.system.ssh.enable = true; + custom.hardware.bluetooth.enable = true; + custom.programs.steam.enable = true; + + # Users custom.user.jopejoe1.enable =true; custom.user.root.enable =true; - - networking.hostName = "oni"; - - time.timeZone = "Europe/Berlin"; - hardware.opengl.enable = true; - - programs = { - dconf.enable = true; - droidcam.enable = true; - sysdig.enable = true; - xwayland.enable = true; - }; - } diff --git a/systems/x86_64-linux/oni/hardware.nix b/systems/x86_64-linux/oni/hardware.nix index dc1e0d0..da4a566 100644 --- a/systems/x86_64-linux/oni/hardware.nix +++ b/systems/x86_64-linux/oni/hardware.nix @@ -7,22 +7,11 @@ in imports = with nixos-hardware.nixosModules; [ (modulesPath + "/installer/scan/not-detected.nix") common-cpu-amd - #common-gpu-nvidia + common-gpu-amd common-pc #common-pc-ssd ]; - hardware.nvidia.prime = { - offload.enable = false; - sync.enable = false; - - # Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA - intelBusId = "PCI:0:2:0"; - - # Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA - nvidiaBusId = "PCI:1:0:0"; - }; - boot = { kernelPackages = pkgs.linuxPackages_zen; @@ -60,6 +49,4 @@ in # high-resolution display hardware.video.hidpi.enable = lib.mkDefault true; - - hardware.bluetooth.enable = true; }