From 9102264fcc513854b26df52ae6c3540a53f6fd8b Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Tue, 28 Oct 2025 18:37:44 +0100 Subject: [PATCH] add deck base config --- flake.nix | 20 ++- hosts/nixos/deck/disk-config.nix | 47 +++++++ hosts/nixos/deck/hardware-configuration.nix | 43 +++++++ hosts/nixos/deck/home.nix | 12 ++ hosts/nixos/deck/system.nix | 133 ++++++++++++++++++++ 5 files changed, 254 insertions(+), 1 deletion(-) create mode 100644 hosts/nixos/deck/disk-config.nix create mode 100644 hosts/nixos/deck/hardware-configuration.nix create mode 100644 hosts/nixos/deck/home.nix create mode 100644 hosts/nixos/deck/system.nix diff --git a/flake.nix b/flake.nix index ba44048..fc83db0 100644 --- a/flake.nix +++ b/flake.nix @@ -14,9 +14,11 @@ }; disko.url = "github:nix-community/disko"; disko.inputs.nixpkgs.follows = "nixpkgs"; + jovian-nixos.url = "github:Jovian-Experiments/Jovian-NixOS"; + jovian-nixos.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = inputs@{ self, nixpkgs, home-manager, nixvim, claude-code, firefox-addons, disko }: + outputs = inputs@{ self, nixpkgs, home-manager, nixvim, claude-code, firefox-addons, disko, jovian-nixos }: { nixosConfigurations."hs" = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -45,6 +47,16 @@ ]; }; + nixosConfigurations."deck" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + disko.nixosModules.disko + jovian-nixos.nixosModules.jovian + ./hosts/nixos/deck/system.nix + ./hosts/nixos/deck/disk-config.nix + ]; + }; + homeConfigurations = { "yanlin@hs" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; @@ -63,6 +75,12 @@ modules = [ ./hosts/nixos/thinkpad/home.nix ]; extraSpecialArgs = { inherit claude-code nixvim firefox-addons; }; }; + + "yanlin@deck" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + modules = [ ./hosts/nixos/deck/home.nix ]; + extraSpecialArgs = { inherit claude-code nixvim firefox-addons; }; + }; }; }; } diff --git a/hosts/nixos/deck/disk-config.nix b/hosts/nixos/deck/disk-config.nix new file mode 100644 index 0000000..7314ed2 --- /dev/null +++ b/hosts/nixos/deck/disk-config.nix @@ -0,0 +1,47 @@ +# Disko configuration for Steam Deck +# Following the partitioning scheme from https://heywoodlh.io/nixos-steamdeck +{ + disko.devices = { + disk = { + main = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + # EFI System Partition + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "fmask=0077" "dmask=0077" ]; + }; + }; + + # Swap partition + swap = { + size = "8G"; + content = { + type = "swap"; + resumeDevice = true; + }; + }; + + # Root partition - takes remaining space + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/nixos/deck/hardware-configuration.nix b/hosts/nixos/deck/hardware-configuration.nix new file mode 100644 index 0000000..ce176fb --- /dev/null +++ b/hosts/nixos/deck/hardware-configuration.nix @@ -0,0 +1,43 @@ +# Placeholder hardware configuration for Steam Deck +# +# This file must be generated on the actual Steam Deck hardware. +# +# To generate this file: +# 1. Boot into the Jovian-NixOS installer ISO on the Steam Deck +# 2. Run: nixos-generate-config --root /mnt --show-hardware-config > hardware-configuration.nix +# 3. Copy the generated file to this location +# +# The generated file will include: +# - CPU and GPU detection +# - Storage device configuration +# - Kernel modules for Steam Deck hardware +# - File system configuration +# +# DO NOT attempt to use this placeholder for installation. + +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ ]; + + # Placeholder - will be replaced by actual hardware detection + boot.initrd.availableKernelModules = [ ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + # Placeholder filesystem configuration + fileSystems."/" = { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-label/boot"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/hosts/nixos/deck/home.nix b/hosts/nixos/deck/home.nix new file mode 100644 index 0000000..c3fac2e --- /dev/null +++ b/hosts/nixos/deck/home.nix @@ -0,0 +1,12 @@ +{ config, pkgs, ... }: + +{ + # Allow unfree packages in home-manager + nixpkgs.config.allowUnfree = true; + + # Import the common NixOS home configuration + imports = [ + ../home-default.nix + ../../../modules/gnome.nix + ]; +} diff --git a/hosts/nixos/deck/system.nix b/hosts/nixos/deck/system.nix new file mode 100644 index 0000000..d117ab5 --- /dev/null +++ b/hosts/nixos/deck/system.nix @@ -0,0 +1,133 @@ +{ config, pkgs, lib, ... }: + +{ + imports = [ + ./hardware-configuration.nix + ../system-default.nix # Common NixOS system configuration + ]; + + # Bootloader - standard UEFI setup + boot.loader = { + systemd-boot.enable = true; + systemd-boot.configurationLimit = 10; + efi.canTouchEfiVariables = true; + timeout = 3; + }; + + # Use latest kernel for better hardware support + boot.kernelPackages = pkgs.linuxPackages_latest; + + # Network configuration + networking = { + hostName = "deck"; + networkmanager = { + enable = true; + wifi.powersave = true; + }; + firewall.enable = false; + }; + + # Hardware support for Steam Deck (AMD APU) + hardware = { + enableRedistributableFirmware = true; + + # Graphics configuration for AMD + graphics = { + enable = true; + enable32Bit = true; + }; + + # Bluetooth support + bluetooth = { + enable = true; + powerOnBoot = true; + settings = { + General = { + Enable = "Source,Sink,Media,Socket"; + }; + }; + }; + }; + + # Sound configuration with PipeWire + services.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + # Jovian Steam Deck configuration + jovian = { + steam = { + enable = true; + autoStart = true; + desktopSession = "gnome"; + }; + decky-loader.enable = true; + devices.steamdeck = { + enable = true; + autoUpdate = true; + }; + }; + + # GNOME Desktop Environment + services.xserver.enable = true; + services.displayManager.gdm.enable = true; + services.desktopManager.gnome.enable = true; + + # Keyboard layout + services.xserver.xkb = { + layout = "us"; + options = ""; + }; + + # XDG portal for proper desktop integration + xdg.portal = { + enable = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-gnome + xdg-desktop-portal-gtk + ]; + }; + + # Touchscreen configuration + services.libinput = { + enable = true; + touchpad = { + naturalScrolling = true; + tapping = true; + }; + }; + + # Host-specific SSH configuration + services.openssh = { + settings = { + PermitRootLogin = "no"; + }; + }; + + # Host-specific user configuration + users.users.yanlin = { + extraGroups = [ "networkmanager" "wheel" "video" "audio" "input" ]; + hashedPassword = "$6$kSyaRzAtj8VPcNeX$NsEP6zQAfp6O8YWcolfPRKnhIcJlKu5luZgWqozJAHtbE/gv90KoOOKU7Dt.FnbPB0Ej26jXoBH4X.7y/OLGB1"; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOzmzq6xXp7KkUfPsFo/4O7AYVCJ1U+GrbD0fB10izMF yanlin@thinkpad" + ]; + }; + + # Host-specific packages + environment.systemPackages = with pkgs; [ + # System utilities + pciutils + usbutils + unzip + + # Icon themes for GNOME applications + adwaita-icon-theme + hicolor-icon-theme + ]; + +}