From 1b8e5032f97b372b6a049eb450548ddf64bd2a54 Mon Sep 17 00:00:00 2001 From: kenji Date: Fri, 18 Jul 2025 08:33:22 -0500 Subject: [PATCH] added steamos --- flake.nix | 7 + hosts/steamos/configuration.nix | 167 +++++++++++++++++++++++ hosts/steamos/hardware-configuration.nix | 47 +++++++ 3 files changed, 221 insertions(+) create mode 100644 hosts/steamos/configuration.nix create mode 100644 hosts/steamos/hardware-configuration.nix diff --git a/flake.nix b/flake.nix index 434dc65..cd00a82 100644 --- a/flake.nix +++ b/flake.nix @@ -80,6 +80,13 @@ ./hosts/hakase/configuration.nix ]; }; + steamos = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = mkArgs "x86_64-linux"; + modules = [ + ./hosts/steamos/configuration.nix + ]; + }; }; homeConfigurations = { diff --git a/hosts/steamos/configuration.nix b/hosts/steamos/configuration.nix new file mode 100644 index 0000000..e8ba292 --- /dev/null +++ b/hosts/steamos/configuration.nix @@ -0,0 +1,167 @@ +{ + config, + pkgs, + lib, + myConfig, + ... +}: { + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + nix.settings.experimental-features = ["nix-command" "flakes"]; + nixpkgs.config.allowUnfree = true; + + #################### + # Boot & Kernel # + #################### + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.timeout = 0; + boot.loader.limine.maxGenerations = 5; + hardware.amdgpu.initrd.enable = true; + + boot.kernelParams = ["quiet"]; + boot.kernelPackages = pkgs.linuxPackages_cachyos; + boot.kernel.sysctl = { + "kernel.split_lock_mitigate" = 0; + "kernel.nmi_watchdog" = 0; + "kernel.sched_bore" = "1"; + }; + + boot.initrd = { + systemd.enable = true; + kernelModules = []; + verbose = false; + }; + boot.plymouth.enable = true; + boot.consoleLogLevel = 0; + systemd.extraConfig = "DefaultTimeoutStopSec=5s"; + + ################ + # FileSystems # + ################ + # fileSystems."/" = { + # options = ["compress=zstd"]; + # }; + + ############ + # Network # + ############ + networking = { + networkmanager.enable = true; + firewall.enable = false; + hostName = "nixos"; + }; + + ################# + # Bluetooth # + ################# + hardware.bluetooth.enable = true; + hardware.bluetooth.settings = { + General = { + MultiProfile = "multiple"; + FastConnectable = true; + }; + }; + + ################# + # Sound & RTKit # + ################# + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + ######################## + # Graphical & Greetd # + ######################## + + services.xserver.enable = false; + services.getty.autologinUser = "steamos"; + services.greetd = { + enable = true; + settings.default_session = { + user = "${myConfig.essenstials.Username}"; + command = "steam-gamescope > /dev/null 2>&1"; + }; + }; + + ######################## + # Programs & Gaming # + ######################## + services.automatic-timezoned.enable = true; + services.flatpak.enable = true; + xdg.portal.enable = true; + xdg.portal.config.common.default = "*"; + xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-gtk]; + + # programs.steam.gamescopeSession.args = ["-w 1920" "-h 1080" "-r 120" "--xwayland-count 2" "-e" "--hdr-enabled" "--mangoapp"]; + + programs = { + appimage = { + enable = true; + binfmt = true; + }; + fish = {enable = true;}; + mosh = {enable = true;}; + tmux = {enable = true;}; + gamescope.capSysNice = true; + steam = { + enable = true; + gamescopeSession.enable = true; + extraCompatPackages = with pkgs; [proton-ge-bin]; + extraPackages = with pkgs; [ + mangohud + gamescope-wsi + ]; + }; + }; + + environment.sessionVariables = { + PROTON_USE_NTSYNC = "1"; + ENABLE_HDR_WSI = "1"; + DXVK_HDR = "1"; + PROTON_ENABLE_AMD_AGS = "1"; + PROTON_ENABLE_NVAPI = "1"; + ENABLE_GAMESCOPE_WSI = "1"; + STEAM_MULTIPLE_XWAYLANDS = "1"; + }; + + ################### + # Virtualization # + ################### + virtualisation.docker.enable = true; + virtualisation.docker.enableOnBoot = false; + virtualisation.libvirtd.enable = true; + + ############### + # Users # + ############### + users.users.${myConfig.essenstials.Username} = { + isNormalUser = true; + description = "SteamOS user"; + extraGroups = ["networkmanager" "wheel" "docker" "video" "seat" "audio" "libvirtd"]; + # password = "steamos"; + }; + + ################# + # Security # + ################# + security.sudo.wheelNeedsPassword = false; + security.polkit.enable = true; + services.seatd.enable = true; + services.openssh.enable = true; + + ###################### + ###################### + + ######################## + # System State Version # + ######################## + system.stateVersion = "24.11"; +} diff --git a/hosts/steamos/hardware-configuration.nix b/hosts/steamos/hardware-configuration.nix new file mode 100644 index 0000000..0884052 --- /dev/null +++ b/hosts/steamos/hardware-configuration.nix @@ -0,0 +1,47 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/532ac73e-1370-4e4d-9d5a-15033de0b96d"; + fsType = "btrfs"; + options = [ "subvol=@" ]; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/1368-D3F3"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + fileSystems."/home" = + { device = "/dev/disk/by-uuid/780aa81f-c4d6-478b-9c51-2d60362fdb07"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/b02ef55c-4caf-4a24-a6a2-fb8001eafe22"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp11s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp10s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}