From 28de149b9c0ae2a39ba4a335a62274301e084191 Mon Sep 17 00:00:00 2001 From: albert Date: Wed, 24 Apr 2024 13:13:51 +0900 Subject: [PATCH] Add initial Steam Deck fongi --- README.md | 1 + flake.nix | 4 ++ .../steamdeck/desktops/plasma6/default.nix | 3 ++ nixos/hosts/steamdeck/default.nix | 36 +++++++++++++ nixos/hosts/steamdeck/disks.nix | 50 +++++++++++++++++++ 5 files changed, 94 insertions(+) create mode 100644 home-manager/hosts/steamdeck/desktops/plasma6/default.nix create mode 100644 nixos/hosts/steamdeck/default.nix create mode 100644 nixos/hosts/steamdeck/disks.nix diff --git a/README.md b/README.md index 4a0245e0..f577b2f9 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ nix develop -c /etc/nixos/git/docs/setup.sh | quitman-rpi4 | Raspberry Pi at my parents house. Headscale Exit Node | On Hold | | bakersfield-rpi4 | Raspberry Pi at my brothers house. Headscale Exit Node | Complete | | nuc-server | Second NUC server at my brothers house | On Hold | +| steamdeck | Valve Steam Deck, handheld gaming console | In Work | # Images | Name | Description | Build Commands | diff --git a/flake.nix b/flake.nix index a0918489..8d13d8a0 100644 --- a/flake.nix +++ b/flake.nix @@ -47,6 +47,8 @@ compose2nix.inputs.nixpkgs.follows = "nixpkgs"; # Hyprland Flake hyprland.url = "github:hyprwm/Hyprland"; + # Steam Deck configs for NixOS + jovain.url = "github:Jovian-Experiments/Jovian-NixOS" }; outputs = { self, nixpkgs, nixpkgs-wayland, home-manager, lanzaboote, nur, sops-nix, doom-emacs, nixos-generators, deploy-rs, ... } @inputs: let @@ -66,6 +68,7 @@ piaware-rpi4 = libx.mkHost { hostname = "piaware-rpi4"; system = "aarch64-linux"; type = "small"; }; quitman-rpi4 = libx.mkHost { hostname = "quitman-rpi4"; system = "aarch64-linux"; type = "small"; }; bakersfield-rpi4 = libx.mkHost { hostname = "bakersfield-rpi4"; system = "aarch64-linux"; type = "small"; }; + steamdeck = libx.mkHost { hostname = "steamdeck"; unfree = true; desktop = "plasma6"; repo = "nixpkgs-unfree"; }; }; homeConfigurations = { "albert@osaka-linode-01" = libx.mkHome { hostname = "osaka-linode-01"; type = "small"; }; @@ -78,6 +81,7 @@ "albert@piaware-rpi4" = libx.mkHome { hostname = "piaware-rpi4"; system = "aarch64-linux"; type = "small"; }; "albert@quitman-rpi4" = libx.mkHome { hostname = "quitman-rpi4"; system = "aarch64-linux"; type = "small"; }; "albert@bakersfield-rpi4" = libx.mkHome { hostname = "bakersfield-rpi4"; system = "aarch64-linux"; type = "small"; }; + "albert@steamdeck" = libx.mkHome { hostname = "steamdeck"; desktop = "plasma6"; }; # Containers "albert@rdesktop" = libx.mkHome { hostname = "rdesktop"; desktop = "xfce"; }; }; diff --git a/home-manager/hosts/steamdeck/desktops/plasma6/default.nix b/home-manager/hosts/steamdeck/desktops/plasma6/default.nix new file mode 100644 index 00000000..0db3279e --- /dev/null +++ b/home-manager/hosts/steamdeck/desktops/plasma6/default.nix @@ -0,0 +1,3 @@ +{ + +} diff --git a/nixos/hosts/steamdeck/default.nix b/nixos/hosts/steamdeck/default.nix new file mode 100644 index 00000000..58ff6ddd --- /dev/null +++ b/nixos/hosts/steamdeck/default.nix @@ -0,0 +1,36 @@ +{ inputs, config, lib, username, pkgs, ... }: { + imports = [ + inputs.jovian.nixosModules + ./disks.nix + ../../common/modules/boot.nix + ../../common/services/tailscale-autoconnect.nix + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "thunderbolt" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" "acpi_call" ]; + boot.extraModulePackages = with config.boot.kernelPackages; [ acpi_call ]; + + networking.useDHCP = lib.mkDefault true; + powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + # Set your time zone. + time.timeZone = "Asia/Tokyo"; + # Set the networking hostname: + networking.hostName = "steamdeck"; + + jovian = { + decky-loader.enable = true; + steam.enable = true; + steam.autoStart = true; + steam.user = username; + steamos.useSteamOSConfig = true; + devices.steamdeck.enable = true; + hardwarhas.amd.gpu = true; + }; + environment.systemPackages = with pkgs; [ + jupiter-dock-updater-bin + steamdeck-firmware + ]; +} diff --git a/nixos/hosts/steamdeck/disks.nix b/nixos/hosts/steamdeck/disks.nix new file mode 100644 index 00000000..dffc3ab3 --- /dev/null +++ b/nixos/hosts/steamdeck/disks.nix @@ -0,0 +1,50 @@ +{ + services.btrfs.autoScrub.enable = true; + services.btrfs.autoScrub.interval = "weekly"; + + disko.devices.disk.nvme0 = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + BOOT = { + priority = 1; + name = "BOOT"; + start = "0%"; + end = "550MiB"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + # https://github.com/nix-community/disko/issues/527 + mountOptions = [ "umask=0077" ]; + mountpoint = "/boot"; + }; + }; # partition 1 (ESP) + ROOT = { + start = "550MiB"; + end = "100%"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/root" = { + mountpoint = "/"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # root + "/home" = { + mountpoint = "/home"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # home + "/nix" = { + mountpoint = "/nix"; + mountOptions = [ "compress=zstd" "noatime" ]; + }; # nix + }; # subvolumes + }; # content + }; # partition 2 (/ BTRFS) + }; # partitions + }; # content + }; # disko.devices.disk.nvme0 +} # root