-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added windows-zalman gaming configuration
- Loading branch information
Showing
5 changed files
with
224 additions
and
59 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Config specific to my Zalman gaming PC | ||
{ config, pkgs, nixpkgs-stable, lib, ... }: | ||
|
||
let | ||
system = pkgs.system; | ||
stable-pkgs = import nixpkgs-stable { | ||
inherit system; | ||
config.allowUnfree = true; | ||
}; | ||
in { | ||
imports = [ | ||
./hardware-configuration.nix | ||
../../server.nix | ||
../../roles/gaming/nvidia-patch.nix | ||
../../roles/gaming/sunshine.nix | ||
]; | ||
|
||
boot.loader.systemd-boot.enable = true; | ||
boot.loader.efi.canTouchEfiVariables = true; | ||
boot.supportedFilesystems = [ "ntfs" ]; | ||
|
||
networking.hostName = "nixos-zalman"; | ||
networking.networkmanager.enable = true; | ||
time.timeZone = "America/Denver"; | ||
i18n.defaultLocale = "en_US.utf8"; | ||
|
||
home-manager.users.heywoodlh = { | ||
heywoodlh.home.applications = [ | ||
{ | ||
name = "Rustdesk"; | ||
command = '' | ||
bash -c "SHELL='/run/current-system/sw/bin/bash' ${pkgs.rustdesk-flutter}/bin/rustdesk" | ||
''; | ||
} | ||
]; | ||
}; | ||
|
||
environment.systemPackages = with pkgs; [ | ||
playerctl | ||
exfatprogs | ||
]; | ||
|
||
# spotifyd | ||
services.spotifyd = { | ||
enable = true; | ||
settings = { | ||
global = { | ||
username = "31los4pph7awxi3i2inw5xiyut4u"; | ||
password_cmd = "cat /opt/spotify.txt"; | ||
dbus_type = "system"; # headless mode :) | ||
device_name = "windows-zalman"; | ||
}; | ||
}; | ||
}; | ||
# spotify ports | ||
networking.firewall = { | ||
allowedTCPPorts = [ 57621 ]; | ||
allowedUDPPorts = [ 5353 ]; | ||
}; | ||
|
||
# wake-on-lan | ||
networking.interfaces.enp4s0.wakeOnLan.enable = true; | ||
|
||
# nix limits | ||
nix.settings = { | ||
cores = 2; | ||
max-jobs = 2; | ||
}; | ||
|
||
# filesystems | ||
#fileSystems = { | ||
# "/games/steam-ssd-2" = { | ||
|
||
# }; | ||
# "/games/wd-black" = { | ||
|
||
# }; | ||
#}; | ||
|
||
swapDevices = [ | ||
{ | ||
device = "/swap"; | ||
size = 32 * 1024; | ||
} | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ pkgs, config, nvidia-patch, ... }: | ||
let | ||
package = config.boot.kernelPackages.nvidiaPackages.stable; | ||
in { | ||
nixpkgs.overlays = [ nvidia-patch.overlays.default ]; | ||
hardware.graphics = { | ||
enable = true; | ||
}; | ||
services.xserver.videoDrivers = ["nvidia"]; | ||
hardware.nvidia = { | ||
modesetting.enable = true; | ||
powerManagement.enable = false; | ||
powerManagement.finegrained = false; | ||
open = false; | ||
nvidiaSettings = true; | ||
package = pkgs.nvidia-patch.patch-nvenc (pkgs.nvidia-patch.patch-fbc package); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,60 @@ | ||
{ config, lib, pkgs, ... }: | ||
with lib; | ||
|
||
# useful links: | ||
# https://docs.lizardbyte.dev/projects/sunshine/en/latest/troubleshooting/linux.html | ||
# https://nixos.wiki/wiki/Steam | ||
let | ||
cfg = config.services.sunshine; | ||
in | ||
{ | ||
options = { | ||
|
||
services.sunshine = { | ||
enable = mkEnableOption (mdDoc "Sunshine"); | ||
}; | ||
gamescope-sh = pkgs.writeShellScriptBin "gs.sh" '' | ||
set -xeuo pipefail | ||
gamescopeArgs=( | ||
--adaptive-sync # VRR support | ||
--hdr-enabled | ||
--mangoapp # performance overlay | ||
--rt | ||
--steam | ||
) | ||
steamArgs=( | ||
-pipewire-dmabuf | ||
-tenfoot | ||
) | ||
mangoConfig=( | ||
cpu_temp | ||
gpu_temp | ||
ram | ||
vram | ||
) | ||
mangoVars=( | ||
MANGOHUD=1 | ||
MANGOHUD_CONFIG="$(IFS=,; echo "''${mangoConfig[*]}")" | ||
) | ||
export "''${mangoVars[@]}" | ||
exec gamescope "''${gamescopeArgs[@]}" -- steam "''${steamArgs[@]}" | ||
''; | ||
in { | ||
services.sunshine = { | ||
enable = true; | ||
autoStart = true; | ||
capSysAdmin = true; # only needed for Wayland -- omit this when using with Xorg | ||
openFirewall = true; | ||
}; | ||
|
||
config = mkIf config.services.sunshine.enable { | ||
|
||
boot = { kernelModules = [ "uinput" ]; }; | ||
services = { | ||
udev.extraRules = '' | ||
KERNEL=="uinput", GROUP="input", MODE="0660" OPTIONS+="static_node=uinput" | ||
''; | ||
}; | ||
|
||
security.wrappers.sunshine = { | ||
owner = "root"; | ||
group = "root"; | ||
capabilities = "cap_sys_admin+p"; | ||
source = "${pkgs.sunshine}/bin/sunshine"; | ||
}; | ||
|
||
systemd.user.services.sunshine = { | ||
description = "sunshine"; | ||
wantedBy = [ "graphical-session.target" ]; | ||
serviceConfig = { | ||
ExecStart = "${config.security.wrapperDir}/sunshine"; | ||
}; | ||
}; | ||
|
||
services.avahi = { | ||
# autologin gamescope | ||
programs = { | ||
gamescope = { | ||
enable = true; | ||
reflector = true; | ||
nssmdns = true; | ||
publish = { | ||
enable = true; | ||
addresses = true; | ||
userServices = true; | ||
workstation = true; | ||
}; | ||
capSysNice = true; | ||
}; | ||
|
||
networking.firewall = { | ||
allowedTCPPorts = [ | ||
47984 | ||
47989 | ||
48010 | ||
]; | ||
allowedUDPPorts = [ | ||
47998 | ||
47999 | ||
48000 | ||
48002 | ||
48010 | ||
]; | ||
steam = { | ||
enable = true; | ||
gamescopeSession.enable = true; | ||
}; | ||
}; | ||
hardware.xone.enable = true; # support for the xbox controller USB dongle | ||
services.getty.autologinUser = "heywoodlh"; | ||
environment = { | ||
systemPackages = pkgs.mangohud; | ||
loginShellInit = '' | ||
[[ "$(tty)" = "/dev/tty1" ]] && ${gamescope-sh}/bin/gs.sh | ||
''; | ||
}; | ||
} |