From 330bcc03606d875b99146e00281cac85c3bd90d8 Mon Sep 17 00:00:00 2001 From: Andre Date: Mon, 11 Mar 2024 12:27:30 -0400 Subject: [PATCH] Modularize K8s and gaming configs --- flake.lock | 18 ++++++++-------- hosts/Haven/default.nix | 1 + hosts/Shura/default.nix | 22 ++++--------------- hosts/Shura/hardware-configuration.nix | 4 ---- modules/apps/development.nix | 30 ++++++++++++++++++-------- modules/apps/gaming.nix | 6 ++++++ 6 files changed, 41 insertions(+), 40 deletions(-) diff --git a/flake.lock b/flake.lock index 5425570..f06dd20 100644 --- a/flake.lock +++ b/flake.lock @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1709904018, - "narHash": "sha256-fVp/89wNjWg7OQ/Gj3eSK2IXKDk9mXSj5ltOz98Ce2w=", + "lastModified": 1710164657, + "narHash": "sha256-l64+ZjaQAVkHDVaK0VHwtXBdjcBD6nLBD+p7IfyBp/w=", "owner": "nix-community", "repo": "home-manager", - "rev": "8b07ca541939211d3cc437ddfd74ebdef3d72471", + "rev": "017b12de5b899ef9b64e2c035ce257bfe95b8ae2", "type": "github" }, "original": { @@ -174,11 +174,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1709410583, - "narHash": "sha256-esOSUoQ7mblwcsSea0K17McZuwAIjoS6dq/4b83+lvw=", + "lastModified": 1710123225, + "narHash": "sha256-j3oWlxRZxB7cFsgEntpH3rosjFHRkAo/dhX9H3OfxtY=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "59e37017b9ed31dee303dbbd4531c594df95cfbc", + "rev": "ad2fd7b978d5e462048729a6c635c45d3d33c9ba", "type": "github" }, "original": { @@ -222,11 +222,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1709703039, - "narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=", + "lastModified": 1709961763, + "narHash": "sha256-6H95HGJHhEZtyYA3rIQpvamMKAGoa8Yh2rFV29QnuGw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d", + "rev": "3030f185ba6a4bf4f18b87f345f104e6a6961f34", "type": "github" }, "original": { diff --git a/hosts/Haven/default.nix b/hosts/Haven/default.nix index fc07bc3..cce6d3c 100644 --- a/hosts/Haven/default.nix +++ b/hosts/Haven/default.nix @@ -15,6 +15,7 @@ in host = { role = "server"; + development.kubernetes.enable = true; services = { apcupsd.enable = true; duplicacy-web = { diff --git a/hosts/Shura/default.nix b/hosts/Shura/default.nix index 29c278c..95edea3 100644 --- a/hosts/Shura/default.nix +++ b/hosts/Shura/default.nix @@ -23,7 +23,10 @@ in host = { role = "workstation"; apps = { - development.enable = true; + development = { + enable = true; + kubernetes.enable = true; + }; dj.enable = true; gaming.enable = true; hugo.enable = true; @@ -54,23 +57,6 @@ in }; }; - # Configure users - users.users = { - aires = { - extraGroups = [ "libvirt" "gremlin" ]; - }; - gremlin = { - extraGroups = [ "libvirt" ]; - }; - }; - - # Add packages specific to Shura - environment.systemPackages = with pkgs; [ - kubectl - kubevirt # Virtctl command-line tool - linuxKernel.packages.linux_zen.xpadneo # Xbox controller driver - ]; - # Move files into target system systemd.tmpfiles.rules = [ # Use gremlin user's monitor config for GDM (defined above) diff --git a/hosts/Shura/hardware-configuration.nix b/hosts/Shura/hardware-configuration.nix index 1115583..8057dea 100644 --- a/hosts/Shura/hardware-configuration.nix +++ b/hosts/Shura/hardware-configuration.nix @@ -29,12 +29,8 @@ kernelModules = [ "kvm-amd" - "hid_xpadneo" ]; - # Add XPadNeo - extraModulePackages = with config.boot.kernelPackages; [ xpadneo ]; - # Add kernel patch to enable sound over the speakers. # This might not be necessary for long - see https://forums.lenovo.com/topic/findpost/27/5258964/6212600 #kernelPatches = [{ diff --git a/modules/apps/development.nix b/modules/apps/development.nix index 1b144f7..4f7f39e 100644 --- a/modules/apps/development.nix +++ b/modules/apps/development.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: let cfg = config.host.apps.development; @@ -6,15 +6,27 @@ in with lib; { options = { - host.apps.development.enable = mkEnableOption (mdDoc "Enables development tools"); + host.apps.development = { + enable = mkEnableOption (mdDoc "Enables development tools"); + kubernetes.enable = mkEnableOption (mdDoc "Enables kubectl, virtctl, and similar tools."); + }; }; - config = mkIf cfg.enable { - host.ui.flatpak.enable = true; + config = mkMerge [ + (mkIf cfg.enable { + host.ui.flatpak.enable = true; - services.flatpak.packages = [ - "com.vscodium.codium" - "dev.k8slens.OpenLens" - ]; - }; + services.flatpak.packages = [ + "com.vscodium.codium" + "dev.k8slens.OpenLens" + ]; + }) + (mkIf (cfg.kubernetes.enable) { + environment.systemPackages = with pkgs; [ + kubectl + kubernetes-helm + kubevirt # Virtctl command-line tool + ]; + }) + ]; } \ No newline at end of file diff --git a/modules/apps/gaming.nix b/modules/apps/gaming.nix index bdb0cdf..45e9c62 100644 --- a/modules/apps/gaming.nix +++ b/modules/apps/gaming.nix @@ -16,5 +16,11 @@ with lib; "com.valvesoftware.Steam" "org.firestormviewer.FirestormViewer" ]; + + # Enable Xbox controller driver (XPadNeo) + boot = { + extraModulePackages = with config.boot.kernelPackages; [ xpadneo ]; + kernelModules = [ "hid_xpadneo" ]; + }; }; }