From 45545dff051a26008d43559868987402120c6935 Mon Sep 17 00:00:00 2001 From: Dominik Polakovics Date: Tue, 26 Sep 2023 14:36:08 +0200 Subject: [PATCH] add steamdeck --- fleet.nix | 4 + hosts/steamdeck.cloonar.com/configuration.nix | 76 +++++++++++++++++++ .../hardware-configuration.nix | 51 +++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 hosts/steamdeck.cloonar.com/configuration.nix create mode 100644 hosts/steamdeck.cloonar.com/hardware-configuration.nix diff --git a/fleet.nix b/fleet.nix index d4f03a3..613e12e 100644 --- a/fleet.nix +++ b/fleet.nix @@ -36,6 +36,10 @@ username = "nb-01.cloonar.com"; key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDN/2SAFm50kraB1fepAizox/QRXxB7WbqVbH+5OPalDT47VIJGNKOKhixQoqhABHxEoLxdf/C83wxlCVlPV9poLfDgVkA3Lyt5r3tSFQ6QjjOJAgchWamMsxxyGBedhKvhiEzcr/Lxytnoz3kjDG8fqQJwEpdqMmJoMUfyL2Rqp16u+FQ7d5aJtwO8EUqovhMaNO7rggjPpV/uMOg+tBxxmscliN7DLuP4EMTA/FwXVzcFNbOx3K9BdpMRAaSJt4SWcJO2cS2KHA5n/H+PQI7nz5KN3Yr/upJN5fROhi/SHvK39QOx12Pv7FCuWlc+oR68vLaoCKYhnkl3DnCfc7A7"; } + { + username = "steamdeck.cloonar.com"; + key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC6j6VMm2qDEwiKRwYBbhaSxrUoPI0HRjhmsngUVZexFTJwVJFRxThourfeQ46LCRHAWSryc/+w0W1QXYzGHoeJFtGntpkL0d4c2xSERgRpmSXG4EBJtlqJCvItWoXgpJK5K8q0lM3SZTtKxUyARtHrx1WQBjS/KoBw6NLkUumi4SkPN9StUt4KqtZVaAIQh5VShkpGJ5yfiIBWjFNaLmZ8uHwY8zV6U6KMNIfOHL97cI0t4PbOfCc1+6ZeVtFlWq1/ceFkaJJodb00XPAQeq10Uc2xNw2nFi2A5HszP4jIEheTtM6AQHE8d9iqAwBZoTe//65heMKd4BWSKryIT7HmG5ANC2MdhkfmxkIymzLyi3GoQv/hYPlGeLG9PFqqhZtNRx1IQlGQjOE1zlbnL3sKDJyZECP+hX0/oj33KOZSxaRPSbhgoHt4pE3Ig71akurYIlQj0ZO4xAABu+YZfe0LyvvLOACDWZH0U6Mqo5hpBy7PuhxGU/EtEkmA82aabjs= root@steamdeck"; + } ]; in { imports = builtins.map create_users users; diff --git a/hosts/steamdeck.cloonar.com/configuration.nix b/hosts/steamdeck.cloonar.com/configuration.nix new file mode 100644 index 0000000..a847ed4 --- /dev/null +++ b/hosts/steamdeck.cloonar.com/configuration.nix @@ -0,0 +1,76 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ( + # Put the most recent revision here: + let revision = "5cb5c5cbac8fc83aa62d8968c58a7ef556342b39"; in + builtins.fetchTarball { + url = "https://github.com/Jovian-Experiments/Jovian-NixOS/archive/${revision}.tar.gz"; + # Update the hash as needed: + sha256 = "sha256:0000000000000000000000000000000000000000000000000000"; + } + "/modules" + ) + + ./hardware-configuration.nix + ]; + + jovian.steam.enable = true; + jovian.steam.autoStart = true; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # Setup keyfile + boot.initrd.secrets = { + "/crypto_keyfile.bin" = null; + }; + + networking.hostName = "steamdeck"; # Define your hostname. + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Vienna"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "de_AT.UTF-8"; + LC_IDENTIFICATION = "de_AT.UTF-8"; + LC_MEASUREMENT = "de_AT.UTF-8"; + LC_MONETARY = "de_AT.UTF-8"; + LC_NAME = "de_AT.UTF-8"; + LC_NUMERIC = "de_AT.UTF-8"; + LC_PAPER = "de_AT.UTF-8"; + LC_TELEPHONE = "de_AT.UTF-8"; + LC_TIME = "de_AT.UTF-8"; + }; + + users.users.dominik = { + isNormalUser = true; + description = "Dominik Polakovics"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; [ + firefox + # thunderbird + ]; + }; + + services.openssh.enable = true; + users.users.root.openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDN/2SAFm50kraB1fepAizox/QRXxB7WbqVbH+5OPalDT47VIJGNKOKhixQoqhABHxEoLxdf/C83wxlCVlPV9poLfDgVkA3Lyt5r3tSFQ6QjjOJAgchWamMsxxyGBedhKvhiEzcr/Lxytnoz3kjDG8fqQJwEpdqMmJoMUfyL2Rqp16u+FQ7d5aJtwO8EUqovhMaNO7rggjPpV/uMOg+tBxxmscliN7DLuP4EMTA/FwXVzcFNbOx3K9BdpMRAaSJt4SWcJO2cS2KHA5n/H+PQI7nz5KN3Yr/upJN5fROhi/SHvK39QOx12Pv7FCuWlc+oR68vLaoCKYhnkl3DnCfc7A7" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIRQuPqH5fdX3KEw7DXzWEdO3AlUn1oSmtJtHB71ICoH Generated By Termius" + ]; + + # Enable automatic login for the user. + services.xserver.displayManager.autoLogin.enable = true; + services.xserver.displayManager.autoLogin.user = "dominik"; + + # Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229 + systemd.services."getty@tty1".enable = false; + systemd.services."autovt@tty1".enable = false; +} diff --git a/hosts/steamdeck.cloonar.com/hardware-configuration.nix b/hosts/steamdeck.cloonar.com/hardware-configuration.nix new file mode 100644 index 0000000..944a6ab --- /dev/null +++ b/hosts/steamdeck.cloonar.com/hardware-configuration.nix @@ -0,0 +1,51 @@ +{ 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/2bc0a1c5-dd58-4824-9a27-4e6e6f33a2e8"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-4dfc511b-12f9-46ef-be2a-f4e026263005".device = "/dev/disk/by-uuid/4dfc511b-12f9-46ef-be2a-f4e026263005"; + + boot.initrd.luks = { + yubikeySupport = true; + devices."luks-4dfc511b-12f9-46ef-be2a-f4e026263005" = { + device = "/dev/disk/by-uuid/4dfc511b-12f9-46ef-be2a-f4e026263005"; + yubikey = { + slot = 2; + twoFactor = false; + storage = { + device = "/dev/disk/by-uuid/661D-F155"; + }; + }; + }; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/661D-F155"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # 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.enp4s0f3u1u3c2.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}