From f9062e9d153f17579f8bf548aea566d6311a3881 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Tue, 26 Dec 2023 00:30:05 +0100 Subject: [PATCH] Add gamin module in both nixos and home-manager --- hosts/morty/{home.nix => home-config.nix} | 1 + hosts/morty/nixos-config.nix | 3 ++ modules/home-manager/default.nix | 1 + .../home-manager/gaming/lutris/default.nix | 29 +++++++++++++++++++ modules/nixos/default.nix | 6 ++++ modules/nixos/gaming/steam/default.nix | 28 ++++++++++++++++++ nixos/default.nix | 14 ++------- 7 files changed, 71 insertions(+), 11 deletions(-) rename hosts/morty/{home.nix => home-config.nix} (76%) create mode 100644 hosts/morty/nixos-config.nix create mode 100644 modules/home-manager/gaming/lutris/default.nix create mode 100644 modules/nixos/default.nix create mode 100644 modules/nixos/gaming/steam/default.nix diff --git a/hosts/morty/home.nix b/hosts/morty/home-config.nix similarity index 76% rename from hosts/morty/home.nix rename to hosts/morty/home-config.nix index c67c7ba..31cf84f 100644 --- a/hosts/morty/home.nix +++ b/hosts/morty/home-config.nix @@ -2,5 +2,6 @@ config.modules = { video.kdenlive.enable = true; web.qutebrowser.enable = true; + gaming.lutris.enable = true; }; } diff --git a/hosts/morty/nixos-config.nix b/hosts/morty/nixos-config.nix new file mode 100644 index 0000000..defbcff --- /dev/null +++ b/hosts/morty/nixos-config.nix @@ -0,0 +1,3 @@ +{ ... }: { + config.modules.gaming.steam.enable = true; +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index d80dcdb..add9133 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,6 +1,7 @@ { lib, config, pkgs, ... }: { imports = [ + ./gaming/lutris ./video/kdenlive ./web/qutebrowser/default.nix ]; diff --git a/modules/home-manager/gaming/lutris/default.nix b/modules/home-manager/gaming/lutris/default.nix new file mode 100644 index 0000000..3718e71 --- /dev/null +++ b/modules/home-manager/gaming/lutris/default.nix @@ -0,0 +1,29 @@ +{ lib, config, pkgs, ... }: +with lib; +let + cfg = config.modules.gaming.lutris; +in +{ + options.modules.gaming.lutris = { + enable = mkEnableOption "enable Lutris Gaming preservation platform"; + }; + config = mkIf cfg.enable { + home.packages = with pkgs; [ + ( lutris.override { + extraLibraries = pkgs: [ + wine + xorg.libXcursor + xorg.libXi + xorg.libXinerama + xorg.libXScrnSaver + libpng + libpulseaudio + libvorbis + stdenv.cc.cc.lib + libkrb5 + keyutils + ]; + }) + ]; + }; +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix new file mode 100644 index 0000000..b546d3e --- /dev/null +++ b/modules/nixos/default.nix @@ -0,0 +1,6 @@ +_: +{ + imports = [ + ./gaming/steam + ]; +} diff --git a/modules/nixos/gaming/steam/default.nix b/modules/nixos/gaming/steam/default.nix new file mode 100644 index 0000000..e2267a7 --- /dev/null +++ b/modules/nixos/gaming/steam/default.nix @@ -0,0 +1,28 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.modules.gaming.steam; +in +{ + options.modules.gaming.steam = { + enable = mkEnableOption "Enable Steam Platform"; + + gamescope = mkOption { + type = types.bool; + default = false; + description = "enable gamescope session (default false)"; + }; + gamemode = mkOption { + type = types.bool; + default = false; + description = "enable Feral Gamemode (default false)"; + }; + }; + config = mkIf cfg.enable { + programs.gamemode.enable = cfg.gamemode; + programs.gamescope.enable = cfg.gamescope; + programs.steam = { + enable = true; + }; + }; +} diff --git a/nixos/default.nix b/nixos/default.nix index 90ec3dc..53545fe 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -3,6 +3,8 @@ imports = [ # Include the results of the hardware scan. ../hosts/${hostname}/hardware-configuration.nix + ../hosts/${hostname}/nixos-config.nix + ../modules/nixos ./includes/hardware/bootloader.nix ./includes/system/locales.nix ./includes/system/flakes.nix @@ -20,12 +22,6 @@ ./includes/desktop/xdg-portal.nix ] else [] - ) ++ ( - if hostConfig.gaming then - [ - ./includes/gaming/steam.nix - ] - else [] ) ++ ( if hostConfig.laptop then [ @@ -72,7 +68,7 @@ ]; imports = [ - ../hosts/${hostname}/home.nix + ../hosts/${hostname}/home-config.nix ../modules/home-manager/default.nix ../home-manager/cli ] ++ (if hostConfig.desktop then @@ -86,10 +82,6 @@ ../home-manager/mpv ] else [] - ) ++ ( - if hostConfig.gaming then - [ ../home-manager/lutris.nix ] - else [] ) ++ lib.optional ( builtins.pathExists ../home-manager/hosts/${hostname}.nix ) ../home-manager/hosts/${hostname}.nix;