From fbf0668ea9cea979b0d25bf010e2ad76bb8657d2 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Fri, 26 Apr 2024 17:54:51 -0400 Subject: [PATCH] added initial steam deck oled (mossdeep) configuration --- flake.lock | 66 ++++++++++++++++------- flake.nix | 24 ++++++++- hosts/mossdeep/default.nix | 66 +++++++++++++++++++++++ hosts/mossdeep/disko.nix | 56 +++++++++++++++++++ hosts/mossdeep/hardware-configuration.nix | 31 +++++++++++ hosts/mossdeep/home.nix | 12 +++++ 6 files changed, 236 insertions(+), 19 deletions(-) create mode 100644 hosts/mossdeep/default.nix create mode 100644 hosts/mossdeep/disko.nix create mode 100644 hosts/mossdeep/hardware-configuration.nix create mode 100644 hosts/mossdeep/home.nix diff --git a/flake.lock b/flake.lock index 208057a3..601777da 100644 --- a/flake.lock +++ b/flake.lock @@ -76,7 +76,9 @@ "hyprland-protocols": "hyprland-protocols", "hyprlang": "hyprlang", "hyprwayland-scanner": "hyprwayland-scanner", - "nixpkgs": "nixpkgs", + "nixpkgs": [ + "nixpkgs" + ], "systems": "systems", "wlroots": "wlroots", "xdph": "xdph" @@ -185,6 +187,49 @@ "type": "github" } }, + "jovian": { + "inputs": { + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1714022840, + "narHash": "sha256-i6xZsf7Kvp1n/Sn3nqPY1MJQx0gf80OGQw32PA/aZd8=", + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "rev": "94def3af1d45fe4b142beda3aa59a6a98e62ce9e", + "type": "github" + }, + "original": { + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "jovian", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1690328911, + "narHash": "sha256-fxtExYk+aGf2YbjeWQ8JY9/n9dwuEt+ma1eUFzF8Jeo=", + "owner": "zhaofengli", + "repo": "nix-github-actions", + "rev": "96df4a39c52f53cb7098b923224d8ce941b64747", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "ref": "matrix-name", + "repo": "nix-github-actions", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1713864415, @@ -202,22 +247,6 @@ } }, "nixpkgs": { - "locked": { - "lastModified": 1713714899, - "narHash": "sha256-+z/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "6143fc5eeb9c4f00163267708e26191d1e918932", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { "locked": { "lastModified": 1713895582, "narHash": "sha256-cfh1hi+6muQMbi9acOlju3V1gl8BEaZBXBR9jQfQi4U=", @@ -239,8 +268,9 @@ "home-manager": "home-manager", "hyprland": "hyprland", "impermanence": "impermanence", + "jovian": "jovian", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" } }, "systems": { diff --git a/flake.nix b/flake.nix index c633edfd..67507ad6 100644 --- a/flake.nix +++ b/flake.nix @@ -19,10 +19,18 @@ impermanence.url = "github:nix-community/impermanence"; # Latest Hyprland - hyprland.url = "github:hyprwm/Hyprland"; + hyprland = { + url = "github:hyprwm/Hyprland"; + inputs.nixpkgs.follows = "nixpkgs"; + }; # Pre-baked hardware support for various devices. nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + + jovian = { + url = "github:Jovian-Experiments/Jovian-NixOS"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; nixConfig = { @@ -40,6 +48,7 @@ impermanence, disko, hyprland, + jovian, ... }: { homeConfigurations = { @@ -54,6 +63,19 @@ }; nixosConfigurations = { + # Steam Deck OLED + mossdeep = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = {inherit inputs;}; + modules = [ + disko.nixosModules.disko + jovian.nixosModules.default + home-manager.nixosModules.home-manager + ./hosts/mossdeep + ./nixosModules + ]; + }; + # Framework 13 with AMD Ryzen 7640U and 32GB RAM. lavaridge = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; diff --git a/hosts/mossdeep/default.nix b/hosts/mossdeep/default.nix new file mode 100644 index 00000000..3f931bcb --- /dev/null +++ b/hosts/mossdeep/default.nix @@ -0,0 +1,66 @@ +# Framework Laptop 13 with AMD Ryzen 7640U, 32GB RAM, 1TB SSD. +{ + inputs, + config, + pkgs, + lib, + ... +}: { + imports = [ + ./hardware-configuration.nix # Include the results of the hardware scan. + ./home.nix + ./disko.nix + ]; + + boot = { + # Bootloader. + loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = true; + + # Use latest Linux kernel. + kernelPackages = pkgs.linuxPackages_latest; + }; + + networking.hostName = "mossdeep"; # Define your hostname. + + services = { + fwupd.enable = true; + }; + + alyraffauf = { + system = { + plymouth.enable = true; + zramSwap = {enable = true;}; + }; + user = { + aly.enable = true; + dustin.enable = false; + }; + desktop = { + enable = true; + hyprland.enable = true; + }; + apps = { + steam.enable = true; + }; + }; + + jovian = { + steam = { + user = "aly"; + enable = true; + autoStart = true; + desktopSession = "hyprland"; + }; + decky-loader = { + user = "aly"; + enable = true; + }; + devices.steamdeck.enable = true; + steamos.useSteamOSConfig = true; + }; + + users.users.aly.hashedPassword = "$y$j9T$koxhEzkA4pYLsyIqZBTWM0$N8VW.JTM.HZZgNm7XgTxTXRzvYd7veA7TojG0gKOzO2"; + + system.stateVersion = "23.11"; # Did you read the comment? +} diff --git a/hosts/mossdeep/disko.nix b/hosts/mossdeep/disko.nix new file mode 100644 index 00000000..54d34b71 --- /dev/null +++ b/hosts/mossdeep/disko.nix @@ -0,0 +1,56 @@ +{ + disko.devices = { + disk = { + vdb = { + type = "disk"; + device = "/dev/nvme0n1"; + content = { + type = "gpt"; + partitions = { + ESP = { + priority = 1; + name = "ESP"; + start = "1M"; + end = "1024M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + size = "100%"; + content = { + type = "btrfs"; + extraArgs = ["-f"]; # Override existing partition + # Subvolumes must set a mountpoint in order to be mounted, + # unless their parent is mounted + subvolumes = { + # Subvolume name is different from mountpoint + "rootfs" = {mountpoint = "/";}; + # For use with future impermanence setups + "persist" = { + mountpoint = "/persist"; + mountOptions = ["compress=zstd" "noatime"]; + }; + # Subvolume name is the same as the mountpoint + "home" = { + mountOptions = ["compress=zstd"]; + mountpoint = "/home"; + }; + # Parent is not mounted so the mountpoint must be set + "nix" = { + mountOptions = ["compress=zstd" "noatime"]; + mountpoint = "/nix"; + }; + }; + mountpoint = "/partition-root"; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/mossdeep/hardware-configuration.nix b/hosts/mossdeep/hardware-configuration.nix new file mode 100644 index 00000000..8563f60e --- /dev/null +++ b/hosts/mossdeep/hardware-configuration.nix @@ -0,0 +1,31 @@ +# 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" "usb_storage" "sd_mod"]; + boot.initrd.kernelModules = ["amdgpu"]; + boot.kernelModules = ["kvm-amd"]; + boot.extraModulePackages = []; + + hardware.opengl.driSupport = true; + + # 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.enp193s0f3u1c2.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/mossdeep/home.nix b/hosts/mossdeep/home.nix new file mode 100644 index 00000000..7016e5bf --- /dev/null +++ b/hosts/mossdeep/home.nix @@ -0,0 +1,12 @@ +{ + inputs, + config, + pkgs, + lib, + ... +}: { + home-manager.users.aly = { + imports = [../../homeManagerModules ../../aly.nix]; + home.stateVersion = "23.11"; + }; +}