start move steam to seperate module

This commit is contained in:
Noa Aarts 2024-05-11 10:25:05 +02:00
parent 11b9c3de44
commit 6f4ec604ab
4 changed files with 88 additions and 65 deletions

View file

@ -9,6 +9,7 @@ rec {
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
../../modules/games/steam.nix
]; ];
# Bootloader. # Bootloader.
@ -34,7 +35,6 @@ rec {
driSupport = true; driSupport = true;
driSupport32Bit = true; driSupport32Bit = true;
}; };
services.xserver.videoDrivers = [ "nvidia" ];
# Allow unfree packages # Allow unfree packages
nixpkgs.config = { nixpkgs.config = {
@ -93,24 +93,6 @@ rec {
LC_TIME = "nl_NL.UTF-8"; LC_TIME = "nl_NL.UTF-8";
}; };
services.xserver = {
enable = true;
xkb = {
layout = "us";
variant = "intl";
};
};
services.greetd = {
enable = true;
settings = rec {
initial_session = {
command = "${pkgs.hyprland}/bin/Hyprland";
user = "noa";
};
default_session = initial_session;
};
};
# Configure console keymap # Configure console keymap
console.keyMap = "us-acentos"; console.keyMap = "us-acentos";
@ -168,11 +150,6 @@ rec {
programs = { programs = {
zsh.enable = true; zsh.enable = true;
steam.enable = true;
steam.gamescopeSession.enable = true;
gamemode.enable = true;
hyprland = { hyprland = {
enable = true; enable = true;
package = inputs.hyprland.packages.${pkgs.system}.hyprland; package = inputs.hyprland.packages.${pkgs.system}.hyprland;
@ -185,41 +162,67 @@ rec {
]; ];
}; };
modules.games.steam.enable = true;
users.defaultUserShell = pkgs.zsh; users.defaultUserShell = pkgs.zsh;
security.rtkit.enable = true; security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
services.fail2ban = { services = {
enable = true; pipewire = {
maxretry = 5;
bantime = "1s";
bantime-increment = {
enable = true; enable = true;
formula = "ban.Time * math.exp(float(ban.Count+1)*banFactor)/math.exp(1*banFactor)"; alsa.enable = true;
maxtime = "1h"; alsa.support32Bit = true;
overalljails = true; pulse.enable = true;
jack.enable = true;
}; };
fail2ban = {
jails = { enable = true;
go-login.settings = { maxretry = 5;
enabled = true; bantime = "1s";
filter = "go-login"; bantime-increment = {
action = ''iptables-multiport[name=HTTP, port="http,https,2000"]''; enable = true;
logpath = "/home/noa/Documents/programming/SODS/login.log"; formula = "ban.Time * math.exp(float(ban.Count+1)*banFactor)/math.exp(1*banFactor)";
backend = "systemd"; maxtime = "1h";
findtime = 600; overalljails = true;
bantime = 600; };
maxretry = 5; jails = {
go-login.settings = {
enabled = true;
filter = "go-login";
action = ''iptables-multiport[name=HTTP, port="http,https,2000"]'';
logpath = "/home/noa/Documents/programming/SODS/login.log";
backend = "systemd";
findtime = 600;
bantime = 600;
maxretry = 5;
};
}; };
}; };
greetd = {
enable = true;
settings = rec {
initial_session = {
command = "${pkgs.hyprland}/bin/Hyprland";
user = "noa";
};
default_session = initial_session;
};
};
openssh = {
enable = true;
settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false;
};
xserver = {
enable = true;
xkb = {
layout = "us";
variant = "intl";
};
videoDrivers = [ "nvidia" ];
};
}; };
environment.etc = { environment.etc = {
@ -242,16 +245,6 @@ rec {
''; '';
security.polkit.enable = true; security.polkit.enable = true;
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
settings.PasswordAuthentication = false;
settings.KbdInteractiveAuthentication = false;
};
# Open ports in the firewall. # Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ 80 443 53317 ]; networking.firewall.allowedTCPPorts = [ 80 443 53317 ];
networking.firewall.allowedUDPPorts = [ 80 443 53317 ]; networking.firewall.allowedUDPPorts = [ 80 443 53317 ];

View file

@ -5,13 +5,14 @@ in
{ {
options.modules.games = { options.modules.games = {
enable = lib.mkEnableOption "enable gaming services"; enable = lib.mkEnableOption "enable gaming services";
minecraft.enable = lib.mkEnableOption "enable minecraft";
}; };
imports = [
./minecraft.nix
];
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
modules.games.minecraft.enable = true;
home.packages = [
pkgs.prismlauncher
];
}; };
} }

View file

@ -0,0 +1,11 @@
{ lib, config, pkgs, ... }:
let
cfg = config.modules.games.minecraft;
in
{
config = lib.mkIf cfg.enable {
home.packages = [
pkgs.prismlauncher
];
};
}

18
modules/games/steam.nix Normal file
View file

@ -0,0 +1,18 @@
{ lib, config, ... }:
{
options.modules.games.steam = {
enable = lib.mkEnableOption "enable steam";
};
config = lib.mkIf config.modules.games.steam.enable {
programs = {
steam = {
enable = true;
remotePlay.openFirewall = true;
gamescopeSession.enable = true;
dedicatedServer.openFirewall = true;
};
gamemode.enable = true;
};
};
}