From 751dada59cfff5d42925ed524d3606327e05ad84 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Sun, 24 Nov 2024 20:32:06 -0500 Subject: [PATCH] flake: onboard petalburg (#174) --- .github/workflows/nix-build.yml | 16 ++++ flake.nix | 3 + hosts/petalburg/README.md | 24 ++++++ hosts/petalburg/default.nix | 96 +++++++++++++++++++++ hosts/petalburg/home.nix | 18 ++++ hosts/petalburg/secrets.nix | 6 ++ hosts/petalburg/stylix.nix | 50 +++++++++++ hwModules/asus/tuf/a16/amd-7030/default.nix | 35 ++++++++ hwModules/common/laptop/default.nix | 2 +- secrets/secrets.nix | 2 + 10 files changed, 251 insertions(+), 1 deletion(-) create mode 100644 hosts/petalburg/README.md create mode 100644 hosts/petalburg/default.nix create mode 100644 hosts/petalburg/home.nix create mode 100644 hosts/petalburg/secrets.nix create mode 100644 hosts/petalburg/stylix.nix create mode 100644 hwModules/asus/tuf/a16/amd-7030/default.nix diff --git a/.github/workflows/nix-build.yml b/.github/workflows/nix-build.yml index f5d7701f..fa4564ea 100644 --- a/.github/workflows/nix-build.yml +++ b/.github/workflows/nix-build.yml @@ -127,6 +127,22 @@ jobs: authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: Build pacifidlog run: nix build --accept-flake-config .#nixosConfigurations.pacifidlog.config.system.build.toplevel + petalburg-build: + runs-on: ubuntu-latest + steps: + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + - uses: actions/checkout@main + with: + fetch-depth: 1 + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - uses: cachix/cachix-action@master + with: + name: alyraffauf + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Build petalburg + run: nix build --accept-flake-config .#nixosConfigurations.petalburg.config.system.build.toplevel rustboro-build: runs-on: ubuntu-latest steps: diff --git a/flake.nix b/flake.nix index a850afff..b7447298 100644 --- a/flake.nix +++ b/flake.nix @@ -100,6 +100,7 @@ "lavaridge" "mauville" "pacifidlog" + "petalburg" "rustboro" "slateport" ]; @@ -156,6 +157,8 @@ hw-common-laptop = import ./hwModules/common/laptop; hw-common-laptop-intel-cpu = import ./hwModules/common/laptop/intel-cpu.nix; hw-common-ssd = import ./hwModules/common/ssd; + + hw-asus-tuf-a16-amd-7030 = import ./hwModules/asus/tuf/a16/amd-7030/default.nix; hw-framework-13-amd-7000 = import ./hwModules/framework/13/amd-7000; hw-framework-13-intel-11th = import ./hwModules/framework/13/intel-11th; hw-lenovo-legion-go = import ./hwModules/lenovo/legion/go; diff --git a/hosts/petalburg/README.md b/hosts/petalburg/README.md new file mode 100644 index 00000000..ad9a7410 --- /dev/null +++ b/hosts/petalburg/README.md @@ -0,0 +1,24 @@ +# petalburg + +## Overview + +Asus TUF A16 AMD Advantage Edition (2023) with AMD Ryzen 7 7735HS and RX77000S dGPU. + +## Todo + +## Specs + +| Model | Asus TUF A16 | +|---------|-------------------------| +| Display | 16.0" 1920x1200 165Hz | +| CPU | AMD Ryzen 7735HS | +| RAM | 16GB 8GBx2 DDR5-4800Mhz | +| iGPU | AMD Radeon 680M | +| dGPU | AMD Radeon RX 7700S | +| Disks | 512GB NVMe SSD | + +## Filesystems + +### / + +Encrypted LUKS btrfs volume. diff --git a/hosts/petalburg/default.nix b/hosts/petalburg/default.nix new file mode 100644 index 00000000..d0529f14 --- /dev/null +++ b/hosts/petalburg/default.nix @@ -0,0 +1,96 @@ +# Asus TUF A16 AMD Advantage Edition (2023) with AMD Ryzen 7 7735HS, 16GB RAM, RX7700S, 512GB SSD. +{ + config, + lib, + pkgs, + self, + ... +}: { + imports = [ + ./home.nix + ./secrets.nix + ./stylix.nix + (import ./../../disko/luks-btrfs-subvolumes.nix {disks = ["/dev/nvme0n1"];}) + self.nixosModules.common-auto-upgrade + self.nixosModules.common-base + self.nixosModules.common-locale + self.nixosModules.common-mauville-share + self.nixosModules.common-nix + self.nixosModules.common-pkgs + self.nixosModules.common-tailscale + self.nixosModules.common-wifi-profiles + self.nixosModules.hw-asus-tuf-a16-amd-7030 + self.nixosModules.hw-common-gaming + ]; + + boot = { + initrd.systemd.enable = true; + + lanzaboote = { + enable = true; + pkiBundle = "/etc/secureboot"; + }; + + loader = { + efi.canTouchEfiVariables = true; + systemd-boot.enable = lib.mkForce false; + }; + }; + + environment.variables.GDK_SCALE = "1"; + networking.hostName = "petalburg"; + + services.udev.extraRules = let + hyprlandDynamicRes = pkgs.writeShellScript "hyprland-dynamic-resolution" '' + MON="eDP-1" + RES="1920x1200" + + for dir in /run/user/*; do + for hypr_dir in "$dir/hypr/"*/; do + socket="''${hypr_dir}.socket.sock" + if [[ -S $socket ]]; then + monitor_info=$(echo -e "monitors" | ${lib.getExe pkgs.socat} - UNIX-CONNECT:"$socket") + + if echo "$monitor_info" | grep -q "$MON"; then + echo -e "keyword monitor $MON, $RES@$1, 0x0, 2, vrr, $2" | ${lib.getExe pkgs.socat} - UNIX-CONNECT:"$socket" + fi + + fi + done + done + ''; + in '' + SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_NAME}=="ACAD", ATTR{online}=="1", ACTION=="change", RUN+="${hyprlandDynamicRes} 165 1" + SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_NAME}=="ACAD", ATTR{online}=="0", ACTION=="change", RUN+="${hyprlandDynamicRes} 60 0" + ''; + + system.stateVersion = "24.11"; + + ar = { + apps = { + firefox.enable = true; + podman.enable = true; + steam.enable = true; + virt-manager.enable = true; + }; + + desktop = { + greetd.enable = true; + hyprland.enable = true; + sway.enable = true; + }; + + laptopMode = true; + + users.aly = { + enable = true; + password = "$y$j9T$NSS7QcEtN4yiigPyofwlI/$nxdgz0lpySa0heDMjGlHe1gX3BWf48jK6Tkfg4xMEs6"; + syncthing = { + enable = true; + certFile = config.age.secrets.syncthingCert.path; + keyFile = config.age.secrets.syncthingKey.path; + syncROMs = true; + }; + }; + }; +} diff --git a/hosts/petalburg/home.nix b/hosts/petalburg/home.nix new file mode 100644 index 00000000..f41d0f69 --- /dev/null +++ b/hosts/petalburg/home.nix @@ -0,0 +1,18 @@ +{self, ...}: { + home-manager = { + sharedModules = [ + { + wayland.windowManager.sway.config.output = { + "eDP-1" = { + adaptive_sync = "on"; + scale = "2.0"; + }; + }; + + ar.home.desktop.hyprland.laptopMonitors = ["eDP-1,1920x1200@165, 0x0, 2, vrr, 0"]; + } + ]; + + users.aly = self.homeManagerModules.aly; + }; +} diff --git a/hosts/petalburg/secrets.nix b/hosts/petalburg/secrets.nix new file mode 100644 index 00000000..cc7459e1 --- /dev/null +++ b/hosts/petalburg/secrets.nix @@ -0,0 +1,6 @@ +{ + age.secrets = { + syncthingCert.file = ../../secrets/aly/syncthing/petalburg/cert.age; + syncthingKey.file = ../../secrets/aly/syncthing/petalburg/key.age; + }; +} diff --git a/hosts/petalburg/stylix.nix b/hosts/petalburg/stylix.nix new file mode 100644 index 00000000..194f2331 --- /dev/null +++ b/hosts/petalburg/stylix.nix @@ -0,0 +1,50 @@ +{ + pkgs, + self, + ... +}: { + stylix = { + enable = true; + base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-hard.yaml"; + image = "${self.inputs.wallpapers}/wallhaven-3lyrvy.png"; + imageScalingMode = "fill"; + polarity = "dark"; + + cursor = { + name = "Bibata-Modern-Classic"; + package = pkgs.bibata-cursors; + size = 24; + }; + + fonts = { + monospace = { + name = "CaskaydiaCove Nerd Font"; + package = pkgs.nerdfonts.override {fonts = ["CascadiaCode"];}; + }; + + sansSerif = { + name = "UbuntuSans Nerd Font"; + package = pkgs.nerdfonts.override {fonts = ["UbuntuSans"];}; + }; + + serif = { + name = "Source Serif Pro"; + package = pkgs.source-serif-pro; + }; + + sizes = { + applications = 12; + desktop = 11; + popups = 12; + terminal = 13; + }; + }; + + opacity = { + applications = 1.0; + desktop = 0.8; + terminal = 0.8; + popups = 0.8; + }; + }; +} diff --git a/hwModules/asus/tuf/a16/amd-7030/default.nix b/hwModules/asus/tuf/a16/amd-7030/default.nix new file mode 100644 index 00000000..39f61019 --- /dev/null +++ b/hwModules/asus/tuf/a16/amd-7030/default.nix @@ -0,0 +1,35 @@ +{ + lib, + pkgs, + self, + ... +}: { + imports = [ + self.nixosModules.hw-common + self.nixosModules.hw-common-amd-cpu + self.nixosModules.hw-common-amd-gpu + self.nixosModules.hw-common-bluetooth + self.nixosModules.hw-common-laptop + self.nixosModules.hw-common-ssd + ]; + + boot = { + initrd.availableKernelModules = ["nvme" "sd_mod" "thunderbolt" "usb_storage" "xhci_pci"]; + kernelPackages = lib.mkDefault pkgs.linuxPackages_latest; + }; + + environment.systemPackages = with pkgs; [ + supergfxctl + ]; + + networking.networkmanager = { + enable = true; + + wifi = { + backend = "iwd"; + powersave = true; + }; + }; + + services.supergfxd.enable = true; +} diff --git a/hwModules/common/laptop/default.nix b/hwModules/common/laptop/default.nix index 9980b70f..fd797681 100644 --- a/hwModules/common/laptop/default.nix +++ b/hwModules/common/laptop/default.nix @@ -4,7 +4,7 @@ ... }: { boot.kernel.sysctl = { - "kernel.nmi_watchdog" = 0; + "kernel.nmi_watchdog" = lib.mkDefault 0; }; services = { diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 52e56436..e2b9bc32 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -31,6 +31,8 @@ in { "aly/syncthing/mauville/key.age".publicKeys = keys; "aly/syncthing/pacifidlog/cert.age".publicKeys = keys; "aly/syncthing/pacifidlog/key.age".publicKeys = keys; + "aly/syncthing/petalburg/cert.age".publicKeys = keys; + "aly/syncthing/petalburg/key.age".publicKeys = keys; "aly/syncthing/rustboro/cert.age".publicKeys = keys; "aly/syncthing/rustboro/key.age".publicKeys = keys; "aly/syncthing/slateport/cert.age".publicKeys = keys;