From 0227f9d3ef473719645ccd0f039309fd42339fc6 Mon Sep 17 00:00:00 2001 From: Emma Thorpe Date: Thu, 4 Jun 2026 13:57:44 +0000 Subject: [PATCH] refactor(nixos): extract workstation.nix base from laptop.nix Move the form-factor-agnostic settings (systemd-boot, swayDesktop, dvorak console, firewall) into a shared workstation.nix so laptop.nix and the new desktop.nix can both import them without drifting. laptop.nix keeps only the iwd Wi-Fi backend. Co-Authored-By: Claude Opus 4.8 (1M context) --- system/modules/laptop.nix | 18 ++++++------------ system/modules/workstation.nix | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 12 deletions(-) create mode 100644 system/modules/workstation.nix diff --git a/system/modules/laptop.nix b/system/modules/laptop.nix index 38910c0..211beab 100644 --- a/system/modules/laptop.nix +++ b/system/modules/laptop.nix @@ -1,21 +1,15 @@ -# Shared configuration for the physical NixOS laptops (X1, MBP-Asahi). Imported -# from the host table in flake.nix. Platform-specific bits (bootloader EFI var -# touching, firmware, audio, hostname, sshd) stay in the per-machine configs. +# Portable NixOS hosts (X1, MBP-Asahi). Imported from the host table in +# flake.nix. Shared graphical-workstation settings live in ./workstation.nix; +# the only laptop-specific bit is the Wi-Fi backend. Mobile home-manager +# components (battery block, brightness keys) are gated by the `portable` flag +# threaded through mkHost -- see lyrathorpe/home/sway.nix. { ... }: { - boot.loader.systemd-boot.enable = true; - - features.swayDesktop.enable = true; - - console.keyMap = "dvorak"; + imports = [ ./workstation.nix ]; # Wi-Fi via iwd with its built-in DHCP/network configuration. networking.wireless.iwd = { enable = true; settings.General.EnableNetworkConfiguration = true; }; - - # Default-deny inbound. Hosts that run a listening service open their own - # ports next to where the service is enabled (e.g. sshd -> 22 on X1). - networking.firewall.enable = true; } diff --git a/system/modules/workstation.nix b/system/modules/workstation.nix new file mode 100644 index 0000000..dc7366f --- /dev/null +++ b/system/modules/workstation.nix @@ -0,0 +1,15 @@ +# Form-factor-agnostic base for the physical graphical NixOS machines. Imported +# by both ./laptop.nix and ./desktop.nix; those add only the bits that differ +# between portable and desktop hosts (chiefly the networking backend). +{ ... }: +{ + boot.loader.systemd-boot.enable = true; + + features.swayDesktop.enable = true; + + console.keyMap = "dvorak"; + + # Default-deny inbound. Hosts that run a listening service open their own + # ports next to where the service is enabled (e.g. sshd -> 22 on X1). + networking.firewall.enable = true; +}