some refactoring and modularizing locale
This commit is contained in:
48
modules/nixos/gaming/gamemode/default.nix
Normal file
48
modules/nixos/gaming/gamemode/default.nix
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption mkOption;
|
||||
cfg = config.nixos.gaming.gamemode;
|
||||
pipewireLowLatencyModule = inputs.nix-gaming.nixosModules.pipewireLowLatency;
|
||||
in {
|
||||
imports = [
|
||||
pipewireLowLatencyModule
|
||||
];
|
||||
options = {
|
||||
nixos.gaming.gamemode = {
|
||||
enable = mkEnableOption "Enables gamemode";
|
||||
optimizeGpu.enable = mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Whether to apply GPU optimizations.";
|
||||
};
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
programs.gamemode = {
|
||||
enable = true;
|
||||
settings = {
|
||||
general = {
|
||||
inhibit_screensaver = 1;
|
||||
softrealtime = "auto";
|
||||
# renice = 15;
|
||||
};
|
||||
gpu = mkIf cfg.optimizeGpu.enable {
|
||||
apply_gpu_optimisations = "accept-responsibility";
|
||||
gpu_device = 0;
|
||||
amd_performance_level = "high";
|
||||
};
|
||||
custom = {
|
||||
start = "${pkgs.libnotify}/bin/notify-send 'GameMode started'";
|
||||
end = "${pkgs.libnotify}/bin/notify-send 'GameMode ended'";
|
||||
};
|
||||
};
|
||||
};
|
||||
# see https://github.com/fufexan/nix-gaming/#pipewire-low-latency
|
||||
services.pipewire.lowLatency.enable = true;
|
||||
};
|
||||
}
|
||||
22
modules/nixos/gaming/gamescope/default.nix
Normal file
22
modules/nixos/gaming/gamescope/default.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
cfg = config.nixos.gaming.gamescope;
|
||||
in {
|
||||
options = {
|
||||
nixos.gaming.gamescope.enable = mkEnableOption "Enables gamescope";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
programs.gamescope = {
|
||||
enable = true;
|
||||
capSysNice = true;
|
||||
args = [
|
||||
"--rt"
|
||||
"--expose-wayland"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
18
modules/nixos/gaming/lutris/default.nix
Normal file
18
modules/nixos/gaming/lutris/default.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
cfg = config.nixos.gaming.lutris;
|
||||
in {
|
||||
options = {
|
||||
nixos.gaming.lutris.enable = mkEnableOption "Enables lutris";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
lutris
|
||||
];
|
||||
};
|
||||
}
|
||||
20
modules/nixos/gaming/steam/default.nix
Normal file
20
modules/nixos/gaming/steam/default.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
cfg = config.nixos.gaming.steam;
|
||||
in {
|
||||
options = {
|
||||
nixos.gaming.steam.enable = mkEnableOption "Enables steam";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
programs = {
|
||||
steam = {
|
||||
enable = true;
|
||||
gamescopeSession.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user