From bb831e45d795ab31f649abc9ba5e57624037f2c4 Mon Sep 17 00:00:00 2001 From: Grey Jones Date: Mon, 31 Aug 2026 14:48:40 +0100 Subject: [PATCH] move features not needed on laptop to be controlled with options --- modules/capabilities/gaming.nix | 5 +++ modules/features/applications/gui/equibop.nix | 25 +++++++---- .../features/hardware/steam-controller.nix | 41 +++++++++++++++++++ modules/global/options.nix | 2 +- modules/hosts/kitagawa/home/zsh.nix | 10 +++-- modules/hosts/kitagawa/kitagawa.nix | 3 +- modules/hosts/takamaki/takamaki.nix | 28 +++++-------- 7 files changed, 83 insertions(+), 31 deletions(-) create mode 100644 modules/capabilities/gaming.nix create mode 100644 modules/features/hardware/steam-controller.nix diff --git a/modules/capabilities/gaming.nix b/modules/capabilities/gaming.nix new file mode 100644 index 0000000..dcd6360 --- /dev/null +++ b/modules/capabilities/gaming.nix @@ -0,0 +1,5 @@ +{ inputs, self, ... }: { + flake.nixosModules.gaming = { pkgs, config, lib, ... }: { + hardware.steam-hardware.enable = true; + }; +} diff --git a/modules/features/applications/gui/equibop.nix b/modules/features/applications/gui/equibop.nix index f30906b..9679b37 100644 --- a/modules/features/applications/gui/equibop.nix +++ b/modules/features/applications/gui/equibop.nix @@ -1,22 +1,33 @@ { inputs, self, ... }: { flake.nixosModules.graphics = { pkgs, lib, config, ...}: { - options.features.applications.gui.equibop.enable = lib.mkEnableOption "equibop"; + options.features.applications.gui.equibop = { + enable = lib.mkEnableOption "equibop"; + autostart = lib.mkOption { + type = lib.types.bool; + default = false; + }; + }; - config = lib.mkIf (config.features.applications.gui.equibop.enable) (inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) { - home-manager.users.grey.features.applications.gui.equibop.enable = lib.mkDefault true; + config = inputs.helpers.mkIfElse (config.features.nixos.home-manager.enable) { + home-manager.users.grey.features.applications.gui.equibop = lib.mkDefault config.features.applications.gui.equibop; } { environment.systemPackages = [ pkgs.equibop ]; - }); + }; }; flake.homeModules.graphics = { pkgs, lib, config, ... }: { - options.features.applications.gui.equibop.enable = lib.mkEnableOption "equibop"; + options.features.applications.gui.equibop = { + enable = lib.mkEnableOption "equibop"; + autostart = lib.mkOption { + type = lib.types.bool; + default = false; + }; + }; config = lib.mkIf (config.features.applications.gui.equibop.enable) { programs.equibop.enable = true; - xdg.configFile."autostart/equibop.desktop" = { - enable = true; + xdg.configFile."autostart/equibop.desktop" = lib.mkIf (config.features.applications.gui.equibop.autostart) { text = '' [Desktop Entry] Type=Application diff --git a/modules/features/hardware/steam-controller.nix b/modules/features/hardware/steam-controller.nix new file mode 100644 index 0000000..0bc5062 --- /dev/null +++ b/modules/features/hardware/steam-controller.nix @@ -0,0 +1,41 @@ +{ inputs, self, ... }: { + flake.nixosModules.gaming = { pkgs, config, lib, ... }: { + options.features.hardware.steam-controller.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Enable tweaks and configurations that assist when using Valve's Steam Controller"; + }; + + config = lib.mkIf (config.features.hardware.steam-controller.enable) { + home-manager.users.grey = lib.mkIf (config.features.nixos.home-manager.enable) { + features.hardware.steam-controller.enable = lib.mkDefault true; + }; + }; + }; + + flake.homeModules.gaming = { pkgs, config, lib, inputs, ... }: { + options.features.hardware.steam-controller.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Enable tweaks and configurations that assist when using Valve's Steam Controller"; + }; + + config = let + pkgsCross = import inputs.nixpkgs { + localSystem = "x86_64-linux"; + hostSystem = "x86_64-linux"; + crossSystem = "i686-linux"; + }; + steam-modified-desktop-file = pkgs.runCommand "modifySteamDesktopFile" {} '' + sed 's@Exec=/usr/bin/steam@Exec=env LD_PRELOAD=${pkgsCross.extest}/lib/libextest.so /usr/bin/steam@' ${self}/assets/steam.desktop.example > $out + ''; + in lib.mkIf (config.features.hardware.steam-controller.enable) { + xdg.dataFile."applications/steam.desktop".source = steam-modified-desktop-file; + + xdg.configFile."autostart/steam.desktop" = { + source = steam-modified-desktop-file; + force = true; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/global/options.nix b/modules/global/options.nix index 3e968ae..b0c38cc 100644 --- a/modules/global/options.nix +++ b/modules/global/options.nix @@ -57,7 +57,7 @@ features.applications = { shellScripts = lib.mkOption { type = lib.types.attrsOf (lib.types.str); - default = []; + default = {}; }; extraPackages = lib.mkOption { diff --git a/modules/hosts/kitagawa/home/zsh.nix b/modules/hosts/kitagawa/home/zsh.nix index 88fa3aa..7bfc202 100644 --- a/modules/hosts/kitagawa/home/zsh.nix +++ b/modules/hosts/kitagawa/home/zsh.nix @@ -1,12 +1,16 @@ { inputs, self, ... }: { - flake.homeModules.kitagawa = { config, pkgs, ... }: { + flake.homeModules.kitagawa = { config, pkgs, ... }: let + mkConfigCommand = args: "zsh -c 'cd ${config.info.rootPath}; git add .; nh os switch ${args}'"; + in { programs.zsh.shellAliases = { wake-takamaki = "ssh sakamoto .local/bin/wake-takamaki"; shutdown-takamaki = "ssh takamaki universal-shutdown"; reboot-takamaki = "ssh takamaki universal-reboot"; switch-takamaki-os = "ssh takamaki switch-os"; - apply-config = "zsh -c 'cd ${config.info.rootPath}; git add .; nh os switch .'"; - update-system = "zsh -c 'cd ${config.info.rootPath}; git add .; nh os switch -u .'"; + apply-config = mkConfigCommand ""; + remote-build-config = mkConfigCommand "-j 0"; + trace-config = mkConfigCommand "-t"; + update-config = mkConfigCommand "-u"; }; }; } \ No newline at end of file diff --git a/modules/hosts/kitagawa/kitagawa.nix b/modules/hosts/kitagawa/kitagawa.nix index 62b9cb0..e830207 100644 --- a/modules/hosts/kitagawa/kitagawa.nix +++ b/modules/hosts/kitagawa/kitagawa.nix @@ -77,8 +77,6 @@ openFirewall = true; }; - hardware.steam-hardware.enable = true; - boot = { # Enable "Silent boot" consoleLogLevel = 3; @@ -94,6 +92,7 @@ flake.homeModules.kitagawa = { config, pkgs, inputs, lib, ... }: { imports = with self.homeModules; [ global + audio graphics ]; diff --git a/modules/hosts/takamaki/takamaki.nix b/modules/hosts/takamaki/takamaki.nix index 4962fd2..82744ee 100644 --- a/modules/hosts/takamaki/takamaki.nix +++ b/modules/hosts/takamaki/takamaki.nix @@ -8,20 +8,12 @@ extraSpecialArgs = { inherit inputs; }; }; - flake.homeModules."grey@takamaki" = { pkgs, config, lib, ... }: let - pkgsCross = import inputs.nixpkgs { - localSystem = "x86_64-linux"; - hostSystem = "x86_64-linux"; - crossSystem = "i686-linux"; - }; - steam-overriden-desktop-file = pkgs.runCommand "modifySteamDesktopFile" {} '' - sed 's@Exec=/usr/bin/steam@Exec=env LD_PRELOAD=${pkgsCross.extest}/lib/libextest.so /usr/bin/steam@' ${self}/assets/steam.desktop.example > $out - ''; - in { + flake.homeModules."grey@takamaki" = { pkgs, config, lib, ... }: { imports = with self.homeModules; [ global audio graphics + gaming ]; info = { @@ -37,13 +29,6 @@ ''; }; - xdg.dataFile."applications/steam.desktop".source = steam-overriden-desktop-file; - - xdg.configFile."autostart/steam.desktop" = { - source = steam-overriden-desktop-file; - force = true; - }; - components = { windowManagers = "niri"; shells = "noctalia"; @@ -59,6 +44,10 @@ easyeffects.enable = true; }; + hardware = { + steam-controller.enable = true; + }; + applications = { cli = { fastfetch.enable = true; @@ -68,7 +57,10 @@ gui = { vscode.enable = true; - equibop.enable = true; + equibop = { + enable = true; + autostart = true; + }; kitty.enable = true; spotify = { enable = true;