nixos-config-master/hosts/steamdeck/configuration.nix

260 lines
6.2 KiB
Nix

{ config, pkgs, lib, ... }:
let
jovianNixosRev = "f6423d86bec22c25a576b23262495c5536b0d069";
jovianNixos = builtins.fetchTarball {
url = "https://github.com/Jovian-Experiments/Jovian-NixOS/archive/${jovianNixosRev}.tar.gz";
sha256 = "sha256:1frd1dfqd97idwf1rj29ab0wvyfa2nx2h3bp9hkbmfa1m802avmb";
};
v4l2loopback-options = {
options = {
exclusive_caps = 1;
video_nr = 0;
card_label = "Immersed Virtual Camera";
};
};
in
{
imports = [
./hardware-configuration.nix
(fetchTarball "https://github.com/nix-community/nixos-vscode-server/tarball/master")
(jovianNixos + "/modules")
./cachix.nix
];
# Basic System Configuration
system.stateVersion = "24.05";
# Printing Configuration
services.printing = {
enable = true;
drivers = [ pkgs.hplipWithPlugin ];
};
services.avahi = {
enable = true;
nssmdns = true;
};
# Nix Package Manager Configuration
nixpkgs = {
overlays = [
(import (jovianNixos + "/overlay.nix"))
];
config.allowUnfree = true;
};
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
substituters = [ "https://cache.nixos.org" ];
allowed-users = [ "@wheel" "jeirmeister" ];
auto-optimise-store = true;
};
nix.extraOptions = ''
trusted-users = root jeirmeister
extra-substituters = https://nixpkgs-python.cachix.org https://devenv.cachix.org
extra-trusted-public-keys = nixpkgs-python.cachix.org-1:hxjI7pFxTyuTHn2NkvWCrAUcNZLNS3ZAvfYNuYifcEU= devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=
'';
# Steam Deck Configuration
jovian = {
hardware.has.amd.gpu = true;
devices.steamdeck = {
enable = true;
enableControllerUdevRules = true;
enableDefaultStage1Modules = true;
enablePerfControlUdevRules = true;
enableOsFanControl = true;
enableSoundSupport = true;
enableXorgRotation = true;
enableKernelPatches = true;
enableFwupdBiosUpdates = false;
autoUpdate = false;
};
steam.enable = false;
workarounds.ignoreMissingKernelModules = true;
};
# Desktop Environment and Display Configuration
services.xserver = {
enable = true;
xkb.layout = "us";
videoDrivers = [ "displaylink" "modesetting" ];
desktopManager.plasma6 = {
enable = true;
};
displayManager = {
sddm = {
enable = true;
settings = {
Wayland = {
EnableHiDPI = true;
};
};
};
sessionCommands = ''
${lib.getBin pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource 2 0
'';
};
};
# VS Code Server Configuration
services.vscode-server = {
enable = true;
enableFHS = true;
};
programs.nix-ld = {
enable = true;
package = pkgs.nix-ld-rs;
};
# System Services Configuration
services = {
# Audio Configuration
pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
# Network Services
openssh = {
enable = true;
settings = {
PasswordAuthentication = true;
AllowUsers = [ "jeirmeister" ];
};
};
tailscale.enable = true;
};
# Systemd Services
systemd.services = {
jupiter-fan-control = {
path = [ pkgs.dmidecode ];
serviceConfig = lib.mkForce {
Environment = "PYTHONUNBUFFERED=1";
StandardOutput = "journal";
StandardError = "journal";
ExecStart = "${pkgs.jupiter-fan-control}/share/jupiter-fan-control/fancontrol.py --run";
ExecStopPost = "${pkgs.jupiter-fan-control}/share/jupiter-fan-control/fancontrol.py --stop";
OOMScoreAdjust = -1000;
Restart = "on-failure";
};
};
# Uncomment when ready to use Immersed
# immersed-video = {
# description = "Load v4l2loopback module for Immersed";
# wantedBy = [ "multi-user.target" ];
# after = [ "systemd-modules-load.service" ];
# requires = [ "systemd-modules-load.service" ];
# serviceConfig = {
# Type = "oneshot";
# RemainAfterExit = true;
# ExecStartPre = "${pkgs.kmod}/bin/modprobe -r v4l2loopback || true";
# ExecStart = "${pkgs.kmod}/bin/modprobe v4l2loopback exclusive_caps=1 video_nr=0 card_label='Immersed Virtual Camera'";
# ExecStop = "${pkgs.kmod}/bin/rmmod v4l2loopback || true";
# };
# };
"systemd-modules-load" = {
wantedBy = [ "multi-user.target" ];
restartIfChanged = true;
};
};
# UDev Rules
services.udev.extraRules = ''
# Steam Deck Fan Control
SUBSYSTEM=="hwmon*", KERNEL=="hwmon*", ACTION=="add", RUN+="${pkgs.coreutils}/bin/chmod a+rw /sys/%p/pwm1"
SUBSYSTEM=="hwmon*", KERNEL=="hwmon*", ACTION=="add", RUN+="${pkgs.coreutils}/bin/chmod a+rw /sys/%p/fan1_input"
'';
# Network Configuration
networking = {
hostName = "steamnix";
networkmanager.enable = true;
};
# User Configuration
users = {
users.jeirmeister = {
isNormalUser = true;
description = "jeirmeister";
group = "steamos";
extraGroups = [
"networkmanager"
"users"
"wheel"
"input"
"video"
"audio"
"render"
"gamepad"
];
packages = with pkgs; [
tailscale
];
};
groups = {
steamos.gid = 1000;
gamepad = { };
render = { };
};
};
# System Programs and Packages
programs = {
firefox.enable = true;
};
environment.systemPackages = with pkgs; [
# System Tools
pciutils
usbutils
lm_sensors
dmidecode
binutils
# Scanner & Printers
epsonscan2
# Virtual Display
linuxPackages.v4l2loopback
v4l-utils
# Development Tools
nixfmt-rfc-style
git
# Network Tools
wget
curl
# Utilities
tree
];
# Locale and Time
time.timeZone = "America/Los_Angeles";
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
};
}