From f62f70d2582114a520b19982384b88b9e3f6fe7f Mon Sep 17 00:00:00 2001 From: wieerwill Date: Tue, 5 Nov 2024 19:59:15 +0100 Subject: [PATCH] init nixos config steamdeck --- configuration.nix | 162 +++++++++++++++++++++++++++++++++++++ hardware-configuration.nix | 40 +++++++++ 2 files changed, 202 insertions(+) create mode 100755 configuration.nix create mode 100644 hardware-configuration.nix diff --git a/configuration.nix b/configuration.nix new file mode 100755 index 0000000..b9b5dcd --- /dev/null +++ b/configuration.nix @@ -0,0 +1,162 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ( + let revision = "e74e57a37de55ecfdc62f49fe5a7463b2a52499a"; in + builtins.fetchTarball { + url = "https://github.com/Jovian-Experiments/Jovian-NixOS/archive/${revision}.tar.gz"; + sha256 = "sha256:184zvpfcxzspai0mjmq5wfh9n6gjzx0430ygq5r1z1b9j59fhd5r"; + } + "/modules" + ) + ]; + + jovian = { + devices.steamdeck = { + enable = true; + autoUpdate = false; + enableGyroDsuService = true; + }; + steam = { + enable = true; + autoStart = true; + user = "wieerwill"; + desktopSession = "sway"; + updater.splash = "jovian"; + }; + decky-loader = { + enable = true; + user = "wieerwill"; + }; + }; + programs.sway = { + enable = true; + wrapperFeatures.gtk = true; + }; + programs.light.enable = true; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "decky"; # Define your hostname. + networking.networkmanager.enable = true; + #networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # Select internationalisation properties. + i18n.defaultLocale = "de_DE.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; + + # Enable the X11 windowing system. + services.xserver.enable = false; + security.polkit.enable = true; + environment.systemPackages = with pkgs; [ + xwayland + ]; + # Enable the gnome-keyring secrets vault. + # Will be exposed through DBus to programs willing to store secrets. + services.gnome.gnome-keyring.enable = true; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "de"; + variant = ""; + }; + + # Configure console keymap + console.keyMap = "de"; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + }; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.groups.steamos.gid = 1000; + users.users.wieerwill = { + isNormalUser = true; + description = "WieErWill"; + group = "steamos"; + extraGroups = [ "networkmanager" "wheel" "users" "video" "audio" "input"]; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # Enable the OpenSSH daemon. + services.openssh = { + enable = true; + ports = [22]; + settings = { + AllowUsers = ["wieerwill"]; + X11Forwarding = false; + PasswordAuthentication = false; # disable to enforce SSH key login + PermitRootLogin = "prohibit-password"; + }; + }; + + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + settings = { + General = { + Experimental = true; + }; + }; + }; + + # Open ports in the firewall. + networking.firewall = { + enable = true; + allowedTCPPorts = [22 80 443]; + allowedUDPPorts = []; + }; + services.fail2ban = { + enable = true; + maxretry = 5; + bantime = "1m"; + }; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.05"; # Did you read the comment? + +} + diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..5b7a41c --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,40 @@ +# 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" "usbhid" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/4765b74a-6eb0-41f1-bf69-3e0cb30e14cf"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/8D22-F1B8"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/8e67c9ae-4b38-4104-b0f5-fcecaeeb1438"; } + ]; + + # 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.enp4s0f3u1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}