From ed24c8eaea2e800223af0d601e33400c0d90b7cb Mon Sep 17 00:00:00 2001 From: kenji Date: Mon, 30 Jun 2025 14:37:42 -0500 Subject: [PATCH] added mangohud --- hosts/desktop/configuration.nix | 2 +- modules/desktop.nix | 20 +++++---- modules/gaming.nix | 72 --------------------------------- packages/mangohud/default.nix | 6 +++ system/gaming.nix | 2 +- 5 files changed, 20 insertions(+), 82 deletions(-) delete mode 100644 modules/gaming.nix create mode 100644 packages/mangohud/default.nix diff --git a/hosts/desktop/configuration.nix b/hosts/desktop/configuration.nix index 6a29551..e4d8318 100644 --- a/hosts/desktop/configuration.nix +++ b/hosts/desktop/configuration.nix @@ -19,7 +19,7 @@ environment.systemPackages = []; - nixpkgs.config.allowUnfree = myConfig.general.allowUnfree; + nixpkgs.config.allowUnfree = true; nix.settings = { trusted-users = myConfig.builds.builder.trustedUsers; diff --git a/modules/desktop.nix b/modules/desktop.nix index e6d2926..0ecd7e7 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -3,12 +3,16 @@ myConfig, ... }: { - imports = [ - ../packages/hyprland/default.nix - ../packages/hypridle/default.nix - ../packages/hyprlock/default.nix - ../packages/rofi/default.nix - ../packages/matugen/default.nix - ../packages/swww/default.nix - ]; + imports = + [ + ../packages/hyprland/default.nix + ../packages/hypridle/default.nix + ../packages/hyprlock/default.nix + ../packages/rofi/default.nix + ../packages/matugen/default.nix + ../packages/swww/default.nix + ] + ++ lib.optionals (myConfig.linux.gaming == true) [ + ../packages/mangohud/default.nix + ]; } diff --git a/modules/gaming.nix b/modules/gaming.nix deleted file mode 100644 index b27f5f4..0000000 --- a/modules/gaming.nix +++ /dev/null @@ -1,72 +0,0 @@ -# In your ~/.config/home-manager/home.nix (or a file imported by it) -{ - config, - pkgs, - ... -}: -# Home Manager modules usually get config and pkgs as arguments -let - # Define the custom Steam launcher script within Home Manager's scope. - # pkgs here refers to the pkgs available to your Home Manager environment. - steamGamescopeWrapper = pkgs.writeScriptBin "steam-gamescope-launcher" '' - #!/usr/bin/env bash - set -xeuo pipefail - - gamescopeArgs=( - --adaptive-sync - --hdr-enabled - --mangoapp - --rt - --steam - ) - steamArgs=( - -pipewire-dmabuf - -tenfoot - ) - mangoConfig=( - cpu_temp - gpu_temp - ram - vram - ) - mangoVars=( - MANGOHUD=1 - MANGOHUD_CONFIG="$(IFS=,; echo "$${mangoConfig[*]}")" - ) - - export PATH="${pkgs.gamescope}/bin:${pkgs.mangohud}/bin:$PATH" - - export "$${mangoVars[@]}" - exec ${pkgs.gamescope}/bin/gamescope "$${gamescopeArgs[@]}" -- ${pkgs.steam}/bin/steam "$${steamArgs[@]}" - ''; -in { - # You don't need 'programs.xdg.enable = true;' explicitly here in Home Manager; - # xdg.desktopEntries will be available directly once Home Manager is active. - - # Home Manager usually manages user-level packages under `home.packages`. - home.packages = with pkgs; [ - protonup-qt - mangohud - goverlay - steamGamescopeWrapper # Add your wrapper script to your user's PATH - ]; - - # Define the desktop entry within Home Manager's xdg.desktopEntries - xdg.desktopEntries.steam = { - name = "Steam (Gamescope)"; - comment = "Launch Steam via Gamescope with MangoHud"; - exec = "${steamGamescopeWrapper}"; - icon = "steam"; - terminal = false; - type = "Application"; - categories = ["Game" "Application"]; - startupNotify = true; - }; - - # If you previously had services.getty.autologinUser, that remains in configuration.nix. - # Likewise for hardware.xone.enable and boot.kernelPackages. - - # Note: programs.steam.enable, programs.gamescope.enable, hardware.xone.enable - # usually remain in configuration.nix (system-wide), as they install the programs - # and drivers for the whole system. -} diff --git a/packages/mangohud/default.nix b/packages/mangohud/default.nix new file mode 100644 index 0000000..39f40ab --- /dev/null +++ b/packages/mangohud/default.nix @@ -0,0 +1,6 @@ +{...}: { + programs.mangohud = { + enable = true; + enableSessionWide = true; + }; +} diff --git a/system/gaming.nix b/system/gaming.nix index 191601e..7466e10 100644 --- a/system/gaming.nix +++ b/system/gaming.nix @@ -3,9 +3,9 @@ inputs, ... }: { + programs.steam.enable = true; environment.systemPackages = [ # inputs.nix-gaming.packages.${pkgs.system}.default - pkgs.steam pkgs.protonup-qt ]; # programs.steam.platformOptimizations.enable = true;