From 7a3d64e645e63401ad479354ba744d91c4601a9e Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Sun, 20 Sep 2026 20:32:33 -0400 Subject: [PATCH] clean up --- hosts/fwbook.nix | 13 ++------ hosts/hl-bigbox2.nix | 4 +-- hosts/hl-fwdesk.nix | 16 ++-------- hosts/hl-fws1.nix | 7 ----- hosts/hl-pi1.nix | 1 - hosts/hl-pi2.nix | 1 - modules/nixos/common/ABOUTME.md | 13 +++++--- modules/nixos/common/core.nix | 34 +++++++-------------- modules/nixos/common/default.nix | 1 - modules/nixos/common/hardware/ABOUTME.md | 6 ++-- modules/nixos/common/hardware/bluetooth.nix | 17 +++++++++++ modules/nixos/common/hardware/default.nix | 2 +- modules/nixos/common/hardware/pipewire.nix | 10 +++--- modules/nixos/common/hardware/sound.nix | 25 --------------- modules/nixos/desktop/ABOUTME.md | 5 +-- modules/nixos/desktop/default.nix | 6 ---- 16 files changed, 55 insertions(+), 106 deletions(-) create mode 100644 modules/nixos/common/hardware/bluetooth.nix delete mode 100644 modules/nixos/common/hardware/sound.nix diff --git a/hosts/fwbook.nix b/hosts/fwbook.nix index c21acb9..99ddf51 100644 --- a/hosts/fwbook.nix +++ b/hosts/fwbook.nix @@ -22,7 +22,6 @@ in core.qemu.enable = true; nixos = { common.hardware = { - sound.enable = true; pipewire.enable = true; laptop-power-mgr = { enable = true; @@ -114,10 +113,7 @@ in # Yubikey services.yubikey-agent.enable = true; # Bluetooth - hardware.bluetooth.settings.General = { - ControllerMode = "bredr"; - }; - hardware.bluetooth.enable = true; + skyg.nixos.common.hardware.bluetooth.enable = true; hardware.bluetooth.powerOnBoot = true; # Packages environment.systemPackages = @@ -258,7 +254,6 @@ in ]); # General hardware stuff - systemd.services.NetworkManager-wait-online.enable = false; systemd.services.systemd-udev-settle.enable = false; services.usbmuxd.enable = true; # Tether — iPhone ↔ Linux Wayland bridge @@ -338,11 +333,7 @@ in "noauto" ]; }; - programs.nh = { - enable = true; - flake = "/home/ari/nixos-setup"; - clean.enable = true; - }; + skyg.nixos.common.nh.flake = "/home/ari/nixos-setup"; # Firewall networking.firewall.allowedUDPPorts = openPorts; networking.firewall.allowedTCPPorts = openPorts; diff --git a/hosts/hl-bigbox2.nix b/hosts/hl-bigbox2.nix index 2599fb4..94996cc 100644 --- a/hosts/hl-bigbox2.nix +++ b/hosts/hl-bigbox2.nix @@ -12,9 +12,9 @@ in # BIOS GRUB must land on the MBR Kingston disk that holds /boot. # hardware-config still says /dev/sda (GPT home disk) which cannot embed GRUB. boot.loader.grub.device = lib.mkForce "/dev/disk/by-id/ata-KINGSTON_SA400S37240G_50026B7785904215"; + # Longer retention than the fleet default: bigbox2 is the shared cache store. + programs.nh.clean.extraArgs = "--keep-since 30d --keep 5"; skyg = { - gc.rootDays = 30; - gc.userDays = 30; user.enable = true; nixos.common = { ssh-server.enable = true; diff --git a/hosts/hl-fwdesk.nix b/hosts/hl-fwdesk.nix index 71c75da..cb8fa82 100644 --- a/hosts/hl-fwdesk.nix +++ b/hosts/hl-fwdesk.nix @@ -39,7 +39,6 @@ in "${my-nixpkgs}/nixos/modules/services/misc/ds4.nix" ]; # Skyg - environment.sessionVariables.NIXPKGS_ALLOW_UNFREE = 1; environment.sessionVariables.ELECTRON_OZONE_PLATFORM_HINT = "wayland"; skyg = { user.enable = true; @@ -47,7 +46,6 @@ in nixos = { common.ssh-server.enable = true; common.hardware = { - sound.enable = true; pipewire.enable = true; amdgpu.enable = true; }; @@ -130,10 +128,6 @@ in "video" "docker" ]; - services.avahi = { - enable = true; - nssmdns4 = true; - }; # Boot boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -156,8 +150,7 @@ in # Firmware updater services.fwupd.enable = true; # Bluetooth - hardware.bluetooth.settings.General = { ControllerMode = "bredr"; }; - hardware.bluetooth.enable = true; + skyg.nixos.common.hardware.bluetooth.enable = true; # Bootloader. environment.systemPackages = (with pkgs; [ @@ -274,12 +267,7 @@ in hardware.amdgpu = { opencl.enable = true; }; - environment.localBinInPath = true; - programs.nh = { - enable = true; - flake = "/home/ari/nixos-setup"; - clean.enable = true; - }; + skyg.nixos.common.nh.flake = "/home/ari/nixos-setup"; networking.firewall.allowedUDPPorts = openPorts; networking.firewall.allowedTCPPorts = openPorts; services.wyoming = { diff --git a/hosts/hl-fws1.nix b/hosts/hl-fws1.nix index 2d32443..2c42aad 100644 --- a/hosts/hl-fws1.nix +++ b/hosts/hl-fws1.nix @@ -5,7 +5,6 @@ nixos = { common.ssh-server.enable = true; common.hardware = { - sound.enable = true; pipewire.enable = true; }; desktop = { @@ -78,9 +77,6 @@ }; services.pipewire = { - enable = true; - pulse.enable = true; - alsa.enable = true; extraConfig.pipewire-pulse."10-raop-discover" = { context.modules = [ { name = "libpipewire-module-raop-discover"; } @@ -123,9 +119,6 @@ systemd.targets.hibernate.enable = false; systemd.targets.hybrid-sleep.enable = false; - # Send audio to AirPlay speakers - services.avahi.enable = true; - # AirPlay receiver services.shairport-sync = { enable = true; diff --git a/hosts/hl-pi1.nix b/hosts/hl-pi1.nix index a2fcc4e..39376fd 100644 --- a/hosts/hl-pi1.nix +++ b/hosts/hl-pi1.nix @@ -15,7 +15,6 @@ containers.enable = false; networking.nfsServer.enable = false; hardware = { - sound.enable = true; pipewire.enable = true; }; }; diff --git a/hosts/hl-pi2.nix b/hosts/hl-pi2.nix index c5cad77..ca6bf73 100644 --- a/hosts/hl-pi2.nix +++ b/hosts/hl-pi2.nix @@ -5,7 +5,6 @@ nixos = { common.ssh-server.enable = true; common.hardware = { - sound.enable = true; pipewire.enable = true; }; desktop = { diff --git a/modules/nixos/common/ABOUTME.md b/modules/nixos/common/ABOUTME.md index 1339485..b4b87e6 100644 --- a/modules/nixos/common/ABOUTME.md +++ b/modules/nixos/common/ABOUTME.md @@ -1,7 +1,8 @@ # modules/nixos/common/ Baseline settings every Linux host receives. `default.nix` imports each file/subfolder and -sets a few always-on defaults (`EDITOR=vi`, `NIXPKGS_ALLOW_UNFREE`, local bin in PATH). +sets a few always-on defaults (`EDITOR=vi`, local bin in PATH). `nixpkgs.config.allowUnfree` +is set once in `core.nix`; no host needs to set `NIXPKGS_ALLOW_UNFREE` itself. Most leaf modules expose a `skyg.nixos.common.*` enable flag and stay inert until switched on. ## Files @@ -9,7 +10,7 @@ Most leaf modules expose a `skyg.nixos.common.*` enable flag and stay inert unti ``` common/ ├── default.nix # Imports everything below + always-on env defaults -├── core.nix # System packages, nh, nix-ld, timezone (Toronto), locale, GC cron; skyg.nixos.common.minimal +├── core.nix # System packages, nh (clean + gc), nix-ld, timezone (Toronto), locale; skyg.nixos.common.minimal ├── networking.nix # skyg.core.hostName, NetworkManager, NFS server (skyg.nixos.common.networking.nfsServer) ├── user.nix # skyg.user.createSystemUser — creates the system user/groups + zsh shell ├── fonts.nix # System font packages + fontconfig defaults (Fira Code, Noto, …); skyg.nixos.common.fonts.minimal @@ -24,9 +25,10 @@ common/ ## Notable details -- **`core.nix`** sets `time.timeZone = "America/Toronto"`, `i18n` to `en_CA.UTF-8`, enables - `programs.nh` with auto-clean, and adds a daily `nix-collect-garbage --delete-older-than 7d` - cron job for both root and the user. +- **`core.nix`** sets `time.timeZone = "America/Toronto"`, `i18n` to `en_CA.UTF-8`, and enables + `programs.nh` with auto-clean (`--keep-since 7d --keep 5`, overridable per host via + `programs.nh.clean.extraArgs`) as the single GC mechanism — no separate cron jobs or + `nix.gc.automatic`. `skyg.nixos.common.nh.flake` sets the flake path per host. - **`networking.nix`** defines `skyg.core.hostName`, enables NetworkManager + the NFS server, and disables the flaky `NetworkManager-wait-online` unit. - **`user.nix`** creates the actual system user (in `wheel` + `networkmanager`) with zsh as @@ -44,6 +46,7 @@ skyg.nixos.common.ssh-server.* → ssh-server.nix skyg.nixos.common.ssh-notify.* → ssh-notify.nix skyg.nixos.common.cachePush.* → binary-cache.nix skyg.nixos.common.minimal → core.nix (skip heavy always-on system packages) +skyg.nixos.common.nh.flake → core.nix (flake path for 'nh os' commands, set per host) skyg.nixos.common.fonts.minimal → fonts.nix (install only a minimal font set) skyg.nixos.common.networking.nfsServer → networking.nix (enable/disable the NFS server) skyg.nixos.common.containers.* → containers/ diff --git a/modules/nixos/common/core.nix b/modules/nixos/common/core.nix index d5a591a..fb8042f 100644 --- a/modules/nixos/common/core.nix +++ b/modules/nixos/common/core.nix @@ -1,25 +1,18 @@ { pkgs, config, lib, ... }: { options.skyg = { - gc = { - rootDays = lib.mkOption { - type = lib.types.int; - description = "How often (in days) we call 'nix-collect-garbage' on root user"; - default = 7; - }; - userDays = lib.mkOption { - type = lib.types.int; - description = "How often in (days) we call 'nix-collect-garbage' on skyg.user.name"; - default = 7; - }; - }; nixos.common.minimal = lib.mkOption { type = lib.types.bool; description = "Minimal common system: skip heavy always-on packages for lean hosts."; default = false; }; + nixos.common.nh.flake = lib.mkOption { + type = lib.types.nullOr lib.types.str; + description = "Flake path for 'nh os' commands. Set per host."; + default = null; + }; }; - config = let skyg = config.skyg; in { + config = { # System Packages services.hydra.useSubstitutes = true; @@ -32,7 +25,11 @@ }; programs.nh = { enable = true; - clean.enable = true; + flake = config.skyg.nixos.common.nh.flake; + clean = { + enable = true; + extraArgs = lib.mkDefault "--keep-since 7d --keep 5"; + }; }; environment.systemPackages = (with pkgs; [ @@ -75,14 +72,5 @@ # Select internationalisation properties. i18n.defaultLocale = "en_CA.UTF-8"; - - # Storage Clean up - services.cron = { - enable = true; - systemCronJobs = [ - "0 23 * * * root nix-collect-garbage --delete-older-than ${toString skyg.gc.rootDays}d" - "0 23 * * * ${skyg.user.name} nix-collect-garbage --delete-older-than ${toString skyg.gc.userDays}d" - ]; - }; }; } diff --git a/modules/nixos/common/default.nix b/modules/nixos/common/default.nix index 6c1ac83..83e0f5a 100644 --- a/modules/nixos/common/default.nix +++ b/modules/nixos/common/default.nix @@ -15,7 +15,6 @@ ]; config = { environment.sessionVariables.EDITOR = "vi"; - environment.sessionVariables.NIXPKGS_ALLOW_UNFREE = 1; environment.localBinInPath = true; }; } diff --git a/modules/nixos/common/hardware/ABOUTME.md b/modules/nixos/common/hardware/ABOUTME.md index b788ac0..a03a643 100644 --- a/modules/nixos/common/hardware/ABOUTME.md +++ b/modules/nixos/common/hardware/ABOUTME.md @@ -12,8 +12,8 @@ hardware/ ├── default.nix # imports + fwupd + enableAllFirmware ├── amdgpu.nix # skyg.nixos.common.hardware.amdgpu — amdgpu driver + ROCm ICD ├── nvidia.nix # skyg.nixos.common.hardware.nvidia — driver + container toolkit -├── sound.nix # skyg.nixos.common.hardware.sound — PipeWire ALSA/JACK + rtkit -├── pipewire.nix # skyg.nixos.common.hardware.pipewire — full PipeWire stack +├── pipewire.nix # skyg.nixos.common.hardware.pipewire — full PipeWire stack (ALSA/JACK/pulse + rtkit) +├── bluetooth.nix # skyg.nixos.common.hardware.bluetooth — BR/EDR-only bluetooth ├── fan2go.nix # skyg.nixos.common.hardware.fan2go — fan2go curve-based fan control ├── fancontrol.nix # skyg.nixos.common.hardware.fancontrol — lm_sensors fancontrol ├── laptop-power.nix # skyg.nixos.common.hardware.laptop-power-mgr — lid events + power mgmt @@ -25,8 +25,8 @@ hardware/ ``` skyg.nixos.common.hardware.amdgpu.enable skyg.nixos.common.hardware.nvidia.enable -skyg.nixos.common.hardware.sound.enable skyg.nixos.common.hardware.pipewire.enable +skyg.nixos.common.hardware.bluetooth.enable skyg.nixos.common.hardware.fan2go.{enable,dbPath} skyg.nixos.common.hardware.fancontrol.{enable,configName} skyg.nixos.common.hardware.laptop-power-mgr.enable diff --git a/modules/nixos/common/hardware/bluetooth.nix b/modules/nixos/common/hardware/bluetooth.nix new file mode 100644 index 0000000..23574f0 --- /dev/null +++ b/modules/nixos/common/hardware/bluetooth.nix @@ -0,0 +1,17 @@ +{ lib +, config +, ... +}: +let + cfg = config.skyg.nixos.common.hardware.bluetooth; +in +{ + options.skyg.nixos.common.hardware.bluetooth = with lib; { + enable = mkEnableOption "bluetooth, BR/EDR only (BLE disabled)"; + }; + + config = lib.mkIf cfg.enable { + hardware.bluetooth.enable = true; + hardware.bluetooth.settings.General.ControllerMode = "bredr"; + }; +} diff --git a/modules/nixos/common/hardware/default.nix b/modules/nixos/common/hardware/default.nix index b2daccd..39be013 100644 --- a/modules/nixos/common/hardware/default.nix +++ b/modules/nixos/common/hardware/default.nix @@ -3,8 +3,8 @@ imports = [ ./fan2go.nix ./fancontrol.nix - ./sound.nix ./pipewire.nix + ./bluetooth.nix ./laptop-power.nix ./nvidia.nix ./amdgpu.nix diff --git a/modules/nixos/common/hardware/pipewire.nix b/modules/nixos/common/hardware/pipewire.nix index 67b3e82..9dd3587 100644 --- a/modules/nixos/common/hardware/pipewire.nix +++ b/modules/nixos/common/hardware/pipewire.nix @@ -7,7 +7,7 @@ let in { options.skyg.nixos.common.hardware.pipewire = with lib; { - enable = mkEnableOption "pipewire"; + enable = mkEnableOption "pipewire audio stack"; }; config = lib.mkIf cfg.enable { @@ -15,13 +15,15 @@ in security.rtkit.enable = true; services.pipewire = { enable = true; + audio.enable = true; wireplumber.enable = true; pulse.enable = true; + alsa.enable = true; + alsa.support32Bit = true; + jack.enable = true; systemWide = false; socketActivation = true; }; - services.jack = { - alsa.enable = true; - }; + services.jack.alsa.enable = true; }; } diff --git a/modules/nixos/common/hardware/sound.nix b/modules/nixos/common/hardware/sound.nix deleted file mode 100644 index 747617a..0000000 --- a/modules/nixos/common/hardware/sound.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ lib -, config -, ... -}: -let - cfg = config.skyg.nixos.common.hardware.sound; -in -{ - options.skyg.nixos.common.hardware.sound = with lib; { - enable = mkEnableOption "sound"; - }; - - config = lib.mkIf cfg.enable { - services.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - alsa.enable = true; - alsa.support32Bit = true; - jack.enable = true; - }; - services.jack = { - alsa.enable = true; - }; - }; -} diff --git a/modules/nixos/desktop/ABOUTME.md b/modules/nixos/desktop/ABOUTME.md index 20634e5..59765ea 100644 --- a/modules/nixos/desktop/ABOUTME.md +++ b/modules/nixos/desktop/ABOUTME.md @@ -8,7 +8,7 @@ have their own sub-options so a host enables only the stack it actually uses. ``` desktop/ -├── default.nix # skyg.nixos.desktop.enable — display manager, dbus, pipewire, xdg portals +├── default.nix # skyg.nixos.desktop.enable — display manager, dbus, xdg portals │ # slimMode — skip Xorg/browser/heavy desktop apps ├── tiler/ # Tiling WMs (niri / hyprland) + DankMaterialShell + swww ├── stylix/ # System-wide theming via Stylix (gruvbox-dark-hard) @@ -23,7 +23,8 @@ desktop/ ## How it composes - `default.nix` (`skyg.nixos.desktop.enable`) provides the shared desktop substrate: display - manager, dbus, PipeWire (only when enabled), upower, avahi, and the XDG portal set. + manager, dbus, upower, avahi, and the XDG portal set. PipeWire is provided separately by + `skyg.nixos.common.hardware.pipewire.enable` (see `common/hardware/ABOUTME.md`). Everything else is opt-in. - `slimMode` keeps the core substrate + tiler but skips the heavy desktop apps and Xorg (`packages.nix`/`wayland.nix`/`x11` were folded into `default.nix`; slim hosts use a diff --git a/modules/nixos/desktop/default.nix b/modules/nixos/desktop/default.nix index 656490a..c5eda21 100644 --- a/modules/nixos/desktop/default.nix +++ b/modules/nixos/desktop/default.nix @@ -62,12 +62,6 @@ let nssmdns4 = true; }; services.upower.enable = true; - services.pipewire = { - enable = true; - audio.enable = true; - pulse.enable = true; - jack.enable = true; - }; xdg = { autostart.enable = true; mime.enable = true;