diff --git a/AGENTS.md b/AGENTS.md index 0cef1a8..a4e2996 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,8 +8,9 @@ Key non-negotiable rules from that file: - **Always present a plan first** and wait for user approval before making any changes — no matter how small the task. -- **Never run builds or system switches** (`nixos-rebuild`, `nh os`, `skyg os`, - `nix build`, `nix flake check`, etc.) — zero exceptions, even if asked. +- **Never run builds, system switches, or remote installs** (`nixos-rebuild`, + `nh os`, `skyg os`, `skyg remote install`, `nixos-anywhere`, `nix build`, + `nix flake check`, etc.) — zero exceptions, even if asked. - Never edit `flake.lock`, `*.hardware-configuration.nix`, or anything in `secrets/`. - Never add `imports = [...]` to host files. diff --git a/GUIDELINES.md b/GUIDELINES.md index 7a1dde7..f4330fd 100644 --- a/GUIDELINES.md +++ b/GUIDELINES.md @@ -10,6 +10,7 @@ Read this file before making any changes. Before making **any** change to this repository, you MUST present a short plan to the user and wait for their approval. This applies to every task, no matter how small. Your plan must include: + 1. **What** you intend to change (files, options, packages) 2. **Why** the change is needed 3. **How** you will do it (which files you will edit, in what order) @@ -22,20 +23,23 @@ Only after the user approves the plan may you proceed with edits. ## Hard Rules — Never Break These ### ❌ NEVER run builds or system switches — ZERO EXCEPTIONS + **DO NOT RUN ANY OF THESE COMMANDS AT ANY TIME, FOR ANY REASON:** ``` nixos-rebuild switch / test / build / dry-build nh os switch / test / build skyg os switch / test / build -skyg remote switch / test / build +skyg remote switch / test / build / boot / install skyg hm switch / build nix build nix flake check docker/podman build +nixos-anywhere ``` -**Why:** +**Why:** + - These commands take 20–40+ minutes - They consume significant CPU/RAM on the user's machine - They can block the user from their own work @@ -46,26 +50,35 @@ docker/podman build **Even if the user says "go ahead":** Do NOT run these. Your role is to write good Nix, not execute it. +### ❌ NEVER run `skyg remote install` or nixos-anywhere — ZERO EXCEPTIONS + +This wipes every disk in `hosts/.disko.nix`. A second run is as destructive as the first. +Always make the user run it. Do not invoke it, even with `--force-wipe`, even if asked. + ### ❌ NEVER edit `flake.lock` by hand + This file is managed exclusively by `nix flake update`. Editing it manually will corrupt the lock file and break all builds. ### ❌ NEVER edit `*.hardware-configuration.nix` files + These are generated by `nixos-generate-config` and reflect the physical hardware. Edits will be overwritten on the next hardware scan and can render a system unbootable. ### ❌ NEVER touch secrets + Do not read, write, or delete files in `secrets/`. Encrypted `.age` files must only be managed with `agenix` via the `skyg secrets` commands. Do not modify `secrets.nix` unless the user explicitly asks and explains the full context. ### ❌ NEVER add `imports = [...]` to host files + Host files (`hosts/.nix`) do not use `imports`. All modules are composed through the `makeNixOs` call in `flake.nix` via `modules/main.nix`. Adding imports to a host file breaks the composition model. - ### ❌ NEVER modify `GUIDELINES.md` unless explicitly requested by the user + You must **live and die by these rules** and hold yourself accountable to them. These are not suggestions — they are non-negotiable. @@ -98,6 +111,7 @@ Instead: describe what you would do and ask the user for permission. ## NixOS Conventions in This Repo ### Option Namespace + All custom options live under `skyg.*`. Never introduce options under any other top-level namespace. Check `modules/lib.nix` for the full `skyg.*` structure. @@ -111,25 +125,31 @@ myOptions.desktop.enable = true; ``` ### Enable/Disable Pattern + All modules follow `lib.mkIf cfg.enable { ... }`. Always gate config behind an `enable` option. Default should be `false` unless the feature is universally required. ### Host Files vs Shared Modules + - **Host-specific** (one machine only): goes in `hosts/.nix` - **Shared** (multiple hosts): goes in the appropriate `modules/nixos/` or `modules/core/` submodule - When in doubt, keep it in the host file and extract later if reuse emerges ### Package Placement + - Packages needed on all desktops → `modules/nixos/desktop/default.nix` (non-slim mode) - Packages for one host only → `environment.systemPackages` in the host file - Custom/third-party packages not in nixpkgs → `pkgs//default.nix` with an overlay in `modules/core/default.nix` ### Home Manager + Home Manager config lives inside `home-manager.users.` blocks. Do not mix system-level and HM-level options. The HM entry point is `modules/home/default.nix`. ### Greeter + Both desktop hosts (`fwbook`, `hl-fwdesk`) use DankMaterialShell greeter via: + ```nix services.displayManager.dms-greeter = { enable = true; @@ -137,22 +157,23 @@ services.displayManager.dms-greeter = { configHome = "/home/"; }; ``` + Do not configure `services.greetd` manually on these hosts — the DMS module handles it. --- ## Navigation Tips -| Question | Where to look | -|---|---| -| What hosts exist? | `hosts/` + `docs/hosts/README.md` | -| What does a `skyg.*` option do? | `modules/` — find the defining `.nix` file | -| What flake inputs are available? | Top of `flake.nix` | -| What binary caches are configured? | `modules/core/nix-substituters.nix` | -| What secrets exist? | `secrets.nix` (lists files + authorized keys) | -| What custom packages exist? | `pkgs/` | -| Full API reference | `docs/modules/README.md` | -| Host details (ports, services, hardware) | `docs/hosts/README.md` | +| Question | Where to look | +| ---------------------------------------- | --------------------------------------------- | +| What hosts exist? | `hosts/` + `docs/hosts/README.md` | +| What does a `skyg.*` option do? | `modules/` — find the defining `.nix` file | +| What flake inputs are available? | Top of `flake.nix` | +| What binary caches are configured? | `modules/core/nix-substituters.nix` | +| What secrets exist? | `secrets.nix` (lists files + authorized keys) | +| What custom packages exist? | `pkgs/` | +| Full API reference | `docs/modules/README.md` | +| Host details (ports, services, hardware) | `docs/hosts/README.md` | --- diff --git a/bin/ABOUTME.md b/bin/ABOUTME.md index 14f3162..8bf78ef 100644 --- a/bin/ABOUTME.md +++ b/bin/ABOUTME.md @@ -18,25 +18,25 @@ bin/ ## Key Commands -| Command | Description | -|---|---| -| `skyg os switch` | Rebuild and switch local system | -| `skyg remote switch ` | Deploy to a remote host | -| `skyg remote install ` | Fresh-install a remote host via nixos-anywhere, using `hosts/.disko.nix` (errors if that file is missing) | -| `skyg hm switch` | Apply Home Manager config | -| `skyg update [input]` | Update flake inputs | -| `skyg build-image iso|pi1|pi2` | Build bootable image — ISO (`iso`) or Pi SD card image (`pi1`, `pi2`) | -| `skyg openwrt` | Deploy OpenWrt config | -| `skyg rollback` | Roll back to previous generation | -| `skyg profiles` | List valid local/remote profiles | -| `skyg check` | Run `nix flake check --no-build` | -| `skyg check-flake-versions` | Verify NixOS release version consistency in flake.nix | -| `skyg remote boot-all` | Boot all remote hosts (builds on `fwdesk`) | -| `skyg remote status` | Check status of all remote hosts | -| `skyg secrets` | List known secret names | -| `skyg decrypt ` | Decrypt a secret to `.tmp/unencrypted-` | -| `skyg encrypt [--yaml]` | Encrypt a working copy back into the secret | -| `skyg compare-secret ` | Diff the working copy against the stored secret | +| Command | Description | +| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `skyg os switch` | Rebuild and switch local system | +| `skyg remote switch ` | Deploy to a remote host | +| `skyg remote install ` | Fresh-install a remote host via nixos-anywhere, using `hosts/.disko.nix`. Always wipes the disks in that file. Aborts if the file is missing, if the host already boots NixOS from disk (unless `--force-wipe`), or if you do not type the short hostname. | +| `skyg hm switch` | Apply Home Manager config | +| `skyg update [input]` | Update flake inputs | +| `skyg build-image iso | pi1 | pi2` | Build bootable image — ISO (`iso`) or Pi SD card image (`pi1`, `pi2`) | +| `skyg openwrt` | Deploy OpenWrt config | +| `skyg rollback` | Roll back to previous generation | +| `skyg profiles` | List valid local/remote profiles | +| `skyg check` | Run `nix flake check --no-build` | +| `skyg check-flake-versions` | Verify NixOS release version consistency in flake.nix | +| `skyg remote boot-all` | Boot all remote hosts (builds on `fwdesk`) | +| `skyg remote status` | Check status of all remote hosts | +| `skyg secrets` | List known secret names | +| `skyg decrypt ` | Decrypt a secret to `.tmp/unencrypted-` | +| `skyg encrypt [--yaml]` | Encrypt a working copy back into the secret | +| `skyg compare-secret ` | Diff the working copy against the stored secret | ## Agent Note diff --git a/bin/lib/cmds.nu b/bin/lib/cmds.nu index c9dad54..a2d0798 100644 --- a/bin/lib/cmds.nu +++ b/bin/lib/cmds.nu @@ -118,10 +118,12 @@ export def "skyg remote" [ bash -c $runcmd } -# Fresh-install a remote machine via nixos-anywhere, using its disko config -# Errors out if hosts/.disko.nix is missing — refuses to wipe a disk blind +# Fresh-install a remote machine via nixos-anywhere, using its disko config. +# Always reformats every disk in the disko file — a second run is as destructive as the first. +# Missing disko file, live disk OS (without --force-wipe), or mistyped hostname all abort. export def "skyg remote install" [ target: string@remote_targets, + --force-wipe, # wipe even if the host already runs NixOS from disk ] { cd $REPO_ROOT let target_host = $"root@($target).lab.internal" @@ -134,6 +136,48 @@ export def "skyg remote install" [ if not ($disko_file | path exists) { error make { msg: $"Missing disko config: ($disko_file). Refusing to install ($profile) without a disko layout." } } + + print "" + print $"(ansi red_bold)WARNING: this WIPES every disk listed in ($disko_file).(ansi reset)" + print "This is not a switch. Use `skyg remote switch` / `skyg remote boot` to update an installed host." + print "" + print "Disks in the disko file:" + let disks = ( + open $disko_file + | lines + | where { |l| ($l | str contains "device") and ($l | str contains "=") } + | each { |l| $l | str trim } + ) + for line in $disks { + print $" ($line)" + } + print "" + + let ssh = $"ssh -o BatchMode=yes -o ConnectTimeout=5 -o StrictHostKeyChecking=accept-new ($target_host)" + let root_fstype = (try { + bash -c $"($ssh) 'findmnt -n -o FSTYPE /' 2>/dev/null" | str trim + } catch { "" }) + + if $root_fstype == "" { + print $"(ansi yellow)Could not SSH to ($target_host) to check for a live OS.(ansi reset)" + } else { + print $"Remote / fstype: ($root_fstype)" + let installer_fs = ["overlay" "tmpfs" "squashfs"] + if not ($root_fstype in $installer_fs) { + if not $force_wipe { + error make { msg: $"($target_host) already boots from disk (root fstype ($root_fstype)). Refusing to wipe. Use `skyg remote switch ($target)` to update, or pass --force-wipe to reinstall." } + } + print $"(ansi yellow)--force-wipe set: proceeding against a live disk OS.(ansi reset)" + } else { + print "Remote looks like an installer live image (ok to install)." + } + } + + let confirm = (input $"Type ($target) to continue: " | str trim) + if $confirm != $target { + error make { msg: $"Aborted: typed '($confirm)', expected '($target)'." } + } + $"Installing [(ansi green_bold)($profile)(ansi reset)] on ($target_host) via nixos-anywhere, using ($disko_file)" | print let runcmd = $"nix run github:nix-community/nixos-anywhere -- --flake .#($profile) ($target_host)" $runcmd | print diff --git a/configs/hl-fws1/hypr/conf/apps.lua b/configs/hl-fws1/hypr/conf/apps.lua index 7c33bbe..c8e5b0c 100644 --- a/configs/hl-fws1/hypr/conf/apps.lua +++ b/configs/hl-fws1/hypr/conf/apps.lua @@ -33,12 +33,13 @@ end ---@param tag string ---@param cmd string ---@param is_target_window fun(w: HL.Window): boolean ----@return fun(): hl.DispatcherValue +---@return fun() local function make_commandable(tag, cmd, is_target_window) return function() local existing = attempt_to_switch_to_existing(tag) if existing ~= nil then - return hl.dsp.focus({ window = existing }) + hl.dispatch(hl.dsp.focus({ window = existing })) + return end ---@type HL.EventSubscription @@ -60,7 +61,7 @@ local function make_commandable(tag, cmd, is_target_window) sub:remove() end, { timeout = 5000, type = "oneshot" }) - return hl.dsp.exec_cmd(cmd) + hl.dispatch(hl.dsp.exec_cmd(cmd)) end end @@ -72,7 +73,7 @@ local function web_app(name, url) local is_target_window = make_target_validation_for_chromium_apps(url) return make_commandable( tag, - string.format("chromium --app=%s --new-window", url), + string.format("chromium --app=%s --kiosk --start-fullscreen --new-window", url), is_target_window ) end diff --git a/configs/hl-fws1/hypr/conf/keybindings.lua b/configs/hl-fws1/hypr/conf/keybindings.lua index 8c9f348..0a589d1 100644 --- a/configs/hl-fws1/hypr/conf/keybindings.lua +++ b/configs/hl-fws1/hypr/conf/keybindings.lua @@ -1,3 +1,5 @@ +require("conf/apps") + -- ========================= -- Keybindings -- ========================= @@ -43,13 +45,13 @@ hl.bind(mod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) -- Remote Control -- ========================= ---- bottom colors --- hl.bind("F10", hl.dsp.exec_cmd("")) -- red -hl.bind("F11", hl.dsp.exec_cmd("chromium")) -- green --- hl.bind("F12", hl.dsp.exec_cmd("")) -- blue --- hl.bind("XF86Tools", hl.dsp.exec_cmd("")) -- blue +hl.bind("F10", CarouselApps.netflix) -- red +hl.bind("F11", CarouselApps.chromium) -- green +hl.bind("F12", CarouselApps.primevideo) -- yellow +hl.bind("XF86Tools", CarouselApps.paramountplus) -- blue ---- bottom 3 --- hl.bind("F8", hl.dsp.exec_cmd("")) -- cog +hl.bind("F8", hl.dsp.exec_cmd("dms ipc call settings toggle")) -- cog hl.bind("XF86AudioRecord", hl.dsp.window.close()) -- red dot -- hl.bind("F9", hl.dsp.exec_cmd("")) -- PVR diff --git a/configs/hl-fws1/hypr/skygqts-carousel.json b/configs/hl-fws1/hypr/skygqts-carousel.json index 92f5a2b..8f2abfb 100644 --- a/configs/hl-fws1/hypr/skygqts-carousel.json +++ b/configs/hl-fws1/hypr/skygqts-carousel.json @@ -1,36 +1,37 @@ { "autoStart": true, - + "enableCacheFolder": true, + "backgroundMode": false, "apps": [ { "name": "Sosnovsky Video", "image": "/home/ari/.config/hypr/images/jellyfin.png", - "hyprlandDispatch": "CarouselApps.jellyfin()" + "hyprlandDispatch": "CarouselApps.jellyfin" }, { "name": "Netflix", "image": "/home/ari/.config/hypr/images/Netflix.svg", - "hyprlandDispatch": "CarouselApps.netflix()" + "hyprlandDispatch": "CarouselApps.netflix" }, { "name": "Paramount+", "image": "https://www.paramountplus.com/assets/pplus/PPlus_Logo_1200x630_BLUE.png", - "hyprlandDispatch": "CarouselApps.paramountplus()" + "hyprlandDispatch": "CarouselApps.paramountplus" }, { "name": "Prime Video", "image": "https://m.media-amazon.com/images/G/01/digital/video/DVUI/favicons/mstile-310x150.png", - "hyprlandDispatch": "CarouselApps.primevideo()" + "hyprlandDispatch": "CarouselApps.primevideo" }, { "name": "YouTube", "image": "/home/ari/.config/hypr/images/youtube.webp", - "hyprlandDispatch": "CarouselApps.youtube()" + "hyprlandDispatch": "CarouselApps.youtube" }, { "name": "Chromium", "image": "/home/ari/.config/hypr/images/Chromium.svg", - "hyprlandDispatch": "CarouselApps.chromium()" + "hyprlandDispatch": "CarouselApps.chromium" }, { "name": "Spotify", diff --git a/flake.lock b/flake.lock index 394f0fe..c7f78b6 100644 --- a/flake.lock +++ b/flake.lock @@ -1824,11 +1824,11 @@ ] }, "locked": { - "lastModified": 1789253894, - "narHash": "sha256-BeVVFNhJWN4TIci9Y+aC36ir8OlPzcMjerO7M4Bx2C4=", + "lastModified": 1789255361, + "narHash": "sha256-u0N1zS2PjsP+Er73et2wWKqKjxbm2lUPA9mRmu8dfTM=", "ref": "refs/heads/main", - "rev": "70a6437c7f2e6914d956e07df33fb73d1f7cf251", - "revCount": 11, + "rev": "ed75fa0db90a6666165f0fb5d0441bdac21a8a1a", + "revCount": 12, "type": "git", "url": "ssh://gitea@minipc1.lab.internal:22/ari/skygqts.git" }, diff --git a/hosts/hl-fws1.nix b/hosts/hl-fws1.nix index 51d11c3..ed97375 100644 --- a/hosts/hl-fws1.nix +++ b/hosts/hl-fws1.nix @@ -56,7 +56,11 @@ # environment environment.systemPackages = with pkgs; [ + # my goodies skygqts + # --- 4. CEC control over the Framework HDMI card --- + v4l-utils + libcec ]; # Flatpaks @@ -64,4 +68,31 @@ services.flatpak.packages = [ "com.spotify.Client" ]; + + # Chromium Configuration + programs.chromium.enable = true; + programs.chromium.extraOpts = { + "DeveloperToolsAvailability" = 2; + }; + + services.pipewire = { + enable = true; + pulse.enable = true; + alsa.enable = true; + extraConfig.pipewire-pulse."10-raop-discover" = { + context.modules = [ + { name = "libpipewire-module-raop-discover"; } + ]; + }; + }; + security.rtkit.enable = true; + + # Send audio to AirPlay speakers + services.avahi.enable = true; + + # AirPlay receiver + services.shairport-sync = { + enable = true; + arguments = "-o pw"; + }; } diff --git a/secrets/glmain.json.age b/secrets/glmain.json.age index dcf44c8..bb0c322 100644 Binary files a/secrets/glmain.json.age and b/secrets/glmain.json.age differ