diff --git a/modules/gaming/common.nix b/modules/gaming/default.nix similarity index 65% rename from modules/gaming/common.nix rename to modules/gaming/default.nix index e074730..98b5aee 100644 --- a/modules/gaming/common.nix +++ b/modules/gaming/default.nix @@ -1,5 +1,7 @@ { config, ... }: { + imports = [ ./leagueoflegends.nix ./lutris.nix ./steam.nix ]; + config = { hardware.opengl = { enable = true; diff --git a/modules/gaming/leagueoflegends.nix b/modules/gaming/leagueoflegends.nix index 84d068f..4f2c878 100644 --- a/modules/gaming/leagueoflegends.nix +++ b/modules/gaming/leagueoflegends.nix @@ -1,9 +1,15 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: -{ - imports = [ ./common.nix ./lutris.nix ]; +with lib; +let cfg = config.modules.gaming.leagueoflegends; - config = { +in { + + options.modules.gaming.leagueoflegends = { + enable = mkEnableOption "leagueoflegends"; + }; + + config = mkIf cfg.enable { # League of Legends anti-cheat boot.kernel.sysctl = { "abi.vsyscall32" = 0; }; diff --git a/modules/gaming/lutris.nix b/modules/gaming/lutris.nix index 8ecf177..7992302 100644 --- a/modules/gaming/lutris.nix +++ b/modules/gaming/lutris.nix @@ -1,9 +1,14 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: -{ +with lib; +let cfg = config.modules.gaming.lutris; - imports = [ ./common.nix ]; +in { - config = { environment.systemPackages = with pkgs; [ lutris amdvlk wine ]; }; + options.modules.gaming.lutris = { enable = mkEnableOption "lutris"; }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ lutris amdvlk wine ]; + }; } diff --git a/modules/gaming/steam.nix b/modules/gaming/steam.nix index 38c4bab..fd79055 100644 --- a/modules/gaming/steam.nix +++ b/modules/gaming/steam.nix @@ -1,8 +1,13 @@ -{ config, pkgs, ... }: { +{ config, pkgs, lib, ... }: - imports = [ ./common.nix ]; +with lib; +let cfg = config.modules.gaming.steam; - config = { +in { + + options.modules.gaming.steam = { enable = mkEnableOption "steam"; }; + + config = mkIf cfg.enable { hardware.steam-hardware.enable = true; environment.systemPackages = with pkgs; [ steam ]; }; diff --git a/nixos/configuration.nix b/nixos/configuration.nix index e1341f4..2e2392c 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -9,7 +9,7 @@ /etc/nixos/hardware-configuration.nix ../modules/system/timezone.nix ../modules/system/doas.nix - ../modules/gaming/steam.nix + ../modules/gaming ]; nixpkgs.config.allowUnfree = true;