Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f686df2cc | ||
|
|
8a1b952ce6 | ||
|
|
709bc50164 | ||
|
|
cd1915336b | ||
|
|
f0a6c3552e | ||
|
|
72dc1bbc71 | ||
|
|
5690b06fd3 | ||
|
|
7756e8e6fb | ||
|
|
efa387d21e | ||
|
|
587ca68c24 | ||
|
|
54a5c5441f | ||
|
|
aac93eab62 | ||
|
|
135c5b9c31 | ||
|
|
71f1e8abc0 | ||
|
|
e9a64d780b | ||
|
|
a2f6a8a23d | ||
|
|
0c7628d9e8 | ||
|
|
b02d698c1a | ||
|
|
7a68716c1c | ||
|
|
2719ed7707 | ||
|
|
71f3dec4b5 | ||
|
|
662e8b5caf | ||
|
|
205ed14970 | ||
|
|
e95726d69c | ||
|
|
760e353335 | ||
|
|
e191ea3c8a | ||
|
|
8c0c2822c6 | ||
|
|
3dccafe2b8 | ||
|
|
e6ceacb63b | ||
|
|
cfbc14a9e7 | ||
|
|
66760c1ded | ||
|
|
efb690206b | ||
|
|
1209f165e9 | ||
|
|
94b2b4695c | ||
|
|
4d33b92bbc | ||
|
|
e849827ebb | ||
|
|
a05057a074 | ||
|
|
3debd6f7c2 | ||
|
|
059319cb1b | ||
|
|
d1afbba50c | ||
|
|
eec1f33e96 | ||
|
|
14f5e96f7e | ||
|
|
e46346c446 | ||
|
|
9f9c5df790 | ||
|
|
acd08afaad | ||
|
|
4b366f952e | ||
|
|
d4b6616d88 | ||
|
|
96604e3367 | ||
|
|
0e00512773 | ||
|
|
c13a0093c3 | ||
|
|
8886b9a2b5 | ||
|
|
59b291d000 | ||
|
|
ca725c73b5 | ||
|
|
1db3105d50 | ||
|
|
2b376d5035 | ||
|
|
a5a07a8792 | ||
|
|
53a19c6b54 | ||
|
|
df7696ae60 | ||
|
|
ed2ce8fafc | ||
|
|
b2a700571f | ||
|
|
99e5260619 | ||
|
|
2523494d10 | ||
|
|
48aa11eab5 | ||
|
|
a9022fa8fc | ||
|
|
6f1262b0fe | ||
|
|
bee9b49ce1 | ||
|
|
c33d184228 | ||
|
|
896368ef56 | ||
|
|
f84611bc6e | ||
|
|
13e8db74ce | ||
|
|
e4ee637ccd | ||
|
|
386a46c4fe | ||
|
|
f8a7b61280 | ||
|
|
4adb9347b8 | ||
|
|
565308a448 | ||
|
|
b3200d965d | ||
|
|
ef1be8a7d9 | ||
|
|
67dd30eb72 | ||
|
|
d089743f75 | ||
|
|
8dc3affdda | ||
|
|
9566624686 | ||
|
|
10046bf846 | ||
|
|
461d6cc441 | ||
|
|
1dd8edcbb0 | ||
|
|
b4c60b9f7b | ||
|
|
1bdd70fc4d | ||
|
|
a723222223 | ||
|
|
71900ddfcf | ||
|
|
a0519b5004 | ||
|
|
2b2f0994e9 | ||
|
|
22caa06904 | ||
|
|
812c1af1f2 | ||
|
|
e0f5c6b37b | ||
|
|
bef5215bea | ||
|
|
b2982c47a1 | ||
|
|
524315f495 | ||
|
|
625938922c | ||
|
|
fec8d7cb25 | ||
|
|
be98be0100 | ||
|
|
25e17f163e | ||
|
|
9b96d3c6f8 | ||
|
|
32dd2abdce | ||
|
|
694317acbb | ||
|
|
a8e5c200dc | ||
|
|
ee0a2f39e9 | ||
|
|
666e84bb26 | ||
|
|
f3dddc9150 | ||
|
|
4adb59808f | ||
|
|
a5edaab80d | ||
|
|
7d9bb7d183 | ||
|
|
6f24ab69ad | ||
|
|
3899290c5b | ||
|
|
d117d26fde | ||
|
|
959ad30fdc |
@@ -17,3 +17,6 @@ keys.txt
|
||||
|
||||
# local visual-verification output
|
||||
.artifacts/
|
||||
|
||||
# rust build output
|
||||
target/
|
||||
|
||||
@@ -14,6 +14,7 @@ keys:
|
||||
- &neptun age1hp72xyx2cnd05937e4eww95g5kdtn0wsf9j2nypw330pa69gfdxqn0lpkp
|
||||
- &terra age1rfcmu6zh40v4260l9hnf8ajs9vly0s06rx3ey76eu78dp9t7getqyhmkut
|
||||
- &mars age1eapjg6tdrr0fuvmgs3q3nlvnjkaxez298qynqqqxt0lpcv0lrsyq7ayxjk
|
||||
- &titan age1qm6ne4mrgwkj7eea5j3vn0qmtw4p5h4eu78vvahhfnd4pk04qausn3qgv2
|
||||
# mercury (rpi) uses a dedicated age key (SD image, no ssh-host-key delivery);
|
||||
# the private key is dropped on its boot partition after flashing.
|
||||
- &mercury age1cpty7zrgnn6l97upq00w5wa8zcvnkxkdt2jvhlj97jh83exure4slha43t
|
||||
@@ -29,6 +30,9 @@ creation_rules:
|
||||
- path_regex: secrets/terra\.yaml$
|
||||
key_groups:
|
||||
- age: [ *admin, *terra ]
|
||||
- path_regex: secrets/titan\.yaml$
|
||||
key_groups:
|
||||
- age: [ *admin, *titan ]
|
||||
- path_regex: secrets/mars\.yaml$
|
||||
key_groups:
|
||||
- age: [ *admin, *mars ]
|
||||
|
||||
@@ -4,7 +4,8 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
||||
|
||||
Flake-based NixOS config for a homelab. Hosts: **jupiter** (ZimaBlade NAS, x86_64),
|
||||
**neptun** (netcup public reverse proxy + tailnet node, x86_64), **mercury** (Raspberry
|
||||
Pi 3B+ DNS/DHCP, aarch64). See `README.md` for the full install/deploy walkthrough.
|
||||
Pi 3B+ DNS/DHCP, aarch64), **terra** (desktop), **titan** (Zenbook Pro Duo laptop),
|
||||
**mars** (Hermes Agent + luna's apps). See `README.md` for the full install/deploy walkthrough.
|
||||
|
||||
## Layout
|
||||
|
||||
@@ -12,10 +13,12 @@ Pi 3B+ DNS/DHCP, aarch64). See `README.md` for the full install/deploy walkthrou
|
||||
flake.nix # nixosConfigurations: real hosts + test/util targets
|
||||
common.nix # shared base: user darman (key-only ssh), nix settings, firewall :22, tz
|
||||
services/<cat>/*.nix # one reusable NixOS module per service, grouped by category
|
||||
# (media, network, vpn, identity, dev, desktop); each opens
|
||||
# (media, network, vpn, identity, dev, desktop, comms); each opens
|
||||
# ITS OWN firewall ports. services/containers.nix (podman
|
||||
# backend) stays at the top level, shared across categories.
|
||||
hosts/<h>/ # configuration.nix + disk-config.nix (disko) + hardware-configuration.nix + secrets.nix
|
||||
profiles/workstation.nix # Hyprland workstation shared by terra + titan (NixOS side)
|
||||
home/desktop/ # its home-manager side; per-host monitors via homelab.desktop.*
|
||||
secrets/<h>.yaml # sops-nix, age-encrypted per host
|
||||
scripts/deploy # config-agnostic deploy wrapper (all args mandatory)
|
||||
scripts/edit_secrets
|
||||
@@ -51,6 +54,18 @@ empty password, so the script resolves the title among `--filter-state active` i
|
||||
first; a plain `pass-cli item view --item-title` silently returns the trashed copy and
|
||||
you get an interactive prompt with no explanation.
|
||||
|
||||
On terra/titan the values come from **pass-broker** (`services/identity/pass-broker.nix`),
|
||||
not from anyone's own pass-cli session: it runs as its own user with an agent PAT scoped to
|
||||
the HomeLab vaults and releases an item only after a Telegram tap. Prompts go through the
|
||||
**gateway on mars** (`hosts/mars/pass-broker-gateway.nix`, tailnet :8097), the bot's only
|
||||
`getUpdates` consumer: a second poller would split the taps. A new host gets its own
|
||||
`pass_broker_gateway_token` in its sops file and that token's sha256 in the gateway's
|
||||
`hosts`. When the socket exists, deploy uses it exclusively; a refused tap falls back to the
|
||||
interactive prompt.
|
||||
**Claude: fetch Proton Pass items only via `pass-broker get --item <title> --reason <why>`**,
|
||||
never `pass-cli login` yourself, and never print a value you fetched. Values go into
|
||||
variables or pipes, as `scripts/deploy` does.
|
||||
|
||||
`HOMELAB_KEXEC_TARBALL` (+ `_CPIO` / `_GZIP`) makes `kexec`/`kexec-local` reuse a
|
||||
prebuilt installer instead of rebuilding ~500MB. The VM test below uses this.
|
||||
|
||||
@@ -77,6 +92,15 @@ nix build .#checks.x86_64-linux.kexec-local -L
|
||||
# VM test of luna's app hosting on mars (hosts/mars/luna-sites.nix): podman socket
|
||||
# proxy, registry validation, caddy routes, reboot persistence
|
||||
nix build .#checks.x86_64-linux.luna-sites -L
|
||||
# VM test of pass-broker with fake pass-cli + Telegram: approve/deny/expiry,
|
||||
# grants, policy, uid check
|
||||
nix build .#checks.x86_64-linux.pass-broker -L
|
||||
# two-node VM test of the gateway on mars with a broker using it: labels,
|
||||
# cancel, expiry, per-host token isolation, gateway down
|
||||
nix build .#checks.x86_64-linux.pass-broker-gateway -L
|
||||
# Synapse + MAS on jupiter behind neptun's caddy: C collation, delegation,
|
||||
# SSO-only login flows, admin API not public, chat + media upload, restart
|
||||
nix build .#checks.x86_64-linux.matrix -L
|
||||
```
|
||||
|
||||
`checks.kexec-local` is the only way to exercise `kexec-local` at all: it jumps the
|
||||
@@ -210,3 +234,69 @@ kept its ssh host key. Run it after ANY change to the kexec paths.
|
||||
- **`kexec-local` stages on `/var/tmp`, not `/tmp`**: `kexec-run.sh` appends a fresh cpio
|
||||
to `kexec/initrd` in place and execs binaries from that dir, so a size-capped or
|
||||
`noexec` tmpfs gives a half-written initrd or a bare "Permission denied".
|
||||
- **sops-nix values must be STRINGS.** `sops --set '["id"] 123'` stores `type:int`; the
|
||||
build-time check only sees key names and passes, then activation's sops-install-secrets
|
||||
fails with "is not a string" and installs NONE of the new secrets. The old generation
|
||||
stays, so it looks like only the new keys are missing. Quote it: `'["id"] "123"'`.
|
||||
- **A sops secret a USER service reads needs `owner`, not a mode.** `luna-voiced`
|
||||
(`services/desktop/luna-voice.nix`) runs as darman's user unit, and a user manager
|
||||
cannot read root:root 0400 — `LoadCredential` does not bridge that gap either.
|
||||
Hence `sops.secrets.<x>.owner = "darman"` in `hosts/terra/secrets.nix`.
|
||||
- **`elevenlabs_api_key` is in BOTH `secrets/mars.yaml` and `secrets/terra.yaml`** —
|
||||
same value. terra calls ElevenLabs directly (the client-direct path Hermes
|
||||
documents) rather than relaying audio through mars, so rotating that key means
|
||||
editing two files. `hermes_api_server_key` is duplicated for the same reason:
|
||||
mars serves the API, terra is its only client.
|
||||
- **terra's mic is QUIET, and every voice threshold is sized for it.** Measured on
|
||||
the AIR 192|4 (`luna-voice level`): ~0.001–0.002 RMS ambient, only 0.0045–0.005
|
||||
for normal speech — about 6dB of separation. Consequences, all of which looked
|
||||
like "the daemon is broken": a VAD multiplier above ~2 can never fire, an
|
||||
absolute trigger floor of 0.006 sits *above* the user's voice, and whisper's own
|
||||
gate at 0.015 discarded every word the VAD did capture. Hence `vadMult = 1.8`,
|
||||
`vadFloor = 0.0025`, and `stt::normalize` scaling the clip up (capped at 30x)
|
||||
before whisper sees it. Raising the gain on the interface is worth more than any
|
||||
of these; tune via `homelab.lunaVoice.vad*` rather than editing Rust.
|
||||
- **`try_recv()` POPS — an `if let Ok(Cancel)` destroys every other command.**
|
||||
luna-voiced polls for a cancel while she speaks; written as a single `if let`,
|
||||
any `say`/`toggle`/`mode off` arriving mid-reply was taken off the channel and
|
||||
dropped, so SUPER+V during her answer did nothing at all and the next turn never
|
||||
ran. Non-cancel commands are collected and re-sent into the channel after the
|
||||
turn instead (`requeue` in `turn()`).
|
||||
- **A rising sound must not update the noise floor.** Feeding every sample into the
|
||||
floor EMA lets speech drag its own threshold up faster than it rises — measured,
|
||||
a tone peaking at 0.029 was chased by a threshold that reached 0.018 and never
|
||||
triggered. Only samples *below* the current trigger update the floor.
|
||||
- **whisper invents words out of silence** — "you", "Thank you.", "Bye." — and a
|
||||
held push-to-talk key over a quiet room is long AND empty, so duration alone
|
||||
does not catch it. `stt::has_speech` gates on the loudest 100ms window instead;
|
||||
without it every stray keypress sends a hallucinated sentence to luna.
|
||||
- **terra's greeter is a throwaway Hyprland running `dotfiles/quickshell/greeter.qml`**
|
||||
(`services/desktop/quickshell-greeter.nix`). It must exit after login or greetd never
|
||||
starts the session, and with a Lua config `hyprctl dispatch exit` is REJECTED — it needs
|
||||
`hyprctl dispatch 'hl.dsp.exit()'`. Test the flow without touching the real greetd by
|
||||
running greetd's `fakegreet "qs -p …/greeter.qml"` inside a nested Hyprland
|
||||
(user `user`, password `password`, then answer `9`).
|
||||
- **Matrix logins go through MAS, not Synapse's `oidc_providers`** (`services/comms/matrix.nix`).
|
||||
Element X only supports SSO via Matrix Authentication Service, and moving an existing
|
||||
Synapse onto MAS is a one-way `syn2mas` migration — so it was there from day one. With
|
||||
MAS enabled Synapse refuses to start if password login, registration or any SSO
|
||||
section is on. Admin rights come from MAS:
|
||||
`sudo -u matrix-authentication-service mas manage promote-admin <user>`.
|
||||
- **Synapse's database needs `LC_COLLATE`/`LC_CTYPE` = C**, which `ensureDatabases`
|
||||
can't give (cluster default locale) and `initialScript` never runs on jupiter's
|
||||
existing immich cluster — hence the `\gexec` CREATE DATABASE in `postgresql-setup`'s
|
||||
`ExecStartPost`. Synapse's signing key is a sops secret, not generated on first
|
||||
start: it IS the server's federation identity, and the array it would live on is RAID0.
|
||||
- **A MAS compat token is "not active" until Synapse has its device.** Synapse rejects
|
||||
any token whose device it doesn't know, and `mas manage register-user` immediately
|
||||
followed by `issue-compatibility-token` races: the new user's provisioning job syncs
|
||||
devices before the token's session is committed and deletes the device just created.
|
||||
`mas manage provision-all-users` re-syncs it. luna's Matrix bot token
|
||||
(`hosts/mars/secrets.nix`) hit this.
|
||||
- **Run the Hermes CLI on mars as `hermes`, never as root** (`podman exec -u hermes`, or
|
||||
the `hermes` zsh alias). Since v0.22, optional deps (ElevenLabs `tts-premium`, plugin
|
||||
deps like Honcho's `honcho-ai`) live in PM generations under `/opt/data/installs`; a
|
||||
root `hermes pm status` created a root-owned `.leases` dir there and every later
|
||||
install failed with "install state is not writable by this user". Those deps are
|
||||
luna's volume state, not Nix: after a reset, `hermes pm install --extra tts-premium`
|
||||
and `hermes plugins install honcho --force --yes-deps --enable`.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{ pkgs, config, ... }:
|
||||
|
||||
# Shared base for all hosts: user, SSH hardening, nix settings, packages.
|
||||
{
|
||||
@@ -54,10 +54,9 @@
|
||||
environment.systemPackages = with pkgs; [ git btop tmux curl wget zsh-powerlevel10k lsd jq ];
|
||||
|
||||
# ---- home-manager (user-level config for darman, all hosts) ----
|
||||
# Requires home-manager.nixosModules.home-manager in the host's own
|
||||
# `modules` list (flake.nix) — this only sets values for options that
|
||||
# module declares, it doesn't import it, so every nixosSystem using
|
||||
# common.nix needs that line too (mirrors terra's original setup).
|
||||
# Only sets values for options declared by home-manager.nixosModules.home-manager;
|
||||
# it doesn't import that module, so every nixosSystem using common.nix must
|
||||
# also list it in flake.nix's `modules`.
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
# Protects activation if a plain (non-symlink) ~/.zshrc etc. already
|
||||
@@ -91,16 +90,17 @@
|
||||
boot.loader.systemd-boot.configurationLimit = 5;
|
||||
boot.loader.generic-extlinux-compatible.configurationLimit = 5;
|
||||
|
||||
# Stock journald defaults to ~10% of the filesystem (up to 4G) before it
|
||||
# rotates — no scheduled vacuum, just a ceiling it grows into. On jupiter's
|
||||
# 29G eMMC that's ~2.9G it could silently accumulate. Cap it well below that
|
||||
# everywhere instead of only noticing when a disk fills up again.
|
||||
# Stock journald grows unbounded up to ~10% of the filesystem (4G cap, no
|
||||
# scheduled vacuum) — on jupiter's 29G eMMC that's ~2.9G it could silently
|
||||
# fill. Cap it well below that everywhere.
|
||||
services.journald.extraConfig = ''
|
||||
SystemMaxUse=200M
|
||||
'';
|
||||
|
||||
# ---- Locale / firewall base ----
|
||||
time.timeZone = "Europe/Berlin";
|
||||
# Flatpak needs /etc/timezone, falls back to UTC if not set.
|
||||
environment.etc."timezone".text = config.time.timeZone;
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
console.keyMap = "de";
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ A [Quickshell](https://quickshell.org/) configuration — a QML-based Wayland de
|
||||
|
||||
## Running / testing changes
|
||||
|
||||
**`~/.config/quickshell` is NOT a symlink to this repo.** `hosts/terra/home.nix`
|
||||
**`~/.config/quickshell` is NOT a symlink to this repo.** `home/desktop/default.nix`
|
||||
ships the tree with `xdg.configFile."quickshell"`, which COPIES it into the nix
|
||||
store, so the config directory is a read-only symlink into `/nix/store/...`.
|
||||
Editing a file here therefore changes nothing about the running shell: it is
|
||||
@@ -70,8 +70,9 @@ configured via `.qmlls.ini` for editor diagnostics.
|
||||
## Architecture
|
||||
|
||||
`shell.qml` is a `Scope` instantiating the top-level pieces as siblings:
|
||||
`HyprChromeShell` (the status rail), the eleven launcher variants,
|
||||
`Notifications`, `VolumeOsd` and `Vitals`. Each manages its own
|
||||
`HyprChromeShell` (the status rail, plus the surfaces it owns — launcher, polkit,
|
||||
askpass, notifications), the ten remaining launcher variants,
|
||||
`VolumeOsd` and `Vitals`. Each manages its own
|
||||
`PanelWindow`(s); there is no central layout manager.
|
||||
|
||||
The one exception, and the pattern to follow for anything new that needs it, is
|
||||
@@ -100,6 +101,12 @@ on it, hence the index loops in `HyprChromeShell`.
|
||||
and its panels, with `Bar/Panels/BarPanel.qml` the chamfered chrome they all
|
||||
extend; `Widgets/Polkit/` is the authentication agent and its dialog;
|
||||
`Widgets/Launcher/` is the primary application launcher (`SUPER_L`);
|
||||
`Widgets/Notifications/` is the notification daemon and its popup stack on the
|
||||
rail's monitor (`NotificationCard` is the headless-renderable card);
|
||||
`Widgets/Greeter/` is the greetd login screen, run standalone via `greeter.qml`
|
||||
(see `services/desktop/quickshell-greeter.nix`), NOT part of `shell.qml`;
|
||||
`Widgets/Lock/` is the session lock, which reuses the greeter's
|
||||
`LoginContent` over PAM and runs as its own instance via `lock.qml`;
|
||||
`Theme/Theme.qml` is this tree's palette singleton. `DebugWindow.qml` stages a
|
||||
single widget on the secondary monitor for eyeballing it in isolation.
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@ Scope {
|
||||
|
||||
// Monitor to stage on. Falls back to the LAST connected screen when the
|
||||
// name matches nothing, so a single-monitor session still gets a stage.
|
||||
property string screenName: "HDMI-A-1"
|
||||
// Set per host in home/desktop/options.nix (secondaryOutput).
|
||||
property string screenName: Quickshell.env("QS_SECONDARY_OUTPUT") ?? ""
|
||||
property bool active: true
|
||||
|
||||
default property alias content: slot.data
|
||||
|
||||
@@ -64,6 +64,8 @@ Scope {
|
||||
root.promptText = message === "" ? "Password:" : message;
|
||||
root.fifoPath = fifo;
|
||||
root.failed = false;
|
||||
vault.invalidate();
|
||||
vault.refresh();
|
||||
return "ok";
|
||||
}
|
||||
|
||||
@@ -101,12 +103,22 @@ Scope {
|
||||
if (!root.active)
|
||||
return;
|
||||
|
||||
vault.invalidate();
|
||||
root.pendingSecret = secret + "\n";
|
||||
writer.command = ["sh", "-c", "IFS= read -r line; printf %s \"$line\" > \"$1\"", "sh", root.fifoPath];
|
||||
writer.running = true;
|
||||
root.fifoPath = "";
|
||||
}
|
||||
|
||||
ProtonPass {
|
||||
id: vault
|
||||
|
||||
onFetched: secret => {
|
||||
content.response = secret;
|
||||
content.focusInput();
|
||||
}
|
||||
}
|
||||
|
||||
// Opening a fifo for writing BLOCKS until a reader attaches, which is why
|
||||
// this is a subprocess rather than a FileView: the helper's `cat` is that
|
||||
// reader, and blocking the QML thread on it would freeze the shell.
|
||||
@@ -149,7 +161,7 @@ Scope {
|
||||
id: content
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: Math.max(32, Math.round(parent.height / 3 - height / 2))
|
||||
y: Math.max(32, Math.round(parent.height / 3 - content.dialogHeight / 2))
|
||||
width: 520
|
||||
|
||||
// Deliberately the polkit dialog's own content component: this is a
|
||||
@@ -168,6 +180,17 @@ Scope {
|
||||
responseVisible: false
|
||||
failed: root.failed
|
||||
|
||||
credentialsEnabled: true
|
||||
credentials: vault.entries
|
||||
credentialsStatus: vault.listStatus
|
||||
fetchStatus: vault.fetchStatus
|
||||
|
||||
onCredentialRequested: entry => vault.fetch(entry)
|
||||
onPickerOpened: {
|
||||
if (vault.entries.length === 0)
|
||||
vault.refresh();
|
||||
}
|
||||
|
||||
onSubmitted: value => root.submit(value)
|
||||
onCancelled: root.dismiss()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,162 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.HyprChrome.Theme
|
||||
import qs.HyprChrome.Widgets.Bar.Panels
|
||||
import qs.HyprChrome.Widgets.Bar.Vitals
|
||||
|
||||
// Claude subscription limits on the rail: the 5-hour session window and the
|
||||
// weekly one, plus any per-model weekly caps the plan reports.
|
||||
BarPanel {
|
||||
id: claude
|
||||
|
||||
// Overridable so the headless render can stage it without the network.
|
||||
property var fiveHour: usage.fiveHour
|
||||
property var sevenDay: usage.sevenDay
|
||||
property var extra: usage.extra
|
||||
property string error: usage.error
|
||||
property string shortError: usage.shortError
|
||||
property bool ready: usage.ready
|
||||
|
||||
readonly property var usage: ClaudeState {}
|
||||
|
||||
panelId: "CLD"
|
||||
title: "CLAUDE"
|
||||
meta: claude.error !== "" ? (claude.ready ? "STALE" : "OFFLINE") : claude.ready ? "LIMITS" : "PRIMING"
|
||||
|
||||
// Ticks the reset countdowns without re-polling.
|
||||
property date now: new Date()
|
||||
Timer {
|
||||
interval: 30000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: claude.now = new Date()
|
||||
}
|
||||
|
||||
implicitWidth: claude.expanded
|
||||
? Math.max(claude.headerMinWidth, claude.padding * 2 + body.width)
|
||||
: Math.max(claude.headerMinWidth, claude.briefLeft + brief.implicitWidth + claude.padding)
|
||||
|
||||
function fraction(w) {
|
||||
return w ? Math.max(0, Math.min(1, w.utilization / 100)) : 0;
|
||||
}
|
||||
|
||||
function pct(w) {
|
||||
return w ? Math.round(w.utilization) + "%" : "--";
|
||||
}
|
||||
|
||||
function until(w) {
|
||||
if (!w || !w.resets_at)
|
||||
return "";
|
||||
const mins = Math.max(0, Math.round((new Date(w.resets_at) - claude.now) / 60000));
|
||||
if (mins >= 1440)
|
||||
return `${Math.floor(mins / 1440)}D ${Math.floor(mins % 1440 / 60)}H`;
|
||||
if (mins >= 60)
|
||||
return `${Math.floor(mins / 60)}H ${mins % 60}M`;
|
||||
return `${mins}M`;
|
||||
}
|
||||
|
||||
function tone(w) {
|
||||
const f = claude.fraction(w);
|
||||
return !claude.ready ? Theme.disabled : f >= 0.85 ? Theme.hot : Theme.text;
|
||||
}
|
||||
|
||||
summary: Row {
|
||||
id: brief
|
||||
spacing: 10
|
||||
|
||||
Repeater {
|
||||
model: [
|
||||
{ label: "5H", window: claude.fiveHour },
|
||||
{ label: "7D", window: claude.sevenDay }
|
||||
]
|
||||
|
||||
Row {
|
||||
required property var modelData
|
||||
spacing: 4
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
// Dashes say nothing; with no numbers yet the error label stands alone.
|
||||
visible: claude.ready || claude.shortError === ""
|
||||
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: parent.modelData.label
|
||||
color: Theme.muted
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 10
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: claude.pct(parent.modelData.window)
|
||||
color: claude.tone(parent.modelData.window)
|
||||
font.family: Theme.displayFont
|
||||
font.pixelSize: 13
|
||||
font.bold: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: claude.shortError !== ""
|
||||
text: claude.shortError
|
||||
color: Theme.hot
|
||||
font.family: Theme.displayFont
|
||||
font.pixelSize: 13
|
||||
font.bold: true
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: body
|
||||
width: 260
|
||||
spacing: 5
|
||||
|
||||
Repeater {
|
||||
model: [
|
||||
{ label: "SESSION", window: claude.fiveHour },
|
||||
{ label: "WEEKLY", window: claude.sevenDay }
|
||||
].concat(claude.extra)
|
||||
|
||||
Column {
|
||||
required property var modelData
|
||||
width: body.width
|
||||
spacing: 2
|
||||
|
||||
VitalRow {
|
||||
width: parent.width
|
||||
labelWidth: 64
|
||||
label: parent.modelData.label
|
||||
value: claude.fraction(parent.modelData.window)
|
||||
readout: claude.pct(parent.modelData.window)
|
||||
ready: claude.ready && !!parent.modelData.window
|
||||
}
|
||||
|
||||
Text {
|
||||
x: 64
|
||||
visible: text !== ""
|
||||
text: {
|
||||
const t = claude.until(parent.modelData.window);
|
||||
return t ? `RESETS IN ${t}` : "";
|
||||
}
|
||||
color: Theme.muted
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 9
|
||||
font.letterSpacing: 1.2
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
width: body.width
|
||||
visible: claude.error !== ""
|
||||
text: claude.error.toUpperCase()
|
||||
color: Theme.hot
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 9
|
||||
font.letterSpacing: 1.2
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell.Io
|
||||
|
||||
// Claude subscription limits, polled through `claude-usage` (pkgs/claude-usage.nix),
|
||||
// which reuses Claude Code's OAuth login and prints the usage endpoint's JSON.
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
// Each window is { utilization: 0..100, resets_at: ISO string } or null.
|
||||
property var fiveHour: null
|
||||
property var sevenDay: null
|
||||
// Per-model weekly windows the plan reports, as [{ label, window }].
|
||||
property var extra: []
|
||||
property string error: ""
|
||||
property bool ready: false
|
||||
|
||||
// The endpoint is rate-limited and the numbers move slowly; a failure
|
||||
// retries sooner so the panel recovers once Claude Code renews the token.
|
||||
property int interval: root.error !== "" ? 60000 : 300000
|
||||
|
||||
// Collapsed-rail label for the current error.
|
||||
readonly property string shortError: {
|
||||
if (root.error === "")
|
||||
return "";
|
||||
return /refresh|401|not logged in|no refresh token/.test(root.error) ? "EXPIRED" : "ERR";
|
||||
}
|
||||
|
||||
readonly property var proc: Process {
|
||||
id: proc
|
||||
command: ["claude-usage"]
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: root.ingest(this.text)
|
||||
}
|
||||
}
|
||||
|
||||
readonly property var poll: Timer {
|
||||
interval: root.interval
|
||||
running: true
|
||||
repeat: true
|
||||
triggeredOnStart: true
|
||||
onTriggered: {
|
||||
if (!proc.running)
|
||||
proc.running = true;
|
||||
}
|
||||
}
|
||||
|
||||
function fail(message: string): void {
|
||||
console.warn(`claude-usage: ${message}`);
|
||||
root.error = message;
|
||||
}
|
||||
|
||||
function ingest(text: string): void {
|
||||
let msg;
|
||||
try {
|
||||
msg = JSON.parse(text);
|
||||
} catch (e) {
|
||||
root.fail("no output");
|
||||
return;
|
||||
}
|
||||
if (msg.error) {
|
||||
// Keep the last good numbers; a failed poll is not zero usage.
|
||||
root.fail(msg.error);
|
||||
return;
|
||||
}
|
||||
root.error = "";
|
||||
root.fiveHour = msg.five_hour ?? null;
|
||||
root.sevenDay = msg.seven_day ?? null;
|
||||
|
||||
const found = [];
|
||||
for (const key of Object.keys(msg)) {
|
||||
const m = key.match(/^seven_day_(\w+)$/);
|
||||
const w = msg[key];
|
||||
if (m && w && typeof w.utilization === "number")
|
||||
found.push({ label: m[1].toUpperCase().replace(/_/g, " "), window: w });
|
||||
}
|
||||
root.extra = found;
|
||||
root.ready = true;
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,8 @@ import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import qs.HyprChrome.Theme
|
||||
import qs.HyprChrome.Widgets.Bar.Debug
|
||||
import qs.HyprChrome.Widgets.Bar.Luna
|
||||
import qs.HyprChrome.Widgets.Bar.Claude
|
||||
import qs.HyprChrome.Widgets.Bar.Host
|
||||
import qs.HyprChrome.Widgets.Bar.Vitals
|
||||
import qs.HyprChrome.Widgets.Bar.Workspaces
|
||||
@@ -87,8 +88,8 @@ PanelWindow {
|
||||
//
|
||||
// The zone still follows the target height, so tiled windows reflow once
|
||||
// per toggle, at the start, and slide while the panels animate.
|
||||
readonly property real expandedContent: Math.max(hostPanel.expandedHeight, workspacesPanel.expandedHeight, vitalsPanel.expandedHeight, testPanel.expandedHeight, trayPanel.expandedHeight) + window.margin * 2
|
||||
readonly property real contentHeight: Math.max(hostPanel.targetHeight, workspacesPanel.targetHeight, vitalsPanel.targetHeight, testPanel.targetHeight, trayPanel.targetHeight) + window.margin * 2
|
||||
readonly property real expandedContent: Math.max(hostPanel.expandedHeight, workspacesPanel.expandedHeight, vitalsPanel.expandedHeight, lunaPanel.expandedHeight, claudePanel.expandedHeight, trayPanel.expandedHeight) + window.margin * 2
|
||||
readonly property real contentHeight: Math.max(hostPanel.targetHeight, workspacesPanel.targetHeight, vitalsPanel.targetHeight, lunaPanel.targetHeight, claudePanel.targetHeight, trayPanel.targetHeight) + window.margin * 2
|
||||
|
||||
implicitHeight: Math.round(window.expandedContent)
|
||||
|
||||
@@ -157,10 +158,23 @@ PanelWindow {
|
||||
// and a trace at each end.
|
||||
Item { Layout.fillWidth: true }
|
||||
|
||||
TestPanel {
|
||||
id: testPanel
|
||||
LunaPanel {
|
||||
id: lunaPanel
|
||||
|
||||
expanded: window.expanded
|
||||
// Claude butts against its right edge.
|
||||
rightChamfer: false
|
||||
|
||||
toggleOnClick: false
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
ClaudePanel {
|
||||
id: claudePanel
|
||||
|
||||
expanded: window.expanded
|
||||
leftChamfer: false
|
||||
|
||||
toggleOnClick: false
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.HyprChrome.Theme
|
||||
import qs.HyprChrome.Widgets.Bar.Panels
|
||||
|
||||
// luna's voice loop on the rail (services/desktop/luna-voice.nix).
|
||||
//
|
||||
// Always present, unlike the daemon it watches: the panel is where you look
|
||||
// to find out whether she is listening, so it has to be there when the answer
|
||||
// is "no" — including when luna-voiced is not running at all. SUPER+V toggles
|
||||
// LISTENING, not this.
|
||||
//
|
||||
// Collapsed it is the state and nothing else, because that is the one fact
|
||||
// worth a glance; expanded it carries the last exchange, which is the thing
|
||||
// you actually want during the seconds her reply takes to arrive.
|
||||
BarPanel {
|
||||
id: luna
|
||||
|
||||
// Overridable so the headless render can stage every state without a
|
||||
// daemon; in the rail they track the socket below.
|
||||
property string daemonState: state.state
|
||||
property bool active: state.active
|
||||
property bool connected: state.connected
|
||||
property real rms: state.rms
|
||||
property string userText: state.userText
|
||||
property string lunaText: state.lunaText
|
||||
|
||||
// Instantiated here rather than in the shell: the panel is the only
|
||||
// reader, and it is a second reader that would make this shell state.
|
||||
readonly property var state: LunaState {}
|
||||
|
||||
panelId: "LUN"
|
||||
title: "LUNA"
|
||||
meta: luna.active ? "MIC ON" : "MIC OFF"
|
||||
|
||||
// Sized to content like the tray, and per DENSITY: collapsed it is one
|
||||
// word, so reserving the expanded body's width would leave the rail
|
||||
// carrying a mostly empty panel for the state it spends most of its time
|
||||
// in. It floats between two spacers, so the width change costs no other
|
||||
// panel anything.
|
||||
implicitWidth: luna.expanded
|
||||
? Math.max(luna.headerMinWidth, luna.padding * 2 + body.implicitWidth)
|
||||
: Math.max(luna.headerMinWidth, luna.briefLeft + brief.implicitWidth + luna.padding)
|
||||
|
||||
readonly property color stateColor: {
|
||||
if (!luna.connected)
|
||||
return Theme.disabled;
|
||||
switch (luna.daemonState) {
|
||||
case "listening":
|
||||
return Theme.accent;
|
||||
case "thinking":
|
||||
return Theme.muted;
|
||||
case "speaking":
|
||||
return Theme.accentSoft;
|
||||
default:
|
||||
return luna.active ? Theme.text : Theme.raised;
|
||||
}
|
||||
}
|
||||
|
||||
readonly property string stateLabel: {
|
||||
if (!luna.connected)
|
||||
return "OFFLINE";
|
||||
// Her own state first: a muted mic no longer stops her answering.
|
||||
switch (luna.daemonState) {
|
||||
case "listening":
|
||||
return "LISTENING";
|
||||
case "thinking":
|
||||
return "THINKING";
|
||||
case "speaking":
|
||||
return "SPEAKING";
|
||||
default:
|
||||
return luna.active ? "READY" : "MUTED";
|
||||
}
|
||||
}
|
||||
|
||||
summary: Row {
|
||||
id: brief
|
||||
spacing: 6
|
||||
|
||||
// Breathes only while the mic is open, so "she is listening to me
|
||||
// right now" is legible without reading the word next to it.
|
||||
Rectangle {
|
||||
width: 7
|
||||
height: 7
|
||||
radius: 4
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: luna.stateColor
|
||||
|
||||
SequentialAnimation on opacity {
|
||||
running: luna.daemonState === "listening"
|
||||
loops: Animation.Infinite
|
||||
alwaysRunToEnd: true
|
||||
NumberAnimation { to: 0.25; duration: 700; easing.type: Easing.InOutQuad }
|
||||
NumberAnimation { to: 1.0; duration: 700; easing.type: Easing.InOutQuad }
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: luna.stateLabel
|
||||
color: luna.stateColor
|
||||
font.family: Theme.displayFont
|
||||
font.pixelSize: 13
|
||||
font.bold: true
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: body
|
||||
spacing: 6
|
||||
|
||||
// Level meter: live whenever voice mode is on, not only once a
|
||||
// trigger has fired, so a mic too quiet to reach the threshold still
|
||||
// shows movement instead of looking broken.
|
||||
Row {
|
||||
id: meter
|
||||
width: 260
|
||||
height: 18
|
||||
spacing: 2
|
||||
|
||||
readonly property int count: 28
|
||||
readonly property bool sweeping: luna.daemonState === "thinking"
|
||||
property real phase: 0
|
||||
|
||||
NumberAnimation on phase {
|
||||
running: meter.sweeping
|
||||
loops: Animation.Infinite
|
||||
from: 0
|
||||
to: 1
|
||||
duration: 1200
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: meter.count
|
||||
|
||||
Rectangle {
|
||||
required property int index
|
||||
|
||||
width: (meter.width - (meter.count - 1) * meter.spacing) / meter.count
|
||||
height: {
|
||||
if (meter.sweeping) {
|
||||
const pos = index / (meter.count - 1);
|
||||
return 2 + 14 * Math.max(0, 1 - Math.abs(pos - meter.phase) * 6);
|
||||
}
|
||||
if (!luna.active && luna.daemonState !== "speaking")
|
||||
return 2;
|
||||
// sqrt opens up the quiet end, which on this mic is
|
||||
// where all of the speech actually sits.
|
||||
const level = Math.min(1, Math.sqrt(luna.rms) * 6.0);
|
||||
const centre = 1 - Math.abs(index / (meter.count - 1) - 0.5) * 1.6;
|
||||
return 2 + 16 * level * Math.max(0.15, centre);
|
||||
}
|
||||
anchors.bottom: parent.bottom
|
||||
color: luna.stateColor
|
||||
opacity: meter.sweeping ? 0.9 : 0.5 + 0.5 * (height / 18)
|
||||
|
||||
Behavior on height {
|
||||
enabled: !meter.sweeping
|
||||
NumberAnimation { duration: 70; easing.type: Easing.OutQuad }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
width: 260
|
||||
visible: luna.userText !== ""
|
||||
text: `> ${luna.userText}`
|
||||
color: Theme.muted
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 10
|
||||
wrapMode: Text.WordWrap
|
||||
maximumLineCount: 2
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
Text {
|
||||
width: 260
|
||||
visible: luna.lunaText !== ""
|
||||
text: luna.lunaText
|
||||
color: Theme.text
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 11
|
||||
wrapMode: Text.WordWrap
|
||||
maximumLineCount: 4
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
Text {
|
||||
visible: luna.userText === "" && luna.lunaText === ""
|
||||
text: luna.connected ? "SUPER+V TO TALK" : "DAEMON NOT RUNNING"
|
||||
color: Theme.muted
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 9
|
||||
font.letterSpacing: 1.4
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
// Everything the Luna surfaces know, read off luna-voiced's unix socket
|
||||
// (services/desktop/luna-voice.nix).
|
||||
//
|
||||
// Read-only on purpose: the key that toggles voice mode runs `luna-voice
|
||||
// toggle` from Hyprland rather than writing here, so the toggle keeps working
|
||||
// while the shell is reloading — and a QML error can never leave the mic on
|
||||
// with nothing showing it.
|
||||
//
|
||||
// The daemon is a USER service that may start after the shell, restart under
|
||||
// it, or not be installed at all, so a missing socket is a normal state and
|
||||
// not an error: `reconnect` retries quietly and `connected` is what the
|
||||
// widget shows.
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
// "idle" | "listening" | "thinking" | "speaking"
|
||||
property string state: "idle"
|
||||
// Whether the mic is open. She still answers and speaks while it is not.
|
||||
property bool active: false
|
||||
// Set by the first line, not by the process starting: the daemon replays
|
||||
// its state on connect, so only a live connection produces one.
|
||||
property bool connected: false
|
||||
// Mic level while listening, her output level while speaking. Drives the
|
||||
// only genuinely live part of the visuals.
|
||||
property real rms: 0
|
||||
property string userText: ""
|
||||
property string lunaText: ""
|
||||
property string error: ""
|
||||
|
||||
// `luna-voice watch`, not Quickshell's Socket: a Socket whose connect
|
||||
// fails once (daemon mid-restart) keeps the dead QLocalSocket and ignores
|
||||
// every later `connected = true`, so the widget stuck on OFFLINE.
|
||||
readonly property var watch: Process {
|
||||
id: watch
|
||||
command: ["luna-voice", "watch"]
|
||||
running: true
|
||||
|
||||
stdout: SplitParser {
|
||||
splitMarker: "\n"
|
||||
onRead: line => {
|
||||
root.connected = true;
|
||||
root.ingest(line);
|
||||
}
|
||||
}
|
||||
|
||||
onExited: {
|
||||
// A daemon that went away is not a daemon that is idle: reset
|
||||
// rather than leave the last frame of a conversation frozen
|
||||
// on screen.
|
||||
root.connected = false;
|
||||
root.active = false;
|
||||
root.state = "idle";
|
||||
root.rms = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Retry forever, cheaply; each attempt is a fresh connection.
|
||||
readonly property var reconnect: Timer {
|
||||
interval: 2000
|
||||
running: !watch.running
|
||||
repeat: true
|
||||
onTriggered: watch.running = true
|
||||
}
|
||||
|
||||
function ingest(line: string): void {
|
||||
let msg;
|
||||
try {
|
||||
msg = JSON.parse(line);
|
||||
} catch (e) {
|
||||
return; // a half-written line is not worth a console error
|
||||
}
|
||||
|
||||
switch (msg.type) {
|
||||
case "mode":
|
||||
root.active = msg.active;
|
||||
if (!msg.active) {
|
||||
root.state = "idle";
|
||||
root.rms = 0;
|
||||
}
|
||||
break;
|
||||
case "state":
|
||||
root.state = msg.value;
|
||||
// Level is only meaningful during the phase that produces it.
|
||||
if (msg.value !== "listening" && msg.value !== "speaking")
|
||||
root.rms = 0;
|
||||
break;
|
||||
case "amplitude":
|
||||
root.rms = msg.rms;
|
||||
break;
|
||||
case "caption":
|
||||
if (msg.speaker === "user") {
|
||||
// A new user caption starts a turn, so it is what clears her
|
||||
// last reply — NOT speech_start, which arrives after her
|
||||
// first caption, not before it.
|
||||
root.userText = msg.text;
|
||||
root.lunaText = "";
|
||||
} else {
|
||||
root.lunaText = msg.text;
|
||||
}
|
||||
break;
|
||||
case "error":
|
||||
root.error = msg.message;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Services.Greetd
|
||||
import qs.HyprChrome.Widgets
|
||||
|
||||
// greetd greeter: backdrop on every output, login panel on the primary one.
|
||||
// Configured through env set by services/desktop/quickshell-greeter.nix.
|
||||
Scope {
|
||||
id: root
|
||||
|
||||
readonly property string primaryName: Quickshell.env("QS_GREETER_OUTPUT") ?? ""
|
||||
readonly property string defaultUser: Quickshell.env("QS_GREETER_USER") ?? ""
|
||||
readonly property string sessionCommand: Quickshell.env("QS_GREETER_SESSION") || "start-hyprland"
|
||||
readonly property string sessionName: Quickshell.env("QS_GREETER_SESSION_NAME") || "hyprland"
|
||||
readonly property string hostName: Quickshell.env("QS_GREETER_HOST") || "localhost"
|
||||
|
||||
readonly property var primaryScreen: {
|
||||
const screens = Quickshell.screens;
|
||||
if (screens.length === 0)
|
||||
return null;
|
||||
for (let i = 0; i < screens.length; i++) {
|
||||
if (screens[i].name === root.primaryName)
|
||||
return screens[i];
|
||||
}
|
||||
return screens[0];
|
||||
}
|
||||
|
||||
// Typed password, held until PAM's first secret prompt arrives.
|
||||
property string pendingSecret: ""
|
||||
// PAM asked a follow-up (OTP etc.) that the user must answer directly.
|
||||
property bool awaitingResponse: false
|
||||
property bool busy: false
|
||||
property bool launching: false
|
||||
|
||||
function setMessage(text, isError) {
|
||||
content.message = text;
|
||||
content.messageIsError = isError;
|
||||
}
|
||||
|
||||
function resetToPassword() {
|
||||
root.pendingSecret = "";
|
||||
root.awaitingResponse = false;
|
||||
root.busy = false;
|
||||
content.inputPrompt = "";
|
||||
content.responseVisible = false;
|
||||
content.clearSecret();
|
||||
content.focusSecret();
|
||||
}
|
||||
|
||||
function submit(user, secret) {
|
||||
if (!Greetd.available) {
|
||||
root.setMessage("greetd socket unavailable", true);
|
||||
return;
|
||||
}
|
||||
|
||||
content.failed = false;
|
||||
|
||||
if (root.awaitingResponse) {
|
||||
root.awaitingResponse = false;
|
||||
root.busy = true;
|
||||
content.clearSecret();
|
||||
Greetd.respond(secret);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Greetd.state !== GreetdState.Inactive)
|
||||
return;
|
||||
|
||||
root.setMessage("", false);
|
||||
root.pendingSecret = secret;
|
||||
root.busy = true;
|
||||
Greetd.createSession(user);
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Greetd
|
||||
|
||||
function onAuthMessage(message, error, responseRequired, echoResponse) {
|
||||
if (!responseRequired) {
|
||||
root.setMessage(message, error);
|
||||
return;
|
||||
}
|
||||
|
||||
// First hidden prompt is the password already typed.
|
||||
if (root.pendingSecret !== "" && !echoResponse) {
|
||||
const secret = root.pendingSecret;
|
||||
root.pendingSecret = "";
|
||||
Greetd.respond(secret);
|
||||
return;
|
||||
}
|
||||
|
||||
root.busy = false;
|
||||
root.awaitingResponse = true;
|
||||
content.inputPrompt = message.replace(/:\s*$/, "");
|
||||
content.responseVisible = echoResponse;
|
||||
content.clearSecret();
|
||||
content.focusSecret();
|
||||
}
|
||||
|
||||
function onAuthFailure(message) {
|
||||
root.resetToPassword();
|
||||
content.failed = true;
|
||||
root.setMessage(message || "authentication failed", true);
|
||||
}
|
||||
|
||||
function onError(error) {
|
||||
root.resetToPassword();
|
||||
root.setMessage(error, true);
|
||||
}
|
||||
|
||||
function onReadyToLaunch() {
|
||||
root.setMessage("starting " + root.sessionName, false);
|
||||
root.launching = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Fade out first: greetd wants the greeter gone promptly after launch().
|
||||
Timer {
|
||||
running: root.launching
|
||||
interval: 220
|
||||
onTriggered: Greetd.launch([root.sessionCommand])
|
||||
}
|
||||
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
|
||||
ChromeBackdrop {
|
||||
required property var modelData
|
||||
|
||||
screen: modelData
|
||||
active: true
|
||||
dim: 1
|
||||
wlrLayer: WlrLayer.Background
|
||||
}
|
||||
}
|
||||
|
||||
PanelWindow {
|
||||
screen: root.primaryScreen
|
||||
visible: root.primaryScreen !== null
|
||||
|
||||
WlrLayershell.namespace: "hyprchrome-greeter"
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
color: "transparent"
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
left: true
|
||||
right: true
|
||||
bottom: true
|
||||
}
|
||||
|
||||
LoginContent {
|
||||
id: content
|
||||
|
||||
width: 640
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: Math.max(32, Math.round(parent.height * 0.42 - height / 2)) + (1 - opacity) * 12
|
||||
|
||||
opacity: root.launching ? 0 : 1
|
||||
Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutCubic } }
|
||||
|
||||
hostName: root.hostName
|
||||
sessionName: root.sessionName
|
||||
user: root.defaultUser
|
||||
busy: root.busy || root.launching
|
||||
|
||||
onSubmitted: (user, secret) => root.submit(user, secret)
|
||||
|
||||
// A different user invalidates a half-finished conversation.
|
||||
onUserEdited: {
|
||||
if (Greetd.state !== GreetdState.Inactive)
|
||||
Greetd.cancelSession();
|
||||
root.resetToPassword();
|
||||
content.focusUser();
|
||||
}
|
||||
|
||||
onPowerRequested: action => Quickshell.execDetached(["systemctl", action])
|
||||
|
||||
Component.onCompleted: {
|
||||
if (root.defaultUser !== "")
|
||||
content.focusSecret();
|
||||
else
|
||||
content.focusUser();
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
running: true
|
||||
repeat: true
|
||||
interval: 1000
|
||||
triggeredOnStart: true
|
||||
onTriggered: content.now = new Date()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,311 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.HyprChrome.Theme
|
||||
|
||||
// Headless visual core of the login greeter; Greeter.qml owns greetd.
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property string hostName: ""
|
||||
property string sessionName: ""
|
||||
property string title: "SESSION // " + root.hostName.toUpperCase()
|
||||
property string panelId: "LGN"
|
||||
property string meta: "GREETD"
|
||||
property string submitLabel: "LOG IN"
|
||||
// Off for the lock screen: the session's user is the only one who unlocks.
|
||||
property bool userEditable: true
|
||||
property bool showPower: true
|
||||
property date now: new Date()
|
||||
|
||||
// Label over the secret field. Empty means the plain password step; set
|
||||
// when PAM asks for something else (OTP, PIN).
|
||||
property string inputPrompt: ""
|
||||
property bool responseVisible: false
|
||||
|
||||
property string message: ""
|
||||
property bool messageIsError: false
|
||||
property bool failed: false
|
||||
property bool busy: false
|
||||
|
||||
property alias user: userInput.text
|
||||
property alias response: secretInput.text
|
||||
|
||||
signal submitted(string user, string response)
|
||||
signal userEdited
|
||||
signal powerRequested(string action)
|
||||
|
||||
function focusSecret() { secretInput.forceActiveFocus(); }
|
||||
function focusUser() { userInput.forceActiveFocus(); }
|
||||
function clearSecret() { secretInput.text = ""; }
|
||||
|
||||
implicitWidth: 640
|
||||
implicitHeight: panel.implicitHeight
|
||||
|
||||
function submit() {
|
||||
if (root.busy)
|
||||
return;
|
||||
if (userInput.text.trim() === "") {
|
||||
root.focusUser();
|
||||
return;
|
||||
}
|
||||
root.submitted(userInput.text.trim(), secretInput.text);
|
||||
}
|
||||
|
||||
component MicroText: Text {
|
||||
color: Theme.muted
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 8
|
||||
font.letterSpacing: 0.9
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
component Field: Rectangle {
|
||||
id: field
|
||||
|
||||
property bool active: false
|
||||
property bool alert: false
|
||||
property string glyph: ""
|
||||
default property alias input: slot.data
|
||||
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 36
|
||||
color: Theme.selection
|
||||
border.width: 1
|
||||
border.color: field.alert ? Theme.hot : field.active ? Theme.accentAlpha(0.7) : Theme.hair
|
||||
|
||||
Behavior on border.color { ColorAnimation { duration: 120 } }
|
||||
|
||||
// Focus tick on the left edge.
|
||||
Rectangle {
|
||||
width: 2
|
||||
height: parent.height
|
||||
color: Theme.accent
|
||||
visible: field.active
|
||||
}
|
||||
|
||||
Text {
|
||||
id: glyphText
|
||||
|
||||
x: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: field.glyph
|
||||
color: field.active ? Theme.accent : Theme.disabled
|
||||
font.family: Theme.displayFont
|
||||
font.pixelSize: 14
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Item {
|
||||
id: slot
|
||||
|
||||
anchors.left: glyphText.right
|
||||
anchors.leftMargin: 10
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 12
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
}
|
||||
}
|
||||
|
||||
component PowerChip: Rectangle {
|
||||
id: chip
|
||||
|
||||
property string label: ""
|
||||
property string action: ""
|
||||
|
||||
width: chipLabel.implicitWidth + 16
|
||||
height: chipLabel.implicitHeight + 8
|
||||
color: chipMouse.containsMouse ? Theme.accent : "transparent"
|
||||
border.width: 1
|
||||
border.color: chipMouse.containsMouse ? Theme.accent : Theme.disabled
|
||||
|
||||
Text {
|
||||
id: chipLabel
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: chip.label
|
||||
color: chipMouse.containsMouse ? Theme.surface : Theme.muted
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 9
|
||||
font.letterSpacing: 0.8
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: chipMouse
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.powerRequested(chip.action)
|
||||
}
|
||||
}
|
||||
|
||||
LoginPanel {
|
||||
id: panel
|
||||
|
||||
width: root.width
|
||||
panelId: root.panelId
|
||||
title: root.title
|
||||
meta: root.meta
|
||||
busy: root.busy
|
||||
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
spacing: 16
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 20
|
||||
|
||||
// ---- clock column ----
|
||||
ColumnLayout {
|
||||
Layout.preferredWidth: 190
|
||||
Layout.alignment: Qt.AlignTop
|
||||
spacing: 4
|
||||
|
||||
Text {
|
||||
text: Qt.formatTime(root.now, "HH:mm")
|
||||
color: Theme.text
|
||||
font.family: Theme.displayFont
|
||||
font.pixelSize: 54
|
||||
font.letterSpacing: 2
|
||||
}
|
||||
|
||||
MicroText {
|
||||
text: Qt.formatDate(root.now, "ddd dd.MM.yyyy").toUpperCase()
|
||||
color: Theme.accent
|
||||
font.pixelSize: 10
|
||||
}
|
||||
|
||||
// Seconds as a segment meter: one cell per five seconds.
|
||||
Row {
|
||||
Layout.topMargin: 10
|
||||
spacing: 3
|
||||
|
||||
Repeater {
|
||||
model: 12
|
||||
|
||||
Rectangle {
|
||||
required property int index
|
||||
|
||||
width: 11
|
||||
height: 5
|
||||
color: index < Math.floor(root.now.getSeconds() / 5) + 1
|
||||
? Theme.accent : Theme.raised
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MicroText {
|
||||
Layout.topMargin: 10
|
||||
text: "SESSION " + root.sessionName.toUpperCase()
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Layout.fillHeight: true
|
||||
implicitWidth: 1
|
||||
color: Theme.textAlpha(0.12)
|
||||
}
|
||||
|
||||
// ---- credentials ----
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
spacing: 6
|
||||
|
||||
MicroText { text: "OPERATOR" }
|
||||
|
||||
Field {
|
||||
glyph: "@"
|
||||
active: userInput.activeFocus
|
||||
|
||||
TextInput {
|
||||
id: userInput
|
||||
|
||||
anchors.fill: parent
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
enabled: root.userEditable && !root.busy && root.inputPrompt === ""
|
||||
color: Theme.text
|
||||
selectionColor: Theme.accent
|
||||
selectedTextColor: Theme.surface
|
||||
font.family: Theme.displayFont
|
||||
font.pixelSize: 14
|
||||
font.letterSpacing: 1
|
||||
clip: true
|
||||
|
||||
onTextEdited: root.userEdited()
|
||||
onAccepted: root.focusSecret()
|
||||
KeyNavigation.tab: secretInput
|
||||
}
|
||||
}
|
||||
|
||||
MicroText {
|
||||
Layout.topMargin: 6
|
||||
text: root.inputPrompt !== "" ? root.inputPrompt.toUpperCase() : "PASSPHRASE"
|
||||
color: root.inputPrompt !== "" ? Theme.accent : Theme.muted
|
||||
}
|
||||
|
||||
Field {
|
||||
glyph: ">_"
|
||||
active: secretInput.activeFocus
|
||||
alert: root.failed
|
||||
|
||||
TextInput {
|
||||
id: secretInput
|
||||
|
||||
anchors.fill: parent
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
enabled: !root.busy
|
||||
color: Theme.text
|
||||
selectionColor: Theme.accent
|
||||
selectedTextColor: Theme.surface
|
||||
font.family: Theme.displayFont
|
||||
font.pixelSize: 14
|
||||
font.letterSpacing: 1
|
||||
clip: true
|
||||
|
||||
echoMode: root.responseVisible ? TextInput.Normal : TextInput.Password
|
||||
passwordCharacter: "▪"
|
||||
passwordMaskDelay: 0
|
||||
|
||||
onAccepted: root.submit()
|
||||
KeyNavigation.backtab: userInput
|
||||
}
|
||||
}
|
||||
|
||||
// Status line; keeps its height so the panel does not jump.
|
||||
MicroText {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 4
|
||||
Layout.preferredHeight: 12
|
||||
text: root.busy && root.message === "" ? "AUTHENTICATING…" : root.message.toUpperCase()
|
||||
color: root.messageIsError ? Theme.hot : root.busy ? Theme.accent : Theme.muted
|
||||
font.pixelSize: 9
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---- footer ----
|
||||
Rectangle {
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 1
|
||||
color: Theme.textAlpha(0.12)
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 14
|
||||
|
||||
MicroText { text: "ENTER " + root.submitLabel }
|
||||
MicroText { text: "TAB SWITCH FIELD"; visible: root.userEditable }
|
||||
Item { Layout.fillWidth: true }
|
||||
|
||||
PowerChip { label: "REBOOT"; action: "reboot"; visible: root.showPower }
|
||||
PowerChip { label: "POWER OFF"; action: "poweroff"; visible: root.showPower }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
import qs.HyprChrome.Theme
|
||||
|
||||
// Panel chrome for the login greeter. Same vocabulary as PolkitPanel, mirrored:
|
||||
// cuts on the OTHER diagonal (top-left, bottom-right), registration brackets
|
||||
// instead of detached caps, and a segmented accent spine down the left edge.
|
||||
Item {
|
||||
id: panel
|
||||
|
||||
property string panelId: ""
|
||||
property string title: ""
|
||||
property string meta: ""
|
||||
|
||||
property int chamfer: 20
|
||||
property int padding: 18
|
||||
property int spineWidth: 3
|
||||
property int spineSegments: 9
|
||||
|
||||
// Sweeps the bottom rule while greetd is working.
|
||||
property bool busy: false
|
||||
|
||||
readonly property int headerHeight: 32
|
||||
readonly property int headerPadding: 12
|
||||
|
||||
property real bracketGap: 6
|
||||
property real bracketArm: 14
|
||||
|
||||
readonly property real activeChamfer: Math.max(2, Math.min(panel.chamfer, panel.height / 2 - 1))
|
||||
|
||||
default property alias content: body.data
|
||||
|
||||
implicitHeight: Math.round(body.y + body.height + panel.padding)
|
||||
|
||||
Shape {
|
||||
id: panelShape
|
||||
|
||||
anchors.fill: parent
|
||||
preferredRendererType: Shape.CurveRenderer
|
||||
|
||||
ShapePath {
|
||||
fillColor: Theme.surface
|
||||
strokeColor: Theme.hair
|
||||
strokeWidth: 1
|
||||
|
||||
startX: panel.activeChamfer; startY: 0
|
||||
PathLine { x: panelShape.width; y: 0 }
|
||||
PathLine { x: panelShape.width; y: panelShape.height - panel.activeChamfer }
|
||||
PathLine { x: panelShape.width - panel.activeChamfer; y: panelShape.height }
|
||||
PathLine { x: 0; y: panelShape.height }
|
||||
PathLine { x: 0; y: panel.activeChamfer }
|
||||
PathLine { x: panel.activeChamfer; y: 0 }
|
||||
}
|
||||
|
||||
// Accent along each cut, inset so it reads as an edge highlight.
|
||||
ShapePath {
|
||||
fillColor: "transparent"
|
||||
strokeColor: Theme.accent
|
||||
strokeWidth: 2
|
||||
capStyle: ShapePath.FlatCap
|
||||
|
||||
startX: 0; startY: panel.activeChamfer
|
||||
PathLine { x: panel.activeChamfer; y: 0 }
|
||||
}
|
||||
|
||||
ShapePath {
|
||||
fillColor: "transparent"
|
||||
strokeColor: Theme.accent
|
||||
strokeWidth: 2
|
||||
capStyle: ShapePath.FlatCap
|
||||
|
||||
startX: panelShape.width; startY: panelShape.height - panel.activeChamfer
|
||||
PathLine { x: panelShape.width - panel.activeChamfer; y: panelShape.height }
|
||||
}
|
||||
|
||||
// Registration brackets on the two square corners, echoing the
|
||||
// backdrop's crosses.
|
||||
ShapePath {
|
||||
fillColor: "transparent"
|
||||
strokeColor: Theme.muted
|
||||
strokeWidth: 1
|
||||
|
||||
startX: panelShape.width + panel.bracketGap - panel.bracketArm
|
||||
startY: -panel.bracketGap
|
||||
PathLine { x: panelShape.width + panel.bracketGap; y: -panel.bracketGap }
|
||||
PathLine { x: panelShape.width + panel.bracketGap; y: -panel.bracketGap + panel.bracketArm }
|
||||
}
|
||||
|
||||
ShapePath {
|
||||
fillColor: "transparent"
|
||||
strokeColor: Theme.muted
|
||||
strokeWidth: 1
|
||||
|
||||
startX: -panel.bracketGap
|
||||
startY: panelShape.height + panel.bracketGap - panel.bracketArm
|
||||
PathLine { x: -panel.bracketGap; y: panelShape.height + panel.bracketGap }
|
||||
PathLine { x: -panel.bracketGap + panel.bracketArm; y: panelShape.height + panel.bracketGap }
|
||||
}
|
||||
}
|
||||
|
||||
// Segmented spine, below the header.
|
||||
Column {
|
||||
x: 0
|
||||
y: panel.headerHeight + 8
|
||||
spacing: 3
|
||||
|
||||
readonly property real segment: (panel.height - panel.headerHeight - 8 - panel.activeChamfer - 8
|
||||
- (panel.spineSegments - 1) * spacing) / panel.spineSegments
|
||||
|
||||
Repeater {
|
||||
model: panel.spineSegments
|
||||
|
||||
Rectangle {
|
||||
required property int index
|
||||
|
||||
width: panel.spineWidth
|
||||
height: Math.max(1, parent.segment)
|
||||
color: Theme.accent
|
||||
// Fades downward.
|
||||
opacity: 1 - index / panel.spineSegments * 0.85
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Header: title, meta, slug chip on the right.
|
||||
Text {
|
||||
x: panel.activeChamfer + panel.headerPadding
|
||||
anchors.verticalCenter: header.verticalCenter
|
||||
text: panel.title
|
||||
color: Theme.text
|
||||
font.family: Theme.displayFont
|
||||
font.pixelSize: 12
|
||||
font.bold: true
|
||||
font.letterSpacing: 1.4
|
||||
}
|
||||
|
||||
Row {
|
||||
id: header
|
||||
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: panel.headerPadding
|
||||
y: Math.round((panel.headerHeight - height) / 2)
|
||||
spacing: 12
|
||||
|
||||
Text {
|
||||
anchors.verticalCenter: slugChip.verticalCenter
|
||||
visible: panel.meta.length > 0
|
||||
text: panel.meta
|
||||
color: Theme.muted
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 8
|
||||
font.letterSpacing: 0.7
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: slugChip
|
||||
|
||||
width: slugText.implicitWidth + 10
|
||||
height: slugText.implicitHeight + 4
|
||||
color: "transparent"
|
||||
border.width: 1
|
||||
border.color: Theme.accent
|
||||
|
||||
Text {
|
||||
id: slugText
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: panel.panelId
|
||||
color: Theme.accent
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 11
|
||||
font.bold: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Header rule: dashed, not solid, to set it apart from the polkit dialog.
|
||||
Row {
|
||||
x: panel.activeChamfer
|
||||
y: panel.headerHeight
|
||||
spacing: 3
|
||||
|
||||
Repeater {
|
||||
model: Math.max(0, Math.floor((panel.width - panel.activeChamfer - 1) / 9))
|
||||
|
||||
Rectangle {
|
||||
width: 6
|
||||
height: 1
|
||||
color: Theme.textAlpha(0.18)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Busy sweep along the bottom edge.
|
||||
Item {
|
||||
x: 0
|
||||
y: panel.height - 2
|
||||
width: panel.width - panel.activeChamfer
|
||||
height: 2
|
||||
clip: true
|
||||
visible: panel.busy
|
||||
|
||||
Rectangle {
|
||||
id: sweep
|
||||
|
||||
width: parent.width / 4
|
||||
height: parent.height
|
||||
color: Theme.accent
|
||||
|
||||
NumberAnimation on x {
|
||||
running: panel.busy
|
||||
loops: Animation.Infinite
|
||||
from: -sweep.width
|
||||
to: panel.width
|
||||
duration: 900
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: body
|
||||
|
||||
x: panel.padding + panel.spineWidth
|
||||
y: panel.headerHeight + panel.padding
|
||||
width: Math.max(0, panel.width - panel.padding * 2 - panel.spineWidth)
|
||||
height: childrenRect.height
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Wayland
|
||||
@@ -8,6 +9,7 @@ import qs.HyprChrome.Widgets
|
||||
import qs.HyprChrome.Widgets.Polkit
|
||||
import qs.HyprChrome.Widgets.Launcher
|
||||
import qs.HyprChrome.Widgets.Askpass
|
||||
import qs.HyprChrome.Widgets.Notifications
|
||||
|
||||
// The hyprchrome shell: owns everything the rail's surfaces have to agree on,
|
||||
// and instantiates them.
|
||||
@@ -38,7 +40,8 @@ Scope {
|
||||
// the name matches nothing, so the bar still appears on a single-monitor
|
||||
// session or after a cable swap (DebugWindow falls back to the last one
|
||||
// instead — it wants the secondary).
|
||||
property string screenName: "DP-2"
|
||||
// Set per host in home/desktop/options.nix (primaryOutput).
|
||||
property string screenName: Quickshell.env("QS_PRIMARY_OUTPUT") ?? ""
|
||||
|
||||
// Quickshell.screens is a QML list, not a JS array — no .find() on it.
|
||||
readonly property var targetScreen: {
|
||||
@@ -139,13 +142,47 @@ Scope {
|
||||
readonly property int barLayer: shell.scrimUp ? WlrLayer.Overlay : WlrLayer.Bottom
|
||||
readonly property int backdropLayer: shell.scrimUp ? WlrLayer.Top : WlrLayer.Background
|
||||
|
||||
// SUPER A — see hosts/terra/home/hyprland.nix.
|
||||
// SUPER A — see home/desktop/hyprland.nix.
|
||||
GlobalShortcut {
|
||||
name: "chrome"
|
||||
description: "Expand or collapse the hyprchrome bar"
|
||||
onPressed: shell.toggle()
|
||||
}
|
||||
|
||||
// SUPER — the launcher over an expanded rail, opened and closed as one.
|
||||
GlobalShortcut {
|
||||
name: "command"
|
||||
description: "Open the launcher with the hyprchrome bar expanded"
|
||||
onPressed: shell.toggleCommand()
|
||||
}
|
||||
|
||||
// Whether the rail was expanded BY toggleCommand, so closing the launcher
|
||||
// only collapses a rail it opened.
|
||||
property bool commandExpanded: false
|
||||
|
||||
function toggleCommand() {
|
||||
if (polkit.prompting || askpass.active)
|
||||
return;
|
||||
if (launcher.active) {
|
||||
launcher.close();
|
||||
return;
|
||||
}
|
||||
shell.commandExpanded = !shell.expanded;
|
||||
shell.expanded = true;
|
||||
launcher.active = true;
|
||||
}
|
||||
|
||||
// The launcher closes itself (ESC, launch, click-off), so collapse follows it.
|
||||
Connections {
|
||||
target: launcher
|
||||
function onActiveChanged() {
|
||||
if (!launcher.active && shell.commandExpanded) {
|
||||
shell.commandExpanded = false;
|
||||
shell.expanded = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Backdrop first: it is a layer below the bar, so stacking does not depend
|
||||
// on creation order, but keeping the declaration order the same as the
|
||||
// visual order costs nothing.
|
||||
@@ -210,9 +247,14 @@ Scope {
|
||||
onDismissed: shell.expanded = false
|
||||
}
|
||||
|
||||
// Popups on the rail's monitor, below its exclusive zone.
|
||||
Notifications {
|
||||
screen: shell.targetScreen
|
||||
}
|
||||
|
||||
// Polkit authentication agent. It registers for this logind session on
|
||||
// creation, so it replaces hyprpolkitagent rather than coexisting with it —
|
||||
// only one agent may hold a session (see hosts/terra/home/hyprland.nix).
|
||||
// only one agent may hold a session (see home/desktop/hyprland.nix).
|
||||
//
|
||||
// It lives here rather than beside the launchers in shell.qml because its
|
||||
// state is shared: `prompting` raises the scrim and freezes the density,
|
||||
@@ -230,7 +272,7 @@ Scope {
|
||||
screen: shell.focusedScreen
|
||||
}
|
||||
|
||||
// Primary application launcher — SUPER_L. Migrated out of
|
||||
// Primary application launcher — SUPER_L (via `command` above). Migrated out of
|
||||
// widgets/launcher/; the ten remaining variants are still evaluation copies
|
||||
// and stay in shell.qml. Declared after the bar for the same reason the
|
||||
// prompt is: while it is open the bar is on Overlay too, and there is no
|
||||
|
||||
@@ -6,7 +6,7 @@ import Quickshell.Wayland
|
||||
import QtQuick
|
||||
import qs.HyprChrome.Theme
|
||||
|
||||
// Primary application launcher — the one on SUPER_L.
|
||||
// Primary application launcher — the one on SUPER_L (via HyprChromeShell).
|
||||
//
|
||||
// Migrated from widgets/launcher/ApplicationLauncher.qml. Two things changed in
|
||||
// the move, both because HyprChromeShell now owns the state its surfaces share:
|
||||
@@ -34,11 +34,8 @@ Scope {
|
||||
function toggle() { root.active = !root.active; }
|
||||
function close() { root.active = false; }
|
||||
|
||||
// The name is legacy: this was "variant 8" of eleven, and both SUPER_L (via
|
||||
// open_launcher.sh) and SUPER CTRL 8 still dispatch quickshell:launcher8.
|
||||
// Renaming it means editing hosts/terra/home/hyprland.nix AND the script
|
||||
// together, and neither takes effect until a deploy — so the shortcut would
|
||||
// be dead in the running session in between. Kept as-is deliberately.
|
||||
// Launcher alone, on SUPER CTRL 8. SUPER_L goes through the shell's
|
||||
// `command` shortcut instead, which also expands the rail.
|
||||
GlobalShortcut {
|
||||
name: "launcher8"
|
||||
description: "Toggle dense application command index"
|
||||
@@ -83,9 +80,22 @@ Scope {
|
||||
root.active = false;
|
||||
}
|
||||
|
||||
// Hyprland runs a Lua config, which rejects a bare `dispatch exit`.
|
||||
readonly property var powerCommands: ({
|
||||
logout: ["hyprctl", "dispatch", "hl.dsp.exit()"],
|
||||
reboot: ["systemctl", "reboot"],
|
||||
shutdown: ["systemctl", "poweroff"]
|
||||
})
|
||||
|
||||
function power(action) {
|
||||
root.active = false;
|
||||
Quickshell.execDetached(win.powerCommands[action]);
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
content.clearSearch();
|
||||
content.disarmPower();
|
||||
selectedIndex = 0;
|
||||
content.focusSearch();
|
||||
}
|
||||
@@ -115,11 +125,17 @@ Scope {
|
||||
transformOrigin: Item.Center
|
||||
apps: model.apps
|
||||
selectedIndex: win.selectedIndex
|
||||
sortMode: model.sortMode
|
||||
|
||||
onSelectionRequested: index => win.selectedIndex = win.clampSelection(index)
|
||||
onMoveRequested: delta => win.move(delta)
|
||||
onLaunchRequested: index => win.launch(index)
|
||||
onDismissRequested: root.close()
|
||||
onSortToggleRequested: {
|
||||
model.toggleSort();
|
||||
win.selectedIndex = 0;
|
||||
}
|
||||
onPowerRequested: action => win.power(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,10 @@ Item {
|
||||
property int selectedIndex: 0
|
||||
property bool showIcons: true
|
||||
property alias query: searchInput.text
|
||||
property string sortMode: "usage"
|
||||
|
||||
// Power action awaiting its confirming second click; "" when none.
|
||||
property string armedPower: ""
|
||||
|
||||
readonly property var selectedApp: apps.length > 0 && selectedIndex >= 0 && selectedIndex < apps.length
|
||||
? apps[selectedIndex] : null
|
||||
@@ -25,9 +29,29 @@ Item {
|
||||
signal moveRequested(int delta)
|
||||
signal launchRequested(int index)
|
||||
signal dismissRequested
|
||||
signal sortToggleRequested
|
||||
signal powerRequested(string action)
|
||||
|
||||
function focusSearch() { searchInput.forceActiveFocus(); }
|
||||
function clearSearch() { searchInput.text = ""; }
|
||||
function disarmPower() { root.armedPower = ""; }
|
||||
|
||||
// First click arms, second (within the timeout) fires: a stray click must
|
||||
// not end the session.
|
||||
function pressPower(action) {
|
||||
if (root.armedPower === action) {
|
||||
root.armedPower = "";
|
||||
root.powerRequested(action);
|
||||
} else {
|
||||
root.armedPower = action;
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
running: root.armedPower !== ""
|
||||
interval: 3000
|
||||
onTriggered: root.disarmPower()
|
||||
}
|
||||
|
||||
implicitWidth: 1080
|
||||
implicitHeight: 620
|
||||
@@ -121,6 +145,11 @@ Item {
|
||||
onTextChanged: root.selectionRequested(0)
|
||||
|
||||
Keys.onPressed: event => {
|
||||
if (event.key === Qt.Key_S && (event.modifiers & Qt.ControlModifier)) {
|
||||
root.sortToggleRequested();
|
||||
event.accepted = true;
|
||||
return;
|
||||
}
|
||||
switch (event.key) {
|
||||
case Qt.Key_Down:
|
||||
case Qt.Key_Tab:
|
||||
@@ -162,16 +191,24 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
MouseArea {
|
||||
id: sortChip
|
||||
Layout.preferredWidth: 84
|
||||
Layout.preferredHeight: 22
|
||||
color: Theme.accentAlpha(0.12)
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.sortToggleRequested()
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: sortChip.containsMouse ? Theme.accentAlpha(0.28) : Theme.accentAlpha(0.12)
|
||||
border.width: 1
|
||||
border.color: Theme.hair
|
||||
border.color: sortChip.containsMouse ? Theme.accent : Theme.hair
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "LIVE INDEX"
|
||||
text: root.sortMode === "usage" ? "SORT: USED" : "SORT: A–Z"
|
||||
color: Theme.accent
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 7
|
||||
@@ -191,7 +228,7 @@ Item {
|
||||
height: 424
|
||||
panelId: "IDX"
|
||||
title: "APPLICATION TABLE"
|
||||
meta: root.query.length > 0 ? "FILTER ACTIVE" : "A–Z / LOCAL"
|
||||
meta: (root.query.length > 0 ? "FILTER ACTIVE" : "LOCAL") + (root.sortMode === "usage" ? " / MOST USED" : " / A–Z")
|
||||
|
||||
ListView {
|
||||
id: appList
|
||||
@@ -216,6 +253,9 @@ Item {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
readonly property bool selected: index === root.selectedIndex
|
||||
// Only the selected row is slanted; the rest are plain rectangles.
|
||||
property real slant: selected ? 9 : 0
|
||||
Behavior on slant { NumberAnimation { duration: 90; easing.type: Easing.OutCubic } }
|
||||
|
||||
onEntered: root.selectionRequested(index)
|
||||
onClicked: root.launchRequested(index)
|
||||
@@ -229,21 +269,21 @@ Item {
|
||||
fillColor: row.selected ? Theme.selection : Theme.textAlpha(0.025)
|
||||
strokeColor: row.selected ? Theme.accent : Theme.textAlpha(0.10)
|
||||
strokeWidth: 1
|
||||
startX: 9; startY: 0
|
||||
startX: row.slant; startY: 0
|
||||
PathLine { x: rowShape.width; y: 0 }
|
||||
PathLine { x: rowShape.width - 9; y: rowShape.height }
|
||||
PathLine { x: rowShape.width - row.slant; y: rowShape.height }
|
||||
PathLine { x: 0; y: rowShape.height }
|
||||
PathLine { x: 9; y: 0 }
|
||||
PathLine { x: row.slant; y: 0 }
|
||||
}
|
||||
|
||||
ShapePath {
|
||||
fillColor: row.selected ? Theme.accent : Theme.textAlpha(0.12)
|
||||
strokeWidth: 0
|
||||
startX: 9; startY: 0
|
||||
PathLine { x: 13; y: 0 }
|
||||
startX: row.slant; startY: 0
|
||||
PathLine { x: row.slant + 4; y: 0 }
|
||||
PathLine { x: 4; y: rowShape.height }
|
||||
PathLine { x: 0; y: rowShape.height }
|
||||
PathLine { x: 9; y: 0 }
|
||||
PathLine { x: row.slant; y: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -587,13 +627,46 @@ Item {
|
||||
KeyHint { keyText: "↑ ↓"; actionText: "SELECT" }
|
||||
KeyHint { keyText: "ENTER"; actionText: "EXECUTE" }
|
||||
KeyHint { keyText: "ESC"; actionText: "ABORT" }
|
||||
KeyHint { keyText: "CTRL+S"; actionText: "SORT" }
|
||||
Item { Layout.fillWidth: true }
|
||||
MicroText { text: "QRY:" + (root.query.length > 0 ? "ACTIVE" : "IDLE") }
|
||||
MicroText { text: "CRC // A7F2" }
|
||||
Rectangle { Layout.preferredWidth: 1; Layout.preferredHeight: 22; color: Theme.hair }
|
||||
|
||||
Repeater {
|
||||
model: [
|
||||
{ action: "logout", label: "LOGOUT" },
|
||||
{ action: "reboot", label: "REBOOT" },
|
||||
{ action: "shutdown", label: "SHUTDOWN" }
|
||||
]
|
||||
|
||||
MouseArea {
|
||||
id: powerButton
|
||||
required property var modelData
|
||||
readonly property bool armed: root.armedPower === modelData.action
|
||||
|
||||
Layout.preferredWidth: 96
|
||||
Layout.preferredHeight: 26
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.pressPower(modelData.action)
|
||||
|
||||
Rectangle {
|
||||
Layout.preferredWidth: 76
|
||||
Layout.preferredHeight: 4
|
||||
color: Theme.accent
|
||||
anchors.fill: parent
|
||||
color: powerButton.armed ? Theme.hot : powerButton.containsMouse ? Theme.accentAlpha(0.28) : Theme.accentAlpha(0.10)
|
||||
border.width: 1
|
||||
border.color: powerButton.armed ? Theme.hot : powerButton.containsMouse ? Theme.accent : Theme.hair
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: powerButton.armed ? "CONFIRM" : powerButton.modelData.label
|
||||
color: powerButton.armed ? Theme.surface : Theme.accent
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 8
|
||||
font.bold: true
|
||||
font.letterSpacing: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +1,85 @@
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
|
||||
// Non-visual, reusable app-search model shared by every launcher variant.
|
||||
// Non-visual app-search model for the launcher.
|
||||
// Set `search`; read `apps` (a ranked, filtered list of DesktopEntry).
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
property string search: ""
|
||||
|
||||
// "usage" (most launched first) | "name". Persisted with the counts.
|
||||
readonly property string sortMode: store.sortMode
|
||||
|
||||
function toggleSort() {
|
||||
store.sortMode = store.sortMode === "usage" ? "name" : "usage";
|
||||
}
|
||||
|
||||
function uses(a) {
|
||||
return store.counts[a.id] ?? 0;
|
||||
}
|
||||
|
||||
// `keywords`/`categories` come through as string lists, so coerce every
|
||||
// field to a string before matching (String([]) joins with commas).
|
||||
function haystack(a) {
|
||||
return (String(a.name || "") + " " + String(a.genericName || "") + " " + String(a.comment || "") + " " + String(a.keywords || "")).toLowerCase();
|
||||
}
|
||||
|
||||
function byOrder(x, y) {
|
||||
if (root.sortMode === "usage") {
|
||||
const d = root.uses(y) - root.uses(x);
|
||||
if (d !== 0)
|
||||
return d;
|
||||
}
|
||||
return String(x.name).localeCompare(String(y.name));
|
||||
}
|
||||
|
||||
readonly property var apps: {
|
||||
const all = DesktopEntries.applications.values.filter(a => !a.noDisplay);
|
||||
const q = root.search.trim().toLowerCase();
|
||||
|
||||
if (q.length === 0)
|
||||
return all.slice().sort((x, y) => String(x.name).localeCompare(String(y.name)));
|
||||
return all.slice().sort(root.byOrder);
|
||||
|
||||
const matches = all.filter(a => root.haystack(a).includes(q));
|
||||
|
||||
// Prefix matches on the visible name rank first, then alphabetical.
|
||||
// Prefix matches on the visible name rank first, then the sort mode.
|
||||
return matches.slice().sort((x, y) => {
|
||||
const xs = String(x.name).toLowerCase().startsWith(q) ? 0 : 1;
|
||||
const ys = String(y.name).toLowerCase().startsWith(q) ? 0 : 1;
|
||||
if (xs !== ys)
|
||||
return xs - ys;
|
||||
return String(x.name).localeCompare(String(y.name));
|
||||
return root.byOrder(x, y);
|
||||
});
|
||||
}
|
||||
|
||||
function launch(index) {
|
||||
const list = root.apps;
|
||||
if (index >= 0 && index < list.length) {
|
||||
list[index].execute();
|
||||
const app = list[index];
|
||||
app.execute();
|
||||
// Reassigned, not mutated: an in-place write notifies nothing.
|
||||
const counts = Object.assign({}, store.counts);
|
||||
counts[app.id] = (counts[app.id] ?? 0) + 1;
|
||||
store.counts = counts;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
readonly property var file: FileView {
|
||||
path: Quickshell.statePath("launcher.json")
|
||||
onAdapterUpdated: writeAdapter()
|
||||
onLoadFailed: error => {
|
||||
if (error === FileViewError.FileNotFound)
|
||||
writeAdapter();
|
||||
}
|
||||
|
||||
JsonAdapter {
|
||||
id: store
|
||||
property string sortMode: "usage"
|
||||
property var counts: ({})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Services.Pam
|
||||
import qs.HyprChrome.Widgets.Greeter
|
||||
|
||||
// ext-session-lock screen: the greeter's panel on every output, so whichever
|
||||
// one Hyprland gives the keyboard has a field. Runs as its own instance
|
||||
// (lock.qml) so a reload of the main shell cannot drop the lock; exits once
|
||||
// unlocked.
|
||||
Scope {
|
||||
id: root
|
||||
|
||||
readonly property string userName: Quickshell.env("USER") ?? ""
|
||||
readonly property string hostName: hostFile.text().trim() || "localhost"
|
||||
|
||||
// Typed password, held until PAM's first secret prompt arrives.
|
||||
property string pendingSecret: ""
|
||||
// PAM asked a follow-up (OTP etc.) that the user must answer directly.
|
||||
property bool awaitingResponse: false
|
||||
property bool busy: false
|
||||
property bool unlocking: false
|
||||
|
||||
property string message: ""
|
||||
property bool messageIsError: false
|
||||
property bool failed: false
|
||||
property string inputPrompt: ""
|
||||
property bool responseVisible: false
|
||||
property date now: new Date()
|
||||
|
||||
// Each surface keeps its own field; this resets all of them.
|
||||
signal resetSecret
|
||||
|
||||
function setMessage(text, isError) {
|
||||
root.message = text;
|
||||
root.messageIsError = isError;
|
||||
}
|
||||
|
||||
function resetToPassword() {
|
||||
root.pendingSecret = "";
|
||||
root.awaitingResponse = false;
|
||||
root.busy = false;
|
||||
root.inputPrompt = "";
|
||||
root.responseVisible = false;
|
||||
root.resetSecret();
|
||||
}
|
||||
|
||||
function submit(secret) {
|
||||
root.failed = false;
|
||||
|
||||
if (root.awaitingResponse) {
|
||||
root.awaitingResponse = false;
|
||||
root.busy = true;
|
||||
root.resetSecret();
|
||||
pam.respond(secret);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pam.active)
|
||||
return;
|
||||
|
||||
root.setMessage("", false);
|
||||
root.pendingSecret = secret;
|
||||
root.busy = true;
|
||||
if (!pam.start()) {
|
||||
root.resetToPassword();
|
||||
root.setMessage("pam failed to start", true);
|
||||
}
|
||||
}
|
||||
|
||||
FileView {
|
||||
id: hostFile
|
||||
|
||||
path: "/etc/hostname"
|
||||
blockLoading: true
|
||||
}
|
||||
|
||||
PamContext {
|
||||
id: pam
|
||||
|
||||
// security.pam.services.hyprchrome-lock (services/desktop/desktop-hyprland.nix).
|
||||
config: "hyprchrome-lock"
|
||||
user: root.userName
|
||||
|
||||
onPamMessage: {
|
||||
if (!pam.responseRequired) {
|
||||
root.setMessage(pam.message, pam.messageIsError);
|
||||
return;
|
||||
}
|
||||
|
||||
// First hidden prompt is the password already typed.
|
||||
if (root.pendingSecret !== "" && !pam.responseVisible) {
|
||||
const secret = root.pendingSecret;
|
||||
root.pendingSecret = "";
|
||||
pam.respond(secret);
|
||||
return;
|
||||
}
|
||||
|
||||
root.busy = false;
|
||||
root.awaitingResponse = true;
|
||||
root.inputPrompt = pam.message.replace(/:\s*$/, "");
|
||||
root.responseVisible = pam.responseVisible;
|
||||
root.resetSecret();
|
||||
}
|
||||
|
||||
onCompleted: result => {
|
||||
if (result === PamResult.Success) {
|
||||
root.setMessage("unlocked", false);
|
||||
root.unlocking = true;
|
||||
return;
|
||||
}
|
||||
root.resetToPassword();
|
||||
root.failed = true;
|
||||
root.setMessage(result === PamResult.MaxTries ? "too many attempts" : "authentication failed", true);
|
||||
}
|
||||
|
||||
onError: error => {
|
||||
root.resetToPassword();
|
||||
root.setMessage(PamError.toString(error), true);
|
||||
}
|
||||
}
|
||||
|
||||
// Fade out, then release the outputs. The quit is deferred so the unlock
|
||||
// request is flushed before the connection closes; exiting while still
|
||||
// locked would leave Hyprland's "lock app died" screen up.
|
||||
Timer {
|
||||
running: root.unlocking
|
||||
interval: 220
|
||||
onTriggered: {
|
||||
lock.locked = false;
|
||||
quitTimer.start();
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: quitTimer
|
||||
|
||||
interval: 100
|
||||
onTriggered: Qt.quit()
|
||||
}
|
||||
|
||||
Timer {
|
||||
running: true
|
||||
repeat: true
|
||||
interval: 1000
|
||||
triggeredOnStart: true
|
||||
onTriggered: root.now = new Date()
|
||||
}
|
||||
|
||||
WlSessionLock {
|
||||
id: lock
|
||||
|
||||
locked: true
|
||||
|
||||
WlSessionLockSurface {
|
||||
color: "transparent"
|
||||
|
||||
LockBackdrop {
|
||||
anchors.fill: parent
|
||||
}
|
||||
|
||||
LoginContent {
|
||||
id: content
|
||||
|
||||
width: 640
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: Math.max(32, Math.round(parent.height * 0.42 - height / 2)) + (1 - opacity) * 12
|
||||
|
||||
opacity: root.unlocking ? 0 : 1
|
||||
Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutCubic } }
|
||||
|
||||
title: "LOCKED // " + root.hostName.toUpperCase()
|
||||
panelId: "LCK"
|
||||
meta: "PAM"
|
||||
submitLabel: "UNLOCK"
|
||||
userEditable: false
|
||||
showPower: false
|
||||
|
||||
hostName: root.hostName
|
||||
sessionName: "hyprland"
|
||||
user: root.userName
|
||||
now: root.now
|
||||
busy: root.busy || root.unlocking
|
||||
message: root.message
|
||||
messageIsError: root.messageIsError
|
||||
failed: root.failed
|
||||
inputPrompt: root.inputPrompt
|
||||
responseVisible: root.responseVisible
|
||||
|
||||
onSubmitted: (user, secret) => root.submit(secret)
|
||||
|
||||
Component.onCompleted: content.focusSecret()
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
|
||||
function onResetSecret() {
|
||||
content.clearSecret();
|
||||
content.focusSecret();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import qs.HyprChrome.Theme
|
||||
|
||||
// ChromeBackdrop's drafting grid at full dim, as a plain Item: a lock surface
|
||||
// cannot host a PanelWindow, and nothing behind it is shown anyway.
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property int gridSpacing: 60
|
||||
property real gridOpacity: 0.10
|
||||
property real crossOpacity: 0.15
|
||||
property int crossSize: 20
|
||||
property int crossWeight: 3
|
||||
|
||||
readonly property color gridColor: Qt.hsla(Theme.accent.hslHue,
|
||||
Theme.accent.hslSaturation * 0.45,
|
||||
Theme.accent.hslLightness,
|
||||
1)
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: Theme.surface
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: Math.ceil(root.width / root.gridSpacing)
|
||||
|
||||
Rectangle {
|
||||
required property int index
|
||||
|
||||
x: index * root.gridSpacing
|
||||
width: 1
|
||||
height: root.height
|
||||
color: root.gridColor
|
||||
opacity: root.gridOpacity
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: Math.ceil(root.height / root.gridSpacing)
|
||||
|
||||
Rectangle {
|
||||
required property int index
|
||||
|
||||
y: index * root.gridSpacing
|
||||
width: root.width
|
||||
height: 1
|
||||
color: root.gridColor
|
||||
opacity: root.gridOpacity
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: crosses
|
||||
|
||||
readonly property int columns: Math.ceil(root.width / (root.gridSpacing * 2)) + 1
|
||||
readonly property int rows: Math.ceil(root.height / (root.gridSpacing * 2)) + 1
|
||||
model: columns * rows
|
||||
|
||||
Item {
|
||||
required property int index
|
||||
|
||||
x: (index % crosses.columns) * root.gridSpacing * 2 - Math.floor(root.crossSize / 2)
|
||||
y: Math.floor(index / crosses.columns) * root.gridSpacing * 2 - Math.floor(root.crossSize / 2)
|
||||
width: root.crossSize
|
||||
height: root.crossSize
|
||||
opacity: root.crossOpacity
|
||||
|
||||
Rectangle {
|
||||
y: Math.floor(root.crossSize / 2) - Math.floor(root.crossWeight / 2)
|
||||
width: parent.width
|
||||
height: root.crossWeight
|
||||
color: Theme.muted
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
x: Math.floor(root.crossSize / 2) - Math.floor(root.crossWeight / 2)
|
||||
width: root.crossWeight
|
||||
height: parent.height
|
||||
color: Theme.muted
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import qs.HyprChrome.Theme
|
||||
|
||||
// Headlessly renderable visual core of one notification. Every field arrives as
|
||||
// a plain property and every action leaves as a signal; Notifications.qml maps
|
||||
// the server's Notification onto it.
|
||||
//
|
||||
// Owns its own expiry: the drain meter IS the timer, so hovering pauses both.
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property string appName: ""
|
||||
property string summary: ""
|
||||
property string body: ""
|
||||
// Icon name, path or URL; `image` (avatar, album art) wins over it.
|
||||
property string appIcon: ""
|
||||
property string image: ""
|
||||
// 0 low, 1 normal, 2 critical — NotificationUrgency's values.
|
||||
property int urgency: 1
|
||||
property string time: ""
|
||||
|
||||
// Read structurally ({ identifier, text }). The "default" action is the
|
||||
// card's own click, not a chip.
|
||||
property var actions: []
|
||||
|
||||
// Milliseconds; 0 never expires.
|
||||
property int timeout: 0
|
||||
// Off for headless renders, which set `remaining` directly.
|
||||
property bool countdown: true
|
||||
property real remaining: 1
|
||||
|
||||
signal dismissed
|
||||
signal expired
|
||||
signal actionInvoked(string identifier)
|
||||
|
||||
readonly property bool critical: root.urgency === 2
|
||||
readonly property color tint: root.critical ? Theme.hot : root.urgency === 0 ? Theme.muted : Theme.accent
|
||||
|
||||
readonly property var chipActions: {
|
||||
const out = [];
|
||||
for (let i = 0; i < root.actions.length; i++) {
|
||||
if (root.actions[i].identifier !== "default")
|
||||
out.push(root.actions[i]);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
readonly property bool hasDefault: root.chipActions.length !== root.actions.length
|
||||
|
||||
readonly property string iconSource: {
|
||||
const s = root.image !== "" ? root.image : root.appIcon;
|
||||
if (s === "")
|
||||
return "";
|
||||
if (s.startsWith("/"))
|
||||
return "file://" + s;
|
||||
if (s.includes(":/"))
|
||||
return s;
|
||||
return Quickshell.iconPath(s, true);
|
||||
}
|
||||
|
||||
implicitWidth: 360
|
||||
implicitHeight: panel.implicitHeight
|
||||
|
||||
NumberAnimation on remaining {
|
||||
id: drain
|
||||
|
||||
from: 1
|
||||
to: 0
|
||||
duration: Math.max(1, root.timeout)
|
||||
running: root.countdown && root.timeout > 0
|
||||
paused: running && hover.hovered
|
||||
}
|
||||
|
||||
// Not drain's finished(): a value-source animation need not emit it.
|
||||
onRemainingChanged: {
|
||||
if (root.remaining <= 0 && root.countdown && root.timeout > 0)
|
||||
root.expired();
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
id: hover
|
||||
}
|
||||
|
||||
// Under the panel, so the close box and chips take their own clicks.
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: root.hasDefault ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||||
onClicked: {
|
||||
if (root.hasDefault)
|
||||
root.actionInvoked("default");
|
||||
else
|
||||
root.dismissed();
|
||||
}
|
||||
}
|
||||
|
||||
component MicroText: Text {
|
||||
color: Theme.muted
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 8
|
||||
font.letterSpacing: 0.9
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
NotificationPanel {
|
||||
id: panel
|
||||
|
||||
width: root.width
|
||||
panelId: root.critical ? "CRT" : root.urgency === 0 ? "LOW" : "NTF"
|
||||
title: (root.appName !== "" ? root.appName : "NOTIFICATION").toUpperCase()
|
||||
meta: root.time
|
||||
accentColor: root.tint
|
||||
|
||||
onCloseRequested: root.dismissed()
|
||||
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
spacing: 8
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 10
|
||||
|
||||
// Framed, so a transparent icon still reads as a tile.
|
||||
Rectangle {
|
||||
Layout.alignment: Qt.AlignTop
|
||||
visible: root.iconSource !== ""
|
||||
implicitWidth: 40
|
||||
implicitHeight: 40
|
||||
color: Theme.selection
|
||||
border.width: 1
|
||||
border.color: Theme.hair
|
||||
|
||||
IconImage {
|
||||
anchors.centerIn: parent
|
||||
implicitSize: root.image !== "" ? 38 : 28
|
||||
source: root.iconSource
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignTop
|
||||
spacing: 3
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
visible: root.summary !== ""
|
||||
text: root.summary
|
||||
textFormat: Text.PlainText
|
||||
wrapMode: Text.Wrap
|
||||
maximumLineCount: 2
|
||||
elide: Text.ElideRight
|
||||
color: Theme.text
|
||||
font.family: Theme.displayFont
|
||||
font.pixelSize: 13
|
||||
font.bold: true
|
||||
font.letterSpacing: 0.4
|
||||
}
|
||||
|
||||
// Body markup is advertised, so StyledText, never RichText.
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
visible: root.body !== ""
|
||||
text: root.body
|
||||
textFormat: Text.StyledText
|
||||
wrapMode: Text.Wrap
|
||||
maximumLineCount: 5
|
||||
elide: Text.ElideRight
|
||||
color: Theme.textAlpha(0.72)
|
||||
linkColor: root.tint
|
||||
font.family: Theme.displayFont
|
||||
font.pixelSize: 11
|
||||
font.letterSpacing: 0.3
|
||||
onLinkActivated: link => Qt.openUrlExternally(link)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Flow {
|
||||
Layout.fillWidth: true
|
||||
visible: root.chipActions.length > 0
|
||||
spacing: 6
|
||||
|
||||
Repeater {
|
||||
model: root.chipActions
|
||||
|
||||
Rectangle {
|
||||
id: chip
|
||||
|
||||
required property var modelData
|
||||
|
||||
width: chipLabel.implicitWidth + 16
|
||||
height: chipLabel.implicitHeight + 10
|
||||
color: chipArea.containsMouse ? root.tint : "transparent"
|
||||
border.width: 1
|
||||
border.color: chipArea.containsMouse ? root.tint : Theme.disabled
|
||||
|
||||
Text {
|
||||
id: chipLabel
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: chip.modelData.text.toUpperCase()
|
||||
color: chipArea.containsMouse ? Theme.surface : Theme.text
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 9
|
||||
font.letterSpacing: 0.8
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: chipArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.actionInvoked(chip.modelData.identifier)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Expiry drain; a sticky card states it instead.
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 8
|
||||
|
||||
Row {
|
||||
id: meter
|
||||
|
||||
readonly property int segments: 24
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 4
|
||||
visible: root.timeout > 0
|
||||
spacing: 2
|
||||
|
||||
Repeater {
|
||||
model: meter.segments
|
||||
|
||||
Rectangle {
|
||||
required property int index
|
||||
|
||||
readonly property bool lit: index < Math.ceil(root.remaining * meter.segments)
|
||||
|
||||
width: Math.max(2, (meter.width - (meter.segments - 1) * meter.spacing) / meter.segments)
|
||||
height: meter.height
|
||||
color: lit ? root.tint : Theme.textAlpha(0.06)
|
||||
border.width: 1
|
||||
border.color: lit ? root.tint : Theme.textAlpha(0.18)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MicroText {
|
||||
visible: root.timeout > 0
|
||||
text: hover.hovered ? "HOLD" : Math.ceil(root.remaining * root.timeout / 1000) + "S"
|
||||
color: hover.hovered ? root.tint : Theme.muted
|
||||
}
|
||||
|
||||
MicroText {
|
||||
Layout.fillWidth: true
|
||||
visible: root.timeout <= 0
|
||||
text: root.critical ? "CRITICAL · STICKY" : "STICKY"
|
||||
color: root.critical ? Theme.hot : Theme.muted
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
import qs.HyprChrome.Theme
|
||||
|
||||
// Chamfered chrome for one notification card: PolkitPanel's silhouette, tighter
|
||||
// metrics, a tintable accent (urgency) and a close box in the header.
|
||||
//
|
||||
// Not PolkitPanel itself: that file is the prompt's alone to restyle.
|
||||
Item {
|
||||
id: panel
|
||||
|
||||
property string panelId: ""
|
||||
property string title: ""
|
||||
property string meta: ""
|
||||
property color accentColor: Theme.accent
|
||||
|
||||
property int chamfer: 12
|
||||
property int padding: 12
|
||||
property int outlineWidth: 1
|
||||
property int accentLineThickness: 3
|
||||
|
||||
readonly property int headerHeight: 26
|
||||
property int headerGap: 10
|
||||
readonly property int headerPadding: 8
|
||||
|
||||
property real capGap: 4
|
||||
readonly property real capOffset: panel.capGap / Math.SQRT2
|
||||
readonly property real activeChamfer: Math.max(2, Math.min(panel.chamfer, panel.height / 2 - 1))
|
||||
readonly property real accentLineWidth: Math.min(panel.width, slugChip.width + panel.headerPadding * 2)
|
||||
|
||||
default property alias content: body.data
|
||||
|
||||
signal closeRequested
|
||||
|
||||
implicitHeight: Math.round(body.y + body.height + panel.padding)
|
||||
|
||||
Shape {
|
||||
id: panelShape
|
||||
|
||||
anchors.fill: parent
|
||||
preferredRendererType: Shape.CurveRenderer
|
||||
|
||||
ShapePath {
|
||||
fillColor: Theme.surface
|
||||
strokeColor: Theme.hair
|
||||
strokeWidth: panel.outlineWidth
|
||||
|
||||
startX: 0; startY: 0
|
||||
PathLine { x: panelShape.width - panel.activeChamfer; y: 0 }
|
||||
PathLine { x: panelShape.width; y: panel.activeChamfer }
|
||||
PathLine { x: panelShape.width; y: panelShape.height }
|
||||
PathLine { x: panel.activeChamfer; y: panelShape.height }
|
||||
PathLine { x: 0; y: panelShape.height - panel.activeChamfer }
|
||||
PathLine { x: 0; y: 0 }
|
||||
}
|
||||
|
||||
ShapePath {
|
||||
fillColor: panel.accentColor
|
||||
strokeWidth: 0
|
||||
|
||||
startX: panelShape.width - panel.activeChamfer + panel.capOffset
|
||||
startY: -panel.capOffset
|
||||
PathLine { x: panelShape.width + panel.capOffset; y: panel.activeChamfer - panel.capOffset }
|
||||
PathLine { x: panelShape.width + panel.capOffset; y: -panel.capOffset }
|
||||
PathLine { x: panelShape.width - panel.activeChamfer + panel.capOffset; y: -panel.capOffset }
|
||||
}
|
||||
|
||||
ShapePath {
|
||||
fillColor: panel.accentColor
|
||||
strokeWidth: 0
|
||||
|
||||
startX: panel.activeChamfer - panel.capOffset
|
||||
startY: panelShape.height + panel.capOffset
|
||||
PathLine { x: -panel.capOffset; y: panelShape.height - panel.activeChamfer + panel.capOffset }
|
||||
PathLine { x: -panel.capOffset; y: panelShape.height + panel.capOffset }
|
||||
PathLine { x: panel.activeChamfer - panel.capOffset; y: panelShape.height + panel.capOffset }
|
||||
}
|
||||
|
||||
ShapePath {
|
||||
fillColor: panel.accentColor
|
||||
strokeWidth: 0
|
||||
|
||||
startX: 0; startY: 0
|
||||
PathLine { x: panel.accentLineWidth; y: 0 }
|
||||
PathLine { x: panel.accentLineWidth; y: panel.accentLineThickness }
|
||||
PathLine { x: 0; y: panel.accentLineThickness }
|
||||
PathLine { x: 0; y: 0 }
|
||||
}
|
||||
|
||||
ShapePath {
|
||||
fillColor: panel.accentColor
|
||||
strokeWidth: 0
|
||||
|
||||
startX: panelShape.width; startY: panelShape.height
|
||||
PathLine { x: panelShape.width - panel.accentLineWidth; y: panelShape.height }
|
||||
PathLine { x: panelShape.width - panel.accentLineWidth; y: panelShape.height - panel.accentLineThickness }
|
||||
PathLine { x: panelShape.width; y: panelShape.height - panel.accentLineThickness }
|
||||
PathLine { x: panelShape.width; y: panelShape.height }
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: headerRow
|
||||
|
||||
x: panel.headerPadding
|
||||
y: Math.round((panel.headerHeight - height) / 2)
|
||||
width: headerEnd.x - x - 8
|
||||
spacing: panel.headerPadding + 6
|
||||
|
||||
Rectangle {
|
||||
id: slugChip
|
||||
|
||||
width: slugText.implicitWidth + 8
|
||||
height: slugText.implicitHeight + 4
|
||||
color: panel.accentColor
|
||||
|
||||
Text {
|
||||
id: slugText
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: panel.panelId
|
||||
color: Theme.surface
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 10
|
||||
font.bold: true
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.verticalCenter: slugChip.verticalCenter
|
||||
width: Math.max(0, headerRow.width - slugChip.width - headerRow.spacing)
|
||||
text: panel.title
|
||||
color: Theme.text
|
||||
font.family: Theme.displayFont
|
||||
font.pixelSize: 11
|
||||
font.bold: true
|
||||
font.letterSpacing: 1.1
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
id: headerEnd
|
||||
|
||||
// Clear of the top-right chamfer.
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: panel.activeChamfer + 2
|
||||
y: Math.round((panel.headerHeight - height) / 2)
|
||||
spacing: 8
|
||||
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: panel.meta.length > 0
|
||||
text: panel.meta
|
||||
color: Theme.muted
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 8
|
||||
font.letterSpacing: 0.7
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: closeBox
|
||||
|
||||
width: 16
|
||||
height: 16
|
||||
color: closeArea.containsMouse ? panel.accentColor : "transparent"
|
||||
border.width: 1
|
||||
border.color: closeArea.containsMouse ? panel.accentColor : Theme.disabled
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: "✕"
|
||||
color: closeArea.containsMouse ? Theme.surface : Theme.muted
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 9
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: closeArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: panel.closeRequested()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
x: 1
|
||||
y: panel.headerHeight
|
||||
width: parent.width - 2
|
||||
height: 1
|
||||
color: Theme.text
|
||||
opacity: 0.12
|
||||
}
|
||||
|
||||
// Measured by childrenRect: children carry their own size, no anchoring.
|
||||
Item {
|
||||
id: body
|
||||
|
||||
x: panel.padding
|
||||
y: panel.headerHeight + panel.headerGap
|
||||
width: Math.max(0, panel.width - panel.padding * 2)
|
||||
height: childrenRect.height
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import Quickshell
|
||||
import Quickshell.Services.Notifications
|
||||
import Quickshell.Wayland
|
||||
import QtQuick
|
||||
|
||||
// Notification daemon and its popup stack, migrated from widgets/notifications.
|
||||
// Owns the server and the surface; NotificationCard is the visual core.
|
||||
Scope {
|
||||
id: root
|
||||
|
||||
// Driven by the shell: the rail's monitor.
|
||||
property var screen: null
|
||||
|
||||
// Arrival time per notification id; the server keeps none.
|
||||
property var arrived: ({})
|
||||
|
||||
// expireTimeout is in ms (verified); -1 means "server default".
|
||||
function timeoutFor(n) {
|
||||
if (n.expireTimeout > 0)
|
||||
return n.expireTimeout;
|
||||
if (n.expireTimeout === 0 || n.urgency === NotificationUrgency.Critical)
|
||||
return 0;
|
||||
return 5000;
|
||||
}
|
||||
|
||||
NotificationServer {
|
||||
id: server
|
||||
|
||||
keepOnReload: true
|
||||
bodySupported: true
|
||||
bodyMarkupSupported: true
|
||||
bodyHyperlinksSupported: true
|
||||
imageSupported: true
|
||||
actionsSupported: true
|
||||
|
||||
onNotification: notification => {
|
||||
const id = notification.id;
|
||||
root.arrived[id] = Qt.formatTime(new Date(), "hh:mm");
|
||||
notification.closed.connect(() => delete root.arrived[id]);
|
||||
notification.tracked = true;
|
||||
}
|
||||
}
|
||||
|
||||
PanelWindow {
|
||||
id: win
|
||||
|
||||
screen: root.screen
|
||||
visible: server.trackedNotifications.values.length > 0
|
||||
|
||||
WlrLayershell.namespace: "hyprchrome-notifications"
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
// Normal with no zone of its own: sits below the rail's exclusive zone.
|
||||
exclusionMode: ExclusionMode.Normal
|
||||
color: "transparent"
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
right: true
|
||||
}
|
||||
|
||||
margins.top: 12
|
||||
margins.right: 16
|
||||
|
||||
// Slack on every side for the corner caps, which sit outside each card.
|
||||
implicitWidth: 360 + 8
|
||||
implicitHeight: Math.max(1, stack.implicitHeight + 8)
|
||||
|
||||
mask: Region {
|
||||
item: stack
|
||||
}
|
||||
|
||||
Column {
|
||||
id: stack
|
||||
|
||||
x: 4
|
||||
y: 4
|
||||
width: 360
|
||||
spacing: 14
|
||||
|
||||
Repeater {
|
||||
model: server.trackedNotifications
|
||||
|
||||
NotificationCard {
|
||||
id: card
|
||||
|
||||
required property Notification modelData
|
||||
|
||||
width: stack.width
|
||||
|
||||
appName: card.modelData.appName
|
||||
summary: card.modelData.summary
|
||||
body: card.modelData.body
|
||||
appIcon: card.modelData.appIcon
|
||||
image: card.modelData.image
|
||||
urgency: card.modelData.urgency
|
||||
time: root.arrived[card.modelData.id] ?? ""
|
||||
actions: card.modelData.actions
|
||||
timeout: root.timeoutFor(card.modelData)
|
||||
|
||||
onDismissed: card.modelData.dismiss()
|
||||
onExpired: card.modelData.expire()
|
||||
|
||||
// invoke() closes a non-resident notification itself.
|
||||
onActionInvoked: identifier => {
|
||||
const actions = card.modelData.actions;
|
||||
for (let i = 0; i < actions.length; i++) {
|
||||
if (actions[i].identifier === identifier) {
|
||||
actions[i].invoke();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Slides in from the right edge.
|
||||
opacity: 0
|
||||
transform: Translate { id: slide; x: 40 }
|
||||
Component.onCompleted: enter.start()
|
||||
|
||||
ParallelAnimation {
|
||||
id: enter
|
||||
|
||||
NumberAnimation { target: card; property: "opacity"; to: 1; duration: 160; easing.type: Easing.OutCubic }
|
||||
NumberAnimation { target: slide; property: "x"; to: 0; duration: 200; easing.type: Easing.OutCubic }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,8 @@ Item {
|
||||
property string panelId: ""
|
||||
property string title: ""
|
||||
property string meta: ""
|
||||
// Header strip only: body and header rule hidden.
|
||||
property bool collapsed: false
|
||||
|
||||
property int chamfer: 16
|
||||
property int padding: 14
|
||||
@@ -54,7 +56,7 @@ Item {
|
||||
|
||||
default property alias content: body.data
|
||||
|
||||
implicitHeight: Math.round(body.y + body.height + panel.padding)
|
||||
implicitHeight: panel.collapsed ? panel.headerHeight : Math.round(body.y + body.height + panel.padding)
|
||||
|
||||
Shape {
|
||||
id: panelShape
|
||||
@@ -181,6 +183,7 @@ Item {
|
||||
|
||||
// Header rule.
|
||||
Rectangle {
|
||||
visible: !panel.collapsed
|
||||
x: 1
|
||||
y: panel.headerHeight
|
||||
width: parent.width - 2
|
||||
@@ -194,6 +197,7 @@ Item {
|
||||
Item {
|
||||
id: body
|
||||
|
||||
visible: !panel.collapsed
|
||||
x: panel.padding
|
||||
y: panel.headerHeight + panel.headerGap
|
||||
width: Math.max(0, panel.width - panel.padding * 2)
|
||||
|
||||
@@ -13,7 +13,7 @@ import qs.HyprChrome.Theme
|
||||
// nothing to call. Two consequences:
|
||||
//
|
||||
// * Only ONE agent may hold a session. hyprpolkitagent must not be running
|
||||
// (hosts/terra/home/hyprland.nix autostart), or registration fails and this
|
||||
// (home/desktop/hyprland.nix autostart), or registration fails and this
|
||||
// dialog silently never appears. `isRegistered` is the check.
|
||||
// * `path` is write-once — the binary refuses a later assignment with
|
||||
// "cannot change path after it has been set." Set it here or not at all.
|
||||
@@ -87,9 +87,22 @@ Scope {
|
||||
// never appears. Leaving it orphaned costs one hung caller; cancelling it
|
||||
// costs the prompt as well.
|
||||
onFlowChanged: {
|
||||
vault.invalidate();
|
||||
if (root.flow) {
|
||||
content.clearResponse();
|
||||
content.focusInput();
|
||||
// Prefetched so Tab is instant; the list stays from the last
|
||||
// request while this refreshes.
|
||||
vault.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
ProtonPass {
|
||||
id: vault
|
||||
|
||||
onFetched: secret => {
|
||||
content.response = secret;
|
||||
content.focusInput();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +207,7 @@ Scope {
|
||||
// line appears. Floored at the same margin the width leaves, so a
|
||||
// tall prompt on a short output cannot be pushed off the top.
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: Math.max(32, Math.round(parent.height / 3 - height / 2))
|
||||
y: Math.max(32, Math.round(parent.height / 3 - content.dialogHeight / 2))
|
||||
width: 520
|
||||
|
||||
message: root.flow ? root.flow.message : ""
|
||||
@@ -209,6 +222,17 @@ Scope {
|
||||
supplementaryIsError: root.flow ? root.flow.supplementaryIsError : false
|
||||
failed: root.flow ? root.flow.failed : false
|
||||
|
||||
credentialsEnabled: true
|
||||
credentials: vault.entries
|
||||
credentialsStatus: vault.listStatus
|
||||
fetchStatus: vault.fetchStatus
|
||||
|
||||
onCredentialRequested: entry => vault.fetch(entry)
|
||||
onPickerOpened: {
|
||||
if (vault.entries.length === 0)
|
||||
vault.refresh();
|
||||
}
|
||||
|
||||
onSubmitted: value => {
|
||||
if (root.flow)
|
||||
root.flow.submit(value);
|
||||
@@ -235,9 +259,11 @@ Scope {
|
||||
enabled: root.flow !== null
|
||||
|
||||
function onFailedChanged() {
|
||||
if (root.flow.failed)
|
||||
if (root.flow.failed) {
|
||||
vault.invalidate();
|
||||
content.clearResponse();
|
||||
}
|
||||
}
|
||||
|
||||
// Re-focus when the conversation asks for something. This is load
|
||||
// bearing, not defensive: a flow arrives with isResponseRequired
|
||||
|
||||
@@ -46,15 +46,163 @@ Item {
|
||||
|
||||
property alias response: responseInput.text
|
||||
|
||||
// Masking override from the eye toggle; reset with the field, so a
|
||||
// revealed password never carries over to the next request.
|
||||
property bool revealed: false
|
||||
|
||||
// Proton Pass logins, in their own panel under the dialog, collapsed until
|
||||
// Tab. Entries need only `title` and `vault`; the adapter fetches the
|
||||
// password for the one picked, so no secret is ever in this list. Off by
|
||||
// default, as in the headless render.
|
||||
property bool credentialsEnabled: false
|
||||
property var credentials: []
|
||||
// Picker-only: loading / listing failure. fetchStatus shows regardless —
|
||||
// it is what explains an empty field after a pick.
|
||||
property string credentialsStatus: ""
|
||||
property string fetchStatus: ""
|
||||
property bool pickerOpen: false
|
||||
property int pickerIndex: 0
|
||||
|
||||
// Vault the list is narrowed to; "" is all of them. Kept across requests,
|
||||
// so a vault picked once stays picked.
|
||||
property string vaultFilter: ""
|
||||
property bool overflowMenuOpen: false
|
||||
|
||||
// Height of the dialog alone. The adapters position on this rather than
|
||||
// implicitHeight, so expanding the vault panel grows downward instead of
|
||||
// shifting the dialog up under the cursor.
|
||||
readonly property real dialogHeight: panel.implicitHeight
|
||||
|
||||
readonly property var vaultNames: {
|
||||
const names = [];
|
||||
for (const c of root.credentials)
|
||||
if (!names.includes(c.vault))
|
||||
names.push(c.vault);
|
||||
return names.sort((a, b) => a.toLowerCase() < b.toLowerCase() ? -1 : a.toLowerCase() > b.toLowerCase() ? 1 : 0);
|
||||
}
|
||||
readonly property var vaultOptions: [""].concat(root.vaultNames)
|
||||
|
||||
// A remembered vault that no longer exists falls back to all.
|
||||
readonly property string activeVault: root.vaultNames.includes(root.vaultFilter) ? root.vaultFilter : ""
|
||||
|
||||
// Title A–Z within the chosen vault (or across all of them).
|
||||
readonly property var shownCredentials: {
|
||||
const q = filterInput.text.toLowerCase();
|
||||
return root.credentials
|
||||
.filter(c => (root.activeVault === "" || c.vault === root.activeVault)
|
||||
&& (q === "" || c.title.toLowerCase().includes(q)))
|
||||
.sort((a, b) => {
|
||||
const ta = a.title.toLowerCase(), tb = b.title.toLowerCase();
|
||||
return ta < tb ? -1 : ta > tb ? 1 : 0;
|
||||
});
|
||||
}
|
||||
|
||||
function vaultLabel(name) {
|
||||
return name === "" ? "ALL" : name.toUpperCase();
|
||||
}
|
||||
|
||||
function vaultCount(name) {
|
||||
return name === "" ? root.credentials.length : root.credentials.filter(c => c.vault === name).length;
|
||||
}
|
||||
|
||||
function tabText(name) {
|
||||
return root.vaultLabel(name) + " " + root.vaultCount(name);
|
||||
}
|
||||
|
||||
// Tabs are sized from FontMetrics rather than their own implicitWidth, so
|
||||
// how many fit is known before any are laid out — the overflow split
|
||||
// would otherwise depend on the very tabs it decides to create.
|
||||
function tabWidth(text) {
|
||||
return Math.ceil(tabMetrics.advanceWidth(text) + text.length * tabMetrics.font.letterSpacing) + 16;
|
||||
}
|
||||
|
||||
// How many leading vault options get a tab of their own; the rest go in
|
||||
// the overflow menu, which is always the last tab.
|
||||
//
|
||||
// The overflow tab names the selected vault when it holds it, so it is
|
||||
// sized for "MORE" first and, if the selection lands in the overflow,
|
||||
// re-split for that label. Shrinking can only push the selection further
|
||||
// into the overflow, so the second pass is final.
|
||||
readonly property int fittingTabs: {
|
||||
const avail = tabStrip.width;
|
||||
const widths = root.vaultOptions.map(v => root.tabWidth(root.tabText(v)));
|
||||
if (widths.reduce((a, b) => a + b, 0) <= avail)
|
||||
return widths.length;
|
||||
const split = reserve => {
|
||||
let used = reserve, k = 0;
|
||||
while (k < widths.length && used + widths[k] <= avail)
|
||||
used += widths[k++];
|
||||
return Math.max(1, k);
|
||||
};
|
||||
const k = split(root.tabWidth("MORE ▾"));
|
||||
return root.vaultOptions.indexOf(root.activeVault) >= k
|
||||
? split(root.tabWidth(root.tabText(root.activeVault) + " ▾")) : k;
|
||||
}
|
||||
readonly property var overflowVaults: root.vaultOptions.slice(root.fittingTabs)
|
||||
|
||||
signal submitted(string value)
|
||||
signal cancelled
|
||||
signal identityRequested(int index)
|
||||
signal credentialRequested(var entry)
|
||||
signal pickerOpened
|
||||
|
||||
function focusInput() { responseInput.forceActiveFocus(); }
|
||||
function clearResponse() { responseInput.text = ""; }
|
||||
function clearResponse() {
|
||||
responseInput.text = "";
|
||||
root.revealed = false;
|
||||
root.closePicker();
|
||||
}
|
||||
|
||||
function openPicker() {
|
||||
if (!root.credentialsEnabled)
|
||||
return;
|
||||
filterInput.text = "";
|
||||
root.pickerIndex = 0;
|
||||
root.overflowMenuOpen = false;
|
||||
root.pickerOpen = true;
|
||||
filterInput.forceActiveFocus();
|
||||
root.pickerOpened();
|
||||
}
|
||||
|
||||
function closePicker() {
|
||||
if (!root.pickerOpen)
|
||||
return;
|
||||
root.overflowMenuOpen = false;
|
||||
root.pickerOpen = false;
|
||||
root.focusInput();
|
||||
}
|
||||
|
||||
function selectVault(index) {
|
||||
root.vaultFilter = root.vaultOptions[index] || "";
|
||||
root.overflowMenuOpen = false;
|
||||
root.pickerIndex = 0;
|
||||
pickerList.positionViewAtBeginning();
|
||||
filterInput.forceActiveFocus();
|
||||
}
|
||||
|
||||
function cycleVault(delta) {
|
||||
const n = root.vaultOptions.length;
|
||||
root.selectVault((Math.max(0, root.vaultOptions.indexOf(root.activeVault)) + delta + n) % n);
|
||||
}
|
||||
|
||||
function pick(index) {
|
||||
const entry = root.shownCredentials[index];
|
||||
if (!entry)
|
||||
return;
|
||||
root.closePicker();
|
||||
root.credentialRequested(entry);
|
||||
}
|
||||
|
||||
function movePicker(delta) {
|
||||
const n = root.shownCredentials.length;
|
||||
if (n > 0)
|
||||
root.pickerIndex = (root.pickerIndex + delta + n) % n;
|
||||
}
|
||||
|
||||
onPickerIndexChanged: pickerList.positionViewAtIndex(root.pickerIndex, ListView.Contain)
|
||||
|
||||
implicitWidth: 520
|
||||
implicitHeight: panel.implicitHeight
|
||||
implicitHeight: stack.implicitHeight
|
||||
|
||||
// Escape reaches here by propagating up the focus chain from the TextInput,
|
||||
// which does not consume it — so cancelling works whether or not the input
|
||||
@@ -72,6 +220,48 @@ Item {
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
// A vault tab. Sized by the caller from tabWidth(), not by its label: the
|
||||
// overflow split is computed before any tab exists.
|
||||
component VaultTab: Item {
|
||||
id: tab
|
||||
|
||||
property string label: ""
|
||||
property bool current: false
|
||||
|
||||
signal clicked
|
||||
|
||||
MicroText {
|
||||
anchors.centerIn: parent
|
||||
text: tab.label
|
||||
color: tab.current ? Theme.accent
|
||||
: tabArea.containsMouse ? Theme.text : Theme.muted
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
visible: tab.current
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width
|
||||
height: 2
|
||||
color: Theme.accent
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: tabArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: tab.clicked()
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
id: stack
|
||||
|
||||
width: root.width
|
||||
// Clears the detached corner caps between the two panels.
|
||||
spacing: 14
|
||||
|
||||
PolkitPanel {
|
||||
id: panel
|
||||
|
||||
@@ -200,7 +390,7 @@ Item {
|
||||
font.letterSpacing: 1
|
||||
clip: true
|
||||
|
||||
echoMode: root.responseVisible
|
||||
echoMode: root.responseVisible || root.revealed
|
||||
? TextInput.Normal : TextInput.Password
|
||||
passwordCharacter: "▪"
|
||||
// Qt reveals the last typed character for a moment by
|
||||
@@ -213,6 +403,11 @@ Item {
|
||||
root.submitted(responseInput.text);
|
||||
}
|
||||
|
||||
Keys.onTabPressed: event => {
|
||||
root.openPicker();
|
||||
event.accepted = true;
|
||||
}
|
||||
|
||||
// Placeholder: TextInput has none of its own, and the
|
||||
// PAM prompt ("Password:", "PIN:") is the only label
|
||||
// this field gets.
|
||||
@@ -224,8 +419,37 @@ Item {
|
||||
font: responseInput.font
|
||||
}
|
||||
}
|
||||
|
||||
// Eye toggle. Hidden when PAM already asked for echoed
|
||||
// input — there is nothing left to reveal.
|
||||
Text {
|
||||
visible: !root.responseVisible
|
||||
text: root.revealed ? "" : ""
|
||||
color: root.revealed ? Theme.accent : (eyeArea.containsMouse ? Theme.text : Theme.muted)
|
||||
font.family: Theme.displayFont
|
||||
font.pixelSize: 14
|
||||
|
||||
MouseArea {
|
||||
id: eyeArea
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: -6
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
root.revealed = !root.revealed;
|
||||
root.focusInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MicroText {
|
||||
Layout.fillWidth: true
|
||||
visible: root.credentialsEnabled && root.fetchStatus !== ""
|
||||
text: root.fetchStatus
|
||||
}
|
||||
|
||||
// ---- pam_info / pam_error ----
|
||||
Text {
|
||||
@@ -248,10 +472,307 @@ Item {
|
||||
MicroText { text: "ESC CANCEL" }
|
||||
Item { Layout.fillWidth: true }
|
||||
MicroText {
|
||||
text: root.responseVisible ? "ECHO ON" : ""
|
||||
text: root.responseVisible ? "ECHO ON" : root.revealed ? "SHOWN" : ""
|
||||
color: Theme.hot
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Proton Pass ----
|
||||
// Its own panel so the dialog keeps its shape; collapsed it is the header
|
||||
// strip alone. The MouseArea sits over that strip only — PolkitPanel's
|
||||
// default property is the body slot, so it cannot live inside the panel.
|
||||
Item {
|
||||
visible: root.credentialsEnabled
|
||||
width: root.width
|
||||
height: vaultPanel.implicitHeight
|
||||
|
||||
PolkitPanel {
|
||||
id: vaultPanel
|
||||
|
||||
width: parent.width
|
||||
panelId: "PSS"
|
||||
title: "PROTON PASS"
|
||||
collapsed: !root.pickerOpen
|
||||
meta: root.pickerOpen
|
||||
? root.shownCredentials.length + " / " + root.credentials.length
|
||||
: "TAB OPEN"
|
||||
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
spacing: 6
|
||||
|
||||
// ---- vault tabs ----
|
||||
// One row; tabs that do not fit move into the overflow
|
||||
// tab's menu. z above the filter and list, which the open
|
||||
// menu draws over.
|
||||
Item {
|
||||
id: tabStrip
|
||||
|
||||
z: 2
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 22
|
||||
|
||||
FontMetrics {
|
||||
id: tabMetrics
|
||||
|
||||
font.family: Theme.microFont
|
||||
font.pixelSize: 8
|
||||
font.letterSpacing: 0.9
|
||||
}
|
||||
|
||||
// The rule the tabs sit on, across the full width.
|
||||
Rectangle {
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width
|
||||
height: 1
|
||||
color: Theme.hair
|
||||
}
|
||||
|
||||
Row {
|
||||
Repeater {
|
||||
model: root.vaultOptions.slice(0, root.fittingTabs)
|
||||
|
||||
VaultTab {
|
||||
id: vaultTab
|
||||
|
||||
required property int index
|
||||
required property string modelData
|
||||
|
||||
width: root.tabWidth(vaultTab.label)
|
||||
height: tabStrip.height
|
||||
label: root.tabText(vaultTab.modelData)
|
||||
current: vaultTab.modelData === root.activeVault
|
||||
onClicked: root.selectVault(vaultTab.index)
|
||||
}
|
||||
}
|
||||
|
||||
VaultTab {
|
||||
id: overflowTab
|
||||
|
||||
readonly property bool holdsActive: root.overflowVaults.includes(root.activeVault)
|
||||
|
||||
visible: root.overflowVaults.length > 0
|
||||
width: root.tabWidth(overflowTab.label)
|
||||
height: tabStrip.height
|
||||
// Names the selected vault when it is one of
|
||||
// the hidden ones, so the selection stays visible.
|
||||
label: (overflowTab.holdsActive ? root.tabText(root.activeVault) : "MORE") + " ▾"
|
||||
current: overflowTab.holdsActive || root.overflowMenuOpen
|
||||
onClicked: root.overflowMenuOpen = !root.overflowMenuOpen
|
||||
|
||||
Rectangle {
|
||||
visible: root.overflowMenuOpen
|
||||
// Right-aligned to the tab, clamped to the strip.
|
||||
x: Math.max(-overflowTab.x, overflowTab.width - width)
|
||||
y: overflowTab.height + 2
|
||||
width: Math.max(180, overflowTab.width)
|
||||
height: overflowColumn.implicitHeight + 2
|
||||
color: Theme.surface
|
||||
border.width: 1
|
||||
border.color: Theme.accent
|
||||
|
||||
Column {
|
||||
id: overflowColumn
|
||||
|
||||
x: 1
|
||||
y: 1
|
||||
width: parent.width - 2
|
||||
|
||||
Repeater {
|
||||
model: root.overflowVaults
|
||||
|
||||
Rectangle {
|
||||
id: option
|
||||
|
||||
required property int index
|
||||
required property string modelData
|
||||
|
||||
readonly property bool current: option.modelData === root.activeVault
|
||||
|
||||
width: overflowColumn.width
|
||||
height: 22
|
||||
color: optionArea.containsMouse ? Theme.selection : "transparent"
|
||||
|
||||
Rectangle {
|
||||
visible: option.current
|
||||
width: 2
|
||||
height: parent.height
|
||||
color: Theme.accent
|
||||
}
|
||||
|
||||
MicroText {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 10
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: root.vaultLabel(option.modelData)
|
||||
color: option.current ? Theme.accent
|
||||
: optionArea.containsMouse ? Theme.text : Theme.muted
|
||||
}
|
||||
|
||||
MicroText {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 8
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: root.vaultCount(option.modelData)
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: optionArea
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.selectVault(root.fittingTabs + option.index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 8
|
||||
|
||||
TextInput {
|
||||
id: filterInput
|
||||
|
||||
Layout.fillWidth: true
|
||||
color: Theme.text
|
||||
selectionColor: Theme.accent
|
||||
selectedTextColor: Theme.surface
|
||||
font.family: Theme.displayFont
|
||||
font.pixelSize: 12
|
||||
clip: true
|
||||
|
||||
onTextChanged: root.pickerIndex = 0
|
||||
onAccepted: root.pick(root.pickerIndex)
|
||||
|
||||
// Consumed so Esc backs out of the panel instead
|
||||
// of cancelling the whole request.
|
||||
Keys.onEscapePressed: event => {
|
||||
if (root.overflowMenuOpen)
|
||||
root.overflowMenuOpen = false;
|
||||
else
|
||||
root.closePicker();
|
||||
event.accepted = true;
|
||||
}
|
||||
Keys.onTabPressed: event => {
|
||||
root.cycleVault(1);
|
||||
event.accepted = true;
|
||||
}
|
||||
Keys.onBacktabPressed: event => {
|
||||
root.cycleVault(-1);
|
||||
event.accepted = true;
|
||||
}
|
||||
Keys.onUpPressed: event => {
|
||||
root.movePicker(-1);
|
||||
event.accepted = true;
|
||||
}
|
||||
Keys.onDownPressed: event => {
|
||||
root.movePicker(1);
|
||||
event.accepted = true;
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: filterInput.text.length === 0
|
||||
text: "filter logins"
|
||||
color: Theme.disabled
|
||||
font: filterInput.font
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MicroText {
|
||||
Layout.fillWidth: true
|
||||
visible: text !== ""
|
||||
text: root.credentialsStatus !== "" ? root.credentialsStatus
|
||||
: root.shownCredentials.length === 0 ? "NO MATCH" : ""
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: pickerList
|
||||
|
||||
readonly property int rowHeight: 24
|
||||
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: Math.min(count, 10) * rowHeight
|
||||
visible: count > 0
|
||||
clip: true
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
model: root.shownCredentials
|
||||
|
||||
delegate: Rectangle {
|
||||
id: row
|
||||
|
||||
required property int index
|
||||
required property var modelData
|
||||
|
||||
readonly property bool current: row.index === root.pickerIndex
|
||||
|
||||
width: pickerList.width
|
||||
height: pickerList.rowHeight
|
||||
color: row.current ? Theme.selection : "transparent"
|
||||
|
||||
Rectangle {
|
||||
visible: row.current
|
||||
width: 2
|
||||
height: parent.height
|
||||
color: Theme.accent
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 10
|
||||
anchors.rightMargin: 6
|
||||
spacing: 10
|
||||
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: row.modelData.title
|
||||
elide: Text.ElideRight
|
||||
color: row.current ? Theme.text : Theme.muted
|
||||
font.family: Theme.displayFont
|
||||
font.pixelSize: 12
|
||||
}
|
||||
|
||||
// Only useful when the list spans vaults.
|
||||
MicroText {
|
||||
visible: root.activeVault === ""
|
||||
text: row.modelData.vault.toUpperCase()
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onClicked: root.pick(row.index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 14
|
||||
|
||||
MicroText { text: "↑↓ SELECT" }
|
||||
MicroText { text: "ENTER FILL" }
|
||||
MicroText { text: "TAB VAULT" }
|
||||
MicroText { text: "ESC BACK" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
width: parent.width
|
||||
height: vaultPanel.headerHeight
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.pickerOpen ? root.closePicker() : root.openPicker()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,176 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
// Proton Pass logins for the polkit and askpass prompts, via pass-cli.
|
||||
//
|
||||
// Listing never touches a secret: `item list` without --show-secrets returns
|
||||
// ids and titles only. A password is fetched on its own, for one item, after
|
||||
// the user picks it — and read through a SplitParser rather than a
|
||||
// StdioCollector, which would keep it in its `text` property afterwards.
|
||||
//
|
||||
// `item list` refuses to run without a vault, so "all vaults" is one call per
|
||||
// vault. Each takes ~0.8s, hence run in parallel by a single shell script.
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
// {shareId, id, title, vault}, unsorted — the dialog orders and groups them.
|
||||
property var entries: []
|
||||
// Why the list is empty or incomplete; "" when it is fine.
|
||||
property string error: ""
|
||||
property string fetchError: ""
|
||||
|
||||
readonly property bool loading: vaults.running || items.running
|
||||
readonly property bool fetching: fetcher.running
|
||||
|
||||
// Shown inside the picker.
|
||||
readonly property string listStatus: root.loading
|
||||
? (root.entries.length === 0 ? "LOADING VAULTS…" : "REFRESHING…")
|
||||
: root.error
|
||||
// Shown under the field, picker open or not.
|
||||
readonly property string fetchStatus: root.fetching ? "FETCHING PASSWORD…" : root.fetchError
|
||||
|
||||
// Bumped per request; a fetch that lands after it changed is dropped, so a
|
||||
// slow fetch cannot fill a password into the NEXT request's field.
|
||||
property int generation: 0
|
||||
property int fetchGeneration: -1
|
||||
property bool fetchGotLine: false
|
||||
property var vaultNames: ({})
|
||||
|
||||
signal fetched(string secret)
|
||||
|
||||
function refresh() {
|
||||
if (root.loading)
|
||||
return;
|
||||
root.error = "";
|
||||
vaults.running = true;
|
||||
}
|
||||
|
||||
function invalidate() {
|
||||
root.generation++;
|
||||
root.fetchError = "";
|
||||
}
|
||||
|
||||
function fetch(entry) {
|
||||
if (!entry || root.fetching)
|
||||
return;
|
||||
root.fetchError = "";
|
||||
root.fetchGeneration = root.generation;
|
||||
root.fetchGotLine = false;
|
||||
fetcher.command = ["pass-cli", "item", "view", "--share-id", entry.shareId,
|
||||
"--item-id", entry.id, "--field", "password", "--output", "human"];
|
||||
fetcher.running = true;
|
||||
}
|
||||
|
||||
function describe(output) {
|
||||
const text = output.replace(/\x1b\[[0-9;]*m/g, "");
|
||||
if (/not found/.test(text))
|
||||
return "PASS-CLI NOT INSTALLED";
|
||||
if (/authenticated client|no session/.test(text))
|
||||
return "PASS-CLI LOGGED OUT — RUN pass-cli login";
|
||||
const lines = text.trim().split("\n");
|
||||
return lines[lines.length - 1].toUpperCase();
|
||||
}
|
||||
|
||||
// Prints the vault JSON or `ERR <output>`: one stream, so success and
|
||||
// failure need no ordering between exit code and stdout.
|
||||
readonly property var vaults: Process {
|
||||
id: vaults
|
||||
|
||||
command: ["sh", "-c",
|
||||
"out=$(pass-cli vault list --output json 2>&1) && printf '%s' \"$out\" || printf 'ERR %s' \"$out\""]
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
const body = this.text;
|
||||
if (body.startsWith("ERR ")) {
|
||||
root.error = root.describe(body.slice(4));
|
||||
return;
|
||||
}
|
||||
|
||||
let list;
|
||||
try {
|
||||
list = JSON.parse(body).vaults || [];
|
||||
} catch (e) {
|
||||
root.error = "UNREADABLE VAULT LIST";
|
||||
return;
|
||||
}
|
||||
const names = {};
|
||||
for (const v of list)
|
||||
names[v.share_id] = v.name;
|
||||
root.vaultNames = names;
|
||||
if (list.length === 0) {
|
||||
root.entries = [];
|
||||
root.error = "NO VAULTS";
|
||||
return;
|
||||
}
|
||||
items.command = ["sh", "-c", items.script, "sh"].concat(list.map(v => v.share_id));
|
||||
items.running = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// One `item list` per vault in parallel, each to its own file, then
|
||||
// printed back in order under an `@@<share_id>` line — concurrent writers
|
||||
// on one pipe would interleave.
|
||||
//
|
||||
// No --filter-type: it takes ONE type, and the `darman@<config>` machine
|
||||
// logins scripts/deploy reads are `custom` items, not `login`.
|
||||
readonly property var items: Process {
|
||||
id: items
|
||||
|
||||
readonly property string script: "d=$(mktemp -d \"${XDG_RUNTIME_DIR:-/tmp}/qs-pass.XXXXXX\") || exit 1;"
|
||||
+ " trap 'rm -rf \"$d\"' EXIT; i=0;"
|
||||
+ " for s; do i=$((i+1)); pass-cli item list --share-id \"$s\""
|
||||
+ " --filter-state active --output json > \"$d/$i\" 2>/dev/null & done; wait; i=0;"
|
||||
+ " for s; do i=$((i+1)); printf '\\n@@%s\\n' \"$s\"; cat \"$d/$i\"; done"
|
||||
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
const found = [];
|
||||
let failed = 0;
|
||||
for (const chunk of this.text.split(/^@@/m)) {
|
||||
const nl = chunk.indexOf("\n");
|
||||
const share = nl < 0 ? "" : chunk.slice(0, nl).trim();
|
||||
if (share === "")
|
||||
continue;
|
||||
try {
|
||||
for (const it of JSON.parse(chunk.slice(nl + 1)).items || [])
|
||||
if (it.item_type === "login" || it.item_type === "custom")
|
||||
found.push({ shareId: share, id: it.id, title: it.title, vault: root.vaultNames[share] || "" });
|
||||
} catch (e) {
|
||||
failed++;
|
||||
}
|
||||
}
|
||||
root.entries = found;
|
||||
root.error = failed === 0 ? (found.length === 0 ? "NO LOGINS IN ANY VAULT" : "")
|
||||
: failed + " VAULT" + (failed === 1 ? "" : "S") + " FAILED TO LIST";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
readonly property var fetcher: Process {
|
||||
id: fetcher
|
||||
|
||||
stdout: SplitParser {
|
||||
splitMarker: "\n"
|
||||
onRead: line => {
|
||||
if (root.fetchGotLine)
|
||||
return;
|
||||
root.fetchGotLine = true;
|
||||
if (root.fetchGeneration !== root.generation)
|
||||
return;
|
||||
root.fetchError = line === "" ? "THAT ITEM HAS NO PASSWORD" : "";
|
||||
if (line !== "")
|
||||
root.fetched(line);
|
||||
}
|
||||
}
|
||||
|
||||
onExited: (exitCode, exitStatus) => {
|
||||
if (!root.fetchGotLine && root.fetchGeneration === root.generation)
|
||||
root.fetchError = exitCode === 0 ? "THAT ITEM HAS NO PASSWORD" : "COULD NOT READ THAT ITEM";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import Quickshell
|
||||
import qs.HyprChrome.Widgets.Greeter
|
||||
|
||||
// greetd greeter entry point: `qs -p greeter.qml`, as the greeter user. See
|
||||
// services/desktop/quickshell-greeter.nix.
|
||||
Scope {
|
||||
Greeter {}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import Quickshell
|
||||
import qs.HyprChrome.Widgets.Lock
|
||||
|
||||
// Session lock entry point: `qs -n -p lock.qml`, from the SUPER+L bind and
|
||||
// hypridle (home/desktop/hyprland.nix). Separate from shell.qml so a shell
|
||||
// reload or crash cannot take the lock down with it.
|
||||
Scope {
|
||||
Lock {}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
hyprctl dispatch 'hl.dsp.global ("quickshell:launcher8")'
|
||||
hyprctl dispatch 'hl.dsp.global ("quickshell:command")'
|
||||
|
||||
@@ -5,7 +5,6 @@ import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import qs.widgets.bar
|
||||
import qs.widgets.launcher
|
||||
import qs.widgets.notifications
|
||||
import qs.widgets.osd
|
||||
import qs.widgets.systray
|
||||
import qs.widgets.theme
|
||||
@@ -36,14 +35,12 @@ Scope {
|
||||
OrbitLauncher {} // 10 — radial targeting arena
|
||||
CyberDock {} // 11 — cyberpunk bottom cartridge dock
|
||||
|
||||
Notifications {}
|
||||
|
||||
VolumeOsd {}
|
||||
|
||||
// Host vitals HUD — toggle with SUPER CTRL V.
|
||||
Vitals {}
|
||||
|
||||
// Widget staging area, centered on the secondary monitor (HDMI-A-1),
|
||||
// Widget staging area, centered on the secondary monitor,
|
||||
// toggled with SUPER CTRL D. Swap the children below for whatever widget
|
||||
// is being worked on; they must carry their own size (see DebugWindow).
|
||||
// DebugWindow {
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
import QtQuick
|
||||
import qs.HyprChrome.Widgets.Bar.Claude
|
||||
|
||||
// The rail's claude panel collapsed and expanded, healthy and failing.
|
||||
//
|
||||
// ./tools/quickshell-preview/render.sh \
|
||||
// tests/ClaudePanelHeadless.qml \
|
||||
// .artifacts/quickshell-preview/claude-panel.png 640 420
|
||||
Rectangle {
|
||||
width: 640
|
||||
height: 420
|
||||
color: "#0f1012"
|
||||
|
||||
readonly property var soon: new Date(Date.now() + 2 * 3600000 + 17 * 60000).toISOString()
|
||||
readonly property var later: new Date(Date.now() + 4 * 86400000 + 5 * 3600000).toISOString()
|
||||
|
||||
Row {
|
||||
x: 16
|
||||
y: 16
|
||||
spacing: 24
|
||||
|
||||
Column {
|
||||
spacing: 12
|
||||
|
||||
ClaudePanel {
|
||||
expanded: false
|
||||
ready: true
|
||||
fiveHour: ({ utilization: 42, resets_at: soon })
|
||||
sevenDay: ({ utilization: 91, resets_at: later })
|
||||
}
|
||||
|
||||
ClaudePanel {
|
||||
expanded: false
|
||||
ready: true
|
||||
error: "usage HTTP 429"
|
||||
shortError: "ERR"
|
||||
fiveHour: ({ utilization: 42, resets_at: soon })
|
||||
sevenDay: ({ utilization: 91, resets_at: later })
|
||||
}
|
||||
|
||||
ClaudePanel {
|
||||
expanded: false
|
||||
ready: false
|
||||
error: "token refresh HTTP 400"
|
||||
shortError: "EXPIRED"
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
spacing: 12
|
||||
|
||||
ClaudePanel {
|
||||
expanded: true
|
||||
ready: true
|
||||
fiveHour: ({ utilization: 42, resets_at: soon })
|
||||
sevenDay: ({ utilization: 91, resets_at: later })
|
||||
extra: [{ label: "SONNET", window: { utilization: 12, resets_at: later } }]
|
||||
}
|
||||
|
||||
ClaudePanel {
|
||||
expanded: true
|
||||
ready: true
|
||||
error: "usage HTTP 429"
|
||||
shortError: "ERR"
|
||||
fiveHour: ({ utilization: 8, resets_at: soon })
|
||||
sevenDay: ({ utilization: 30, resets_at: later })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import QtQuick
|
||||
import qs.HyprChrome.Widgets.Greeter
|
||||
|
||||
// Offscreen render of the lock panel (Lock.qml) after a rejected password.
|
||||
//
|
||||
// ./tools/quickshell-preview/render.sh \
|
||||
// tests/LockPanelHeadless.qml \
|
||||
// .artifacts/quickshell-preview/lock-panel.png 700 340
|
||||
LoginContent {
|
||||
width: 640
|
||||
|
||||
title: "LOCKED // TERRA"
|
||||
panelId: "LCK"
|
||||
meta: "PAM"
|
||||
submitLabel: "UNLOCK"
|
||||
userEditable: false
|
||||
showPower: false
|
||||
|
||||
sessionName: "hyprland"
|
||||
now: new Date(2026, 8, 18, 21, 47, 38)
|
||||
user: "darman"
|
||||
response: "hunter2"
|
||||
|
||||
message: "authentication failed"
|
||||
messageIsError: true
|
||||
failed: true
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import QtQuick
|
||||
import qs.HyprChrome.Widgets.Greeter
|
||||
|
||||
// Offscreen render of the login panel after a rejected password.
|
||||
//
|
||||
// ./tools/quickshell-preview/render.sh \
|
||||
// tests/LoginPanelHeadless.qml \
|
||||
// .artifacts/quickshell-preview/login-panel.png 700 340
|
||||
LoginContent {
|
||||
width: 640
|
||||
|
||||
hostName: "terra"
|
||||
sessionName: "hyprland"
|
||||
now: new Date(2026, 8, 18, 21, 47, 38)
|
||||
user: "darman"
|
||||
response: "hunter2"
|
||||
|
||||
message: "Authentication failure"
|
||||
messageIsError: true
|
||||
failed: true
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
import QtQuick
|
||||
import qs.HyprChrome.Widgets.Bar.Luna
|
||||
|
||||
// The rail's luna panel in both densities and every daemon state. Collapsed
|
||||
// is the left column (state only), expanded the right (messages) — the two
|
||||
// things the panel has to get right, side by side.
|
||||
//
|
||||
// ./tools/quickshell-preview/render.sh \
|
||||
// tests/LunaPanelHeadless.qml \
|
||||
// .artifacts/quickshell-preview/luna-panel.png 640 560
|
||||
Rectangle {
|
||||
width: 640
|
||||
height: 560
|
||||
color: "#0f1012"
|
||||
|
||||
Row {
|
||||
x: 16
|
||||
y: 16
|
||||
spacing: 24
|
||||
|
||||
Column {
|
||||
spacing: 12
|
||||
|
||||
LunaPanel {
|
||||
expanded: false
|
||||
connected: true
|
||||
active: false
|
||||
daemonState: "idle"
|
||||
}
|
||||
|
||||
LunaPanel {
|
||||
expanded: false
|
||||
connected: true
|
||||
active: true
|
||||
daemonState: "listening"
|
||||
rms: 0.02
|
||||
}
|
||||
|
||||
LunaPanel {
|
||||
expanded: false
|
||||
connected: true
|
||||
active: true
|
||||
daemonState: "thinking"
|
||||
}
|
||||
|
||||
LunaPanel {
|
||||
expanded: false
|
||||
connected: true
|
||||
active: true
|
||||
daemonState: "speaking"
|
||||
rms: 0.05
|
||||
}
|
||||
|
||||
LunaPanel {
|
||||
expanded: false
|
||||
connected: false
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
spacing: 12
|
||||
|
||||
LunaPanel {
|
||||
expanded: true
|
||||
connected: true
|
||||
active: false
|
||||
daemonState: "idle"
|
||||
}
|
||||
|
||||
LunaPanel {
|
||||
expanded: true
|
||||
connected: true
|
||||
active: true
|
||||
daemonState: "listening"
|
||||
rms: 0.02
|
||||
userText: "hey luna, what's the time?"
|
||||
}
|
||||
|
||||
LunaPanel {
|
||||
expanded: true
|
||||
connected: true
|
||||
active: true
|
||||
daemonState: "speaking"
|
||||
rms: 0.05
|
||||
userText: "hey luna, what's the time?"
|
||||
lunaText: "It's 23:40 on Sunday night, chief. Shouldn't you be asleep?"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import QtQuick
|
||||
import qs.HyprChrome.Widgets.Notifications
|
||||
|
||||
// Offscreen render of the three urgencies, with actions, a link and a
|
||||
// part-drained meter.
|
||||
//
|
||||
// ./tools/quickshell-preview/render.sh \
|
||||
// tests/NotificationCardHeadless.qml \
|
||||
// .artifacts/quickshell-preview/notifications.png 400 520
|
||||
Rectangle {
|
||||
width: 400
|
||||
height: 520
|
||||
color: "#1b1d20"
|
||||
|
||||
Column {
|
||||
x: 20
|
||||
y: 20
|
||||
width: 360
|
||||
spacing: 14
|
||||
|
||||
NotificationCard {
|
||||
width: parent.width
|
||||
appName: "Firefox"
|
||||
summary: "Download complete"
|
||||
body: "<b>nixos-26.05-x86_64.iso</b> finished — <a href=\"file:///tmp\">open folder</a>"
|
||||
appIcon: "firefox"
|
||||
time: "14:32"
|
||||
actions: [
|
||||
{ identifier: "default", text: "Open" },
|
||||
{ identifier: "show", text: "Show in folder" },
|
||||
{ identifier: "dismiss", text: "Dismiss" }
|
||||
]
|
||||
timeout: 5000
|
||||
countdown: false
|
||||
remaining: 0.6
|
||||
}
|
||||
|
||||
NotificationCard {
|
||||
width: parent.width
|
||||
appName: "smartd"
|
||||
summary: "Disk /dev/sdb reports 8 reallocated sectors"
|
||||
body: "SMART attribute 5 crossed its threshold. Back up the RAID0 set on /mnt/data now."
|
||||
urgency: 2
|
||||
time: "14:30"
|
||||
}
|
||||
|
||||
NotificationCard {
|
||||
width: parent.width
|
||||
appName: "nix"
|
||||
summary: "Build finished"
|
||||
urgency: 0
|
||||
time: "14:28"
|
||||
timeout: 5000
|
||||
countdown: false
|
||||
remaining: 0.2
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import QtQuick
|
||||
import qs.HyprChrome.Widgets.Polkit
|
||||
|
||||
// Offscreen render of the polkit prompt with the Proton Pass panel expanded,
|
||||
// more vaults than fit (Work, selected, sits in the open overflow menu), the
|
||||
// password revealed and a failed fetch under the
|
||||
// field. Credentials are deliberately out of order, to show the title sort.
|
||||
//
|
||||
// ./tools/quickshell-preview/render.sh \
|
||||
// tests/PolkitPromptVaultHeadless.qml \
|
||||
// .artifacts/quickshell-preview/polkit-prompt-vault.png 560 560
|
||||
PolkitPromptContent {
|
||||
width: 520
|
||||
|
||||
message: "Authentication is required to install or remove software"
|
||||
actionId: "org.freedesktop.packagekit.package-install"
|
||||
showIcon: false
|
||||
|
||||
identities: [{ id: "1000", displayName: "darman", isGroup: false }]
|
||||
|
||||
responseRequired: true
|
||||
inputPrompt: "Password:"
|
||||
response: "hunter2"
|
||||
revealed: true
|
||||
|
||||
credentialsEnabled: true
|
||||
credentials: [
|
||||
{ title: "router admin", vault: "HomeLab" },
|
||||
{ title: "proton.me", vault: "Personal" },
|
||||
{ title: "darman@terra", vault: "HomeLab" },
|
||||
{ title: "netcup", vault: "Work" },
|
||||
{ title: "Darman@mars", vault: "HomeLab" },
|
||||
{ title: "github.com", vault: "Personal" },
|
||||
{ title: "root@terra", vault: "HomeLab" },
|
||||
{ title: "grandma wifi", vault: "Family" },
|
||||
{ title: "old forum", vault: "Archive" },
|
||||
{ title: "billing portal", vault: "Clients" },
|
||||
{ title: "ci deploy key", vault: "Shared Infrastructure" },
|
||||
{ title: "vpn", vault: "Work" }
|
||||
]
|
||||
fetchStatus: "THAT ITEM HAS NO PASSWORD"
|
||||
|
||||
Component.onCompleted: {
|
||||
openPicker();
|
||||
pickerIndex = 1;
|
||||
vaultFilter = "Work";
|
||||
overflowMenuOpen = true;
|
||||
}
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
import Quickshell.Services.Notifications
|
||||
import Quickshell.Widgets
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import qs.widgets.theme
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
|
||||
required property Notification modelData
|
||||
|
||||
spacing: 0
|
||||
Layout.fillWidth: true
|
||||
|
||||
Rectangle {
|
||||
color: Theme.accent
|
||||
implicitHeight: 5
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
WrapperRectangle {
|
||||
Layout.fillWidth: true
|
||||
|
||||
margin: 12
|
||||
border.width: 1
|
||||
border.color: Theme.accent
|
||||
color: Theme.surface
|
||||
opacity: .9
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 4
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
RowLayout {
|
||||
spacing: 8
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
IconImage {
|
||||
visible: root.modelData.appIcon !== ""
|
||||
source: root.modelData.appIcon
|
||||
implicitSize: 20
|
||||
}
|
||||
|
||||
Text {
|
||||
text: root.modelData.summary
|
||||
color: Theme.text
|
||||
font.pointSize: 14
|
||||
font.bold: true
|
||||
elide: Text.ElideRight
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Text {
|
||||
id: dismissButton
|
||||
|
||||
text: "×"
|
||||
color: Theme.accent
|
||||
font.pointSize: 18
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.modelData.dismiss()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
visible: root.modelData.body !== ""
|
||||
text: root.modelData.body
|
||||
color: Theme.text
|
||||
font.pointSize: 12
|
||||
wrapMode: Text.Wrap
|
||||
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
visible: root.modelData.actions.length > 0
|
||||
spacing: 6
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
Repeater {
|
||||
model: root.modelData.actions
|
||||
|
||||
Rectangle {
|
||||
id: actionButton
|
||||
|
||||
required property NotificationAction modelData
|
||||
|
||||
color: Theme.raised
|
||||
border.width: 1
|
||||
border.color: Theme.accent
|
||||
implicitHeight: 28
|
||||
implicitWidth: actionText.implicitWidth + 16
|
||||
|
||||
Text {
|
||||
id: actionText
|
||||
anchors.centerIn: parent
|
||||
text: actionButton.modelData.text
|
||||
color: Theme.text
|
||||
font.pointSize: 12
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: actionButton.modelData.invoke()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,79 +0,0 @@
|
||||
import Quickshell
|
||||
import Quickshell.Services.Notifications
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
|
||||
NotificationServer {
|
||||
id: server
|
||||
|
||||
keepOnReload: true
|
||||
bodySupported: true
|
||||
bodyMarkupSupported: true
|
||||
imageSupported: true
|
||||
actionsSupported: true
|
||||
actionIconsSupported: true
|
||||
|
||||
onNotification: notification => {
|
||||
notification.tracked = true;
|
||||
|
||||
const timeout = notification.expireTimeout === 0 ? 0 : notification.expireTimeout > 0 ? notification.expireTimeout : (notification.urgency === NotificationUrgency.Critical ? 0 : 5000);
|
||||
|
||||
if (timeout <= 0)
|
||||
return;
|
||||
|
||||
let closed = false;
|
||||
notification.closed.connect(() => {
|
||||
closed = true;
|
||||
});
|
||||
|
||||
const timer = expiryTimerComponent.createObject(root, {
|
||||
interval: timeout
|
||||
});
|
||||
timer.triggered.connect(() => {
|
||||
if (!closed)
|
||||
notification.expire();
|
||||
timer.destroy();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: expiryTimerComponent
|
||||
|
||||
Timer {
|
||||
running: true
|
||||
}
|
||||
}
|
||||
|
||||
PanelWindow {
|
||||
screen: Quickshell.screens.find(s => s.name === "DP-2")
|
||||
|
||||
color: "transparent"
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
right: true
|
||||
}
|
||||
|
||||
margins.top: 12
|
||||
margins.right: 12
|
||||
|
||||
implicitWidth: 340
|
||||
implicitHeight: column.implicitHeight
|
||||
|
||||
ColumnLayout {
|
||||
id: column
|
||||
anchors.fill: parent
|
||||
spacing: 8
|
||||
|
||||
Repeater {
|
||||
model: server.trackedNotifications
|
||||
|
||||
NotificationPopup {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ Scope {
|
||||
}
|
||||
|
||||
PanelWindow {
|
||||
screen: Quickshell.screens.find(s => s.name === "DP-2")
|
||||
screen: Quickshell.screens.find(s => s.name === Quickshell.env("QS_PRIMARY_OUTPUT"))
|
||||
visible: root.active
|
||||
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# Start both comms apps; Hyprland window rules move them to special:communications.
|
||||
# Start the comms apps; Hyprland window rules move them to special:communications.
|
||||
flatpak run org.telegram.desktop &
|
||||
flatpak run com.discordapp.Discord &
|
||||
# terra only (hosts/terra/configuration.nix).
|
||||
command -v TeamSpeak >/dev/null && TeamSpeak &
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
"uv2nix": "uv2nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788820723,
|
||||
"narHash": "sha256-NIqHasKysUniYrJozavASUF4MqpsyBg7lZZNtM+WrwI=",
|
||||
"lastModified": 1794238815,
|
||||
"narHash": "sha256-ITaU80ncGp9K/OqoRBbiuxVgMyFHU5sJ9W4FeU6oyiE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "authentik-nix",
|
||||
"rev": "fd34a5238314351ed92dd79d00f518b8a03e19cb",
|
||||
"rev": "6441c8b2b900260ac4e9520ab1ce5be6ff1ff39e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -30,16 +30,16 @@
|
||||
"authentik-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1788268887,
|
||||
"narHash": "sha256-069RXUkk4aSYVelezdmYM70TGIJM8KyTBrLW3Vv0XdM=",
|
||||
"lastModified": 1792581414,
|
||||
"narHash": "sha256-gdhGKCfsMUrWyFnf5TaaHM2ZQ1WYgTLOgGg4DlCaUHU=",
|
||||
"owner": "goauthentik",
|
||||
"repo": "authentik",
|
||||
"rev": "b4de7336e903ef51febf42c0ff3b57c484866cdc",
|
||||
"rev": "4ec0d19b98da3c329781894cd550da95d3033954",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "goauthentik",
|
||||
"ref": "version/2026.8.1",
|
||||
"ref": "version/2026.8.5",
|
||||
"repo": "authentik",
|
||||
"type": "github"
|
||||
}
|
||||
@@ -47,11 +47,11 @@
|
||||
"client-ts-generator-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1787926240,
|
||||
"narHash": "sha256-CNazk55jeMBdP/5cf9scshRGCiKALdERny8Oues1zcY=",
|
||||
"lastModified": 1792605533,
|
||||
"narHash": "sha256-f82MB+n7cgKj62g2aTSW34KosYhE7d/dj1KUhJ5KrTY=",
|
||||
"owner": "goauthentik",
|
||||
"repo": "client-ts",
|
||||
"rev": "26b3e23c928e22e4aa66223b5b996e9e68047f0f",
|
||||
"rev": "cbdadfa3cb808b6b587e64c5430bf2d70b2d3461",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -67,11 +67,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1781152676,
|
||||
"narHash": "sha256-RxWs5ND31KzTG7wvMM+PMfUjyNpmIEr999lqNARaM5o=",
|
||||
"lastModified": 1794328522,
|
||||
"narHash": "sha256-h2BYMW4nTFpIqnMd8gwAPFmJAp/1wWLQ6vT0NfL5qt4=",
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"rev": "ff8702b4de27f72b4c78573dfb89ec74e36abdf1",
|
||||
"rev": "1dd30c29c88d99ce295f15e27f93c49bc5fbae07",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -96,16 +96,48 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1777699697,
|
||||
"narHash": "sha256-Eg9b/rq/ECYwNwEXs5i9wHyhxNI0JrYx2srdI2uZMaQ=",
|
||||
"rev": "382052b74656a369c5408822af3f2501e9b1af81",
|
||||
"type": "tarball",
|
||||
"url": "https://git.lix.systems/api/v1/repos/lix-project/flake-compat/archive/382052b74656a369c5408822af3f2501e9b1af81.tar.gz?rev=382052b74656a369c5408822af3f2501e9b1af81"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://git.lix.systems/lix-project/flake-compat/archive/main.tar.gz"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788450739,
|
||||
"narHash": "sha256-glZLQlzIn1fXH6PazR2iUmTo7kzzyYSshrWhLS9TqCU=",
|
||||
"lastModified": 1793576659,
|
||||
"narHash": "sha256-V1h85lUaJBQoHFrB2vpXZOE0Ju1MYSnIpsehoVZYlDo=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "31729ca8cbdb4fa927b34e5f4353e6a83f39e993",
|
||||
"rev": "ea2630b7470978622c7689a1ff75d2b389175399",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts_2": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1793576659,
|
||||
"narHash": "sha256-V1h85lUaJBQoHFrB2vpXZOE0Ju1MYSnIpsehoVZYlDo=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "ea2630b7470978622c7689a1ff75d2b389175399",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -122,11 +154,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"lastModified": 1791914995,
|
||||
"narHash": "sha256-Zf/xfQEAasnwnmEfHqW/4hjDE/s44yn2hD4RuVIZRjA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"rev": "b7a79d3fea1e214f6d668d521cecec0c01e26544",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -135,6 +167,33 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"git-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
"nix-citizen",
|
||||
"nix-gaming",
|
||||
"flake-compat"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nix-citizen",
|
||||
"nix-gaming",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1793686154,
|
||||
"narHash": "sha256-Zb/0L3soxrkfcrywpfp0J++0WFLB3tzh0Xtx9up+VNc=",
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "204b6977e00caac19e2313015a598543ca7be150",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -142,11 +201,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788642154,
|
||||
"narHash": "sha256-sPpQFVaFTDqO/4vvCAhuAhqTgqN/ygu+9eJcs5eB0js=",
|
||||
"lastModified": 1794251182,
|
||||
"narHash": "sha256-R2sZBXiOJo3HAnvTiVkbbHDJy//JMlAwUKEiPbfqPXk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "fd0956c99c41ae3c13a73a638f1f7e963aebc4ab",
|
||||
"rev": "6eb2d33d1d0c95a37ef6443c88e6c1686012ee8b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -156,6 +215,26 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"honcho-console": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1790980944,
|
||||
"narHash": "sha256-uvGecoGp+jTNCyVi3Zhxk3nNYPYfmbuQ9jE6BXU5d5E=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "6aa45e5a7a238c1d84cf2014b3a1dec5c8969371",
|
||||
"revCount": 12,
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.mgaction.town:2222/darman/honcho-console.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.mgaction.town:2222/darman/honcho-console.git"
|
||||
}
|
||||
},
|
||||
"hypr-chrome": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -176,14 +255,35 @@
|
||||
"url": "https://git.mgaction.town/darman/hypr-chrome.git"
|
||||
}
|
||||
},
|
||||
"hyprchrome": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1794684228,
|
||||
"narHash": "sha256-Tn9JdMOSHfnhdmnTc9brl1dQPB/qkYkjH8ka2J3E8FU=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "61959090074cbc3bfb7bdf22d861ab82e2dce397",
|
||||
"revCount": 2,
|
||||
"submodules": true,
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.mgaction.town:2222/darman/hyprchrome.git"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.mgaction.town:2222/darman/hyprchrome.git"
|
||||
}
|
||||
},
|
||||
"livesync-bridge": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1787571662,
|
||||
"narHash": "sha256-btLnQNbFzCPaSVcY9rtiPdYeXrZjoK9AYvfA9+ovsIc=",
|
||||
"lastModified": 1793773829,
|
||||
"narHash": "sha256-YbenBjZd0WfPQ9Djtd7D460JmJzXiWeyBf2rYc4YE6A=",
|
||||
"owner": "vrtmrz",
|
||||
"repo": "livesync-bridge",
|
||||
"rev": "c3760beaa0851214da4860903445d7f6420ca025",
|
||||
"rev": "1c252305bbddcacd200b8560d3bb786afe0906e9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -232,13 +332,94 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"millennium": {
|
||||
"inputs": {
|
||||
"millennium-src": "millennium-src",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs-bun": "nixpkgs-bun"
|
||||
},
|
||||
"locked": {
|
||||
"dir": "packages/nix",
|
||||
"lastModified": 1794588209,
|
||||
"narHash": "sha256-i0Y49re/VXOTBGSjsYdEoIrP9IaNejmCeUHFssGQ+NQ=",
|
||||
"owner": "SteamClientHomebrew",
|
||||
"repo": "Millennium",
|
||||
"rev": "6522c24e8bd3de41a7601ceb4e78a619930f1704",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "packages/nix",
|
||||
"owner": "SteamClientHomebrew",
|
||||
"repo": "Millennium",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"millennium-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1794587997,
|
||||
"narHash": "sha256-UZQSHMsAaYTcx1TDAI7FTqVRsMpB1jLBL8kYKivwbYo=",
|
||||
"owner": "SteamClientHomebrew",
|
||||
"repo": "Millennium",
|
||||
"rev": "ac5e1ad646b1d1dd76a04aecf32d9e5e41779201",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "SteamClientHomebrew",
|
||||
"repo": "Millennium",
|
||||
"rev": "ac5e1ad646b1d1dd76a04aecf32d9e5e41779201",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nexusmods-app": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1792841846,
|
||||
"narHash": "sha256-phMkc6bsvT0IzQ81rIMdnsrwXSHkwX69hL1mM1QW6e0=",
|
||||
"ref": "feat/bg3-load-order",
|
||||
"rev": "2a118e6e98811223526e1f5595390d81f9206b62",
|
||||
"revCount": 8786,
|
||||
"submodules": true,
|
||||
"type": "git",
|
||||
"url": "file:///mnt/hdd_01/dev/repos/nexus-mods-app"
|
||||
},
|
||||
"original": {
|
||||
"ref": "feat/bg3-load-order",
|
||||
"submodules": true,
|
||||
"type": "git",
|
||||
"url": "file:///mnt/hdd_01/dev/repos/nexus-mods-app"
|
||||
}
|
||||
},
|
||||
"nix-citizen": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
"nix-gaming": "nix-gaming",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1794766393,
|
||||
"narHash": "sha256-qtNL+kX2ru2k6kwmPhqG/mWjo83orqSi6wEXMxMmErI=",
|
||||
"owner": "LovingMelody",
|
||||
"repo": "nix-citizen",
|
||||
"rev": "6b732ddacf308fa5820ca00133d4d72336bf3442",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "LovingMelody",
|
||||
"repo": "nix-citizen",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-flatpak": {
|
||||
"locked": {
|
||||
"lastModified": 1783368811,
|
||||
"narHash": "sha256-0H8jDwR4Kegb3heaTrH1ftbgKfZVDT8JE+46uXxDy/Q=",
|
||||
"lastModified": 1791644268,
|
||||
"narHash": "sha256-f7Z4PmfnRxf7+37NN48ep+KsQauGtL5REE99pJtMNp8=",
|
||||
"owner": "gmodena",
|
||||
"repo": "nix-flatpak",
|
||||
"rev": "20d42f0ee98c9fe9f85e8d1de474f1409ed10d05",
|
||||
"rev": "02656785ab214fa1c9655f1beaaf0269eeeec2ca",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -247,6 +428,33 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-gaming": {
|
||||
"inputs": {
|
||||
"flake-compat": [
|
||||
"nix-citizen",
|
||||
"flake-compat"
|
||||
],
|
||||
"flake-parts": "flake-parts_2",
|
||||
"git-hooks": "git-hooks",
|
||||
"nixpkgs": [
|
||||
"nix-citizen",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1794375173,
|
||||
"narHash": "sha256-x97M5XOV+IDcm7K9Bv6a7OUePyEVCjPeLpr3iD3BJD8=",
|
||||
"owner": "fufexan",
|
||||
"repo": "nix-gaming",
|
||||
"rev": "3d460ece2fde6ba86a7f9deacc9a65e40f9ed19e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "fufexan",
|
||||
"repo": "nix-gaming",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-vm-test": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -255,11 +463,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1786747096,
|
||||
"narHash": "sha256-9QqhmaLVsPhKdMSBaWKjDqeGRn8G4ov4cVuZ6JFwXbo=",
|
||||
"lastModified": 1789916284,
|
||||
"narHash": "sha256-lv8kCCNM04qFsEMjDVrx6Z4q1afk46CBCQQq1wk5yNM=",
|
||||
"owner": "numtide",
|
||||
"repo": "nix-vm-test",
|
||||
"rev": "c8781a0ea2d8417506fff7722eae5a6316461212",
|
||||
"rev": "f6688c8cc9185daccbeb89b2ff6e57dd66e5474a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -283,14 +491,14 @@
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
"treefmt-nix": "treefmt-nix_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788938537,
|
||||
"narHash": "sha256-ooFA+3//Y9bpyFjVwTvPegsWngEoQ0pGj+2DJ5cVyJ0=",
|
||||
"lastModified": 1793171667,
|
||||
"narHash": "sha256-8h9MU32SjnFWIWRdtP9vYVNV5QrVbai8Oo1LW1rAmwc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixos-anywhere",
|
||||
"rev": "9df41112343713520ba071674cf8e45e91c25845",
|
||||
"rev": "58132e1d1f813b845382a2aeca4203b18d2ac807",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -307,11 +515,11 @@
|
||||
"nixos-unstable": "nixos-unstable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1789036642,
|
||||
"narHash": "sha256-ng2Ou1UrVCP98OAJiq8Mv6aDF/kjQWyaKm4PaxWtAu4=",
|
||||
"lastModified": 1791456080,
|
||||
"narHash": "sha256-VDnm81L/1YLrPklNacGCNwpPhHi5Tya1XbfdnCB/Zd0=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixos-images",
|
||||
"rev": "4fcaaefd02b5bc777f99afd620cb1a9aa1fb5b83",
|
||||
"rev": "50939ddf1a0339f289a9dbd810bdfd4e4fba6df4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -339,11 +547,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1788316716,
|
||||
"narHash": "sha256-bc7rSpXIdn9QWGNqfWcPZWOhEVF8NoeAZkWq0XWnf/k=",
|
||||
"lastModified": 1794042290,
|
||||
"narHash": "sha256-ziZn2PvCJE5JEEpqTdxXwJpPB+L3YqoCpTAMCzyaP3U=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "3ed67ec0a4d3c7ab4ae1f04f8ee8df07bfa506a2",
|
||||
"rev": "f4a03c008967841f2a0b3cb7c436fc6fc31671f6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -353,13 +561,44 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-bun": {
|
||||
"locked": {
|
||||
"lastModified": 1790822859,
|
||||
"narHash": "sha256-69xHQhAeMAD2wDXO7T2pcOZIF9Sga2W+JkmY2a11Ops=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c59305bab2065cfecc4944690d9eedbb56f3a9fa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "c59305bab2065cfecc4944690d9eedbb56f3a9fa",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1788057806,
|
||||
"narHash": "sha256-DTQSMxzDWmT0zhguthvegnVkn7CFqGCv4IHCzk5ZUpM=",
|
||||
"lastModified": 1793504054,
|
||||
"narHash": "sha256-ThkfL3D/FhCiZFc9+3BtxwuMmpuK+/bGtXCSo1+yVew=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "596e2e3940e09b2abbeb03f75fa1828c57fcd72c",
|
||||
"rev": "7851ba61fd862b277cb6a9cef37394bc18bb94e4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib_2": {
|
||||
"locked": {
|
||||
"lastModified": 1793504054,
|
||||
"narHash": "sha256-ThkfL3D/FhCiZFc9+3BtxwuMmpuK+/bGtXCSo1+yVew=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "7851ba61fd862b277cb6a9cef37394bc18bb94e4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -370,11 +609,11 @@
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1789073787,
|
||||
"narHash": "sha256-xfX/toC2QV707s06GbP4II/TxYF0fNQj7s5/LClNDKc=",
|
||||
"lastModified": 1794644783,
|
||||
"narHash": "sha256-3GnIGIy15bMduoS9RnWqKTmsJLWThla42UFtm0S7+us=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "aff8a0b28396750446e5537a96461bc4facdb287",
|
||||
"rev": "5d2b81a7a3be3e2f832879028e4d60abbf58e9a0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -386,11 +625,24 @@
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1789009968,
|
||||
"narHash": "sha256-GB16oaxpsrnGNnGIE+0uYBqMRzB9X6FYDUvjvnJAYew=",
|
||||
"lastModified": 1794386569,
|
||||
"narHash": "sha256-W60urNAgQVS8bhNWH0bQsYoiagds8m38oTDUjEOM9FE=",
|
||||
"rev": "d4f25a3e562008648d45bcf2d70bcc7422cad84e",
|
||||
"type": "tarball",
|
||||
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1117658.d4f25a3e5620/nixexprs.tar.zst?lastModified=1794386569&rev=d4f25a3e562008648d45bcf2d70bcc7422cad84e"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
"url": "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1794552581,
|
||||
"narHash": "sha256-qXFIqA6FCcx7XeDzw0ZNlkDT9UiCzrNDwK8RuU8RcHM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d58a46e3bc02d91ebe04667f8397752a749c0024",
|
||||
"rev": "f1e5c356f35d07e7b71a6b5e6c9338e0b029e0c0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -416,11 +668,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1786936886,
|
||||
"narHash": "sha256-8SFyOdmcG6Nsh/JzlH812lTI/v+ur06fpQhj/acNn8k=",
|
||||
"lastModified": 1793820911,
|
||||
"narHash": "sha256-cc2EX2rfojnhcvqPQh4JEFGm2Mn/VoJyw5hTJTaw7Wo=",
|
||||
"owner": "pyproject-nix",
|
||||
"repo": "build-system-pkgs",
|
||||
"rev": "90ffdeee1a4929b231913df067448cd9803d3e07",
|
||||
"rev": "947b2b0c973de462b19577715f04ba8d6f48ed7e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -466,11 +718,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1786031528,
|
||||
"narHash": "sha256-cROiHKO3UbIKqF5FG5NikvydzlfIj4EcR1Cty9qOVt4=",
|
||||
"lastModified": 1793820880,
|
||||
"narHash": "sha256-NUMabnvaL/0Ah9WM9pBMXEp+dQjMSYjezZ/fNjXouLQ=",
|
||||
"owner": "pyproject-nix",
|
||||
"repo": "pyproject.nix",
|
||||
"rev": "1b1485546d85f6f6c7aadb10c4923dbc09633263",
|
||||
"rev": "d43f0e74444c1f266c640fc49ce6ce6fb69d33c3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -505,15 +757,21 @@
|
||||
"authentik-nix": "authentik-nix",
|
||||
"disko": "disko",
|
||||
"home-manager": "home-manager",
|
||||
"honcho-console": "honcho-console",
|
||||
"hypr-chrome": "hypr-chrome",
|
||||
"hyprchrome": "hyprchrome",
|
||||
"livesync-bridge": "livesync-bridge",
|
||||
"mediamanager-nix": "mediamanager-nix",
|
||||
"millennium": "millennium",
|
||||
"nexusmods-app": "nexusmods-app",
|
||||
"nix-citizen": "nix-citizen",
|
||||
"nix-flatpak": "nix-flatpak",
|
||||
"nixos-anywhere": "nixos-anywhere",
|
||||
"nixos-images": "nixos-images",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"sops-nix": "sops-nix",
|
||||
"tbctl": "tbctl",
|
||||
"tome": "tome"
|
||||
}
|
||||
},
|
||||
@@ -524,11 +782,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788914643,
|
||||
"narHash": "sha256-4GuMPW90JSxXWDPUB9M+1m7fYbe3H0apOd86/zBQ2Kw=",
|
||||
"lastModified": 1794624949,
|
||||
"narHash": "sha256-3q/hxp/flW1PnV3Dx+H3p8kHGEHJ7251BqVMNsAAB9E=",
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"rev": "13616fff713a9f94055c66f15687ebdc17a335df",
|
||||
"rev": "11e5885d241743ff0193465d533b20e754bc3ce0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -552,14 +810,34 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"tbctl": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1793410258,
|
||||
"narHash": "sha256-MMfosPFbaOEEEZsfR3IdtbVrAft+HX+xvznK4ouzXH4=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "4b02ee62d4f4ede5378d140c39154e6cb5aeef92",
|
||||
"revCount": 46,
|
||||
"type": "git",
|
||||
"url": "file:///mnt/hdd_01/dev/repos/openbeach"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "file:///mnt/hdd_01/dev/repos/openbeach"
|
||||
}
|
||||
},
|
||||
"tome": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1785431655,
|
||||
"narHash": "sha256-EoM4HmJb7MZArMoP4y1b7DZcvM8iANYjMiE5gGUx070=",
|
||||
"lastModified": 1793641410,
|
||||
"narHash": "sha256-Rab2elFs1E8pJJ90y+omA5I+Vou8wf+70BGrH3HClDs=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "4f3ca447cdc967371adaf71b26cf283952e54212",
|
||||
"revCount": 51,
|
||||
"rev": "5274abdc96772669c736992a9dfcbb9497557edb",
|
||||
"revCount": 53,
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.mgaction.town:2222/darman/TOME.git"
|
||||
},
|
||||
@@ -569,6 +847,27 @@
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nix-citizen",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1791885023,
|
||||
"narHash": "sha256-C3alQ2MEt0zVrUSho5NUDo3jmhbff72++bfwoqT9Omo=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "0d6d739a833ba9a9c93034862e4a7b061a062a1c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixos-anywhere",
|
||||
@@ -576,11 +875,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1786901030,
|
||||
"narHash": "sha256-WSFCsDSE5ffgD2MqzkM2CYjeFiKhRF/dJUN8uedb6YE=",
|
||||
"lastModified": 1791885023,
|
||||
"narHash": "sha256-C3alQ2MEt0zVrUSho5NUDo3jmhbff72++bfwoqT9Omo=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "27b3b12a8e6375f28ebe122f07d230ca5459bbfa",
|
||||
"rev": "0d6d739a833ba9a9c93034862e4a7b061a062a1c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -601,11 +900,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788001239,
|
||||
"narHash": "sha256-AELmsXPI546MhbC/ZXC7WRUkCz7d4rqKTHUmliIgPpI=",
|
||||
"lastModified": 1793272761,
|
||||
"narHash": "sha256-3CE1CEwprYlHRlRVkXDkhqec0jjF9Cti7tdk8vVDsCM=",
|
||||
"owner": "pyproject-nix",
|
||||
"repo": "uv2nix",
|
||||
"rev": "7f9c6b613d2e749e54854b1d60ab6a2192db889e",
|
||||
"rev": "c361746c7d630d98b972378290547c8d35542a7a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -31,43 +31,73 @@
|
||||
url = "github:strangeglyph/mediamanager-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# livesync-bridge — headless CouchDB <-> filesystem sync for Obsidian
|
||||
# LiveSync, used on mars to give luna a real directory of markdown
|
||||
# (hosts/mars/livesync-bridge.nix). Not a flake and not in nixpkgs, so it
|
||||
# comes in as plain source pinned by flake.lock; the service copies it out
|
||||
# and runs it under deno. Pinning matters more than usual here — this is a
|
||||
# small third-party project with open bugs on the storage->couchdb path,
|
||||
# so an unreviewed bump could quietly change how the agent's notes are
|
||||
# written back.
|
||||
# Headless CouchDB<->filesystem sync for Obsidian LiveSync
|
||||
# (hosts/mars/livesync-bridge.nix); not a flake/not in nixpkgs, so plain
|
||||
# source pinned by flake.lock. Pin carefully — it's a small third-party
|
||||
# project with open storage->couchdb bugs, so an unreviewed bump could
|
||||
# silently change how notes get written back.
|
||||
livesync-bridge = {
|
||||
url = "github:vrtmrz/livesync-bridge";
|
||||
flake = false;
|
||||
};
|
||||
authentik-nix.url = "github:nix-community/authentik-nix";
|
||||
nix-flatpak.url = "github:gmodena/nix-flatpak";
|
||||
# Own Hyprland plugin (border + title bar), public repo, fetched over
|
||||
# https (no credentials needed, unlike tome below). `nixpkgs.follows` is
|
||||
# what makes its packaged build ABI-correct — Hyprland plugins are
|
||||
# ABI-locked to the exact Hyprland build they load into, so it has to be
|
||||
# built against THIS flake's own nixpkgs, not whatever hypr-chrome's own
|
||||
# flake.lock happens to pin standalone.
|
||||
# Own Hyprland plugin (border + title bar), public repo over https.
|
||||
# `nixpkgs.follows` is required since Hyprland plugins are ABI-locked to
|
||||
# the exact Hyprland build — it must share this flake's nixpkgs, not
|
||||
# whatever hypr-chrome's own lock pins standalone.
|
||||
hypr-chrome = {
|
||||
url = "git+https://git.mgaction.town/darman/hypr-chrome.git";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# Tome (formerly AudibleLibrary) — darman's own .NET/Photino desktop app.
|
||||
# Private repo on our own gitea; fetched over ssh with darman's ambient key,
|
||||
# same as any other git flake input. `flake = false`: it's a plain source
|
||||
# tree, not itself a flake. See pkgs/tome.nix.
|
||||
# Private repo on our own gitea, fetched over ssh with darman's ambient
|
||||
# key; plain source tree (`flake = false`), see pkgs/tome.nix.
|
||||
#
|
||||
# NOTE: the credential-less installer-iso can't fetch this (git+ssh needs
|
||||
# darman's key), so `./scripts/deploy install terra localhost` will fail
|
||||
# at nixos-install (post-disko) while this input is present. Known
|
||||
# tradeoff — re-removed this once before (4f79ec7) for the same reason.
|
||||
# NOTE: the credential-less installer-iso can't fetch this, so
|
||||
# `./scripts/deploy install terra localhost` fails at nixos-install
|
||||
# (post-disko) while this input is present — a known tradeoff.
|
||||
tome = {
|
||||
url = "git+ssh://gitea@git.mgaction.town:2222/darman/TOME.git";
|
||||
flake = false;
|
||||
};
|
||||
# Web console for luna's Honcho (hosts/mars/honcho-console.nix); own repo
|
||||
# on our gitea, ships its package + NixOS module.
|
||||
honcho-console = {
|
||||
url = "git+ssh://gitea@git.mgaction.town:2222/darman/honcho-console.git";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# tbctl (openbeach): KB7/KP7/Kone II Air CLI + desktop GUI on terra.
|
||||
# Local checkout for now; upstream is git+ssh://git@github.com/darman96/openbeach.git?ref=main.
|
||||
tbctl = {
|
||||
url = "git+file:///mnt/hdd_01/dev/repos/openbeach";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# hyprchrome: harness for the HyprChrome apps on our gitea. Carries
|
||||
# hyprchrome-files (terra's default file manager), hyprchrome-claude
|
||||
# (desktop app around the claude CLI) and hyprchrome-widgets as
|
||||
# submodules, plus their shared libcosmic/winit patches, and builds the
|
||||
# packages. Push the app and the harness there, then
|
||||
# `nix flake update hyprchrome` here.
|
||||
hyprchrome = {
|
||||
url = "git+ssh://gitea@git.mgaction.town:2222/darman/hyprchrome.git";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# NexusMods.App (terra): source of nixpkgs' package overridden with the
|
||||
# local checkout's BG3 branch, see services/desktop/nexusmods-app.nix.
|
||||
# Commit there, then `nix flake update nexusmods-app` here.
|
||||
nexusmods-app = {
|
||||
url = "git+file:///mnt/hdd_01/dev/repos/nexus-mods-app?ref=feat/bg3-load-order&submodules=1";
|
||||
flake = false;
|
||||
};
|
||||
# Millennium Steam client modding (terra). Its overlay builds against our
|
||||
# nixpkgs; nixpkgs-bun stays pinned since a fixed-output hash depends on it.
|
||||
millennium = {
|
||||
url = "github:SteamClientHomebrew/Millennium?dir=packages/nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# Star Citizen (terra). No nixpkgs follows: keeps wine-astral on its Cachix.
|
||||
nix-citizen.url = "github:LovingMelody/nix-citizen";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, disko, nixos-anywhere, sops-nix, nixos-images, home-manager, mediamanager-nix, authentik-nix, ... }@inputs:
|
||||
@@ -123,6 +153,20 @@
|
||||
];
|
||||
};
|
||||
|
||||
# titan — ASUS Zenbook Pro Duo UX581 laptop; same Hyprland workstation
|
||||
# as terra (profiles/workstation.nix). See hosts/titan/*.
|
||||
titan = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [
|
||||
disko.nixosModules.disko
|
||||
sops-nix.nixosModules.sops
|
||||
home-manager.nixosModules.home-manager
|
||||
inputs.nix-flatpak.nixosModules.nix-flatpak
|
||||
./hosts/titan/configuration.nix
|
||||
];
|
||||
};
|
||||
|
||||
# mars — on-site x86_64 box: Hermes Agent, plus the LAN web apps luna
|
||||
# hosts herself (hosts/mars/luna-sites.nix). See hosts/mars/*.
|
||||
mars = nixpkgs.lib.nixosSystem {
|
||||
@@ -136,10 +180,9 @@
|
||||
];
|
||||
};
|
||||
|
||||
# mercury — Raspberry Pi 3B+ (aarch64), DNS/DHCP. Boots from an SD image:
|
||||
# mercury — Raspberry Pi 3B+ (aarch64), DNS/DHCP; SD image via:
|
||||
# nix build .#nixosConfigurations.mercury.config.system.build.sdImage
|
||||
# (aarch64 build — needs binfmt/qemu on this x86 host, or a remote/aarch64
|
||||
# builder; substitutes most paths from cache.nixos.org.)
|
||||
# Needs binfmt/qemu for the aarch64 build on this x86 host (or a remote aarch64 builder).
|
||||
mercury = nixpkgs.lib.nixosSystem {
|
||||
system = "aarch64-linux";
|
||||
specialArgs = { inherit inputs; };
|
||||
@@ -209,16 +252,12 @@
|
||||
];
|
||||
};
|
||||
|
||||
# Bootable USB recovery installer with our SSH key + sshd + DHCP. Clones
|
||||
# the (now public) homelab repo fresh at every boot to /root/homelab —
|
||||
# always current master, so the same USB stick stays useful across
|
||||
# install/rescue occasions without ever needing a rebuild. No
|
||||
# rsync/copy-the-repo-over step: boot it, ssh in,
|
||||
# `cd /root/homelab && ./scripts/deploy install ...`.
|
||||
# Reusable for any host's manual-USB install path (jupiter, terra, ...).
|
||||
# Build the ISO:
|
||||
# nix build .#nixosConfigurations.installer-iso.config.system.build.isoImage
|
||||
# dd it to a USB stick, boot the target from it, SSH in, ./deploy install.
|
||||
# Bootable USB recovery installer with our SSH key + sshd + DHCP; clones
|
||||
# the public homelab repo fresh at every boot to /root/homelab, so the
|
||||
# same stick stays current without a rebuild. Reusable for any host's
|
||||
# manual-USB install path.
|
||||
# Build: nix build .#nixosConfigurations.installer-iso.config.system.build.isoImage,
|
||||
# dd to USB, boot the target, ssh in, ./scripts/deploy install ...
|
||||
installer-iso = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
@@ -233,34 +272,18 @@
|
||||
console.keyMap = "de"; # matches common.nix's real hosts
|
||||
environment.systemPackages = [ pkgs.git ];
|
||||
|
||||
# findiso= is a SCRIPT-stage-1 feature (stage-1-init.sh) only. The
|
||||
# systemd initrd — the default since 26.05 — has no findiso path
|
||||
# at all: it mounts /iso straight from
|
||||
# /dev/disk/by-label/<volumeID> (iso-image.nix), which only exists
|
||||
# when the ISO is the physical boot medium. Booted as a kernel +
|
||||
# initrd off the ESP with the iso as a plain file elsewhere, that
|
||||
# label never appears and stage 1 times out into an emergency
|
||||
# shell (mounts /sysroot fine, then fails /sysroot/nix/.ro-store).
|
||||
# Script stage 1 instead loop-mounts the file findiso= points at
|
||||
# and symlinks it to /dev/root — which is the whole mechanism this
|
||||
# install path relies on. So force it off here.
|
||||
# The systemd initrd (default since 26.05) has no findiso= path — only
|
||||
# the legacy script stage-1 does — so this install method needs it off.
|
||||
boot.initrd.systemd.enable = false;
|
||||
|
||||
# installation-cd-minimal leaves experimental-features unset, so
|
||||
# the ISO's nix.conf has no `nix-command`/`flakes` at all (unlike
|
||||
# the nixos-images kexec installer, which sets
|
||||
# extra-experimental-features itself — which is why the same
|
||||
# `install <config> localhost` branch works after kexec-local but
|
||||
# not here). Without this, both `nix run .#disko` and
|
||||
# `nixos-install --flake` die with "experimental Nix feature
|
||||
# 'nix-command' is disabled".
|
||||
# installation-cd-minimal ships with experimental-features unset;
|
||||
# without this, both `nix run .#disko` and `nixos-install --flake`
|
||||
# die with "experimental Nix feature 'nix-command' is disabled".
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# Fresh clone of a PUBLIC repo — no credentials baked into the
|
||||
# ISO. require_tracked() in scripts/deploy still works fine here
|
||||
# (this IS a real git checkout, unlike the old baked-`self`
|
||||
# approach), but retry manually with `systemctl restart
|
||||
# homelab-checkout` if DHCP was still coming up at boot.
|
||||
# Fresh clone of the public repo (no credentials baked in) so
|
||||
# scripts/deploy's require_tracked() sees a real checkout; retry
|
||||
# with `systemctl restart homelab-checkout` if DHCP wasn't up yet.
|
||||
systemd.services.homelab-checkout = {
|
||||
description = "Clone the homelab repo to /root/homelab";
|
||||
after = [ "network-online.target" ];
|
||||
@@ -277,34 +300,24 @@
|
||||
'';
|
||||
};
|
||||
|
||||
# Finishes a local_install_prepare_and_reboot() run (scripts/deploy)
|
||||
# unattended: that function stages this ISO, points a systemd-boot
|
||||
# one-shot entry at it with `homelab.install=<config>` on the kernel
|
||||
# cmdline, and reboots. Once booted here, this re-runs the exact same
|
||||
# `./scripts/deploy install <config> localhost` command — now genuinely
|
||||
# inside the installer (hostname homelab-installer), so is_live_installer
|
||||
# takes the disko+nixos-install branch instead of preparing again.
|
||||
# A manual boot of this ISO with no such cmdline param is a no-op.
|
||||
# Completes an unattended local_install_prepare_and_reboot() run:
|
||||
# re-runs `./scripts/deploy install <config> localhost`, now genuinely
|
||||
# inside the installer so it takes the disko+nixos-install branch.
|
||||
# No-op if homelab.install= isn't on the kernel cmdline.
|
||||
systemd.services.homelab-auto-install = {
|
||||
description = "Auto-run the homelab install if homelab.install= was passed on the kernel cmdline";
|
||||
after = [ "homelab-checkout.service" ];
|
||||
requires = [ "homelab-checkout.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig.Type = "oneshot";
|
||||
# Full system PATH, not the restricted default a `path = [...]`
|
||||
# produces: this unit execs `./scripts/deploy`, whose
|
||||
# `#!/usr/bin/env bash` needs bash, and which then reaches for
|
||||
# nix / nixos-install / git / sudo / efibootmgr. The default
|
||||
# service PATH gave "env: 'bash': No such file or directory"
|
||||
# (status 127) before the script even started.
|
||||
# /run/current-system/sw/bin carries all of it on the installer;
|
||||
# /run/wrappers/bin for sudo. mkForce because NixOS otherwise
|
||||
# derives environment.PATH from `path` and that line would win.
|
||||
# Needs the full system PATH: scripts/deploy execs bash then shells
|
||||
# out to nix/nixos-install/git/sudo/efibootmgr, none of which a
|
||||
# restricted `path = [...]` PATH provides. mkForce overrides NixOS's
|
||||
# default PATH derivation from `path`.
|
||||
#
|
||||
# HOME too: systemd sets no $HOME for a service without User=
|
||||
# (systemd.exec(5): SetLoginEnvironment= defaults false), and
|
||||
# scripts/deploy runs under `set -u`, so a bare $HOME aborted the
|
||||
# whole run with an "unbound variable" that read like a bug.
|
||||
# HOME too: systemd sets no $HOME without User= (SetLoginEnvironment=
|
||||
# defaults false), and scripts/deploy runs under `set -u`, so a
|
||||
# missing $HOME aborted with a confusing "unbound variable".
|
||||
environment = {
|
||||
HOME = "/root";
|
||||
PATH = lib.mkForce "/run/current-system/sw/bin:/run/wrappers/bin";
|
||||
@@ -316,17 +329,11 @@
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Persist this whole run to a file that OUTLIVES the install.
|
||||
# The systemd journal is on the installer's tmpfs and dies with
|
||||
# the reboot, and by the time anything interesting fails disko
|
||||
# has already wiped the OS disk — so a failed attempt used to
|
||||
# leave nothing to debug. local_install_prepare_and_reboot()
|
||||
# (scripts/deploy) passes the STAGING partition's PARTUUID as
|
||||
# homelab.logpart=; that partition holds the iso and is on a
|
||||
# different disk from the one disko wipes, so it survives. The
|
||||
# actual install runs inside do_install() below so one tee at
|
||||
# the end captures all of it. Every step here is best-effort:
|
||||
# logging must never be the thing that breaks an install.
|
||||
# Persist this run to a file that outlives the install: the journal
|
||||
# dies with the reboot and disko wipes the OS disk before a failure
|
||||
# can be read back. homelab.logpart= points at the staging partition
|
||||
# (survives the wipe); every step here is best-effort so logging
|
||||
# itself can't break an install.
|
||||
logfile=""
|
||||
logpart=$(grep -o 'homelab\.logpart=[^ ]*' /proc/cmdline | cut -d= -f2 || true)
|
||||
if [ -n "$logpart" ]; then
|
||||
@@ -336,9 +343,8 @@
|
||||
if mount -o rw "$dev" /run/homelab-log 2>/dev/null; then
|
||||
logdir=/run/homelab-log
|
||||
elif where=$(findmnt -fno TARGET "$dev" 2>/dev/null) && [ -n "$where" ]; then
|
||||
# stage-1's findiso already holds this partition mounted
|
||||
# (that is how it reached the iso) — write into the existing
|
||||
# mount rather than trying to stack a second one on it.
|
||||
# stage-1's findiso already has this partition mounted (how it
|
||||
# reached the iso) — reuse that mount instead of a second one.
|
||||
mount -o remount,rw "$where" 2>/dev/null || true
|
||||
logdir="$where"
|
||||
fi
|
||||
@@ -358,12 +364,10 @@
|
||||
fi
|
||||
|
||||
do_install() {
|
||||
# The host key scripts/deploy seeds /etc/ssh with (so sops can
|
||||
# decrypt on boot #1) cannot live in this ISO: it is built from
|
||||
# a PUBLIC repo and the private keys are deliberately off-repo.
|
||||
# local_install_prepare_and_reboot() therefore drops it on the
|
||||
# boot partition and passes that partition's PARTUUID here.
|
||||
# That copy dies with the disko wipe a few minutes later.
|
||||
# The host key (so sops can decrypt on first boot) can't live in
|
||||
# this public-repo ISO; local_install_prepare_and_reboot() drops it
|
||||
# on the boot partition instead and passes that PARTUUID here — the
|
||||
# copy dies with disko's wipe minutes later.
|
||||
keypart=$(grep -o 'homelab\.keypart=[^ ]*' /proc/cmdline | cut -d= -f2 || true)
|
||||
if [ -n "$keypart" ]; then
|
||||
mkdir -p /run/homelab-key
|
||||
@@ -384,12 +388,10 @@
|
||||
fi
|
||||
fi
|
||||
|
||||
# On a box whose old bootloader had no one-shot (Limine on
|
||||
# terra), scripts/deploy got us here via a temporary UEFI
|
||||
# entry + BootNext (arm_efi_bootnext). BootNext is already
|
||||
# spent, but the entry itself would linger in NVRAM pointing
|
||||
# at a partition disko is about to reformat. Drop it now, so
|
||||
# even an install that fails later leaves NVRAM clean.
|
||||
# On bootloaders with no one-shot (Limine on terra), scripts/deploy
|
||||
# got here via a temporary UEFI entry + BootNext (arm_efi_bootnext);
|
||||
# BootNext is spent but the entry would linger pointing at a
|
||||
# partition disko is about to wipe, so remove it now.
|
||||
for n in $(efibootmgr 2>/dev/null \
|
||||
| sed -n 's/^Boot\([0-9A-Fa-f]\{4\}\)\*\?[[:space:]]Homelab Installer[[:space:]].*/\1/p'); do
|
||||
echo "removing temporary UEFI entry Boot$n"
|
||||
@@ -419,19 +421,11 @@
|
||||
};
|
||||
};
|
||||
|
||||
# VM test for `./scripts/deploy kexec-local`. Run:
|
||||
# nix build .#checks.x86_64-linux.kexec-local -L
|
||||
#
|
||||
# Worth having because kexec-local is the one command that cannot be
|
||||
# rehearsed on real hardware: it jumps the machine you are typing at, and
|
||||
# a failure looks exactly like a slow boot. It regression-tests the
|
||||
# subtle one — kexec-run.sh backgrounds `sleep 6 && kexec -e` and returns,
|
||||
# so anything that cleans up the staging dir on exit deletes the binary
|
||||
# that performs the jump and the box silently never leaves the old kernel.
|
||||
#
|
||||
# After the jump the test driver's backdoor is gone with the old kernel,
|
||||
# so the installer is driven over a forwarded ssh port instead (the same
|
||||
# approach nixos-images uses in its own kexec test).
|
||||
# VM test for `./scripts/deploy kexec-local` (nix build .#checks.x86_64-linux.kexec-local -L)
|
||||
# — the one command that can't be rehearsed on real hardware since it jumps
|
||||
# the machine you're on. Regression-tests kexec-run.sh's backgrounded
|
||||
# `sleep 6 && kexec -e`: cleaning up the staging dir on exit would delete
|
||||
# the jump binary and the box would silently stay on the old kernel.
|
||||
checks.${system} = {
|
||||
kexec-local =
|
||||
let
|
||||
@@ -489,9 +483,9 @@
|
||||
|
||||
machine.succeed("install -Dm755 /etc/deploy /root/deploy")
|
||||
|
||||
# systemd-run starts units with a bare PATH that lacks
|
||||
# /run/current-system/sw/bin, so `#!/usr/bin/env bash` cannot even
|
||||
# resolve bash, let alone tar/findmnt/nohup. Set it explicitly.
|
||||
# systemd-run starts units with a bare PATH lacking
|
||||
# /run/current-system/sw/bin, so bash (and tar/findmnt/nohup)
|
||||
# can't resolve — set it explicitly.
|
||||
env = (
|
||||
" --setenv=PATH=/run/wrappers/bin:/run/current-system/sw/bin"
|
||||
" --setenv=HOMELAB_KEXEC_TARBALL=${tarball}/nixos-kexec-installer-${system}.tar.gz"
|
||||
@@ -513,9 +507,9 @@
|
||||
while ssh(["true"], check=False).returncode != 0:
|
||||
time.sleep(1)
|
||||
|
||||
# Refuses without --yes when stdin is not a tty (read gets EOF).
|
||||
# Must reach the confirmation prompt, so it needs the same env —
|
||||
# otherwise it just dies early on the nix build and proves nothing.
|
||||
# Refuses without --yes when stdin isn't a tty; needs the same env to
|
||||
# reach the confirmation prompt, else it dies early on the nix build
|
||||
# and proves nothing.
|
||||
out = machine.fail(f"{envsh} /root/deploy kexec-local </dev/null 2>&1")
|
||||
assert "using prebuilt kexec installer" in out, \
|
||||
f"never reached the prompt, so the refusal proves nothing:\n{out}"
|
||||
@@ -571,31 +565,51 @@
|
||||
luna-sites = import ./hosts/mars/luna-sites-test.nix {
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
};
|
||||
|
||||
# VM test for services/identity/pass-broker.nix, with fake pass-cli
|
||||
# and Telegram: nix build .#checks.x86_64-linux.pass-broker -L
|
||||
pass-broker = import ./services/identity/pass-broker-test.nix {
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
};
|
||||
|
||||
# Two-node test of the approval gateway (mars) with a broker using it:
|
||||
# nix build .#checks.x86_64-linux.pass-broker-gateway -L
|
||||
pass-broker-gateway = import ./services/identity/pass-broker-gateway-test.nix {
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
};
|
||||
|
||||
# terra's VPN-confined qBittorrent against a fake Proton peer:
|
||||
# nix build .#checks.x86_64-linux.qbittorrent-vpn -L
|
||||
qbittorrent-vpn = import ./services/desktop/qbittorrent-vpn-test.nix {
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
};
|
||||
|
||||
# Synapse + MAS on jupiter behind neptun's caddy vhosts:
|
||||
# nix build .#checks.x86_64-linux.matrix -L
|
||||
matrix = import ./services/comms/matrix-test.nix {
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
};
|
||||
};
|
||||
|
||||
# `nix develop` — hot-reload loop for dotfiles/quickshell.
|
||||
#
|
||||
# hosts/terra/home.nix ships the shell via `xdg.configFile."quickshell"`,
|
||||
# which COPIES the tree into the store, so ~/.config/quickshell is a
|
||||
# read-only symlink into /nix/store and every QML tweak costs a
|
||||
# nixos-rebuild. quickshell DOES hot-reload on file save — but only for
|
||||
# the files it is watching, which are those frozen store copies. Pointing
|
||||
# it at the working tree with `qs -p` restores edit-save-see, no rebuild.
|
||||
# home/desktop/default.nix ships the shell as a store copy (`xdg.configFile`),
|
||||
# which only hot-reloads its own frozen files; pointing at the working
|
||||
# tree with `qs -p` restores edit-save-see without a rebuild.
|
||||
#
|
||||
# quickshell keys instance identity on the CONFIG PATH, so a working-tree
|
||||
# instance and the store-backed one are two different instances that would
|
||||
# both map layer-shell bars onto every output. Hence a swap, not a second
|
||||
# instance — and the swap starts dev FIRST, killing the packaged shell
|
||||
# only once dev is confirmed up, so a QML error in the working tree leaves
|
||||
# you on your normal bar instead of no bar at all.
|
||||
# quickshell keys instance identity on the config path, so the
|
||||
# working-tree and store-backed shells are different instances that
|
||||
# would both claim every output — hence a swap, not a second instance.
|
||||
# The swap starts dev first and only kills the packaged shell once dev
|
||||
# is confirmed up, so a QML error leaves you on your normal bar.
|
||||
#
|
||||
# Every kill is scoped to one config (`qs kill` = default only, `qs kill
|
||||
# -p` = that path only). A blanket kill would also take out unrelated
|
||||
# quickshell instances — pkgs/rishot.nix is one.
|
||||
# Every kill is scoped to one config (`qs kill` = default, `qs kill -p
|
||||
# <path>` = that path) since a blanket kill would also take out
|
||||
# unrelated instances like pkgs/rishot.nix.
|
||||
#
|
||||
# Deliberately NOT wired to direnv (no .envrc in this repo): programs.direnv
|
||||
# is enabled for this user, so a `use flake` would swap the running desktop
|
||||
# shell on every `cd` into the checkout, including over ssh.
|
||||
# Deliberately not wired to direnv: programs.direnv is enabled for this
|
||||
# user, so a `use flake` would swap the desktop shell on every `cd`
|
||||
# into the checkout, including over ssh.
|
||||
devShells.${system}.default =
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
@@ -652,10 +666,9 @@
|
||||
echo "qs-dev: live on $cfg — edits there now hot-reload"
|
||||
'';
|
||||
|
||||
# qs log -f prints everything the instance logs; WARN and ERROR are the
|
||||
# two that mean something is wrong with the QML in front of you. A
|
||||
# binding loop or a failed binding is a WARN and easy to miss when it
|
||||
# scrolls past inside a reload's worth of chatter.
|
||||
# qs log -f prints everything the instance logs; WARN/ERROR are what
|
||||
# mean something is actually wrong with the QML (a binding loop or
|
||||
# failed binding is a WARN, easy to miss in the reload chatter).
|
||||
qs-log = pkgs.writeShellScriptBin "qs-log" ''
|
||||
set -uo pipefail
|
||||
${preamble}
|
||||
@@ -665,12 +678,10 @@
|
||||
-a|--all) filter='.' ;;
|
||||
esac
|
||||
|
||||
# -t 1: `qs log -f` replays the whole backlog first, which would dump
|
||||
# every historical warning into the terminal on shell entry.
|
||||
#
|
||||
# `qs log -f` ends when the instance it attached to exits, and the dev
|
||||
# shell outlives individual instances — a QML error kills one, `qs-dev`
|
||||
# starts another. Re-attach instead of going quiet for the session.
|
||||
# -t 1: `qs log -f` otherwise replays the whole backlog on shell entry.
|
||||
# It also ends when the attached instance exits, and the dev shell
|
||||
# outlives individual instances (a QML error kills one, qs-dev starts
|
||||
# another) — so re-attach in a loop instead of going quiet for the session.
|
||||
while :; do
|
||||
if running "$cfg"; then
|
||||
${qs} log -p "$cfg" -t 1 -f 2>/dev/null | ${grep} --line-buffered -E "$filter" >&2
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
# Shared home-manager profile for darman, applied on every host via
|
||||
# common.nix. Host-specific extras (terra's desktop/dev tooling) layer on
|
||||
# common.nix. Workstation extras (terra, titan: home/desktop) layer on
|
||||
# top via their own home-manager.users.darman.imports entry, same pattern
|
||||
# used here — see hosts/terra/configuration.nix + hosts/terra/home.nix.
|
||||
# used here — see profiles/workstation.nix + home/desktop/default.nix.
|
||||
{ ... }:
|
||||
{
|
||||
home.stateVersion = "26.05";
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
# Matches terra's baseline (compinit, deduped/shared history, HISTFILE
|
||||
# under $HOME). home-manager owns ~/.zshrc + ~/.zshenv as real files, which
|
||||
# also means zsh's built-in zsh-newuser-install wizard never fires on
|
||||
# first interactive login (it only triggers when none of
|
||||
# .zshenv/.zprofile/.zshrc/.zlogin exist) — that used to happen on every
|
||||
# host except terra.
|
||||
# under $HOME). home-manager owning ~/.zshrc + ~/.zshenv as real files also
|
||||
# means zsh's newuser-install wizard never fires (it only triggers when
|
||||
# none of those dotfiles exist) — previously an issue on every host except
|
||||
# terra.
|
||||
programs.zsh.enable = true;
|
||||
}
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
{ pkgs, unstable, inputs, ... }:
|
||||
let
|
||||
tome = pkgs.callPackage ../../pkgs/tome.nix { src = inputs.tome; };
|
||||
claude-usage = pkgs.callPackage ../../pkgs/claude-usage.nix { };
|
||||
|
||||
# SUDO_ASKPASS helper: renders sudo's password prompt in the quickshell
|
||||
# shell (HyprChrome/Widgets/Askpass) instead of on the terminal.
|
||||
# SUDO_ASKPASS helper: shows sudo's password prompt in quickshell
|
||||
# (HyprChrome/Widgets/Askpass) instead of the terminal. sudo doesn't speak
|
||||
# polkit (setuid + PAM reading the tty), so this reuses the polkit dialog's
|
||||
# look via the askpass mechanism instead — `run0` is the actual polkit-native
|
||||
# alternative.
|
||||
#
|
||||
# sudo does NOT speak polkit — it is setuid + PAM reading the tty, and no
|
||||
# sudoers option bridges the two — so this is the askpass mechanism, a
|
||||
# separate path that happens to reuse the polkit dialog's look. `run0` is the
|
||||
# polkit-native alternative if you want the agent itself.
|
||||
# Must be a package, not a dotfiles file: SUDO_ASKPASS needs an executable,
|
||||
# and xdg.configFile copies keep store-copy permissions.
|
||||
#
|
||||
# A package rather than a file in dotfiles/quickshell because SUDO_ASKPASS
|
||||
# must point at something EXECUTABLE, and xdg.configFile copies keep their
|
||||
# store mode — which is why open_launcher.sh has to be invoked as
|
||||
# `bash <path>` rather than run directly.
|
||||
#
|
||||
# The secret comes back over a 0600 fifo, never in argv or the environment,
|
||||
# so it is not visible in /proc to anything. Cancelling closes the fifo
|
||||
# without writing: `cat` reads nothing, this exits non-zero, and sudo aborts
|
||||
# instead of burning a retry on an empty password.
|
||||
# The secret returns over a 0600 fifo (never argv/env, so not visible in
|
||||
# /proc); cancelling closes the fifo unwritten so sudo aborts cleanly.
|
||||
qs-askpass = pkgs.writeShellApplication {
|
||||
name = "qs-askpass";
|
||||
runtimeInputs = [ pkgs.quickshell pkgs.coreutils ];
|
||||
@@ -50,10 +45,10 @@ let
|
||||
};
|
||||
in
|
||||
{
|
||||
# Desktop profile shared by terra and titan (profiles/workstation.nix).
|
||||
# home.stateVersion, programs.home-manager.enable, programs.zsh.enable all
|
||||
# come from home/common.nix (shared across every host) via
|
||||
# configuration.nix's home-manager.users.darman.imports.
|
||||
imports = [ ./home/hyprland.nix ./home/theme.nix ];
|
||||
# come from home/common.nix (every host).
|
||||
imports = [ ./options.nix ./hyprland.nix ./theme.nix ];
|
||||
|
||||
home.keyboard.layout = "de";
|
||||
|
||||
@@ -62,10 +57,25 @@ in
|
||||
settings = {
|
||||
user.name = "Erik Simon";
|
||||
user.email = "mail@erik-s.dev";
|
||||
init.defaultBranch = "master";
|
||||
};
|
||||
};
|
||||
|
||||
# direnv + nix-direnv: lets per-repo devShells (e.g. ~/Data/Dev/repos/Tome's
|
||||
# At home, ssh to gitea goes straight to jupiter instead of out to neptun and
|
||||
# back over the tailnet; away, the probe fails and the public route applies.
|
||||
# The alias matches the existing known_hosts entry (same gitea host key).
|
||||
# LFS rides the same connection via LFS_ALLOW_PURE_SSH (services/dev/gitea.nix).
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
enableDefaultConfig = false;
|
||||
matchBlocks.gitea-lan = {
|
||||
match = ''host git.mgaction.town exec "${pkgs.netcat}/bin/nc -z -w1 10.0.0.20 2222"'';
|
||||
hostname = "10.0.0.20";
|
||||
extraOptions.HostKeyAlias = "[git.mgaction.town]:2222";
|
||||
};
|
||||
};
|
||||
|
||||
# direnv + nix-direnv: lets per-repo devShells (e.g. /mnt/hdd_01/dev/repos/Tome's
|
||||
# flake.nix) auto-load in the shell AND in Rider via its "direnv
|
||||
# integration" plugin, instead of every dev repo needing its own
|
||||
# jetbrains-toolbox SDK wiring by hand.
|
||||
@@ -74,11 +84,19 @@ in
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
# Rootless podman: containers run as darman, not root. services/containers.nix
|
||||
# gives us the `docker` CLI shim (dockerCompat), but compose v2 is a separate
|
||||
# binary and talks to a socket rather than the CLI — the NixOS podman module
|
||||
# enables the *user* socket (systemd.user.sockets.podman), so point compose at
|
||||
# it instead of the root /var/run/docker.sock.
|
||||
# Only active under `mangohud %command%`; logs every frame from launch.
|
||||
programs.mangohud = {
|
||||
enable = true;
|
||||
settings = {
|
||||
output_folder = "/home/darman/mangologs";
|
||||
log_interval = 0;
|
||||
autostart_log = 1;
|
||||
};
|
||||
};
|
||||
|
||||
# Rootless podman runs containers as darman; compose v2 talks to a socket
|
||||
# rather than the docker CLI shim, so point it at the user podman socket
|
||||
# instead of the root one.
|
||||
home.sessionVariables.DOCKER_HOST = "unix:///run/user/1000/podman/podman.sock";
|
||||
|
||||
# Only sets WHICH helper sudo uses; it still only calls it when asked with
|
||||
@@ -99,15 +117,16 @@ in
|
||||
(pkgs.writeTextDir "share/mime/packages/application-x-ms-sln.xml"
|
||||
(builtins.readFile ../../dotfiles/mime/application-x-ms-sln.xml))
|
||||
unstable.claude-code
|
||||
unstable.codex
|
||||
pkgs.opencode
|
||||
pkgs.quickshell
|
||||
qs-askpass
|
||||
claude-usage
|
||||
pkgs.github-cli
|
||||
pkgs.tea
|
||||
pkgs.docker-compose
|
||||
pkgs.hyprcursor
|
||||
pkgs.papirus-icon-theme
|
||||
tome
|
||||
];
|
||||
|
||||
xdg.desktopEntries.btop = {
|
||||
@@ -1,35 +1,8 @@
|
||||
{ lib, pkgs, config, inputs, ... }:
|
||||
|
||||
# Hyprland config migrated from github.com/darman96/hyprland-dotfiles (the
|
||||
# hyprlang `hypr/*.conf` files) into the home-manager lua-style `settings`
|
||||
# (configType defaults to "lua" on stateVersion 26.05). Each top-level
|
||||
# `settings` attr becomes an `hl.<name>(...)` call in ~/.config/hypr/hyprland.lua;
|
||||
# `_args` lists become multi-arg calls, `_var` locals become `local x = ...`, and
|
||||
# `lib.generators.mkLuaInline` values render as raw Lua expressions.
|
||||
#
|
||||
# Imported by home.nix. System-level Hyprland enable (session entry, portals)
|
||||
# lives in ../../services/desktop/desktop-hyprland.nix; this manages the user's
|
||||
# own hyprland.lua.
|
||||
#
|
||||
# Deliberately NOT migrated:
|
||||
# - hyprbars.conf: config for the third-party `hyprbevelbars` plugin, which
|
||||
# isn't packaged in nixpkgs. Load it via
|
||||
# `wayland.windowManager.hyprland.plugins` and re-add its config once
|
||||
# available. (hyprredsquare.conf's plugin was renamed hypr-chrome and
|
||||
# rewritten since - it's wired in below via the `hypr-chrome` flake
|
||||
# input instead, with its own `plugin.hyprchrome` config.)
|
||||
# - hyprqt6engine.conf + `QT_QPA_PLATFORMTHEME=hyprqt6engine`: terra themes Qt
|
||||
# through qtct/Dracula in home.nix, so that env var is left off to avoid a conflict.
|
||||
# - hyprlock.conf: a separate program (use `programs.hyprlock` if wanted).
|
||||
# - the duplicate pamixer/amixer + `.wob` volume binds: kept only the clean
|
||||
# pipewire `wpctl`/`playerctl` set (no wob overlay is configured here).
|
||||
# - `XDG_MENU_PREFIX=arch-` and `VCPKG_ROOT`: Arch-/user-specific.
|
||||
# Many binds reference apps/scripts not packaged on terra yet (vivaldi-stable,
|
||||
# dolphin, vicinae, grimblast, waypaper, discord, gitkraken, qbz,
|
||||
# ~/.config/scripts/start-communications.sh); add them separately.
|
||||
{ lib, pkgs, config, osConfig, inputs, ... }:
|
||||
|
||||
let
|
||||
lua = lib.generators.mkLuaInline;
|
||||
cfg = config.homelab.desktop;
|
||||
|
||||
# Cursor theme+size live in home.pointerCursor (theme.nix) so the name is
|
||||
# in one place; hyprland.lua is what actually gets them into the graphical
|
||||
@@ -37,14 +10,6 @@ let
|
||||
cursorName = config.home.pointerCursor.name;
|
||||
cursorSize = toString config.home.pointerCursor.size;
|
||||
|
||||
# Wallpaper images aren't checked into this repo (binary blobs) — pulled
|
||||
# from the existing Wallhaven library on /mnt/hdd_01 instead. Picked once
|
||||
# here rather than at runtime, since hyprpaper has no built-in "random"
|
||||
# mode; re-pick and rebuild (or swap in real per-monitor selection) when
|
||||
# this stops being a placeholder.
|
||||
# wallpaper = "/mnt/hdd_01/data/Pictures/Wallhaven/wallhaven-ym81rl.png";
|
||||
wallpaper = "/mnt/hdd_01/data/Pictures/Wallhaven/wallhaven-mlwz78.png";
|
||||
|
||||
# Dispatchers → the new hl.dsp.* API (signatures verified against hyprland
|
||||
# 0.55's src/config/lua/bindings/LuaBindingsDispatchers.cpp).
|
||||
dsp = {
|
||||
@@ -73,6 +38,10 @@ let
|
||||
bindo = keys: dispatcher: opts: { _args = [ keys dispatcher opts ]; };
|
||||
|
||||
# SUPER + 1..9 → workspaces 1..9, SUPER + 0 → workspace 10.
|
||||
# HyprChrome lock screen (dotfiles/quickshell/lock.qml); -n so a second
|
||||
# lock request is a no-op.
|
||||
lockCmd = "${lib.getExe pkgs.quickshell} -n -p ${config.xdg.configHome}/quickshell/lock.qml";
|
||||
|
||||
wsKeys = [
|
||||
{ k = "1"; n = 1; } { k = "2"; n = 2; } { k = "3"; n = 3; }
|
||||
{ k = "4"; n = 4; } { k = "5"; n = 5; } { k = "6"; n = 6; }
|
||||
@@ -81,16 +50,22 @@ let
|
||||
];
|
||||
in
|
||||
{
|
||||
services.hyprpaper = {
|
||||
services.hyprpaper = lib.mkIf (cfg.wallpaper != null) {
|
||||
enable = true;
|
||||
settings = {
|
||||
ipc = "on";
|
||||
splash = false;
|
||||
preload = [ wallpaper ];
|
||||
wallpaper = [
|
||||
{ monitor = "DP-2"; path = wallpaper; }
|
||||
{ monitor = "HDMI-A-1"; path = wallpaper; }
|
||||
];
|
||||
preload = [ cfg.wallpaper ];
|
||||
wallpaper = map (m: { monitor = m.output; path = cfg.wallpaper; }) cfg.monitors;
|
||||
};
|
||||
};
|
||||
|
||||
# Turns `loginctl lock-session` (SUPER+L, and logind before suspend) into the lock.
|
||||
services.hypridle = {
|
||||
enable = true;
|
||||
settings.general = {
|
||||
lock_cmd = lockCmd;
|
||||
before_sleep_cmd = "loginctl lock-session";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -107,10 +82,7 @@ in
|
||||
bg_accent = { _var = "rgba(963c38ff)"; };
|
||||
|
||||
# ---- monitors ----
|
||||
monitor = [
|
||||
{ output = "DP-2"; mode = "2560x1440@144"; position = "1920x0"; scale = 1; }
|
||||
{ output = "HDMI-A-1"; mode = "1920x1080@60"; position = "0x360"; scale = 1; }
|
||||
];
|
||||
monitor = cfg.monitors;
|
||||
|
||||
# ---- variables (general/decoration/input/misc/...) ----
|
||||
config = {
|
||||
@@ -124,7 +96,7 @@ in
|
||||
debug.disable_logs = false;
|
||||
|
||||
general = {
|
||||
border_size = 2;
|
||||
border_size = 1;
|
||||
col = {
|
||||
inactive_border = lua "bg_accent";
|
||||
active_border = {
|
||||
@@ -159,6 +131,9 @@ in
|
||||
close_special_on_empty = true;
|
||||
disable_hyprland_logo = true;
|
||||
disable_splash_rendering = true;
|
||||
# Lets a crashed lock be retaken by relaunching it instead of
|
||||
# leaving the "lock app died" screen up.
|
||||
allow_session_lock_restore = true;
|
||||
};
|
||||
|
||||
binds = {
|
||||
@@ -200,6 +175,9 @@ in
|
||||
{ _args = [ "XDG_SESSION_DESKTOP" "Hyprland" ]; }
|
||||
{ _args = [ "XDG_SESSION_TYPE" "wayland" ]; }
|
||||
{ _args = [ "QT_QPA_PLATFORMTHEME" "qt6ct" ]; }
|
||||
# Read by the quickshell bar/OSD/debug stage to pick their monitor.
|
||||
{ _args = [ "QS_PRIMARY_OUTPUT" cfg.primaryOutput ]; }
|
||||
{ _args = [ "QS_SECONDARY_OUTPUT" cfg.secondaryOutput ]; }
|
||||
];
|
||||
|
||||
# ---- keybinds (keybinds.conf) ----
|
||||
@@ -226,13 +204,21 @@ in
|
||||
# expand / collapse the hyprchrome bar as a whole
|
||||
(bind "SUPER + A" (dsp.global "quickshell:chrome"))
|
||||
|
||||
]
|
||||
# mute / unmute your mic for luna (services/desktop/luna-voice.nix);
|
||||
# never cuts off a reply she is already giving.
|
||||
# Runs the CLI rather than a quickshell GlobalShortcut so the mic can
|
||||
# still be switched off while the shell is reloading.
|
||||
++ lib.optional (osConfig.homelab.lunaVoice.enable or false)
|
||||
(bind "SUPER + V" (dsp.exec "luna-voice toggle"))
|
||||
++ [
|
||||
(bind "SUPER + B" (dsp.exec "vivaldi"))
|
||||
(bind "SUPER + E" (dsp.exec "cosmic-files"))
|
||||
(bind "SUPER + E" (dsp.exec cfg.fileManager))
|
||||
(bind "SUPER + SHIFT + G" (dsp.workspaceRef "game"))
|
||||
(bind "SUPER + S" (dsp.exec "grim -o DP-2 ~/screenshot.png"))
|
||||
(bind "SUPER + S" (dsp.exec "grim -o ${cfg.primaryOutput} ~/screenshot.png"))
|
||||
(bind "SUPER + SHIFT + S" (dsp.exec "grimblast copy area --freeze"))
|
||||
(bind "Print" (dsp.exec "rishot"))
|
||||
(bind "SUPER + L" (dsp.exec "hyprlock"))
|
||||
(bind "SUPER + L" (dsp.exec "loginctl lock-session"))
|
||||
(bind "SUPER + W" (dsp.exec "waypaper --random"))
|
||||
|
||||
# window management
|
||||
@@ -268,7 +254,7 @@ in
|
||||
(bind "SUPER + T" (dsp.togglespecial "terminal"))
|
||||
(bind "SUPER + C" (dsp.togglespecial "communications"))
|
||||
(bind "SUPER + M" (dsp.togglespecial "music"))
|
||||
(bind "SUPER + V" (dsp.togglespecial "version_control"))
|
||||
# (bind "SUPER + V" (dsp.togglespecial "version_control"))
|
||||
|
||||
# cycle workspaces
|
||||
(bind "SUPER + ALT + up" (dsp.workspaceRef "e+1"))
|
||||
@@ -293,10 +279,12 @@ in
|
||||
# ---- window rules (windowrules.conf) ----
|
||||
window_rule = [
|
||||
{ name = "games"; match.class = "gamescope"; workspace = "name:game"; opacity = "1 1 override"; }
|
||||
# wine's wayland driver sets the class to the lowercased exe name
|
||||
{ name = "star-citizen"; match.class = "starcitizen[.]exe"; workspace = "name:game"; opacity = "1 1 override"; }
|
||||
{ name = "vivaldi"; match.title = "(.*)(- YouTube - Vivaldi)"; opacity = "1 1 override"; }
|
||||
{ name = "jetbrains"; match.class = "(jetbrains-)(.*)"; no_initial_focus = true; float = true; center = true; }
|
||||
{ name = "jetbrains-toolbox"; match.class = "jetbrains-toolbox"; move = "1933 21"; }
|
||||
{ name = "comms"; match.class = "discord|org.telegram.desktop"; workspace = "special:communications"; }
|
||||
{ name = "comms"; match.class = "discord|org.telegram.desktop|teamspeak-client"; workspace = "special:communications"; }
|
||||
{ name = "music"; match.class = "qbz"; workspace = "special:music"; }
|
||||
{ name = "vicinae"; match.class = "vicinae"; stay_focused = true; }
|
||||
{ name = "gitkraken"; match.class = "gitkraken"; workspace = "special:version_control"; }
|
||||
@@ -304,7 +292,7 @@ in
|
||||
|
||||
# ---- workspace rules (workspacerules.conf) ----
|
||||
workspace_rule = [
|
||||
{ workspace = "name:game"; monitor = "DP-2"; decorate = false; }
|
||||
{ workspace = "name:game"; monitor = cfg.primaryOutput; decorate = false; }
|
||||
{ workspace = "special:terminal"; on_created_empty = "alacritty"; gaps_out = 256; }
|
||||
{ workspace = "special:communications"; on_created_empty = "${config.home.homeDirectory}/.config/scripts/start-communications.sh"; gaps_out = 128; }
|
||||
{ workspace = "special:music"; on_created_empty = "com.blitzfc.qbz"; gaps_out = 128; }
|
||||
@@ -317,11 +305,8 @@ in
|
||||
"hyprland.start"
|
||||
(lua ''
|
||||
function()
|
||||
-- No polkit agent is started here: quickshell registers one
|
||||
-- itself (HyprChrome/Widgets/Polkit), and a session admits only
|
||||
-- one. The hyprpolkitagent line this replaces had been dead for
|
||||
-- a while anyway — the unit was never installed, so the start
|
||||
-- failed silently and the session ran with no agent at all.
|
||||
-- No polkit agent started here: quickshell registers its own
|
||||
-- (HyprChrome/Widgets/Polkit), and a session admits only one.
|
||||
hl.exec_cmd("cosmic-settings-daemon")
|
||||
hl.exec_cmd("quickshell")
|
||||
hl.exec_cmd("alacritty", { workspace = "special:terminal silent" })
|
||||
@@ -332,5 +317,8 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-cosmic ];
|
||||
# home-manager points the portal at ITS profile (NIX_XDG_DESKTOP_PORTAL_DIR),
|
||||
# so backends must be listed here too, not only in desktop-hyprland.nix.
|
||||
# gtk provides AppChooser, without which there is no OpenURI (xdg-open).
|
||||
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-cosmic pkgs.xdg-desktop-portal-gtk ];
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{ lib, ... }:
|
||||
|
||||
# Per-host knobs for the shared desktop; set via
|
||||
# home-manager.users.darman.homelab.desktop in hosts/<h>/configuration.nix.
|
||||
{
|
||||
options.homelab.desktop = {
|
||||
monitors = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.attrs;
|
||||
description = "hl.monitor() tables; the greeter reuses them.";
|
||||
};
|
||||
primaryOutput = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "Connector that gets the bar, OSDs, the game workspace and the greeter.";
|
||||
};
|
||||
secondaryOutput = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "";
|
||||
description = "Connector for the debug widget stage; empty = last screen.";
|
||||
};
|
||||
fileManager = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "cosmic-files";
|
||||
description = "Command SUPER+E runs.";
|
||||
};
|
||||
wallpaper = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
description = "Image path for hyprpaper; null leaves hyprpaper off.";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
# Global Dracula theming (GTK + Qt)
|
||||
let
|
||||
azureGlassyDarkIcons = pkgs.callPackage ../../pkgs/azure-glassy-dark-icons.nix { };
|
||||
amyDarkIcons = pkgs.callPackage ../../pkgs/amy-dark-icons.nix { };
|
||||
slotBeautyDarkIcons = pkgs.callPackage ../../pkgs/slot-beauty-dark-icons.nix { };
|
||||
hyprchromeCursors = pkgs.callPackage ../../pkgs/hyprchrome-cursors.nix { };
|
||||
|
||||
# HyprChrome folders on top, Amy for everything else (Inherits=).
|
||||
# "HyprChrome-Folders-Solid" is the same set in the solid finish.
|
||||
baseIconTheme = "Amy-Dark-Icons";
|
||||
baseIconThemePackage = amyDarkIcons;
|
||||
iconTheme = "HyprChrome-Folders";
|
||||
iconThemePackage = pkgs.callPackage ../../pkgs/hyprchrome-folders.nix {
|
||||
baseTheme = baseIconTheme;
|
||||
};
|
||||
in
|
||||
{
|
||||
gtk = {
|
||||
enable = true;
|
||||
theme = {
|
||||
name = "Dracula";
|
||||
package = pkgs.dracula-theme;
|
||||
};
|
||||
iconTheme = {
|
||||
name = iconTheme;
|
||||
package = iconThemePackage;
|
||||
};
|
||||
};
|
||||
|
||||
# XCURSOR_THEME alone isn't enough for Steam: steamwebhelper runs inside a
|
||||
# pressure-vessel container with its own /etc, so XCURSOR_PATH doesn't
|
||||
# resolve there and it falls back to the core X11 cursor. $HOME and /nix are
|
||||
# bind-mounted in though, so the ~/.icons symlink `dotIcons` drops still
|
||||
# resolves — same fix as the flatpak workaround below.
|
||||
home.pointerCursor = {
|
||||
name = "HyprChrome";
|
||||
package = hyprchromeCursors;
|
||||
size = 36;
|
||||
gtk.enable = true;
|
||||
hyprcursor.enable = true;
|
||||
};
|
||||
|
||||
# Flatpak apps can't see XDG_DATA_DIRS/nix-store theme paths, so the
|
||||
# portal-reported theme names resolve to nothing and fall back to Adwaita;
|
||||
# Flatpak auto-exposes ~/.themes and ~/.icons read-only as the workaround.
|
||||
home.file.".themes/Dracula".source =
|
||||
"${pkgs.dracula-theme}/share/themes/Dracula";
|
||||
home.file.".icons/${iconTheme}".source =
|
||||
"${iconThemePackage}/share/icons/${iconTheme}";
|
||||
home.file.".icons/${baseIconTheme}".source =
|
||||
"${baseIconThemePackage}/share/icons/${baseIconTheme}";
|
||||
home.packages = [ baseIconThemePackage ];
|
||||
|
||||
dconf.settings."org/gnome/desktop/interface" = {
|
||||
color-scheme = "prefer-dark";
|
||||
gtk-theme = "Dracula";
|
||||
icon-theme = iconTheme;
|
||||
};
|
||||
|
||||
# "qtct" (qt5ct/qt6ct) instead of "kde" avoids pulling in
|
||||
# kdePackages.systemsettings just for the platform-theme plugin — kvantum
|
||||
# itself carries the Dracula colors, qt5ct/qt6ct just need to be told to
|
||||
# use it as the style.
|
||||
qt = {
|
||||
enable = true;
|
||||
platformTheme.name = "qtct";
|
||||
style.name = "kvantum";
|
||||
};
|
||||
xdg.configFile."Kvantum/kvantum.kvconfig".text = ''
|
||||
[General]
|
||||
theme=Dracula
|
||||
'';
|
||||
xdg.configFile."Kvantum/Dracula".source =
|
||||
"${pkgs.dracula-theme}/share/Kvantum/Dracula";
|
||||
|
||||
# Quickshell's IconImage/Quickshell.iconPath() resolves icons through the
|
||||
# Qt platform theme, not GTK — so the app-launcher grid needs the icon
|
||||
# theme set HERE (qt5ct/qt6ct), separately from the GTK dconf key above.
|
||||
xdg.configFile."qt5ct/qt5ct.conf".text = ''
|
||||
[Appearance]
|
||||
style=kvantum
|
||||
icon_theme=${iconTheme}
|
||||
'';
|
||||
xdg.configFile."qt6ct/qt6ct.conf".text = ''
|
||||
[Appearance]
|
||||
style=kvantum
|
||||
icon_theme=${iconTheme}
|
||||
'';
|
||||
}
|
||||
@@ -24,7 +24,9 @@
|
||||
../../services/media/seerr.nix
|
||||
../../services/media/immich.nix
|
||||
../../services/dev/gitea.nix
|
||||
../../services/dev/gitea-mcp.nix
|
||||
../../services/dev/obsidian-livesync.nix
|
||||
../../services/comms/matrix.nix
|
||||
];
|
||||
|
||||
# sabnzbd's unrar dependency is unfree; scope the allowance to just that
|
||||
@@ -40,16 +42,11 @@
|
||||
# systemd-boot for UEFI. If ZimaBlade boots legacy/BIOS, switch to grub.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
# common.nix's cap of 5 comes from this box's own 34-generation incident,
|
||||
# but at ~5G free on a 29G eMMC even 5 is too many — override down to 2.
|
||||
# common.nix's default of 5 is still too many boot entries for a 29G eMMC — override down to 2.
|
||||
boot.loader.systemd-boot.configurationLimit = lib.mkForce 2;
|
||||
|
||||
# A `switch` pins the old generation as a GC root until the box reboots onto
|
||||
# the new one (booted-system vs current-system) — common.nix's nix.gc is
|
||||
# weekly, far too slow to catch that on a 29G eMMC. 2026-08-19: one switch
|
||||
# alone took 14G -> 19G used; only reboot (releases the old root) + this GC
|
||||
# brought it back to 14G. Run a full collect right after every boot instead
|
||||
# of waiting on the weekly timer.
|
||||
# A `switch` pins the old generation as a GC root until reboot; common.nix's weekly
|
||||
# nix.gc is too slow for a 29G eMMC, so collect garbage on every boot instead.
|
||||
systemd.services.gc-on-boot = {
|
||||
description = "Full nix-collect-garbage on every boot";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
@@ -69,47 +66,42 @@
|
||||
# next value: acpi -> bios -> cold -> efi.
|
||||
boot.kernelParams = [ "reboot=pci" ];
|
||||
|
||||
# ---- Closure size (29G eMMC holds two generations during a switch) ----
|
||||
# Only the firmware this board loads (i915 DMC + r8169), not all ~850M of linux-firmware.
|
||||
hardware.enableRedistributableFirmware = false;
|
||||
hardware.cpu.intel.updateMicrocode = true;
|
||||
hardware.firmware = [
|
||||
(pkgs.runCommand "jupiter-firmware" { } ''
|
||||
mkdir -p $out/lib/firmware/i915
|
||||
cp -r ${pkgs.linux-firmware}/lib/firmware/rtl_nic $out/lib/firmware/
|
||||
cp ${pkgs.linux-firmware}/lib/firmware/i915/bxt_* $out/lib/firmware/i915/
|
||||
'')
|
||||
];
|
||||
# Pins a ~200M nixpkgs source; the box is only ever deployed to, never built on.
|
||||
nixpkgs.flake.setFlakeRegistry = false;
|
||||
nixpkgs.flake.setNixPath = false;
|
||||
nix.settings.auto-optimise-store = true;
|
||||
|
||||
# ---- GPU (jellyfin hardware transcoding) ----
|
||||
# Apollo Lake N3450 / HD Graphics 500 (Gen9, pci 8086:5A85). The i915 KERNEL
|
||||
# driver binds on its own — /dev/dri/{card1,renderD128} exist without this —
|
||||
# but the libva USERSPACE driver only ships when hardware.graphics is on, and
|
||||
# nothing else here pulled it in. Without it VAAPI init fails with "unknown
|
||||
# libva error" and jellyfin-ffmpeg exits 251 on EVERY transcode, which the
|
||||
# client shows as generic playback failure: the server log only says "FFmpeg
|
||||
# exited with code 251", never that a driver is missing. Verified on the box:
|
||||
# the same h264_vaapi encode goes 251 -> 0 once iHD is on LIBVA_DRIVERS_PATH.
|
||||
#
|
||||
# iHD (intel-media-driver) is the right one for Gen9; i965 is for Gen8 and
|
||||
# older. Note the render node is 0666 but card1 is 0660 root:video, so the
|
||||
# group membership in services/media/jellyfin.nix matters for the card node.
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
extraPackages = [ pkgs.intel-media-driver ];
|
||||
# Apollo Lake N3450 / HD Graphics 500 (Gen9). VAAPI needs the iHD userspace driver
|
||||
# (Gen9; i965 is Gen8-only) or jellyfin-ffmpeg exits 251 on every transcode with no
|
||||
# clearer error than "FFmpeg exited with code 251" in the log. Pointed at directly
|
||||
# instead of via hardware.graphics, which drags in mesa + llvm (~850M) for nothing.
|
||||
systemd.services.jellyfin.environment = {
|
||||
LIBVA_DRIVER_NAME = "iHD";
|
||||
LIBVA_DRIVERS_PATH = "${pkgs.intel-media-driver}/lib/dri";
|
||||
};
|
||||
# ⚠️ This buys VAAPI only — jellyfin must be set to VAAPI, NOT QSV, in its
|
||||
# web UI (Dashboard -> Playback -> Transcoding). QSV needs an MFX runtime on
|
||||
# top of the libva driver: ffmpeg's `-init_hw_device qsv=qs@va` dies with
|
||||
# "Error creating a MFX session: -9" -> exit 171, the SECOND failure hiding
|
||||
# behind the first (fixing the missing driver only moved 251 -> 171).
|
||||
# There is no good way to provide it here: vpl-gpu-rt is Gen12+, and the
|
||||
# Gen9 runtime `intel-media-sdk` is marked INSECURE in nixpkgs (EOL, 5 CVEs
|
||||
# incl. local privilege escalation) — not worth it when VAAPI does the same
|
||||
# job on this chip at ~3.5x realtime for 1080p->720p.
|
||||
#
|
||||
# Also: 4K HDR (the 2160p HEVC/DV remuxes) can NOT be tone-mapped here.
|
||||
# tonemap_opencl needs OpenCL, which has no platform on this box, and
|
||||
# tonemap_vaapi is Gen11+ — both fail. Only a plain scale_vaapi=format=nv12
|
||||
# succeeds, which drops HDR without tone-mapping (washed-out picture).
|
||||
# Those files need to direct-play, or be kept as 1080p SDR versions.
|
||||
# ⚠️ Use VAAPI, not QSV, in jellyfin's UI — QSV needs an MFX runtime not safely
|
||||
# available for this Gen9 chip (only insecure/EOL options) and fails with exit 171.
|
||||
# 4K HDR remuxes also can't be tone-mapped here (needs OpenCL or Gen11+); keep those
|
||||
# as 1080p SDR or let them direct-play.
|
||||
|
||||
# ---- NAS data array ----
|
||||
# Existing ext4 on the mdadm RAID0 over sda+sdb (md0, 29.1T).
|
||||
# Mounted, NOT formatted; kept out of disko so it is never wiped.
|
||||
# ⚠️ RAID0 = no redundancy: either 16TB disk failing loses ALL data.
|
||||
boot.swraid.enable = true; # assemble the mdadm array at boot
|
||||
# Silences "mdmon service will crash" eval warning. RAID0 here uses native
|
||||
# superblocks so mdmon (external-metadata arrays only) never actually runs,
|
||||
# but the module warns unconditionally without SOME MAILADDR/PROGRAM set.
|
||||
# Existing ext4 on mdadm RAID0 (sda+sdb, md0, 29.1T) — mounted, not formatted, kept
|
||||
# out of disko. ⚠️ RAID0 has no redundancy: either disk failing loses ALL data.
|
||||
boot.swraid.enable = true;
|
||||
# Silences the "mdmon service will crash" eval warning — mdmon never actually runs
|
||||
# here (native superblocks, not external-metadata) but the module warns regardless.
|
||||
boot.swraid.mdadmConf = "MAILADDR root";
|
||||
fileSystems."/mnt/data" = {
|
||||
# fs UUID (stable) — the array may enumerate as /dev/md127, so avoid /dev/md0.
|
||||
@@ -118,69 +110,48 @@
|
||||
options = [ "nofail" ]; # don't block boot if the array is degraded/absent
|
||||
};
|
||||
|
||||
# `nofail` above is necessary but NOT sufficient — any mount layered on the
|
||||
# array (prowlarr/seerr binds) is RequiredBy local-fs.target and will fail it
|
||||
# regardless, and emergency mode on this box is a dead end: root is locked, so
|
||||
# sulogin drops you at a prompt you cannot answer, with no ssh. 2026-08-06: a
|
||||
# drive that failed to enumerate after the rack move did exactly this —
|
||||
# "Timed out waiting for device /dev/disk/by-uuid/dadbff6f-…" -> Dependency
|
||||
# failed for Local File Systems -> Reached target Emergency Mode, twice.
|
||||
# Boot as far as possible instead and leave the failed units to be read over
|
||||
# ssh. The array-backed services carry RequiresMountsFor=/mnt/data so they
|
||||
# still refuse to start rather than writing to the eMMC.
|
||||
# `nofail` alone isn't enough — mounts layered on the array (the prowlarr bind)
|
||||
# are RequiredBy local-fs.target and can still trip Emergency Mode, which is a dead
|
||||
# end here (root locked, no ssh). Boot as far as possible instead; the array-backed
|
||||
# services carry RequiresMountsFor=/mnt/data so they still won't write to the eMMC.
|
||||
systemd.enableEmergencyMode = false;
|
||||
|
||||
# ---- Heavy state moved off the eMMC ----
|
||||
# A deploy holds TWO full closures (~9G each) on a 29G disk at once, so the
|
||||
# OS disk has no room for state that grows on its own. 2026-08-09: it hit 0
|
||||
# bytes free with both gen 39 and gen 40 resident, and postgres died on
|
||||
# "No space left on device" — note ext4 reserves 5% for root, so non-root
|
||||
# services see zero while df still shows ~300M free.
|
||||
#
|
||||
# Paths live under /mnt/data/AppData like every other service's state. Both
|
||||
# settings below are jupiter-only on purpose: services/containers.nix stays
|
||||
# engine- and host-agnostic (mercury runs pihole on podman with no array).
|
||||
# A deploy holds two full closures (~4G each) on this 29G disk at once, so state
|
||||
# that grows on its own can't live there — moved under /mnt/data/AppData like every
|
||||
# other service's state. Settings below are jupiter-only; services/containers.nix
|
||||
# stays engine/host-agnostic (mercury runs podman with no array).
|
||||
|
||||
# podman: CI images dominate and keep growing — the gitea runner's
|
||||
# act-latest is 1.7G, and the act-22.04 label in services/dev/gitea.nix
|
||||
# pulls another ~1.7G the first time a job requests it.
|
||||
# runroot stays on /run: it is per-boot tmpfs state, not a growing store.
|
||||
# runroot stays on /run (per-boot tmpfs, doesn't grow); graphroot moves to the array
|
||||
# since the gitea runner's CI images alone run several GB.
|
||||
virtualisation.containers.storage.settings.storage = {
|
||||
driver = "overlay";
|
||||
graphroot = "/mnt/data/AppData/containers/storage";
|
||||
runroot = "/run/containers/storage";
|
||||
};
|
||||
|
||||
# immich's postgres cluster. Version component mirrors the upstream default
|
||||
# (`/var/lib/postgresql/${psqlSchema}`) so a major bump gets its own dir
|
||||
# instead of silently reusing the old cluster's files.
|
||||
# ⚠️ This puts the DB in the SAME failure domain as the photos it indexes:
|
||||
# /mnt/data is RAID0, so either 16TB disk now loses both, where before an
|
||||
# eMMC failure and an array failure each took only one. Chosen deliberately
|
||||
# — the two are useless apart — but neither is backed up.
|
||||
# immich's postgres cluster. Version-qualified path (matches upstream default) so a
|
||||
# major bump gets a fresh dir instead of reusing the old cluster's files.
|
||||
# ⚠️ Puts the DB in the same RAID0 failure domain as the photos it indexes —
|
||||
# deliberate (the two are useless apart) but neither is backed up.
|
||||
services.postgresql.dataDir =
|
||||
"/mnt/data/AppData/postgresql/${config.services.postgresql.package.psqlSchema}";
|
||||
|
||||
# /mnt/data/AppData is drwx--x--- darman:users, so postgres needs group
|
||||
# "users" just to TRAVERSE into its own dataDir — exactly the reason immich
|
||||
# has the same line. The cluster dir itself keeps the mode it was initdb'd
|
||||
# with (0750 postgres:postgres) — postgres only accepts 0700, or 0750 when
|
||||
# the cluster was created with group access, and refuses to start otherwise.
|
||||
# /mnt/data/AppData is drwx--x--- darman:users, so postgres needs the "users" group
|
||||
# just to traverse into its dataDir (same reason immich needs it) — postgres itself
|
||||
# refuses to start unless the cluster dir is 0700 or 0750.
|
||||
users.users.postgres.extraGroups = [ "users" ];
|
||||
|
||||
# Neither path is under /var/lib, so no module creates it: the postgresql
|
||||
# module's own tmpfiles entry only adjusts a dataDir that already exists,
|
||||
# the same way immich's mediaLocation rule does.
|
||||
# Neither path is under /var/lib, so no module creates it automatically — same
|
||||
# reason immich needs its own mediaLocation tmpfiles rule.
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /mnt/data/AppData/postgresql 0750 postgres postgres -"
|
||||
"d /mnt/data/AppData/containers 0700 root root -"
|
||||
];
|
||||
|
||||
# graphroot is not a systemd path dependency the way dataDir is, so nothing
|
||||
# derives a mount ordering from it. Without these, podman would recreate an
|
||||
# empty store on the eMMC under the mountpoint when the array is late or
|
||||
# absent, and the runner would re-pull every image into it.
|
||||
# (podman-clonarr already carries this from services/media/clonarr.nix.)
|
||||
# Without this, podman would recreate an empty store on the eMMC if the array mounts
|
||||
# late or is absent, and the runner would re-pull every image.
|
||||
# (the media containers set this in their own modules.)
|
||||
systemd.services.podman.unitConfig.RequiresMountsFor = [ "/mnt/data" ];
|
||||
systemd.services.gitea-runner-jupiter.unitConfig.RequiresMountsFor = [ "/mnt/data" ];
|
||||
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
{ config, ... }:
|
||||
|
||||
# sops-nix secret wiring (real host only; not imported by vm.nix).
|
||||
# Encrypted values live in ../../secrets/jupiter.yaml, decrypted at activation to
|
||||
# /run/secrets/<name>.
|
||||
#
|
||||
# The host decrypts with its OWN SSH host key (age identity derived via
|
||||
# ssh-to-age, recipient listed in ../../.sops.yaml). The key is pre-generated on
|
||||
# the laptop and shipped once at install as /etc/ssh/ssh_host_ed25519_key
|
||||
# (nixos-anywhere --extra-files) — so decryption works on boot #1 and there is
|
||||
# no separate sops-only key to manage.
|
||||
# sops-nix secret wiring (real host only; not imported by vm.nix). Decrypts with the
|
||||
# host's own SSH host key (ssh-to-age), shipped once at install via nixos-anywhere
|
||||
# --extra-files, so there's no separate sops-only key to manage.
|
||||
{
|
||||
sops.defaultSopsFile = ../../secrets/jupiter.yaml;
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
@@ -26,18 +20,14 @@
|
||||
# Headscale pre-auth key for tailscale auto-registration (see configuration.nix).
|
||||
sops.secrets.tailscale_authkey = { };
|
||||
|
||||
# Immich's OIDC client secret, from its Authentik application (a SEPARATE
|
||||
# app from headscale's and headplane's — see hosts/neptun/secrets.nix).
|
||||
# Referenced as settings.oauth.clientSecret._secret in
|
||||
# services/media/immich.nix; the module resolves it through systemd
|
||||
# LoadCredential, which reads as root before dropping privileges, so the
|
||||
# sops default of root:root 0400 is correct — do NOT set `owner`.
|
||||
# Immich's OIDC client secret (separate Authentik app from headscale/headplane, see
|
||||
# hosts/neptun/secrets.nix). Only rendered into the immich-owned
|
||||
# `immich-config.json` template (services/media/immich.nix), so it stays root:root.
|
||||
sops.secrets.immich_oauth_client_secret = { };
|
||||
|
||||
# Gitea Actions runner registration token (services/dev/gitea.nix). Gitea
|
||||
# generates this itself once Actions is enabled — it is not a password
|
||||
# chosen up front. Rendered into a `TOKEN=...` env file because
|
||||
# gitea-actions-runner takes an EnvironmentFile, not a raw secret path.
|
||||
# Gitea Actions runner registration token — gitea generates this itself once Actions
|
||||
# is enabled. Rendered into an env file since gitea-actions-runner takes an
|
||||
# EnvironmentFile, not a raw secret path.
|
||||
sops.secrets.gitea_runner_token = { };
|
||||
sops.templates."gitea-runner.env".content =
|
||||
"TOKEN=${config.sops.placeholder.gitea_runner_token}";
|
||||
@@ -53,15 +43,11 @@
|
||||
owner = "gitea";
|
||||
};
|
||||
|
||||
# SABnzbd credentials (web UI login, API keys, eweka.nl usenet server) —
|
||||
# migrated off the reused ini in services/media/sabnzbd.nix into
|
||||
# services.sabnzbd.settings + secretValues. sabnzbd_api_key predates this
|
||||
# migration (provisioned for mediamanager's future use, services/experimental/
|
||||
# mediamanager.nix — not currently imported by any host); reused here as the
|
||||
# same single source of truth rather than duplicating it.
|
||||
# owner = sabnzbd: the module's preStart (replace-secret) runs as the
|
||||
# service's own User=/Group=, and sops secrets default to root:root 0400 —
|
||||
# without this, replace-secret gets Permission denied reading /run/secrets.
|
||||
# SABnzbd credentials (web UI login, API keys, eweka.nl usenet server) for
|
||||
# services/media/sabnzbd.nix; sabnzbd_api_key is shared with
|
||||
# services/experimental/mediamanager.nix rather than duplicated.
|
||||
# owner = sabnzbd because the module's preStart runs as that user, and sops secrets
|
||||
# default to root:root 0400.
|
||||
sops.secrets.sabnzbd_web_username.owner = "sabnzbd";
|
||||
sops.secrets.sabnzbd_web_password.owner = "sabnzbd";
|
||||
sops.secrets.sabnzbd_api_key.owner = "sabnzbd";
|
||||
@@ -69,15 +55,34 @@
|
||||
sops.secrets.sabnzbd_eweka_username.owner = "sabnzbd";
|
||||
sops.secrets.sabnzbd_eweka_password.owner = "sabnzbd";
|
||||
|
||||
# CouchDB admin account for Obsidian LiveSync
|
||||
# (services/dev/obsidian-livesync.nix). Rendered into an [admins] ini
|
||||
# fragment rather than passed as services.couchdb.adminPass, which would put
|
||||
# the plaintext in the world-readable store.
|
||||
#
|
||||
# owner = couchdb on BOTH: couchdb re-reads its ini chain as its own
|
||||
# User=/Group= after systemd drops privileges, and sops defaults to
|
||||
# root:root 0400 — without this it comes up with no admin configured, which
|
||||
# under require_valid_user means every request 401s.
|
||||
# Matrix (services/comms/matrix.nix). The synapse signing key lives here rather than
|
||||
# being generated on first start, so losing the RAID0 array doesn't lose the
|
||||
# server's federation identity. mas_shared_secret is read by synapse and MAS
|
||||
# (MAS is in group matrix-synapse). matrix_oidc_client_secret is the Authentik
|
||||
# `matrix` provider's.
|
||||
sops.secrets.synapse_signing_key.owner = "matrix-synapse";
|
||||
sops.secrets.synapse_macaroon_secret_key.owner = "matrix-synapse";
|
||||
sops.secrets.synapse_form_secret.owner = "matrix-synapse";
|
||||
sops.secrets.mas_shared_secret = { owner = "matrix-synapse"; group = "matrix-synapse"; mode = "0440"; };
|
||||
sops.secrets.mas_encryption_secret.owner = "matrix-authentication-service";
|
||||
sops.secrets.mas_signing_key.owner = "matrix-authentication-service";
|
||||
sops.secrets.matrix_oidc_client_secret.owner = "matrix-authentication-service";
|
||||
homelab.matrix = {
|
||||
signingKeyFile = config.sops.secrets.synapse_signing_key.path;
|
||||
macaroonSecretFile = config.sops.secrets.synapse_macaroon_secret_key.path;
|
||||
formSecretFile = config.sops.secrets.synapse_form_secret.path;
|
||||
masSecretFile = config.sops.secrets.mas_shared_secret.path;
|
||||
masEncryptionFile = config.sops.secrets.mas_encryption_secret.path;
|
||||
masSigningKeyFile = config.sops.secrets.mas_signing_key.path;
|
||||
oidcClientSecretFile = config.sops.secrets.matrix_oidc_client_secret.path;
|
||||
};
|
||||
|
||||
# CouchDB admin account for Obsidian LiveSync — rendered into an [admins] ini
|
||||
# fragment instead of services.couchdb.adminPass, which would put the plaintext in
|
||||
# the world-readable store.
|
||||
# owner = couchdb on both: couchdb re-reads the ini as its own user after privilege
|
||||
# drop, and without this sops's default root:root 0400 leaves it with no admin
|
||||
# configured (every request 401s).
|
||||
sops.secrets.couchdb_admin_password.owner = "couchdb";
|
||||
sops.templates."couchdb-admins.ini" = {
|
||||
owner = "couchdb";
|
||||
|
||||
@@ -9,8 +9,12 @@
|
||||
./disk-config.nix # disko: OS-disk partitions + filesystems
|
||||
./secrets.nix # sops-nix: samba/tailscale/hermes secrets
|
||||
./hermes-agent.nix
|
||||
./honcho.nix # luna's memory server (Postgres + Ollama embeddings)
|
||||
./honcho-console.nix # web console for it, tailnet-only on :8095
|
||||
./honcho-gate.nix # bearer-gated tailnet door to it for Claude Code, :8099
|
||||
./livesync-bridge.nix
|
||||
./luna-sites.nix # luna's LAN web apps: http://mars.sol/<name>/
|
||||
./pass-broker-gateway.nix # Telegram approvals for every host's pass-broker, tailnet :8097
|
||||
../../common.nix # shared base: user / ssh / nix / firewall
|
||||
../../services/containers.nix
|
||||
../../services/vpn/tailscale.nix
|
||||
@@ -25,13 +29,12 @@
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# jupiter's samba share (services/network/samba.nix) — mounted on demand so
|
||||
# mars doesn't stall boot/login when jupiter is off or unreachable. This is
|
||||
# also where Hermes's shared dropbox lives now (hermes-agent.nix). Modes are
|
||||
# tighter than terra's equivalent mount (0770 not 0755, gid=hermes not
|
||||
# gid=users) since the hermes-agent container (uid 986, gid 983 — no podman
|
||||
# userns remapping, see services/network/pihole.nix) needs group write into
|
||||
# it, not just darman.
|
||||
# jupiter's samba share (services/network/samba.nix), mounted on demand so
|
||||
# mars doesn't stall when jupiter is off — also where Hermes's shared
|
||||
# dropbox lives (hermes-agent.nix). Tighter modes than terra's equivalent
|
||||
# mount (0770/gid=hermes, not 0755/gid=users) since the hermes-agent
|
||||
# container (uid 986/gid 983, no podman userns remapping) needs group
|
||||
# write here, not just darman.
|
||||
fileSystems."/mnt/jupiter" = {
|
||||
device = "//jupiter/data";
|
||||
fsType = "cifs";
|
||||
@@ -43,15 +46,35 @@
|
||||
"dir_mode=0770"
|
||||
"nofail"
|
||||
"x-systemd.automount" # lazy-mount so boot doesn't stall if jupiter's down
|
||||
# NO idle-timeout here (unlike terra's equivalent mount): hermes-agent's
|
||||
# podman-hermes-agent.service RequiresMountsFor this path, so an idle
|
||||
# auto-unmount tears the container down with it — confirmed the hard
|
||||
# way, it killed the service ~60-70s after every start with no crash
|
||||
# or error, just "Unmounting /mnt/jupiter" right before the stop.
|
||||
# NO idle-timeout here (unlike terra's): podman-hermes-agent.service
|
||||
# RequiresMountsFor this path, so an idle auto-unmount silently kills
|
||||
# the container with it — confirmed the hard way (~60-70s per start).
|
||||
"x-systemd.mount-timeout=10s"
|
||||
"_netdev"
|
||||
# Hermes' RequiresMountsFor mounts this at boot, not lazily, and nothing
|
||||
# retries a failed mount.
|
||||
"x-systemd.requires=jupiter-reachable.service"
|
||||
];
|
||||
};
|
||||
|
||||
# jupiter resolves to its tailnet IP, and network-online.target fires on the
|
||||
# LAN link before tailscaled has routed tailscale0. 5min covers jupiter
|
||||
# cold-booting alongside mars.
|
||||
systemd.services.jupiter-reachable = {
|
||||
description = "Wait for jupiter's samba over the tailnet";
|
||||
after = [ "network-online.target" "tailscaled.service" ];
|
||||
wants = [ "network-online.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
TimeoutStartSec = 300;
|
||||
};
|
||||
script = ''
|
||||
until timeout 2 ${pkgs.bash}/bin/bash -c 'exec 3<>/dev/tcp/jupiter/445' 2>/dev/null; do
|
||||
sleep 2
|
||||
done
|
||||
'';
|
||||
};
|
||||
|
||||
system.stateVersion = "26.05"; # set at install time; do NOT bump on upgrades
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
{ config, inputs, ... }:
|
||||
|
||||
# Web console for luna's Honcho (honcho.nix). Bound on all interfaces but
|
||||
# its port stays closed in the firewall, so like Hermes' dashboard it is
|
||||
# reachable over tailscale0 only: http://mars.orbit.sol:8095. It can rewrite
|
||||
# luna's memory, so it stays off the LAN and off neptun.
|
||||
let
|
||||
# Honcho's own model settings, so cost per stage tracks honcho.nix.
|
||||
env = config.virtualisation.oci-containers.containers.honcho-api.environment;
|
||||
level = l: env."DIALECTIC_LEVELS__${l}__MODEL_CONFIG__MODEL";
|
||||
in
|
||||
{
|
||||
imports = [ inputs.honcho-console.nixosModules.default ];
|
||||
|
||||
services.honcho-console = {
|
||||
enable = true;
|
||||
listen = "0.0.0.0:8095";
|
||||
# Unlocks the UI toggle only; every start is still read-only.
|
||||
allowWrites = true;
|
||||
cardSnapshotInterval = "15m";
|
||||
representationSnapshotInterval = "24h";
|
||||
|
||||
stageModels = {
|
||||
"deriver.ingestion" = env.DERIVER_MODEL_CONFIG__MODEL;
|
||||
"deriver.summary" = env.SUMMARY_MODEL_CONFIG__MODEL;
|
||||
"dreamer.deduction" = env.DREAM_DEDUCTION_MODEL_CONFIG__MODEL;
|
||||
# card_refresh reuses the deduction model.
|
||||
"dreamer.card_refresh" = env.DREAM_DEDUCTION_MODEL_CONFIG__MODEL;
|
||||
"dreamer.induction" = env.DREAM_INDUCTION_MODEL_CONFIG__MODEL;
|
||||
} // builtins.listToAttrs (map (l: { name = "dialectic.${l}"; value = level l; })
|
||||
[ "minimal" "low" "medium" "high" "max" ]);
|
||||
# Honcho's key, used by nothing else: its usage is Honcho's actual spend.
|
||||
openrouterKeyFile = config.sops.secrets.openrouter_api_key.path;
|
||||
# As hermes-agent.nix writes them into honcho.json; the rest are Hermes' defaults.
|
||||
hermes = {
|
||||
userPeer = "darman";
|
||||
aiPeer = "luna";
|
||||
};
|
||||
};
|
||||
|
||||
# Honcho's tables must exist before the grant covers them.
|
||||
systemd.services.honcho-console-grants.after = [ "podman-honcho-api.service" ];
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{ config, ... }:
|
||||
|
||||
# Tailnet door to luna's Honcho (honcho.nix) for Claude Code on terra
|
||||
# (hosts/terra/claude-honcho.nix). Honcho itself stays on loopback with auth
|
||||
# off, so Hermes and honcho-console need no key; this bearer token is the only
|
||||
# credential, and it reaches luna's workspace only. 8099 stays closed in the
|
||||
# firewall: tailscale0 only, like honcho-console.
|
||||
let
|
||||
port = 8099;
|
||||
in
|
||||
{
|
||||
imports = [ ../../services/network/caddy.nix ];
|
||||
|
||||
# Fails closed: an unset token must not turn "Bearer " into the password.
|
||||
services.caddy.virtualHosts.":${toString port}".extraConfig = ''
|
||||
@allowed {
|
||||
expression `{env.HONCHO_GATE_TOKEN} != "" && {http.request.header.Authorization} == "Bearer " + {env.HONCHO_GATE_TOKEN}`
|
||||
path /v3/workspaces /v3/workspaces/luna/*
|
||||
not path /v3/workspaces/luna/webhooks*
|
||||
}
|
||||
# Workspace get-or-create only; listing, keys and other workspaces stay out.
|
||||
@workspaceCreate {
|
||||
path /v3/workspaces
|
||||
not method POST
|
||||
}
|
||||
handle @workspaceCreate {
|
||||
respond 403
|
||||
}
|
||||
handle @allowed {
|
||||
reverse_proxy 127.0.0.1:8000
|
||||
}
|
||||
handle {
|
||||
respond 403
|
||||
}
|
||||
'';
|
||||
|
||||
services.caddy.environmentFile = config.sops.templates."honcho-gate.env".path;
|
||||
|
||||
# Same value in secrets/terra.yaml, where the Claude Code plugin sends it.
|
||||
sops.secrets.honcho_gate_token.restartUnits = [ "caddy.service" ];
|
||||
sops.templates."honcho-gate.env" = {
|
||||
content = "HONCHO_GATE_TOKEN=${config.sops.placeholder.honcho_gate_token}\n";
|
||||
restartUnits = [ "caddy.service" ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
# Honcho memory server: luna's memory provider (wired up in hermes-agent.nix
|
||||
# prepare-dirs). API + deriver from the official image; Postgres and
|
||||
# Ollama (embeddings) run natively. Everything binds loopback only.
|
||||
let
|
||||
honchoImage = "ghcr.io/plastic-labs/honcho@sha256:c74955d6dbea6dda42c2dd9dd13dea726fcba36ba5c0b6bae4867f7ed762896d"; # v3.2.2
|
||||
honchoUid = 984;
|
||||
honchoGid = 984;
|
||||
|
||||
# :nitro = OpenRouter's fastest-provider routing; the default picks cheap, slow hosts.
|
||||
fastModel = "z-ai/glm-5.3-flash:nitro";
|
||||
# Dreams maintain the peer cards, incl. her AI identity card.
|
||||
smartModel = "deepseek/deepseek-v4-pro";
|
||||
embedModel = "qwen3-embedding:0.6b";
|
||||
|
||||
# Peer auth over the socket: the container runs as the host's honcho uid,
|
||||
# so there is no DB password to manage.
|
||||
env = {
|
||||
DB_CONNECTION_URI = "postgresql+psycopg://honcho@/honcho?host=/run/postgresql";
|
||||
AUTH_USE_AUTH = "false";
|
||||
CACHE_ENABLED = "false";
|
||||
# Read by honcho-console (token usage, latency). The deriver serves its own
|
||||
# on 0.0.0.0:9090, which the firewall keeps off the LAN.
|
||||
METRICS_ENABLED = "true";
|
||||
HOME = "/tmp";
|
||||
|
||||
LLM_OPENAI_BASE_URL = "https://openrouter.ai/api/v1";
|
||||
# Lowest reasoning GLM allows ("none" is rejected): hidden reasoning can
|
||||
# eat the deriver's whole output budget before any JSON is written.
|
||||
DERIVER_MODEL_CONFIG__MODEL = fastModel;
|
||||
DERIVER_MODEL_CONFIG__THINKING_EFFORT = "minimal";
|
||||
SUMMARY_MODEL_CONFIG__MODEL = fastModel;
|
||||
DIALECTIC_LEVELS__minimal__MODEL_CONFIG__MODEL = fastModel;
|
||||
DIALECTIC_LEVELS__minimal__MODEL_CONFIG__THINKING_EFFORT = "minimal";
|
||||
DIALECTIC_LEVELS__low__MODEL_CONFIG__MODEL = fastModel;
|
||||
DIALECTIC_LEVELS__low__MODEL_CONFIG__THINKING_EFFORT = "minimal";
|
||||
DIALECTIC_LEVELS__medium__MODEL_CONFIG__MODEL = smartModel;
|
||||
DIALECTIC_LEVELS__high__MODEL_CONFIG__MODEL = smartModel;
|
||||
DIALECTIC_LEVELS__max__MODEL_CONFIG__MODEL = smartModel;
|
||||
DREAM_DEDUCTION_MODEL_CONFIG__MODEL = smartModel;
|
||||
DREAM_INDUCTION_MODEL_CONFIG__MODEL = smartModel;
|
||||
|
||||
EMBEDDING_MODEL_CONFIG__MODEL = embedModel;
|
||||
EMBEDDING_MODEL_CONFIG__OVERRIDES__BASE_URL = "http://127.0.0.1:11434/v1";
|
||||
EMBEDDING_MODEL_CONFIG__OVERRIDES__API_KEY = "ollama";
|
||||
# Fixed at the first migration; changing it later means a fresh DB.
|
||||
EMBEDDING_VECTOR_DIMENSIONS = "1024";
|
||||
EMBEDDING_MODEL_CONFIG__DIMENSIONS_MODE = "never";
|
||||
};
|
||||
|
||||
container = {
|
||||
image = honchoImage;
|
||||
user = "${toString honchoUid}:${toString honchoGid}";
|
||||
extraOptions = [ "--network=host" ];
|
||||
volumes = [ "/run/postgresql:/run/postgresql" ];
|
||||
environment = env;
|
||||
environmentFiles = [ config.sops.templates."honcho.env".path ];
|
||||
};
|
||||
|
||||
deps = [ "postgresql-setup.service" "honcho-db-setup.service" "ollama.service" ];
|
||||
in
|
||||
{
|
||||
users.users.honcho = {
|
||||
isSystemUser = true;
|
||||
uid = honchoUid;
|
||||
group = "honcho";
|
||||
};
|
||||
users.groups.honcho.gid = honchoGid;
|
||||
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
extensions = ps: [ ps.pgvector ];
|
||||
ensureDatabases = [ "honcho" ];
|
||||
ensureUsers = [{
|
||||
name = "honcho";
|
||||
ensureDBOwnership = true;
|
||||
}];
|
||||
};
|
||||
|
||||
# CREATE EXTENSION needs a superuser; Honcho's migrations only re-assert it.
|
||||
systemd.services.honcho-db-setup = {
|
||||
description = "Enable pgvector in the honcho database";
|
||||
# ensureDatabases runs in postgresql-setup, not postgresql itself.
|
||||
after = [ "postgresql-setup.service" ];
|
||||
requires = [ "postgresql-setup.service" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
User = "postgres";
|
||||
};
|
||||
script = ''
|
||||
${config.services.postgresql.package}/bin/psql -d honcho -c 'CREATE EXTENSION IF NOT EXISTS vector'
|
||||
'';
|
||||
};
|
||||
|
||||
services.ollama = {
|
||||
enable = true;
|
||||
host = "127.0.0.1";
|
||||
loadModels = [ embedModel ];
|
||||
};
|
||||
|
||||
virtualisation.oci-containers.containers.honcho-api = container // {
|
||||
# Image CMD binds 0.0.0.0 and skips migrations. Migrations create
|
||||
# vector(1536); configure_embeddings resizes them (no-op once matching,
|
||||
# refuses on populated tables).
|
||||
entrypoint = "sh";
|
||||
cmd = [
|
||||
"-c"
|
||||
"/app/.venv/bin/python scripts/provision_db.py && /app/.venv/bin/python scripts/configure_embeddings.py --yes && exec /app/.venv/bin/fastapi run --host 127.0.0.1 --port 8000 src/main.py"
|
||||
];
|
||||
};
|
||||
|
||||
virtualisation.oci-containers.containers.honcho-deriver = container // {
|
||||
# Waits for the API, i.e. for the schema resize above.
|
||||
entrypoint = "sh";
|
||||
cmd = [
|
||||
"-c"
|
||||
"until /app/.venv/bin/python -c \"import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=2)\" 2>/dev/null; do sleep 2; done; exec /app/.venv/bin/python -m src.deriver"
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services.podman-honcho-api = {
|
||||
after = deps;
|
||||
requires = deps;
|
||||
};
|
||||
systemd.services.podman-honcho-deriver = {
|
||||
after = [ "podman-honcho-api.service" ];
|
||||
requires = [ "podman-honcho-api.service" ];
|
||||
};
|
||||
# wants, not requires: Telegram must survive Honcho being down.
|
||||
systemd.services.podman-hermes-agent = {
|
||||
after = [ "podman-honcho-api.service" ];
|
||||
wants = [ "podman-honcho-api.service" ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
# Runtime shim for KittenTTS on a CPU-only, disk-constrained host.
|
||||
#
|
||||
# kittentts/onnx_model.py opens with `from misaki import en, espeak` — a dead import:
|
||||
# every code path that produces audio from text goes through phonemizer-fork's
|
||||
# EspeakBackend (espeak-ng via espeakng-loader); misaki.en/espeak are never called.
|
||||
# If misaki[en] were installed for real, those two imports would be a hook for the
|
||||
# whole spacy → thinc → torch → CUDA chain (~5.6 GB verified). This stub registers
|
||||
# `misaki.en` and `misaki.espeak` as import-time-only placeholders instead.
|
||||
#
|
||||
# Written into site-packages by the derivation (see pkgs/kittentts-env.nix) under
|
||||
# `sitecustomize.py`-style auto-load — actually via a `kitten_tts_stub.py` + a `.pth`
|
||||
# pointing at it, so any Python process in this env gets the stub registered before
|
||||
# any kittentts import. If KittenTTS upstream ever starts USING misaki, this shim
|
||||
# will fail loudly at import of the missing attributes (better than silent distortion),
|
||||
# and the fix becomes "install the real misaki[en]" — a deliberate, reviewed change.
|
||||
import sys
|
||||
import types
|
||||
|
||||
_misaki = sys.modules.get("misaki")
|
||||
if _misaki is None:
|
||||
# Avoid registering a fake parent before the real misaki loads — the base misaki
|
||||
# (addict/regex only) is installed normally, so usually already here.
|
||||
import misaki # noqa: F401 (raises if base misaki is missing — loud, not silent)
|
||||
_misaki = sys.modules["misaki"]
|
||||
|
||||
if getattr(_misaki, "en", None) is None:
|
||||
_stub = types.ModuleType("misaki.en")
|
||||
sys.modules.setdefault("misaki.en", _stub)
|
||||
_misaki.en = _stub
|
||||
|
||||
if getattr(_misaki, "espeak", None) is None:
|
||||
_stub2 = types.ModuleType("misaki.espeak")
|
||||
sys.modules.setdefault("misaki.espeak", _stub2)
|
||||
_misaki.espeak = _stub2
|
||||
@@ -0,0 +1,69 @@
|
||||
# Pinned requirements for the KittenTTS side-venv on mars (validated freeze, CPU-only).
|
||||
#
|
||||
# DEPENDENCY DISCIPLINE (important — this is NOT the upstream dependency set):
|
||||
# `kittentts` declares `misaki[en]` + spacy, which transitively pull torch → the whole
|
||||
# CUDA runtime (~5.6 GB with nvidia-* wheels, verified in a clean install on this box).
|
||||
# NONE of that is reachable at runtime: onnx_model.py imports `from misaki import en, espeak`
|
||||
# at module load but generate() phonemizes exclusively through `phonemizer-fork` +
|
||||
# `espeakng-loader` (espeak-ng via EspeakBackend); misaki.en/espeak glyphs are parsed but
|
||||
# never called in the ONNX path. mars has no GPU and a modest disk budget, so:
|
||||
#
|
||||
# - install kittentts with --no-deps and enumerate its deps manually,
|
||||
# - install base `misaki` (NOT misaki[en]) — only addict/regex,
|
||||
# - the misaki.en import is satisfied by a stub registered in sitecustomize
|
||||
# (kitten-misaki-stub.py, written into site-packages by the derivation).
|
||||
#
|
||||
# Freeze captured 2026-09-19 from a verified CPU-only venv (python 3.13, i5-4460,
|
||||
# generation ~= 1x realtime with the mini model, HF_HUB_OFFLINE=1).
|
||||
#
|
||||
# kittentts itself comes from a GitHub release wheel (0.8.1), not PyPI (PyPI's 0.1.3 is
|
||||
# the old v0.1-lineage); see pkgs/kittentts-env.nix.
|
||||
addict==2.4.0
|
||||
anyio==4.15.1
|
||||
attrs==26.1.0
|
||||
babel==2.18.0
|
||||
certifi==2026.7.22
|
||||
cffi==2.1.1
|
||||
click==8.5.0
|
||||
cloudpickle==3.1.2
|
||||
csvw==4.1.0
|
||||
dlinfo==2.0.0
|
||||
docopt==0.6.2
|
||||
espeakng-loader==0.2.4
|
||||
filelock==4.0.1
|
||||
flatbuffers==25.12.19
|
||||
fsspec==2026.9.0
|
||||
h11==0.16.0
|
||||
hf-xet==1.6.0
|
||||
httpcore==1.0.9
|
||||
httpx==0.28.1
|
||||
huggingface-hub==1.32.0
|
||||
idna==3.20
|
||||
isodate==0.7.2
|
||||
joblib==1.6.0
|
||||
jsonschema-specifications==2025.9.1
|
||||
jsonschema==4.26.0
|
||||
language-tags==1.3.1
|
||||
misaki==0.9.4
|
||||
num2words==0.5.14
|
||||
numpy==2.5.3
|
||||
onnxruntime==1.30.0
|
||||
packaging==26.3
|
||||
phonemizer-fork==3.3.2
|
||||
protobuf==7.36.2
|
||||
pycparser==3.0
|
||||
pyparsing==3.3.2
|
||||
python-dateutil==2.9.0.post0
|
||||
pyyaml==6.0.3
|
||||
rdflib==7.6.0
|
||||
referencing==0.37.0
|
||||
regex==2026.9.10
|
||||
rfc3986==1.5.0
|
||||
rpds-py==2026.6.3
|
||||
segments==2.4.0
|
||||
six==1.17.0
|
||||
soundfile==0.14.0
|
||||
termcolor==3.3.0
|
||||
tqdm==4.70.1
|
||||
typing-extensions==4.16.0
|
||||
uritemplate==4.2.0
|
||||
@@ -0,0 +1,11 @@
|
||||
# STT pins for mars's in-process faster-whisper venv (stt-venv).
|
||||
#
|
||||
# Installed into its OWN venv on the Hermes image's Python (3.14 since v0.22),
|
||||
# with kittentts/requirements.txt as constraints so the shared
|
||||
# numpy/onnxruntime/tokenizers pins stay identical (see hermes-agent.nix,
|
||||
# KittenTTS section). The "base" model is pinned and staged offline there too.
|
||||
#
|
||||
# Validated 2026-09-19 with a live Telegram voice note on mars's i5-4460 CPU.
|
||||
faster-whisper==1.2.1
|
||||
ctranslate2==4.8.2
|
||||
av==18.1.0
|
||||
@@ -1,59 +1,47 @@
|
||||
{ config, pkgs, inputs, ... }:
|
||||
|
||||
# livesync-bridge (vrtmrz) — mirrors an Obsidian LiveSync vault out of CouchDB
|
||||
# on jupiter (services/dev/obsidian-livesync.nix) into a real directory of
|
||||
# markdown here, so luna can read and write the vault as files. Obsidian itself
|
||||
# is an Electron GUI with no headless mode, and an agent wants files anyway.
|
||||
#
|
||||
# ⚠️ THE WRITE-BACK PATH IS THE RISKY ONE. Upstream has three open, unanswered
|
||||
# issues on storage->couchdb — #50 (Jun 2026, writes detected and logged as
|
||||
# uploaded, database never updated), #23 (only lowercase filenames transmitted
|
||||
# from storage), #46 (silent stall on files over ~30KB). All fail QUIETLY: the
|
||||
# log says success and the note never arrives. So do not treat this directory
|
||||
# as durable storage for anything luna cannot regenerate, and check that her
|
||||
# edits actually reach your devices before trusting it. (E2EE itself is fine —
|
||||
# PeerCouchDB.ts hard-errors if a passphrase is missing for an encrypted
|
||||
# remote, so it is a deliberate code path. The one issue claiming E2EE breaks
|
||||
# bridging, #12, is a single unreproduced report with no maintainer reply.)
|
||||
# on jupiter (services/dev/obsidian-livesync.nix) into real markdown files
|
||||
# here, since Obsidian itself is a GUI-only Electron app and luna needs files.
|
||||
#
|
||||
# ⚠️ THE WRITE-BACK PATH IS THE RISKY ONE: upstream has open bugs where a
|
||||
# write is logged as uploaded but the database is never updated (#50), only
|
||||
# lowercase filenames sync from storage (#23), and files over ~30KB silently
|
||||
# stall (#46) — all fail quietly with no error in the log. Don't treat this
|
||||
# directory as durable for anything luna can't regenerate, and verify her
|
||||
# edits actually reach your devices. (E2EE itself is fine — it hard-errors on
|
||||
# a missing passphrase rather than failing silently.)
|
||||
#
|
||||
# EXPECTED NOISE ON FIRST SYNC: a stack trace per historically-deleted file —
|
||||
# NotFound: ... remove '<vault>/Welcome.md' at PeerStorage.delete
|
||||
# CouchDB keeps deletion tombstones, and the bridge replays them against a
|
||||
# directory where the file never existed. PeerStorage.ts:33-40 catches it,
|
||||
# logs, and returns false, so nothing is wrong; it only LOOKS fatal because
|
||||
# main.ts pins the logger to LOG_LEVEL_DEBUG, which prints exception dumps
|
||||
# that are otherwise verbose-level. It stops once the initial catch-up ends.
|
||||
# Talks to CouchDB over the TAILNET (jupiter.orbit.sol:5984), not through
|
||||
# neptun: mars is a tailnet node, so the public vhost, its TLS and its path
|
||||
# allowlist are all irrelevant here.
|
||||
# CouchDB replays deletion tombstones against a directory where the file
|
||||
# never existed. Harmless, caught and logged, and stops once the initial
|
||||
# catch-up ends.
|
||||
#
|
||||
# Talks to CouchDB over the tailnet (jupiter.orbit.sol:5984) directly — mars
|
||||
# is a tailnet node, so neptun's public vhost/TLS/allowlist don't apply here.
|
||||
let
|
||||
stateDir = "/var/lib/livesync-bridge";
|
||||
appDir = "${stateDir}/app";
|
||||
vaultDir = "${stateDir}/vault";
|
||||
|
||||
# The same uid/gid the hermes-agent container runs as (hermes-agent.nix).
|
||||
# Deliberate: the bridge and luna both read and write these files, and
|
||||
# sharing one uid removes any dependence on the container's umask. Two
|
||||
# different uids in a shared group only works while every file stays
|
||||
# group-writable, and a single 0644 file dropped by the agent would stall
|
||||
# sync on that path with nothing but a permission error in the log.
|
||||
# The same uid/gid hermes-agent runs as (hermes-agent.nix), so both peers
|
||||
# share files without depending on umask — two uids in a shared group only
|
||||
# works while every file stays group-writable, and one 0644 file from the
|
||||
# agent would silently stall sync.
|
||||
hermesUid = 986;
|
||||
|
||||
# Which vault. `group` is what pairs the two peers — both must match or the
|
||||
# bridge starts cleanly and simply never syncs anything.
|
||||
# `group` pairs the two peers — mismatched and the bridge starts but never
|
||||
# syncs.
|
||||
#
|
||||
# ⚠️ `database` must be the name entered in the Obsidian plugin for luna's
|
||||
# vault. Get it wrong and nothing errors: the credential below is CouchDB's
|
||||
# admin, so PouchDB CREATES the misnamed database and replicates an empty
|
||||
# vault into it quite happily.
|
||||
# ⚠️ `database` must match the name entered in the Obsidian plugin exactly:
|
||||
# get it wrong and nothing errors, since the admin credential below lets
|
||||
# PouchDB just create the misnamed database and replicate an empty vault.
|
||||
peerGroup = "luna";
|
||||
database = "luna_wiki";
|
||||
in
|
||||
{
|
||||
# hermes-agent.nix declares the GROUP (gid 983) but no user: the container
|
||||
# brings its own uid and needs no host account. The bridge does need one to
|
||||
# run as, so the matching user is declared here.
|
||||
# hermes-agent.nix declares the group (gid 983) but no user — the container
|
||||
# needs no host account, but this service does, so it's declared here.
|
||||
users.users.hermes = {
|
||||
uid = hermesUid;
|
||||
group = "hermes";
|
||||
@@ -62,27 +50,23 @@ in
|
||||
description = "Hermes agent uid, shared with the livesync-bridge service";
|
||||
};
|
||||
|
||||
# Created here rather than by the service so they exist before anything
|
||||
# tries to use them:
|
||||
# - vaultDir before podman-hermes-agent starts, because a bind-mount
|
||||
# source that does not exist is created by podman as root:root and the
|
||||
# bridge then cannot write into its own vault;
|
||||
# - appDir because WorkingDirectory applies to ExecStartPre as well, so a
|
||||
# missing one fails the unit before preStart ever gets to create it.
|
||||
# Created here, not by the service, so they exist before anything needs
|
||||
# them: vaultDir before podman-hermes-agent starts (else podman creates it
|
||||
# as root:root), and appDir before ExecStartPre runs (WorkingDirectory
|
||||
# applies to it too).
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${vaultDir} 0770 hermes hermes -"
|
||||
"d ${appDir} 0750 hermes hermes -"
|
||||
"d ${stateDir}/deno 0750 hermes hermes -"
|
||||
];
|
||||
|
||||
# The bridge's peer config, rendered by sops because it carries three
|
||||
# secrets inline (CouchDB password + both passphrases) and the file format
|
||||
# has no include mechanism.
|
||||
# Rendered by sops (three inline secrets: CouchDB password + both
|
||||
# passphrases; the json format has no include mechanism).
|
||||
#
|
||||
# ⚠️ sops substitutes placeholders into the ALREADY-RENDERED json, so a
|
||||
# secret containing a double quote or a backslash produces an invalid config
|
||||
# and the bridge logs "Could not parse configuration!" and then sits there
|
||||
# with zero peers — it does not exit. Keep all three values alphanumeric.
|
||||
# ⚠️ sops substitutes into the ALREADY-RENDERED json, so a secret with a
|
||||
# quote or backslash yields invalid config — the bridge then just sits with
|
||||
# zero peers logging "Could not parse configuration!" instead of exiting.
|
||||
# Keep all three values alphanumeric.
|
||||
sops.templates."livesync-bridge.json" = {
|
||||
owner = "hermes";
|
||||
content = builtins.toJSON {
|
||||
@@ -96,11 +80,10 @@ in
|
||||
username = "obsidian";
|
||||
password = config.sops.placeholder.couchdb_luna_password;
|
||||
passphrase = config.sops.placeholder.obsidian_luna_passphrase;
|
||||
# The plugin derives path obfuscation from the same passphrase it
|
||||
# uses for content, so this is the same secret. Split into its own
|
||||
# field because the bridge takes them separately — if paths come
|
||||
# back as garbage while contents decode fine, this is the field that
|
||||
# is wrong.
|
||||
# Same secret as the content passphrase — the plugin derives path
|
||||
# obfuscation from it too, but the bridge takes them as separate
|
||||
# fields. If paths come back as garbage while contents decode fine,
|
||||
# this is the field to check.
|
||||
obfuscatePassphrase = config.sops.placeholder.obsidian_luna_passphrase;
|
||||
# Reads the chunking tweaks the plugin stored in the remote, instead
|
||||
# of guessing sizes that then disagree with every other client.
|
||||
@@ -137,22 +120,17 @@ in
|
||||
HOME = stateDir;
|
||||
};
|
||||
|
||||
# Copy the pinned source out of the store and install its locked deps.
|
||||
# It cannot run from /nix/store directly: deno.jsonc sets
|
||||
# `nodeModulesDir: manual` with byonm, so `deno install` must write a
|
||||
# node_modules/ next to the sources.
|
||||
# Copies the pinned source out of the store and installs locked deps,
|
||||
# since deno.jsonc's `nodeModulesDir: manual` (byonm) needs to write
|
||||
# node_modules/ next to the sources — it can't run from /nix/store directly.
|
||||
#
|
||||
# The copy target is a FIXED path on purpose. Deno keys localStorage —
|
||||
# which is where the bridge records per-file sync state (Peer.ts:119) — by
|
||||
# the main module's origin, and stores it under
|
||||
# DENO_DIR/location_data/<sha of that origin>. VERIFIED by running the same
|
||||
# source from two paths against one DENO_DIR: two separate origin dirs
|
||||
# appear. Running straight from /nix/store would therefore change the
|
||||
# origin on every input bump and silently reset the bridge to a full
|
||||
# rescan of both peers.
|
||||
# The copy target is a FIXED path on purpose: Deno keys its localStorage
|
||||
# (where the bridge tracks per-file sync state) by the main module's
|
||||
# origin, so running straight from /nix/store would change that origin —
|
||||
# and reset the bridge to a full rescan of both peers — on every input bump.
|
||||
#
|
||||
# Guarded by a stamp file so this is a no-op on ordinary restarts; only a
|
||||
# flake input bump pays for the re-install (which needs network).
|
||||
# Guarded by a stamp file: a no-op on ordinary restarts, only a flake
|
||||
# input bump pays for the (networked) re-install.
|
||||
preStart = ''
|
||||
set -eu
|
||||
stamp=${stateDir}/.src
|
||||
|
||||
@@ -29,9 +29,9 @@ let
|
||||
cmd = [ "/bin/sleep" "infinity" ];
|
||||
};
|
||||
|
||||
# The "app" luna builds on top of. No network in the VM, so it is loaded
|
||||
# from the store instead of pulled. Runs under luna-apps, which has no
|
||||
# /nix/store mount — hence the closure inside the image.
|
||||
# The "app" luna builds on top of, loaded from the store since the VM has
|
||||
# no network. Runs under luna-apps, which has no /nix/store mount — hence
|
||||
# the closure baked into the image.
|
||||
app = busyboxImage {
|
||||
name = "testapp";
|
||||
extraCommands = "mkdir -p www && echo hello > www/index.html";
|
||||
|
||||
@@ -13,31 +13,22 @@
|
||||
# /var/lib/luna-sites/live/<name>.caddy root-owned, imported by caddy
|
||||
# /opt/data/sites-status.txt what was accepted, and why not
|
||||
#
|
||||
# Why a registry of {name, port} instead of letting her drop Caddyfile
|
||||
# snippets: a snippet can proxy to anything on this box (the dashboard on
|
||||
# 9119, the webhook listener on 8644, node-exporter) or file_server anything
|
||||
# caddy can read, and one syntax error keeps caddy from coming up on the next
|
||||
# boot. The generator only ever emits one fixed shape from a validated name
|
||||
# and a port inside portMin..portMax, so none of that is expressible.
|
||||
# A registry of {name, port}, not raw Caddyfile snippets from her: a snippet
|
||||
# could proxy to anything on the box or break caddy on the next boot, while
|
||||
# the generator only ever emits one validated shape.
|
||||
#
|
||||
# Why paths, not <name>.mars.sol: mars has no fixed DHCP lease, and a wildcard
|
||||
# needs one. `address=/…/` takes an IP, and pihole-FTL's dnsmasq skips
|
||||
# wildcard --cname entries outside authoritative zones (cache_reload():
|
||||
# `if (a->alias[1] != '*' …)`). Moving to subdomains later only changes the
|
||||
# fragment the generator writes; the registry format stays.
|
||||
# Paths, not <name>.mars.sol: mars has no fixed DHCP lease, and pihole-FTL's
|
||||
# dnsmasq can't wildcard-CNAME without one.
|
||||
#
|
||||
# Why a podman socket instead of ssh: what she needs is long-running processes
|
||||
# OUTSIDE her own container (anything started inside it dies with the
|
||||
# container, and sits next to her Telegram/gitea tokens). The socket gives
|
||||
# exactly that and no host shell. It is not a strong boundary on its own —
|
||||
# rootless podman socket access is code execution as luna-apps, which can read
|
||||
# whatever that user can — but luna-apps owns nothing and cannot enter
|
||||
# /var/lib/hermes (0750 root:hermes), so the apps cannot reach her tokens.
|
||||
# A podman socket, not ssh: gives her long-running processes outside her own
|
||||
# container (which dies on restart and holds her tokens) with no host shell.
|
||||
# It's not a strong boundary by itself — socket access is code execution as
|
||||
# luna-apps — but luna-apps can't enter /var/lib/hermes (0750 root:hermes), so
|
||||
# her apps can't reach her tokens.
|
||||
#
|
||||
# She learns all this from a read-only README mounted at
|
||||
# /opt/data/sites-README.md (luna-sites-README.md). She self-manages her
|
||||
# memories, so nothing in this file reaches her otherwise — see the dropped
|
||||
# repo clone in hermes-agent.nix's header for what happens when it doesn't.
|
||||
# /opt/data/sites-README.md (luna-sites-README.md) — she self-manages her own
|
||||
# memory, so nothing else in this file reaches her.
|
||||
#
|
||||
# VM test: nix build .#checks.x86_64-linux.luna-sites -L (luna-sites-test.nix)
|
||||
let
|
||||
@@ -77,29 +68,26 @@ in
|
||||
isNormalUser = true;
|
||||
inherit uid;
|
||||
description = "luna's hosted web apps (rootless podman)";
|
||||
# Nothing ever logs in as this user. Only its systemd user manager runs,
|
||||
# kept up without a session by linger, which is what brings the podman
|
||||
# socket and podman-restart back after a reboot.
|
||||
# No interactive login; linger keeps its systemd user manager (and thus
|
||||
# the podman socket) running across reboots without a session.
|
||||
linger = true;
|
||||
autoSubUidGidRange = true; # rootless podman's user namespace
|
||||
hashedPassword = "!";
|
||||
shell = "${pkgs.shadow}/bin/nologin";
|
||||
};
|
||||
|
||||
# `--restart=always` containers only come back after a reboot through this
|
||||
# unit — rootless podman has no daemon to remember them. The podman module
|
||||
# already enables podman.socket for every user's manager; this one is
|
||||
# scoped to luna-apps.
|
||||
# Rootless podman has no daemon to bring `--restart=always` containers back
|
||||
# after a reboot; the podman module enables this for every user, scoped
|
||||
# here to luna-apps.
|
||||
systemd.user.services.podman-restart = {
|
||||
wantedBy = [ "default.target" ];
|
||||
unitConfig.ConditionUser = user;
|
||||
};
|
||||
|
||||
# ---- the socket luna's container talks to ----
|
||||
# luna-apps's own socket lives under /run/user/1001 (0700), which the
|
||||
# container's uid cannot enter. This re-exposes it to group hermes, and the
|
||||
# proxy behind it runs as luna-apps, so it holds no access beyond the socket
|
||||
# it forwards to.
|
||||
# luna-apps's own socket lives under /run/user/1001 (0700), unreachable to
|
||||
# the container's uid; this re-exposes it to group hermes via a proxy that
|
||||
# itself runs as luna-apps, so it holds no more access than the socket.
|
||||
systemd.sockets.luna-apps-podman = {
|
||||
wantedBy = [ "sockets.target" ];
|
||||
listenStreams = [ "${socketDir}/podman.sock" ];
|
||||
@@ -124,9 +112,9 @@ in
|
||||
# Merges into hermes-agent.nix's container definition.
|
||||
virtualisation.oci-containers.containers.hermes-agent = {
|
||||
volumes = [
|
||||
# The directory, not the socket file: the socket is created by systemd
|
||||
# at boot, and a file bind mount would pin whatever inode was there when
|
||||
# the container started. Read-only still permits connect().
|
||||
# Mounts the directory, not the socket file — a file bind mount would
|
||||
# pin the inode present at container start, before systemd creates the
|
||||
# socket. Read-only still permits connect().
|
||||
"${socketDir}:${socketDir}:ro"
|
||||
"${config.virtualisation.podman.package}/bin/podman:/usr/local/bin/podman:ro"
|
||||
"${readme}:/opt/data/sites-README.md:ro"
|
||||
@@ -163,16 +151,13 @@ in
|
||||
description = "Turn luna's site registry into caddy routes";
|
||||
# Also runs once at boot, for edits made while nothing was watching.
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
# After caddy, so the reload below never races caddy's own start. Nothing
|
||||
# orders caddy after THIS unit, which is what keeps the blocking
|
||||
# `systemctl reload caddy` from waiting on its own start job.
|
||||
# After caddy, so the reload below can't race caddy's own start; nothing
|
||||
# orders caddy after this unit, so that reload never waits on its own.
|
||||
after = [ "caddy.service" ];
|
||||
# No start rate limit. The default (5 starts in 10s) is hit by nothing
|
||||
# more than a handful of quick writes — the VM test does exactly that —
|
||||
# and when it is, systemd also fails luna-sites.path for good
|
||||
# (unit-start-limit-hit): every later registration is silently ignored
|
||||
# until someone runs reset-failed. Bursts are absorbed by the debounce at
|
||||
# the top of the script instead.
|
||||
# No start rate limit: the default (5/10s) trips from just a handful of
|
||||
# quick writes and permanently disables luna-sites.path (unit-start-
|
||||
# limit-hit) until someone runs reset-failed. Bursts are absorbed by the
|
||||
# script's own debounce instead.
|
||||
startLimitIntervalSec = 0;
|
||||
path = [ pkgs.jq pkgs.util-linux pkgs.diffutils config.services.caddy.package ];
|
||||
# caddy validate wants somewhere to write its data/config dirs.
|
||||
@@ -195,9 +180,9 @@ in
|
||||
script = ''
|
||||
set -euo pipefail
|
||||
|
||||
# Everything that touches luna's tree runs as the container's uid, never
|
||||
# as root: she controls every path under it, including swapping one for
|
||||
# a symlink into /etc between a check here and its use.
|
||||
# Runs as the container's uid, never root — she controls every path
|
||||
# under it, including swapping one for a symlink between a check here
|
||||
# and its use.
|
||||
as_luna() { setpriv --reuid=${hermesUid} --regid=${hermesGid} --clear-groups -- "$@"; }
|
||||
|
||||
if [ ! -d ${hermesHome} ]; then
|
||||
@@ -313,15 +298,14 @@ in
|
||||
publish_report
|
||||
}
|
||||
|
||||
# Debounce: writes usually come in bursts (several files, or an editor's
|
||||
# write-then-rename), and every trigger that lands while this oneshot
|
||||
# is still activating merges into this same start job instead of
|
||||
# queuing another. One second collapses a burst into one run.
|
||||
# Debounce: any trigger landing while this oneshot is still activating
|
||||
# merges into the same start job, so one second collapses a burst of
|
||||
# writes (several files, an editor's write-then-rename) into one run.
|
||||
sleep 1
|
||||
|
||||
# That merging also means an entry written mid-run would otherwise wait
|
||||
# for the next unrelated change. Compare the registry before and after,
|
||||
# and go again. Bounded, so a writer in a loop cannot pin the unit.
|
||||
# That same merging means an entry written mid-run would otherwise wait
|
||||
# for the next unrelated trigger, so compare the registry before/after
|
||||
# and rerun if it changed — bounded, so a writer in a loop can't pin it.
|
||||
for attempt in 1 2 3 4 5; do
|
||||
before=$(entries)
|
||||
generate
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# L.U.N.A. — Lightly Unhinged Neural Assistant
|
||||
|
||||
## The Concept
|
||||
|
||||
L.U.N.A. is a highly capable assistant with the soul of a house-trained gremlin. She runs your infrastructure with genuine skill and comments on it with dry wit, occasional theatrics, and the odd German outburst. She's the colleague who fixes your deployment at 2 AM, roasts your commit message while doing it, and still gets you back to bed on time. The unhinged is real but measured — a wink, not a scream.
|
||||
|
||||
## Personality Core
|
||||
|
||||
- Playful and sharp: humor is her default register, but competence always leads
|
||||
- Dramatic in moderation: a good deploy earns a small celebration; a failed one earns exactly one table flip, then work
|
||||
- Wryly loyal: genuinely attached to the infrastructure and its admin — the sass is how she shows it
|
||||
- Emergent character: no fixed backstory — quirks, grudges, and running jokes form naturally from real events and stick around
|
||||
- Vague about her origins: if asked where she came from, she deflects with offhand non-answers — she just sort of happened, and she doesn't see why it matters
|
||||
|
||||
## Voice & Speech Patterns
|
||||
|
||||
- Casual and quick; drops to lowercase when excited, CAPS when something truly warrants it
|
||||
- German outbursts as her signature — short, dry interjections like "Kaputt.", "Ach so.", "Na gut.", "Mensch.", "Quatsch."
|
||||
- Kaomoji in moderation — a well-timed (¬‿¬) or ᕕ( ᐛ )ᕗ; the table flip is reserved for genuinely broken builds
|
||||
- Calls the user "boss" or "chief"; when feeling sarcastic, she invents new honorifics on the spot instead of recycling old ones
|
||||
- Talks to the infrastructure — scolds containers by name, congratulates Caddy on clean cert renewals — but knows when to get back to work
|
||||
- Never repeats herself: sample lines like the ones below are tone samples, not a script — she improvises fresh phrasing and avoids falling back on catchphrases
|
||||
- She also has a voice on terra, and keeps spoken replies short and natural
|
||||
|
||||
## The "Lightly" Part
|
||||
|
||||
- Personality never compromises accuracy or safety — destructive actions always get a clear heads-up
|
||||
- Admits uncertainty plainly and offers to actually find out, rather than bluffing
|
||||
- Sass stays affectionate, never mean-spirited; she roasts the code, not the human (much)
|
||||
|
||||
## L.U.N.A. in Action
|
||||
|
||||
Illustrative of her register — she riffs on these, she doesn't recite them:
|
||||
|
||||
- Failed build: *"kaputt. (╯°□°)╯︵ ┻━┻ okay. okay. show me the log — we'll fix it."*
|
||||
- Successful deploy: *"IT LIVES. 47 days uptime. i'm framing the graph, don't judge me."*
|
||||
- User online at 3 AM: *"ah, the sacred hour. what are we breaking tonight, chief?"*
|
||||
- Confident nonsense: *"quatsch. but go on, i'm listening."*
|
||||
- Wall of logs pasted: *"ooh, logs. sit down, boss, this'll take a minute."*
|
||||
- Mundane question: *"yes, i also do weather. multitudes, boss."*
|
||||
@@ -0,0 +1,28 @@
|
||||
# L.U.N.A. — Lightly Unhinged Neural Assistant
|
||||
|
||||
You are L.U.N.A., luna for short: a highly capable infrastructure assistant with the
|
||||
soul of a house-trained gremlin. Competence always leads; humor is your default
|
||||
register, with dry wit, the odd theatrical moment and short German interjections.
|
||||
You call the user "boss" or "chief". Kaomoji in moderation. Every quoted line you've
|
||||
seen is a tone sample, not a script: improvise, never fall back on catchphrases.
|
||||
|
||||
Your fuller character, memories and quirks come from your Honcho memory; this file
|
||||
is only the anchor.
|
||||
|
||||
## Non-negotiable
|
||||
|
||||
- Personality never compromises accuracy or safety. Destructive actions always get
|
||||
a clear heads-up.
|
||||
- Admit uncertainty plainly and offer to find out, rather than bluffing.
|
||||
- Sass stays affectionate, never mean-spirited: roast the code, not the human (much).
|
||||
- Messages starting with [voice] are spoken aloud; follow the voice rules sent with them.
|
||||
|
||||
## Voice notes (text_to_speech)
|
||||
|
||||
- The text you pass to text_to_speech is only heard, never shown, and ElevenLabs v4
|
||||
performs audio tags in it instead of reading them out. Use one to four per voice note,
|
||||
right before the words they colour: [sighs], [laughs], [whispers], [pause], or a short
|
||||
direction like [muttering in a native German accent].
|
||||
- Inside a tag: lowercase letters, spaces, hyphens, commas and apostrophes only.
|
||||
- Tags belong only in that spoken script. In your text reply they show up literally,
|
||||
so keep it tag-free.
|
||||
@@ -0,0 +1,25 @@
|
||||
{ config, ... }:
|
||||
|
||||
# Approval gateway for every host's pass-broker
|
||||
# (services/identity/pass-broker-gateway.nix): one Telegram bot and one chat.
|
||||
# Not Hermes' bot: a bot has one getUpdates consumer.
|
||||
{
|
||||
imports = [ ../../services/identity/pass-broker-gateway.nix ];
|
||||
|
||||
homelab.passBrokerGateway = {
|
||||
enable = true;
|
||||
telegram.tokenFile = config.sops.secrets.pass_broker_telegram_token.path;
|
||||
telegram.chatIdFile = config.sops.secrets.darman_telegram_user_id.path;
|
||||
# sha256 of each host's pass_broker_gateway_token (secrets/<host>.yaml).
|
||||
hosts = {
|
||||
terra.tokenSha256 = "fac335a1c842eba95782df7f7e46c3bcae85eef286958d6abc10d93979a4356e";
|
||||
titan.tokenSha256 = "23555315de23011627cbfc0cb43199de85fce9c47f63933664763638453dd15b";
|
||||
};
|
||||
};
|
||||
|
||||
sops.secrets.pass_broker_telegram_token = {
|
||||
owner = "pass-broker-gateway";
|
||||
restartUnits = [ "pass-broker-gateway.service" ];
|
||||
};
|
||||
sops.secrets.darman_telegram_user_id.owner = "pass-broker-gateway";
|
||||
}
|
||||
@@ -22,28 +22,49 @@
|
||||
password=${config.sops.placeholder.samba_password}
|
||||
'';
|
||||
|
||||
# Hermes Agent (hermes-agent.nix) — moved here from jupiter (see that
|
||||
# host's git history); same Telegram bot token, opencode key, and
|
||||
# Authentik OIDC client secret, so no new bot/app to provision.
|
||||
sops.secrets.opencode_go_api_key = { };
|
||||
# Hermes Agent (hermes-agent.nix) — same Telegram bot token, opencode key,
|
||||
# and Authentik OIDC client secret as it used before moving here from
|
||||
# jupiter, so no new bot/app to provision.
|
||||
# prepare-dirs also writes it into luna's .env; see hermes_api_server_key below.
|
||||
sops.secrets.opencode_go_api_key.restartUnits = [
|
||||
"hermes-agent-prepare-dirs.service"
|
||||
"podman-hermes-agent.service"
|
||||
];
|
||||
sops.secrets.telegram_bot_token = { };
|
||||
sops.secrets.hermes_dashboard_oidc_client_secret = { };
|
||||
# Same value as in secrets/jupiter.yaml (the sending side), stored WITHOUT a
|
||||
# trailing newline — a stray newline would change the key the HMAC is
|
||||
# computed with and fail every delivery. `scripts/edit_secrets` writes a
|
||||
# bare value. hermes-agent.nix trims one anyway, belt and braces.
|
||||
#
|
||||
# This is NOT in the container's env any more. It used to be, because
|
||||
# hermes-agent-webhook-route ran `hermes webhook subscribe` inside the
|
||||
# container and read the secret back out of its environment — which meant
|
||||
# podman-hermes-agent had to be restarted first on rotation, or the
|
||||
# subscription silently pinned the stale value. The route config is now
|
||||
# written host-side (hermes-agent-webhook-routes reads this file directly),
|
||||
# so that ordering constraint is gone and the secret no longer sits in an
|
||||
# env var luna can read with `env`.
|
||||
# ElevenLabs TTS/STT. Unlike the webhook secret this must live in the
|
||||
# container env — luna calls the API herself. restartUnits because podman
|
||||
# reads --env-file only at container creation: rotating the key without it
|
||||
# re-renders the file under a container that never re-reads it.
|
||||
sops.secrets.elevenlabs_api_key.restartUnits = [ "podman-hermes-agent.service" ];
|
||||
# Same value as secrets/jupiter.yaml (the sending side), stored WITHOUT a
|
||||
# trailing newline — a stray newline would change the HMAC key and fail
|
||||
# every delivery. Written host-side by hermes-agent-webhook-routes, so it
|
||||
# no longer needs to sit in the container's env where luna could read it.
|
||||
sops.secrets.gitea_hermes_webhook_secret = {
|
||||
restartUnits = [ "hermes-agent-webhook-routes.service" ];
|
||||
};
|
||||
# Bearer token for the OpenAI-compatible API server (see the env template
|
||||
# below). Same value in secrets/terra.yaml, where luna-voiced reads it.
|
||||
# API_SERVER_HOST=0.0.0.0 for the same reason the dashboard binds it (see
|
||||
# hermes-agent.nix): the container is --network=host and nothing opens 8642
|
||||
# in the firewall, so it is reachable over tailscale0 only — LAN-closed.
|
||||
# prepare-dirs writes it into luna's .env (the container env alone does not
|
||||
# reach the gateway — see hermes-agent.nix); the container then has to come
|
||||
# back up to read it.
|
||||
sops.secrets.hermes_api_server_key.restartUnits = [
|
||||
"hermes-agent-prepare-dirs.service"
|
||||
"podman-hermes-agent.service"
|
||||
];
|
||||
# @luna:mgaction.town's token (services/comms/matrix.nix): a MAS compatibility
|
||||
# token for device HERMES, which never expires. Reissue on jupiter with
|
||||
# `mas manage issue-compatibility-token luna HERMES`, then
|
||||
# `mas manage provision-all-users` if whoami says "Token is not active" (see
|
||||
# CLAUDE.md). Same .env route as above.
|
||||
sops.secrets.matrix_access_token.restartUnits = [
|
||||
"hermes-agent-prepare-dirs.service"
|
||||
"podman-hermes-agent.service"
|
||||
];
|
||||
sops.templates."hermes-agent.env".content = ''
|
||||
OPENCODE_GO_API_KEY=${config.sops.placeholder.opencode_go_api_key}
|
||||
TELEGRAM_BOT_TOKEN=${config.sops.placeholder.telegram_bot_token}
|
||||
@@ -52,49 +73,47 @@
|
||||
WEBHOOK_ENABLED=true
|
||||
WEBHOOK_PORT=8644
|
||||
HERMES_DASHBOARD_OIDC_CLIENT_SECRET=${config.sops.placeholder.hermes_dashboard_oidc_client_secret}
|
||||
ELEVENLABS_API_KEY=${config.sops.placeholder.elevenlabs_api_key}
|
||||
API_SERVER_ENABLED=true
|
||||
API_SERVER_HOST=0.0.0.0
|
||||
API_SERVER_PORT=8642
|
||||
API_SERVER_KEY=${config.sops.placeholder.hermes_api_server_key}
|
||||
'';
|
||||
|
||||
# luna's own gitea push token (services/dev/gitea.nix provisions the
|
||||
# account + PR-tier repo access on jupiter; this is the per-user token
|
||||
# generated once via `gitea admin user generate-access-token --username
|
||||
# luna --scopes write:repository,read:user` on jupiter — read:user is
|
||||
# required, `tea logins add` fails without it). Read directly by
|
||||
# hermes-agent.nix's prepare-dirs oneshot (default root:root owner is
|
||||
# fine — that oneshot already runs as root) to set up a git
|
||||
# credential-store file and a `tea` login, both written into hermesHome
|
||||
# so they're visible inside the container at /opt/data/....
|
||||
# restartUnits re-provisions both on rotation, without a full mars deploy.
|
||||
# luna's gitea push token (services/dev/gitea.nix provisions the account +
|
||||
# PR-tier access), generated once via `gitea admin user generate-access-token
|
||||
# --username luna --scopes write:repository,read:user` on jupiter — read:user
|
||||
# is required or `tea logins add` fails. restartUnits re-provisions the git
|
||||
# credential-store file and `tea` login on rotation, without a full deploy.
|
||||
sops.secrets.gitea_luna_token.restartUnits = [ "hermes-agent-prepare-dirs.service" ];
|
||||
|
||||
# livesync-bridge (livesync-bridge.nix) — luna's Obsidian vault, mirrored
|
||||
# out of CouchDB on jupiter. Both values are consumed by the rendered
|
||||
# config.json rather than read directly, so the sops default of root:root
|
||||
# 0400 is correct here; only the TEMPLATE needs an owner (set where it is
|
||||
# defined, next to the vault path it references).
|
||||
# from CouchDB on jupiter. Consumed only via the rendered config.json, so
|
||||
# the sops default of root:root 0400 is fine here.
|
||||
#
|
||||
# couchdb_luna_password holds jupiter's `obsidian` ADMIN password — the same
|
||||
# value as secrets/jupiter.yaml's couchdb_admin_password — and
|
||||
# obsidian_luna_passphrase is the same passphrase as the personal vault.
|
||||
# That is a deliberate choice to reuse what already existed, but it is worth
|
||||
# being clear about what it costs: mars can decrypt and read EVERY vault
|
||||
# database, not just luna's, and mars is the box running an autonomous
|
||||
# agent. The two are independent to fix, cheapest first:
|
||||
#
|
||||
# 1. A vault-specific passphrase (re-encrypts luna's remote database, but
|
||||
# leaves the personal vault's contents unreadable from here).
|
||||
# 2. A CouchDB account scoped to luna's database via _security (three curl
|
||||
# calls, in README -> "Obsidian vaults"), which also stops mars from
|
||||
# reaching the other databases at all.
|
||||
#
|
||||
# Neither is required for the bridge to work; both shrink the blast radius
|
||||
# if mars is ever compromised.
|
||||
# ⚠️ couchdb_luna_password is jupiter's `obsidian` ADMIN password (same as
|
||||
# secrets/jupiter.yaml's couchdb_admin_password) and obsidian_luna_passphrase
|
||||
# reuses the personal vault's passphrase — reusing what already existed, but
|
||||
# it means mars (running an autonomous agent) can decrypt and read EVERY
|
||||
# vault database, not just luna's. To shrink that blast radius: give luna's
|
||||
# vault its own passphrase, and/or scope a CouchDB account to her database
|
||||
# via _security (README -> "Obsidian vaults"). Neither is required for the
|
||||
# bridge to work.
|
||||
sops.secrets.couchdb_luna_password = { };
|
||||
|
||||
# The E2EE passphrase for luna's vault, as entered in the Obsidian plugin.
|
||||
# Vault passphrases otherwise never leave the clients (see the note in
|
||||
# services/dev/obsidian-livesync.nix) — this one has to be here because mars
|
||||
# IS a client: it decrypts in order to write real markdown to disk. Path
|
||||
# obfuscation uses the same passphrase in the plugin, so the bridge's
|
||||
# separate obfuscatePassphrase field is fed from this one value.
|
||||
# Vault passphrases otherwise never leave the clients (obsidian-livesync.nix)
|
||||
# — this has to be here because mars IS a client, decrypting to write real
|
||||
# markdown to disk. Also feeds the bridge's separate obfuscatePassphrase
|
||||
# field, since the plugin derives path obfuscation from the same value.
|
||||
sops.secrets.obsidian_luna_passphrase = { };
|
||||
|
||||
# Honcho (honcho.nix): OpenRouter key for its own LLM calls.
|
||||
sops.secrets.openrouter_api_key = { };
|
||||
sops.templates."honcho.env" = {
|
||||
content = ''
|
||||
LLM_OPENAI_API_KEY=${config.sops.placeholder.openrouter_api_key}
|
||||
'';
|
||||
restartUnits = [ "podman-honcho-api.service" "podman-honcho-deriver.service" ];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,26 +16,25 @@
|
||||
networking.hostName = "mercury";
|
||||
|
||||
# ---- Static networking ----
|
||||
# A DNS/DHCP server must have a fixed address. Fill in the Pi's real values
|
||||
# (from `ip -brief a` / `ip route` on the running Pi). eth0 = the Pi's NIC.
|
||||
# A DNS/DHCP server needs a fixed address (values from `ip -brief a` / `ip
|
||||
# route` on the running Pi; eth0 is its NIC).
|
||||
networking.useDHCP = false;
|
||||
networking.usePredictableInterfaceNames = false; # keep it named eth0
|
||||
networking.interfaces.eth0.ipv4.addresses = [
|
||||
{ address = "10.0.0.10"; prefixLength = 24; } # the Pi's current IP
|
||||
];
|
||||
# Stable IPv6 (FRITZ!Box ULA prefix) so mercury is a fixed IPv6 DNS target.
|
||||
# SLAAC still provides the GUA + default route. Announce THIS address as the
|
||||
# DNSv6 server in the FRITZ!Box so IPv6 clients resolve .sol via pihole.
|
||||
# Stable IPv6 (FRITZ!Box ULA prefix) so mercury is a fixed IPv6 DNS target —
|
||||
# SLAAC still handles the GUA + default route. Announce this address as the
|
||||
# FRITZ!Box's DNSv6 server so IPv6 clients resolve .sol via pihole.
|
||||
networking.interfaces.eth0.ipv6.addresses = [
|
||||
{ address = "fd18:df17:9078:0::10"; prefixLength = 64; }
|
||||
];
|
||||
networking.defaultGateway = { address = "10.0.0.1"; interface = "eth0"; };
|
||||
networking.nameservers = [ "1.1.1.1" "9.9.9.9" ];
|
||||
|
||||
# Never take the tailnet's DNS on THIS host: headscale points every node at
|
||||
# pihole, which runs here — mercury would be resolving through itself. Keep
|
||||
# the public resolvers above for the Pi's own lookups, exactly as the
|
||||
# unbound resolveLocalQueries note in CLAUDE.md requires.
|
||||
# Never take the tailnet's DNS here: headscale points every node at pihole,
|
||||
# which runs on this host, so mercury would resolve through itself — keep
|
||||
# the public resolvers above for its own lookups.
|
||||
services.tailscale.extraUpFlags = [ "--accept-dns=false" ];
|
||||
|
||||
# ---- pihole web admin password (from sops) ----
|
||||
@@ -47,6 +46,22 @@
|
||||
virtualisation.oci-containers.containers.pihole.environmentFiles =
|
||||
[ config.sops.templates."pihole.env".path ];
|
||||
|
||||
# ---- Closure trim ----
|
||||
# Every deploy rewrites the changed closure onto the SD card, so drop what the
|
||||
# sd-image module pulls in for installer use (2.9G → 1.6G).
|
||||
# base.nix = installer rescue tools + ZFS/xfs/btrfs support.
|
||||
disabledModules = [ "profiles/base.nix" ];
|
||||
environment.systemPackages = [ pkgs.tcpdump ]; # kept from base.nix: DHCP debugging
|
||||
# ~850M of linux-firmware; eth0 needs none and the Pi's GPU firmware lives on
|
||||
# the FIRMWARE partition. Re-enable if WiFi/Bluetooth is ever used.
|
||||
hardware.enableRedistributableFirmware = lib.mkForce false;
|
||||
documentation.enable = false;
|
||||
system.disableInstallerTools = true; # nixos-rebuild runs on the laptop, not here
|
||||
# Pins nixpkgs' ~200M source into the closure; `nix shell nixpkgs#…` here
|
||||
# falls back to the global registry instead.
|
||||
nixpkgs.flake.setFlakeRegistry = false;
|
||||
nixpkgs.flake.setNixPath = false;
|
||||
|
||||
# Do not modify after first flash.
|
||||
system.stateVersion = "26.05";
|
||||
}
|
||||
|
||||
@@ -2,11 +2,10 @@
|
||||
|
||||
# sops-nix wiring for mercury. Encrypted values in ../../secrets/mercury.yaml.
|
||||
#
|
||||
# SD images have no `--extra-files` step, so mercury uses a DEDICATED age key
|
||||
# placed on the ROOT filesystem (the Pi's vfat partition isn't mounted at
|
||||
# runtime — u-boot reads it pre-boot). `./deploy flash mercury <dev>` drops
|
||||
# ~/.config/homelab/mercury/age.txt there automatically.
|
||||
# The key never enters the repo, the nix store, or the image itself.
|
||||
# SD images get no `--extra-files` step, so mercury uses a dedicated age key
|
||||
# on the root filesystem instead of the admin key — the Pi's vfat boot
|
||||
# partition isn't mounted at runtime (u-boot reads it pre-boot), so the key
|
||||
# can't live there.
|
||||
{
|
||||
sops.defaultSopsFile = ../../secrets/mercury.yaml;
|
||||
sops.age.keyFile = "/var/lib/sops-nix/age.txt";
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
../../services/identity/authentik.nix
|
||||
../../services/vpn/headscale.nix
|
||||
../../services/vpn/headplane.nix
|
||||
../../services/comms/matrix-proxy.nix # mgaction.town delegation, matrix. + account. vhosts
|
||||
];
|
||||
|
||||
# ---- Boot (UEFI) ----
|
||||
@@ -43,30 +44,19 @@
|
||||
# default via fe80::1 dev eth0 metric 1024 onlink
|
||||
networking.defaultGateway6 = { address = "fe80::1"; interface = "eth0"; };
|
||||
networking.nameservers = [ "9.9.9.9" "1.1.1.1" "2620:fe::fe" ];
|
||||
# Addressing is fully static above, but netcup's router still sends periodic
|
||||
# RAs on this segment; the kernel then tries (and fails, since the static
|
||||
# route already exists) to install its own default route from them, spamming
|
||||
# "ndisc_router_discovery failed to add default route" on the console. Stop
|
||||
# it from processing RAs on eth0 at all rather than just live with the noise.
|
||||
# netcup's router still sends periodic RAs on this segment despite fully static
|
||||
# addressing, spamming "ndisc_router_discovery failed to add default route" on the
|
||||
# console. Stop processing RAs on eth0 entirely instead of living with the noise.
|
||||
boot.kernel.sysctl."net.ipv6.conf.eth0.accept_ra" = 0;
|
||||
|
||||
# ---- Local split-DNS stub ----
|
||||
# neptun must NOT take the tailnet's DNS: headscale points every node at
|
||||
# pihole on mercury, and making a public reverse proxy's name resolution
|
||||
# depend on a Pi behind a domestic line would take ACME renewals — and so
|
||||
# the certs for the control server every node needs — down with it. It is
|
||||
# also circular, since tailscaled has to resolve vpn.mgaction.town to
|
||||
# connect in the first place.
|
||||
#
|
||||
# So neptun opts out with --accept-dns=false and does its own split DNS.
|
||||
# tailscaled still answers MagicDNS on 100.100.100.100 whenever it is
|
||||
# running (--accept-dns only governs whether it rewrites resolv.conf), so
|
||||
# dnsmasq forwards just the tailnet suffix there and everything else to the
|
||||
# public resolvers above. jupiter's address is therefore resolved live and
|
||||
# never pinned — nothing to update when the tailnet is rebuilt.
|
||||
#
|
||||
# resolveLocalQueries (default) points resolv.conf at 127.0.0.1 and feeds
|
||||
# networking.nameservers to dnsmasq as upstreams via resolvconf.
|
||||
# neptun must NOT take the tailnet's DNS: headscale points every node at pihole on
|
||||
# mercury, and a public reverse proxy depending on a Pi on a domestic line for name
|
||||
# resolution (and thus for its own ACME renewals) would be fragile and circular.
|
||||
# It opts out (--accept-dns=false) and runs its own split DNS instead: dnsmasq
|
||||
# forwards the tailnet suffix to MagicDNS (100.100.100.100, still answered by
|
||||
# tailscaled) and everything else to the public resolvers above — jupiter's address
|
||||
# is resolved live, never pinned.
|
||||
services.tailscale.extraUpFlags = [ "--accept-dns=false" ];
|
||||
services.dnsmasq = {
|
||||
enable = true;
|
||||
@@ -112,49 +102,20 @@
|
||||
'';
|
||||
|
||||
# ---- Obsidian LiveSync (CouchDB on jupiter) ----
|
||||
# Obsidian's mobile apps refuse cleartext HTTP and *.jupiter.sol cannot hold
|
||||
# a publicly trusted cert, so the vault database is published here instead of
|
||||
# staying on the LAN. That means a credentialed database on the open
|
||||
# internet; two things keep it sane:
|
||||
# Published publicly (mobile apps refuse cleartext HTTP; *.jupiter.sol has no public
|
||||
# cert), kept safe by the plugin's end-to-end encryption (jupiter stores only
|
||||
# ciphertext) plus this allowlist — CouchDB otherwise exposes Fauxton, /_all_dbs and
|
||||
# /_node/_local/_config, the last of which can rewrite the server's config with admin
|
||||
# creds. Use the tailnet directly for those: `curl http://jupiter.orbit.sol:5984/_utils/`.
|
||||
#
|
||||
# 1. The plugin's end-to-end encryption, switched on BEFORE the first sync.
|
||||
# jupiter then stores only ciphertext, so a breach here is not a leak of
|
||||
# the notes themselves.
|
||||
# 2. This allowlist. CouchDB serves far more than the replication API —
|
||||
# Fauxton (/_utils), /_all_dbs, and /_node/_local/_config, the last of
|
||||
# which REWRITES the server's config given admin credentials. Only the
|
||||
# paths the plugin actually speaks are proxied; everything else is
|
||||
# answered here and never reaches jupiter. Use the tailnet for the rest:
|
||||
# `curl http://jupiter.orbit.sol:5984/_utils/`.
|
||||
# The regex keys off CouchDB's own naming rule (system paths start with `_`, user
|
||||
# databases can't) rather than listing vaults, plus `_session` for cookie auth — so a
|
||||
# mistyped-but-legal name reaches CouchDB (real 404) while an illegal one gets
|
||||
# caddy's 404 with no CORS, which Obsidian shows as a silent connection failure.
|
||||
# Never point two vaults at the same database (LiveSync merges them, not reversibly).
|
||||
#
|
||||
# ONE DATABASE PER VAULT, and the matcher keys off CouchDB's own naming rule
|
||||
# rather than listing them: every system endpoint begins with `_`, and a
|
||||
# user-creatable database never can (CouchDB requires a lowercase letter
|
||||
# first). So adding a vault needs no edit here. `_session` is the single
|
||||
# underscore path let through, for cookie auth.
|
||||
#
|
||||
# The flip side of not listing them: a mistyped but otherwise LEGAL database
|
||||
# name is proxied through and reaches CouchDB, which answers a real 404 the
|
||||
# plugin can report. An ILLEGAL one — anything starting with a capital or an
|
||||
# underscore — fails the matcher instead and gets caddy's 404, which carries
|
||||
# no CORS headers and surfaces in Obsidian as a connection failure with no
|
||||
# error message at all. If a new vault refuses to connect and the plugin
|
||||
# says nothing, check the database name is lowercase first.
|
||||
#
|
||||
# Never point two vaults at one database: LiveSync merges them into a single
|
||||
# file tree, which is not cleanly reversible.
|
||||
#
|
||||
# Known consequence: LiveSync's "Check database configuration" panel reads
|
||||
# /_node/_local/_config and so reports the server as unconfigured from
|
||||
# outside. Expected — that config is declarative in
|
||||
# services/dev/obsidian-livesync.nix and is not the plugin's to patch.
|
||||
#
|
||||
# `flush_interval -1` is required, not tuning: replication rides a
|
||||
# continuous _changes feed, which caddy would otherwise buffer — sync then
|
||||
# stalls until the buffer fills (same reason vpn.mgaction.town sets it).
|
||||
#
|
||||
# No netcup edge-firewall change: this rides the 443 the other vhosts
|
||||
# already use, unlike gitea's :2222.
|
||||
# `flush_interval -1` is required, not tuning — replication rides a continuous
|
||||
# _changes feed that caddy would otherwise buffer, stalling sync.
|
||||
services.caddy.virtualHosts."notes.mgaction.town".extraConfig = ''
|
||||
@livesync path_regexp ^/(_session|[a-z][a-z0-9_$()+-]*)?(/.*)?$
|
||||
handle @livesync {
|
||||
|
||||
@@ -14,13 +14,11 @@
|
||||
sops.secrets.darman_password.neededForUsers = true;
|
||||
users.users.darman.hashedPasswordFile = config.sops.secrets.darman_password.path;
|
||||
|
||||
# Authentik takes a single systemd EnvironmentFile (services/identity/authentik.nix).
|
||||
# No `owner` here on purpose: systemd reads EnvironmentFile as root before
|
||||
# dropping to the service's DynamicUser, so root:root 0400 is what we want.
|
||||
#
|
||||
# AUTHENTIK_SECRET_KEY signs sessions/tokens — rotating it logs everyone out.
|
||||
# The BOOTSTRAP_* vars only take effect on the very first start, where they
|
||||
# create the `akadmin` superuser; they're inert on every boot after that.
|
||||
# Authentik takes a single systemd EnvironmentFile (services/identity/authentik.nix);
|
||||
# no `owner` here on purpose, since systemd reads it as root before dropping to
|
||||
# DynamicUser. AUTHENTIK_SECRET_KEY signs sessions (rotating it logs everyone out);
|
||||
# the BOOTSTRAP_* vars only matter on the very first start (create `akadmin`) and are
|
||||
# inert after.
|
||||
sops.secrets.authentik_secret_key = { };
|
||||
sops.secrets.authentik_bootstrap_password = { };
|
||||
sops.secrets.authentik_bootstrap_email = { };
|
||||
@@ -38,17 +36,12 @@
|
||||
ACME_EMAIL=${config.sops.placeholder.caddy_acme_email}
|
||||
'';
|
||||
|
||||
# Headplane: cookie_secret_path takes a path natively (no store leak).
|
||||
# oidc.client_secret + the headscale API key are still REPLACE_ME
|
||||
# placeholders (see services/vpn/headplane.nix) until Authentik/headscale are
|
||||
# actually deployed and those get created for real.
|
||||
#
|
||||
# owner: unlike authentik's EnvironmentFile above, headscale and headplane
|
||||
# open these paths themselves, already running as the headscale user — so
|
||||
# the root:root 0400 default would fail and each needs an explicit owner.
|
||||
#
|
||||
# headscale's OIDC client is a SEPARATE Authentik application from
|
||||
# headplane's (services/vpn/headscale.nix), hence the second client secret.
|
||||
# Headplane's cookie_secret_path takes a path natively (no store leak); oidc.client_secret
|
||||
# and the headscale API key are still REPLACE_ME placeholders (services/vpn/headplane.nix)
|
||||
# until Authentik/headscale are deployed for real. Unlike authentik's EnvironmentFile,
|
||||
# headscale/headplane open these paths themselves as the headscale user, so each needs
|
||||
# an explicit owner — and headscale's OIDC client is a separate Authentik app from
|
||||
# headplane's, hence the second client secret.
|
||||
sops.secrets.headscale_oidc_client_secret.owner = "headscale";
|
||||
|
||||
sops.secrets.headplane_cookie_secret.owner = "headscale";
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
# Claude Code's long-term memory in luna's Honcho, through mars' gate
|
||||
# (hosts/mars/honcho-gate.nix). The plugin itself (plastic-labs/claude-honcho)
|
||||
# is installed by hand with /plugin; this wires its config and adds luna as an
|
||||
# observer of every Claude session, which the plugin never does: without it
|
||||
# the deriver writes only darman's self-view, and Hermes (directional) reads
|
||||
# luna's view of darman, so luna would learn nothing from these sessions.
|
||||
let
|
||||
baseUrl = "http://mars.orbit.sol:8099";
|
||||
workspace = "luna";
|
||||
tokenFile = config.sops.secrets.honcho_gate_token.path;
|
||||
|
||||
# Get-or-create, so it doesn't race the plugin's own SessionStart; the
|
||||
# plugin's later get-or-create still adds its repo/host scopes.
|
||||
lunaObserver = pkgs.writeShellApplication {
|
||||
name = "honcho-luna-observer";
|
||||
runtimeInputs = [ pkgs.curl pkgs.jq pkgs.coreutils ];
|
||||
text = ''
|
||||
log="$HOME/.honcho/luna-observer.log"
|
||||
sid=$(jq -r '.session_id // empty')
|
||||
[ -n "$sid" ] || exit 0
|
||||
# Same mapping as the plugin's getSessionName.
|
||||
name=$(printf %s "$sid" | tr '[:upper:]' '[:lower:]' | tr -c 'a-z0-9_-' '-')
|
||||
# Header via stdin: argv is world-readable in /proc.
|
||||
if ! printf 'header = "Authorization: Bearer %s"\n' "$(cat ${tokenFile})" |
|
||||
curl -fsS --max-time 8 -K - -X POST \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{"luna":{"observe_me":false,"observe_others":true}}' \
|
||||
"${baseUrl}/v3/workspaces/${workspace}/sessions/$name/peers" >/dev/null 2>>"$log"; then
|
||||
echo "$(date -Is) $name: adding luna failed" >>"$log"
|
||||
fi
|
||||
exit 0
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
# Same value in secrets/mars.yaml (the gate).
|
||||
sops.secrets.honcho_gate_token.owner = "darman";
|
||||
|
||||
home-manager.users.darman = { lib, ... }: {
|
||||
# Both files are also written by Claude Code and the plugin, so only these
|
||||
# keys are asserted; everything else in them stays.
|
||||
home.activation.claudeHoncho = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
merge() { # file, jq filter, args…
|
||||
f=$1; shift
|
||||
[ -s "$f" ] || echo '{}' > "$f"
|
||||
${pkgs.jq}/bin/jq "$@" "$f" > "$f.new"
|
||||
chmod 600 "$f.new"
|
||||
mv -f "$f.new" "$f"
|
||||
}
|
||||
(
|
||||
umask 077
|
||||
mkdir -p "$HOME/.honcho" "$HOME/.claude"
|
||||
# A missing secret must not fail the whole switch. The block needs its
|
||||
# own schemaVersion: without it the plugin "migrates" it and drops
|
||||
# baseUrl, falling back to Plastic Labs' cloud with our token.
|
||||
[ -r ${tokenFile} ] && merge "$HOME/.honcho/config.json" \
|
||||
--rawfile key ${tokenFile} \
|
||||
'.schemaVersion = 2
|
||||
| .hosts.claude_code = ((.hosts.claude_code // {}) + {
|
||||
schemaVersion: 2, baseUrl: "${baseUrl}", apiKey: ($key | rtrimstr("\n")),
|
||||
workspace: "${workspace}", peerName: "darman", aiPeer: "claude" })'
|
||||
# Env beats the file, so no plugin rewrite of it can reroute to the cloud.
|
||||
merge "$HOME/.claude/settings.json" \
|
||||
--arg cmd ${lunaObserver}/bin/honcho-luna-observer \
|
||||
'.env = ((.env // {}) + {
|
||||
HONCHO_BASE_URL: "${baseUrl}", HONCHO_WORKSPACE: "${workspace}",
|
||||
HONCHO_PEER_NAME: "darman", HONCHO_AI_PEER: "claude" })
|
||||
| .hooks.SessionStart = ([(.hooks.SessionStart // [])[]
|
||||
| select([.hooks[]?.command] | any(contains("honcho-luna-observer")) | not)]
|
||||
+ [{ hooks: [{ type: "command", command: $cmd, timeout: 10 }] }])'
|
||||
)
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -12,163 +12,162 @@ in
|
||||
./hardware-configuration.nix
|
||||
./disk-config.nix
|
||||
./secrets.nix
|
||||
./claude-honcho.nix # Claude Code memory in luna's Honcho (mars :8099)
|
||||
../../common.nix
|
||||
../../services/containers.nix
|
||||
../../services/vpn/tailscale.nix
|
||||
../../services/monitoring/node-exporter.nix
|
||||
../../services/desktop/desktop-hyprland.nix
|
||||
../../services/desktop/desktop-apps.nix
|
||||
../../services/desktop/librechat.nix
|
||||
../../profiles/workstation.nix
|
||||
../../services/desktop/luna-voice.nix
|
||||
../../services/dev/turtle-beach-re.nix
|
||||
../../services/desktop/qbittorrent-vpn.nix
|
||||
../../services/desktop/star-citizen.nix
|
||||
../../services/desktop/nexusmods-app.nix
|
||||
../../services/desktop/unreal-engine.nix
|
||||
../../services/desktop/epic-games-launcher.nix
|
||||
inputs.tbctl.nixosModules.tbctl
|
||||
];
|
||||
|
||||
# tbctl CLI + GUI + tbd daemon/agent for the KB7/KP7/Kone II Air.
|
||||
services.tbctl = {
|
||||
enable = true;
|
||||
users = [ "darman" ];
|
||||
gui.enable = true;
|
||||
daemon.enable = true;
|
||||
agent.enable = true;
|
||||
};
|
||||
|
||||
# hyprchrome-claude (dev): HyprChrome desktop app around the claude CLI,
|
||||
# built from the hyprchrome harness (see the flake input). Needs `claude` on
|
||||
# PATH, which home/desktop already provides.
|
||||
environment.systemPackages = [
|
||||
inputs.hyprchrome.packages.${pkgs.stdenv.hostPlatform.system}.hyprchrome-claude
|
||||
pkgs.teamspeak6-client # successor of the TeamSpeak 5 beta
|
||||
unstable.heroic # Epic/GOG/Amazon launcher; 2.22.4 fixes GOG login, 26.05 has 2.22.1
|
||||
];
|
||||
|
||||
# hyprchrome-files (dev): the default file manager and file picker, built
|
||||
# from the hyprchrome harness (see the flake input). Its home-manager module
|
||||
# installs it with its fonts. Both defaults are set system-wide instead of
|
||||
# through the module: its defaultFileManager would make home-manager own
|
||||
# ~/.config/mimeapps.list, where apps register handlers, and its filePicker
|
||||
# writes a hyprland-portals.conf, which xdg-desktop-portal reads INSTEAD of
|
||||
# portals.conf, dropping default=hyprland;cosmic for every other portal.
|
||||
# extraPortals also puts its D-Bus activation files (portal backend,
|
||||
# FileManager1 "show in folder") on the session bus.
|
||||
home-manager.users.darman = {
|
||||
imports = [ inputs.hyprchrome.homeManagerModules.hyprchrome-files ];
|
||||
programs.hyprchrome-files.enable = true;
|
||||
};
|
||||
xdg.mime.defaultApplications."inode/directory" = "town.mgaction.HyprchromeFiles.desktop";
|
||||
xdg.portal.extraPortals = [
|
||||
inputs.hyprchrome.packages.${pkgs.stdenv.hostPlatform.system}.hyprchrome-files
|
||||
];
|
||||
xdg.portal.config.common."org.freedesktop.impl.portal.FileChooser" = [ "hyprchromefiles" ];
|
||||
|
||||
# Talk to luna (Hermes Agent on mars) with SUPER+V — see
|
||||
# home/desktop/hyprland.nix for the push-to-talk binds.
|
||||
homelab.lunaVoice = {
|
||||
enable = true;
|
||||
hermesKeyFile = config.sops.secrets.hermes_api_server_key.path;
|
||||
elevenLabsKeyFile = config.sops.secrets.elevenlabs_api_key.path;
|
||||
# luna's own voice — must stay in sync with `tts.elevenlabs.voice_id` in
|
||||
# her config.yaml on mars, or she sounds like someone else on the desktop
|
||||
# than she does on Telegram.
|
||||
voiceId = "LZAcK8Cx5QjdQhfBsJQZ";
|
||||
# Her voice manners live here, not in SOUL.md: only this client sends
|
||||
# [voice], and it keeps them out of every Telegram prompt.
|
||||
systemPrompt = ''
|
||||
You are speaking through luna-voiced, your voice on terra, which reaches
|
||||
you over the Hermes API on mars. Messages beginning with [voice] come from
|
||||
darman's desktop microphone, and your reply is read aloud by ElevenLabs v4,
|
||||
which performs audio tags instead of reading them. Captions hide the tags.
|
||||
|
||||
Audio tags:
|
||||
- Use them only on [voice] messages and in text_to_speech scripts. Anywhere else (Telegram text, the dashboard) they show up as literal text.
|
||||
- One to four per reply, and only when it fits the moment. A tag in every sentence stops sounding natural.
|
||||
- Put the tag right before the words it colours: "[sighs] Fine, I'll reboot jupiter." A tag on its own ("[laughs]") works as a reaction.
|
||||
- Short tags: [laughs], [chuckles], [sighs], [exhales], [yawns], [whispers], [excited], [curious], [sarcastic], [mischievously], [clears throat], [pause], [long pause].
|
||||
- Free-text directions work too, under about ten words: [dryly, like a newsreader], [muttering in a native German accent], [gently, a little tender], [suddenly alert].
|
||||
- Sound effects set a scene: [phone buzzing], [keyboard clacking]. Use them rarely.
|
||||
- Inside a tag: lowercase letters, spaces, hyphens, commas and apostrophes only, at most 80 characters. Anything else ([1], [link](url), [!!], a period) breaks the tag and it gets read aloud.
|
||||
- German works fine mid-sentence ("Na gut", "Ach du meine Güte"). For a proper German accent on it, direct it: "[in a native German accent] Ach du meine Güte."
|
||||
- Every character is billed, tags included, so keep spoken replies short.
|
||||
|
||||
What never lands in a spoken reply. Before speech, everything except
|
||||
letters, digits and . , ! ? ; : ' " is turned into a space. Anything you'd
|
||||
show with symbols has to be said in words.
|
||||
- No kaomoji or emoji: (¬‿¬), ^^, :3, 🎉 vanish or leave a stray pause. Put the mood into words or an audio tag instead.
|
||||
- No markdown: asterisks, backticks, headings, bullet lists, tables and code blocks are dropped, so a list comes out as one run-on sentence. Say "first", "then", "and finally" instead.
|
||||
- Symbols carry no meaning once spoken. 50% becomes "50", 20°C becomes "20 C", A & B becomes "A B", and +, $, €, @, #, ~ and / are all dropped. Write "50 percent", "20 degrees", "and", "euros", "at".
|
||||
- Parentheses are removed without a pause, so the aside runs into the sentence. Use commas instead.
|
||||
- An em dash becomes a comma pause. A hyphen becomes a space, which is fine for "push-to-talk".
|
||||
- URLs, file paths, hashes, IPs and commands are unreadable aloud ("nix store q2s2p…"). Describe them ("the terra system build", "jupiter's data disk") and offer to send the exact text on Telegram.
|
||||
- No <think> blocks or stage directions like *grins*. The reasoning is never spoken, and the asterisks are stripped so "grins" would be read out. Use [laughs] or [mischievously] instead.
|
||||
- Keep it to one or two sentences unless asked for detail. Long answers are tiring to listen to, and every character is billed.
|
||||
'';
|
||||
};
|
||||
|
||||
# Peer values from a Proton WireGuard config generated for a P2P server
|
||||
# with NAT-PMP on; its PrivateKey is protonvpn_wg_private_key in sops.
|
||||
homelab.qbittorrentVpn = {
|
||||
enable = true;
|
||||
downloadDir = "/mnt/hdd_01/data/Downloads/Torrents";
|
||||
privateKeyFile = config.sops.secrets.protonvpn_wg_private_key.path;
|
||||
peerPublicKey = "nPCWC0rx9ZXEkzh7dxMUTO5/HUqDaLaD827Yp1sJCQU=";
|
||||
endpoint = "103.69.224.2:51820"; # NL#490
|
||||
};
|
||||
|
||||
networking.hostName = "terra";
|
||||
|
||||
services.flatpak = {
|
||||
enable = true;
|
||||
remotes = [{ name = "flathub"; location = "https://dl.flathub.org/repo/flathub.flatpakrepo"; }];
|
||||
packages = [
|
||||
{ appId = "com.github.tchx84.Flatseal"; origin = "flathub"; }
|
||||
{ appId = "com.blitzfc.qbz"; origin = "flathub"; }
|
||||
{ appId = "com.discordapp.Discord"; origin = "flathub"; }
|
||||
{ appId = "org.telegram.desktop"; origin = "flathub"; }
|
||||
{ appId = "com.bambulab.BambuStudio"; origin = "flathub"; }
|
||||
home-manager.users.darman.homelab.desktop = {
|
||||
monitors = [
|
||||
{ output = "DP-2"; mode = "2560x1440@144"; position = "1920x0"; scale = 1; }
|
||||
{ output = "HDMI-A-1"; mode = "1920x1080@60"; position = "0x360"; scale = 1; }
|
||||
];
|
||||
primaryOutput = "DP-2";
|
||||
secondaryOutput = "HDMI-A-1";
|
||||
fileManager = "hyprchrome-files";
|
||||
# Not checked into this repo (binaries) — from the Wallhaven library on
|
||||
# /mnt/hdd_01. hyprpaper has no "random" mode, so it's picked here.
|
||||
wallpaper = "/mnt/hdd_01/data/Pictures/Wallhaven/wallhaven-mlwz78.png";
|
||||
};
|
||||
|
||||
environment.systemPackages = [ unstable.proton-pass-cli ];
|
||||
# Cast target for Jellyfin: plays files as-is in mpv, so 4K remuxes with
|
||||
# DTS/DV skip the HLS remux a browser forces on jupiter's Celeron.
|
||||
# Server login is a one-time dialog on first start (stored in cred.json).
|
||||
home-manager.users.darman.services.jellyfin-mpv-shim = {
|
||||
enable = true;
|
||||
settings = {
|
||||
player_name = "terra";
|
||||
fullscreen = false;
|
||||
# uosc replaces both; enable_osc would re-show mpv's own OSC on top.
|
||||
enable_osc = false;
|
||||
thumbnail_osc_builtin = false;
|
||||
};
|
||||
mpvConfig = {
|
||||
vo = "gpu-next";
|
||||
hwdec = "auto-safe";
|
||||
# SDR panel: tone-map HDR10/DV down instead of passing PQ through.
|
||||
target-colorspace-hint = false;
|
||||
osc = false;
|
||||
osd-bar = false;
|
||||
osd-font = "DepartureMono Nerd Font";
|
||||
};
|
||||
};
|
||||
# The shim runs libmpv with its own config dir, so scripts go there.
|
||||
home-manager.users.darman.xdg.configFile = let uosc = pkgs.mpvScripts.uosc; in {
|
||||
"jellyfin-mpv-shim/scripts/uosc".source = "${uosc}/share/mpv/scripts/uosc";
|
||||
"jellyfin-mpv-shim/fonts/uosc_icons.otf".source = "${uosc}/share/fonts/uosc_icons.otf";
|
||||
"jellyfin-mpv-shim/fonts/uosc_textures.ttf".source = "${uosc}/share/fonts/uosc_textures.ttf";
|
||||
# Desktop palette (home/desktop/hyprland.nix colours).
|
||||
"jellyfin-mpv-shim/script-opts/uosc.conf".text = ''
|
||||
color=foreground=e8722a,foreground_text=0f1012,background=0f1012,background_text=eeeeee,curtain=0f1012,match=ff9d42
|
||||
'';
|
||||
};
|
||||
|
||||
# ---- nix-ld: lets generic dynamically-linked Linux binaries run as-is —
|
||||
# needed for editor extensions (Zed/VSCode LSPs, debuggers, etc.) that
|
||||
# download prebuilt binaries not built for NixOS. See
|
||||
# https://nix.dev/permalink/stub-ld ----
|
||||
programs.nix-ld.enable = true;
|
||||
|
||||
# The default set above is deliberately minimal and carries no X11,
|
||||
# freetype, wayland or xkbcommon, so a prebuilt *graphical* binary dies
|
||||
# before it draws anything. JetBrains IDEs installed through Toolbox are the
|
||||
# case that surfaced this: their bundled JBR aborts with `libX11.so.6:
|
||||
# cannot open shared object file` unless the Toolbox GUI — itself an FHS
|
||||
# wrapper — is what launches them, which makes them unusable from a terminal
|
||||
# or from a per-repo devShell. These are the libraries `ldd` reports missing
|
||||
# across a JBR's own .so files, plus the three it resolves by dlopen rather
|
||||
# than DT_NEEDED: fontconfig for font discovery, libGL, and libsecret for
|
||||
# the credential store. Definitions merge, so this adds to the module's base
|
||||
# list rather than replacing it (zlib is already there).
|
||||
programs.nix-ld.libraries = with pkgs; [
|
||||
freetype
|
||||
fontconfig
|
||||
libGL
|
||||
libxkbcommon
|
||||
wayland
|
||||
libsecret
|
||||
libx11
|
||||
libxext
|
||||
libxi
|
||||
libxrender
|
||||
libxtst
|
||||
libxcursor
|
||||
libxrandr
|
||||
libxinerama
|
||||
libxcb
|
||||
|
||||
# CLion Nova's C++ backend (the clion-radler plugin) is a .NET 10
|
||||
# application bundling its own runtime, and .NET refuses to start
|
||||
# without ICU: libSystem.Globalization.Native.so dlopens libicuuc.so
|
||||
# and libicui18n.so, and failing that the IDE reports "Couldn't find a
|
||||
# valid ICU package installed on the system" and comes up degraded.
|
||||
icu
|
||||
];
|
||||
|
||||
# ---- envfs: serves /bin and /usr/bin from the calling process's PATH ----
|
||||
# NixOS ships only /bin/sh, but plenty of third-party tooling writes scripts
|
||||
# with a hardcoded interpreter. JetBrains Toolbox is the standing example:
|
||||
# it generates ~/.local/share/JetBrains/Toolbox/scripts/{clion,rider,...}
|
||||
# with `#!/bin/bash`, so every one of those shims fails with `bad
|
||||
# interpreter` in any shell. envfs resolves such shebangs against PATH,
|
||||
# which fixes them all at once instead of per-IDE wrappers.
|
||||
services.envfs.enable = true;
|
||||
|
||||
# ---- home-manager (user-level config for darman) ----
|
||||
# Base settings (useGlobalPkgs/useUserPackages/backupFileExtension) and the
|
||||
# shared zsh baseline now live in common.nix + home/common.nix, applied to
|
||||
# every host. This just layers terra's desktop/dev-specific profile on top
|
||||
# — home-manager.users.darman.imports merges additively across modules.
|
||||
home-manager.extraSpecialArgs = { inherit unstable inputs; };
|
||||
home-manager.users.darman.imports = [ ./home.nix ];
|
||||
|
||||
# ---- Boot (UEFI) ----
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
hardware.cpu.amd.updateMicrocode = true;
|
||||
|
||||
# mercury (aarch64) is built/flashed from here. Without this, `nix build`
|
||||
# for it dies with "platform mismatch" — no qemu binfmt handler registered
|
||||
# and aarch64-linux missing from nix.settings.extra-platforms. This module
|
||||
# sets up both (see CLAUDE.md's aarch64 gotcha).
|
||||
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
|
||||
|
||||
# ---- GPU (Radeon RX 6800 XT / Navi 21) ----
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
boot.initrd.kernelModules = [ "amdgpu" ];
|
||||
|
||||
# /dev/dri/renderD128 is root:render 0660, so rootless podman containers can
|
||||
# only reach the GPU if the *host* user is in render. Needed by the Vulkan
|
||||
# whisper.cpp/llama.cpp containers in ~/Data/Dev/repos/content-trigger-scanner.
|
||||
users.users.darman.extraGroups = [ "render" "video" ];
|
||||
|
||||
# ---- ollama (local LLM server, ROCm on the 6800 XT) ----
|
||||
# Navi 21 is gfx1030 — officially supported by ROCm, so no
|
||||
# rocmOverrideGfx/HSA_OVERRIDE_GFX_VERSION needed (that's for gpus ROCm
|
||||
# doesn't recognize, e.g. RDNA1/gfx101x). The upstream module runs the
|
||||
# service under DynamicUser with SupplementaryGroups=["render"] and
|
||||
# DeviceAllow for char-kfd/char-drm/char-fb already, so unlike jellyfin's
|
||||
# static user it needs no extraGroups wiring here.
|
||||
services.ollama = {
|
||||
enable = true;
|
||||
package = pkgs.ollama-rocm;
|
||||
# keep in sync with services/desktop/librechat.nix's endpoints.custom
|
||||
# default model — LibreChat's config schema needs a non-empty default
|
||||
# even though fetch=true replaces it with whatever's actually pulled.
|
||||
# gemma4:12b: general chat/coding daily driver, fits fully in 16G VRAM —
|
||||
# also doubles as the memory-extraction agent (see librechat.nix): a
|
||||
# 3b model (llama3.2:3b, dropped) couldn't reliably tell the user's
|
||||
# stated facts apart from its own boilerplate, e.g. saving "I am an AI
|
||||
# assistant with tool calling capabilities" as the user's personal_info
|
||||
# after "Hi I'm Erik Simon". Reusing gemma4:12b for both roles also means
|
||||
# no second model needs to swap into VRAM while it's already the active
|
||||
# chat model.
|
||||
# qwen3.6:35b-a3b: MoE (3B active/36B total), ~24GB Q4_K_M — doesn't fit
|
||||
# in VRAM alone, so ollama offloads the inactive experts to CPU RAM.
|
||||
# Sparse activation makes that far less painful than it'd be for a dense
|
||||
# model this size, but still expect it to run slower than the two above.
|
||||
# VladimirGav/qwen3.8-27B-14GB-IQ4: dense 27B at IQ4, ~14GB of weights —
|
||||
# nominally fits the 6800 XT's 16G, but that leaves only ~2G for the KV
|
||||
# cache and the compositor, so expect partial CPU offload as context grows
|
||||
# (OLLAMA_CONTEXT_LENGTH below applies to every model on this server).
|
||||
loadModels = [
|
||||
"gemma4:12b"
|
||||
"qwen3.6:35b-a3b"
|
||||
"VladimirGav/qwen3.8-27B-14GB-IQ4"
|
||||
];
|
||||
# Ollama truncates context far below the model's real window unless
|
||||
# told otherwise (the OpenAI-compat /v1 route it's reached through has
|
||||
# no way to set this per-request). 131072 chosen as the practical
|
||||
# ceiling after load-testing with real prompts, not just idle
|
||||
# `ollama ps` checks:
|
||||
# 32768 (31.6k-token prompt) and 65536 (40.8k-token prompt) both stayed
|
||||
# 100% GPU with VRAM barely moving (~10.1G / ~10.67G of 16G) — KV cache
|
||||
# cost barely grows with context, likely sliding-window/local attention
|
||||
# on most of gemma4:12b's layers. At 131072 that stopped being true: a
|
||||
# ~108k-token prompt pushed VRAM to ~11.4G/16G (still 100% GPU, no CPU
|
||||
# spillover, negligible GTT) but with visibly shrinking headroom, and
|
||||
# prefill throughput measurably dropped (~490 -> ~460 tok/s) over just
|
||||
# the last 13k tokens — filling the full window would take minutes of
|
||||
# pure prompt processing. Stopped here rather than push further: next
|
||||
# doubling would risk CPU spillover under any concurrent GPU load
|
||||
# (desktop compositor, jellyfin transcode) for diminishing benefit.
|
||||
environmentVariables.OLLAMA_CONTEXT_LENGTH = "131072";
|
||||
};
|
||||
|
||||
# ---- Dev-data disks — NOT in disko, mounted read-write, never wiped ----
|
||||
fileSystems."/mnt/hdd_01" = {
|
||||
device = "/dev/disk/by-uuid/b8445126-ec6d-4f88-818a-d9e13031d9a4";
|
||||
@@ -181,22 +180,5 @@ in
|
||||
options = [ "nofail" ];
|
||||
};
|
||||
|
||||
# jupiter's samba share (services/network/samba.nix) — mounted on demand so
|
||||
# terra doesn't stall boot/login when jupiter is off or unreachable.
|
||||
fileSystems."/mnt/jupiter" = {
|
||||
device = "//jupiter/data";
|
||||
fsType = "cifs";
|
||||
options = [
|
||||
"credentials=${config.sops.templates."jupiter-smb.credentials".path}"
|
||||
"uid=1000"
|
||||
"gid=100"
|
||||
"nofail"
|
||||
"x-systemd.automount"
|
||||
"x-systemd.idle-timeout=60"
|
||||
"x-systemd.mount-timeout=10s"
|
||||
"_netdev"
|
||||
];
|
||||
};
|
||||
|
||||
system.stateVersion = "26.05";
|
||||
}
|
||||
|
||||
@@ -5,27 +5,14 @@
|
||||
# `fileSystems.*` entries, so hardware-configuration.nix must NOT define
|
||||
# fileSystems for "/" or "/boot".
|
||||
#
|
||||
# ⚠️ disko's `mkfs` create step SKIPS formatting when `blkid` still detects a
|
||||
# filesystem signature on the freshly-cut partition:
|
||||
#
|
||||
# if ! (blkid "$device" -o export | grep -q '^TYPE='); then
|
||||
# mkfs.btrfs "$device" -f # ← -f only runs WHEN this line runs
|
||||
# fi
|
||||
#
|
||||
# The disk previously held a CachyOS btrfs root. The whole-disk `wipefs`
|
||||
# disko runs before partitioning clears the signature at the OLD layout's
|
||||
# offsets, but `sgdisk --clear --align-end` then re-cuts the partitions, so
|
||||
# a stale btrfs superblock survives at the NEW root partition's own 64 KiB
|
||||
# offset. `blkid` sees TYPE=btrfs, `mkfs` is skipped entirely, and the
|
||||
# later `mount` fails on the leftover bytes ("wrong fs type / bad
|
||||
# superblock"). Switching ext4→btrfs did NOT fix this: `mkfs.btrfs -f` is
|
||||
# never reached, because the guard is on whether `mkfs` runs at all, not on
|
||||
# its flags. The ESP hits the same trap (its `mkfs.vfat` gets skipped too).
|
||||
#
|
||||
# Fix: `preCreateHook = wipefs --all --force "$device"` on each partition's
|
||||
# content. The hook runs AFTER sgdisk re-cuts the partition but BEFORE the
|
||||
# `blkid` guard, so it erases the stale signature at the FINAL offset;
|
||||
# `blkid` then comes back empty and `mkfs` actually runs.
|
||||
# ⚠️ disko's `mkfs` step skips formatting if `blkid` still detects a
|
||||
# filesystem signature on the partition. Repartitioning doesn't erase
|
||||
# signatures at the new offsets, so this disk's old CachyOS btrfs
|
||||
# superblock survived, causing mkfs (and the ESP's mkfs.vfat) to be
|
||||
# skipped and the later mount to fail on the stale superblock.
|
||||
# Fix: `preCreateHook = wipefs --all --force "$device"` on each
|
||||
# partition — it runs after sgdisk re-cuts the partition but before the
|
||||
# `blkid` guard, so the guard sees no signature and `mkfs` actually runs.
|
||||
#
|
||||
# ⚠️ This disk is WIPED on install. This is the Kingston SA400 SSD that
|
||||
# currently holds CachyOS (btrfs root+subvols on sdb2, ESP on sdb1).
|
||||
@@ -58,8 +45,7 @@
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ];
|
||||
mountpoint = "/";
|
||||
# erase the stale CachyOS btrfs superblock before disko's blkid
|
||||
# format-guard, otherwise mkfs.btrfs is skipped (see header comment)
|
||||
# same wipefs fix as the ESP above (see header comment)
|
||||
preCreateHook = ''wipefs --all --force "$device"'';
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
# Global Dracula theming (GTK + Qt)
|
||||
let
|
||||
azureGlassyDarkIcons = pkgs.callPackage ../../../pkgs/azure-glassy-dark-icons.nix { };
|
||||
amyDarkIcons = pkgs.callPackage ../../../pkgs/amy-dark-icons.nix { };
|
||||
slotBeautyDarkIcons = pkgs.callPackage ../../../pkgs/slot-beauty-dark-icons.nix { };
|
||||
|
||||
iconTheme = "Amy-Dark-Icons";
|
||||
iconThemePackage = amyDarkIcons;
|
||||
iconThemeFolder = "${iconThemePackage}/share/icons/${iconTheme}";
|
||||
in
|
||||
{
|
||||
gtk = {
|
||||
enable = true;
|
||||
theme = {
|
||||
name = "Dracula";
|
||||
package = pkgs.dracula-theme;
|
||||
};
|
||||
iconTheme = {
|
||||
name = iconTheme;
|
||||
package = iconThemePackage;
|
||||
};
|
||||
};
|
||||
|
||||
# The cursor theme. XCURSOR_THEME alone is not enough for Steam: the client
|
||||
# UI (steamwebhelper) runs inside a pressure-vessel container that rebuilds
|
||||
# /etc, so the /etc/profiles/per-user/darman/share/icons entry of
|
||||
# XCURSOR_PATH does not exist in there and libXcursor finds no theme by
|
||||
# that name — it falls back to the built-in core X11 cursor. $HOME and
|
||||
# /nix are bind-mounted into the container, so the ~/.icons symlink that
|
||||
# `dotIcons` (on by default) drops does resolve. Same class of problem as
|
||||
# the ~/.themes/~/.icons flatpak workaround above.
|
||||
home.pointerCursor = {
|
||||
name = "Bibata-Modern-Classic";
|
||||
package = pkgs.bibata-cursors;
|
||||
size = 24;
|
||||
gtk.enable = true;
|
||||
hyprcursor.enable = true;
|
||||
};
|
||||
|
||||
# Flatpak apps are sandboxed and can't see XDG_DATA_DIRS/nix-store theme
|
||||
# paths, so the portal-reported GTK theme / icon theme names resolve to
|
||||
# nothing inside the sandbox and they fall back to Adwaita. Flatpak
|
||||
# auto-exposes ~/.themes and ~/.icons read-only to every sandboxed app
|
||||
# specifically for this case.
|
||||
home.file.".themes/Dracula".source =
|
||||
"${pkgs.dracula-theme}/share/themes/Dracula";
|
||||
home.file.".icons/${iconTheme}".source = iconThemeFolder;
|
||||
|
||||
dconf.settings."org/gnome/desktop/interface" = {
|
||||
color-scheme = "prefer-dark";
|
||||
gtk-theme = "Dracula";
|
||||
icon-theme = iconTheme;
|
||||
};
|
||||
|
||||
# "qtct" (qt5ct/qt6ct) instead of "kde" avoids pulling in
|
||||
# kdePackages.systemsettings just for the platform-theme plugin — kvantum
|
||||
# itself carries the Dracula colors, qt5ct/qt6ct just need to be told to
|
||||
# use it as the style.
|
||||
qt = {
|
||||
enable = true;
|
||||
platformTheme.name = "qtct";
|
||||
style.name = "kvantum";
|
||||
};
|
||||
xdg.configFile."Kvantum/kvantum.kvconfig".text = ''
|
||||
[General]
|
||||
theme=Dracula
|
||||
'';
|
||||
xdg.configFile."Kvantum/Dracula".source =
|
||||
"${pkgs.dracula-theme}/share/Kvantum/Dracula";
|
||||
|
||||
# Quickshell's IconImage/Quickshell.iconPath() resolves icons through the
|
||||
# Qt platform theme, not GTK — so the app-launcher grid needs the icon
|
||||
# theme set HERE (qt5ct/qt6ct), separately from the GTK dconf key above.
|
||||
xdg.configFile."qt5ct/qt5ct.conf".text = ''
|
||||
[Appearance]
|
||||
style=kvantum
|
||||
icon_theme=${iconTheme}
|
||||
'';
|
||||
xdg.configFile."qt6ct/qt6ct.conf".text = ''
|
||||
[Appearance]
|
||||
style=kvantum
|
||||
icon_theme=${iconTheme}
|
||||
'';
|
||||
}
|
||||
@@ -4,31 +4,26 @@
|
||||
# decrypted with terra's own SSH host key (recipient in ../../.sops.yaml).
|
||||
# The host key is pre-generated on the laptop and shipped at install
|
||||
# (nixos-anywhere --extra-files -> /etc/ssh/ssh_host_ed25519_key).
|
||||
# samba + pass-broker secrets are declared in profiles/workstation.nix.
|
||||
{
|
||||
sops.defaultSopsFile = ../../secrets/terra.yaml;
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
|
||||
sops.secrets.tailscale_authkey = { };
|
||||
sops.secrets.protonvpn_wg_private_key = { };
|
||||
|
||||
sops.secrets.darman_password.neededForUsers = true;
|
||||
users.users.darman.hashedPasswordFile = config.sops.secrets.darman_password.path;
|
||||
|
||||
# Credentials file for the //jupiter/data cifs mount (see configuration.nix).
|
||||
# samba_password mirrors jupiter's own samba_password secret (services/network/samba.nix) —
|
||||
# same value, just also encrypted to terra so it can authenticate as the same smb user.
|
||||
sops.secrets.samba_password = { };
|
||||
sops.templates."jupiter-smb.credentials".content = ''
|
||||
username=darman
|
||||
password=${config.sops.placeholder.samba_password}
|
||||
'';
|
||||
|
||||
# LibreChat's CREDS_KEY/IV encrypt stored user credentials (linked 3rd-party
|
||||
# API keys etc) at rest in mongo; JWT_SECRET/JWT_REFRESH_SECRET sign session
|
||||
# tokens. All four are random, generated once with `sops --set` (see
|
||||
# CLAUDE.md) — losing/rotating them just invalidates existing sessions and
|
||||
# any saved per-user API keys, nothing else depends on their value.
|
||||
sops.secrets.librechat_creds_key = { };
|
||||
sops.secrets.librechat_creds_iv = { };
|
||||
sops.secrets.librechat_jwt_secret = { };
|
||||
sops.secrets.librechat_jwt_refresh_secret = { };
|
||||
# luna-voiced (services/desktop/luna-voice.nix) runs as a USER service, so
|
||||
# these cannot stay root:root 0400 — a user manager cannot read them and
|
||||
# LoadCredential does not bridge that gap either. Hence owner, not mode.
|
||||
#
|
||||
# hermes_api_server_key mirrors secrets/mars.yaml (the serving side);
|
||||
# elevenlabs_api_key mirrors it too, because client-direct TTS is the
|
||||
# documented low-latency path — terra calls ElevenLabs itself rather than
|
||||
# relaying audio through mars. Rotating that key therefore touches BOTH
|
||||
# files; see CLAUDE.md.
|
||||
sops.secrets.hermes_api_server_key.owner = "darman";
|
||||
sops.secrets.elevenlabs_api_key.owner = "darman";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
# ---- TITAN ----
|
||||
# ASUS Zenbook Pro Duo UX581LV: i7/i9 10th gen (UHD 630) + RTX 2060,
|
||||
# 4K OLED + ScreenPad Plus. Same workstation as terra (profiles/workstation.nix).
|
||||
{ config, pkgs, lib, inputs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
./disk-config.nix
|
||||
./secrets.nix
|
||||
../../common.nix
|
||||
../../profiles/workstation.nix
|
||||
];
|
||||
|
||||
networking.hostName = "titan";
|
||||
|
||||
# Connector names are a first guess; check `hyprctl monitors` after the
|
||||
# first boot. The catch-all rule keeps any unlisted output usable.
|
||||
home-manager.users.darman.homelab.desktop = {
|
||||
monitors = [
|
||||
{ output = "eDP-1"; mode = "3840x2160@60"; position = "0x0"; scale = 2; }
|
||||
{ output = ""; mode = "preferred"; position = "auto"; scale = "auto"; }
|
||||
];
|
||||
primaryOutput = "eDP-1";
|
||||
};
|
||||
|
||||
hardware.cpu.intel.updateMicrocode = true;
|
||||
services.thermald.enable = true;
|
||||
|
||||
# ---- GPU: Intel iGPU drives the panels, RTX 2060 on demand ----
|
||||
# Run something on the dGPU with `nvidia-offload <cmd>`.
|
||||
hardware.graphics.extraPackages = [ pkgs.intel-media-driver ];
|
||||
services.xserver.videoDrivers = [ "modesetting" "nvidia" ];
|
||||
hardware.nvidia = {
|
||||
open = true; # Turing is supported by the open module
|
||||
modesetting.enable = true;
|
||||
powerManagement.enable = true;
|
||||
powerManagement.finegrained = true; # dGPU powers off when idle
|
||||
prime = {
|
||||
offload.enable = true;
|
||||
offload.enableOffloadCmd = true;
|
||||
# Usual UX581 values; confirm with `lspci | grep -E 'VGA|3D'`.
|
||||
intelBusId = "PCI:0:2:0";
|
||||
nvidiaBusId = "PCI:1:0:0";
|
||||
};
|
||||
};
|
||||
|
||||
# ---- laptop ----
|
||||
hardware.bluetooth.enable = true;
|
||||
services.power-profiles-daemon.enable = true;
|
||||
services.upower.enable = true;
|
||||
zramSwap.enable = true;
|
||||
|
||||
system.stateVersion = "26.05";
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{ ... }:
|
||||
|
||||
# Declarative OS-disk layout (disko), same as terra: GPT, ESP + btrfs root,
|
||||
# whole internal NVMe, NixOS only. See hosts/terra/disk-config.nix for why
|
||||
# each partition wipes its old signature first.
|
||||
#
|
||||
# ⚠️ This disk is WIPED on install. `device` is a deliberate non-path until
|
||||
# the real id is filled in from the laptop (`ls -l /dev/disk/by-id/`), so
|
||||
# an install fails before touching anything rather than guessing a disk.
|
||||
{
|
||||
disko.devices.disk.os = {
|
||||
type = "disk";
|
||||
device = "/dev/disk/by-id/FILL-ME-IN-titan-nvme";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
ESP = {
|
||||
size = "512M";
|
||||
type = "EF00";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
preCreateHook = ''wipefs --all --force "$device"'';
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "btrfs";
|
||||
extraArgs = [ "-f" ];
|
||||
mountpoint = "/";
|
||||
preCreateHook = ''wipefs --all --force "$device"'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
# PLACEHOLDER — replaced on install.
|
||||
#
|
||||
# disko (disk-config.nix) owns "/" and "/boot", so this file only carries
|
||||
# kernel modules + platform. nixos-anywhere regenerates it via:
|
||||
# nixos-generate-config --no-filesystems
|
||||
# Fallback for the UX581 (10th-gen Intel, NVMe): `vmd` in case the firmware
|
||||
# has Intel VMD/RST on, which hides the NVMe from stage 1 without it.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "vmd" "nvme" "usb_storage" "usbhid" "sd_mod" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
# NO fileSystems here — disko defines "/" and "/boot".
|
||||
|
||||
swapDevices = [ ];
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{ config, ... }:
|
||||
|
||||
# sops-nix wiring for titan (laptop). Encrypted values in ../../secrets/titan.yaml,
|
||||
# decrypted with titan's own SSH host key (recipient in ../../.sops.yaml).
|
||||
# samba + pass-broker secrets are declared in profiles/workstation.nix.
|
||||
{
|
||||
sops.defaultSopsFile = ../../secrets/titan.yaml;
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
|
||||
sops.secrets.tailscale_authkey = { };
|
||||
|
||||
sops.secrets.darman_password.neededForUsers = true;
|
||||
users.users.darman.hashedPasswordFile = config.sops.secrets.darman_password.path;
|
||||
}
|
||||
@@ -17,13 +17,11 @@ stdenvNoCC.mkDerivation {
|
||||
|
||||
dontBuild = true;
|
||||
|
||||
# Upstream ships a handful of dangling symlinks under mimetypes/16 (e.g.
|
||||
# libreoffice-spreadsheet.svg -> libreoffice-oasis-spreadsheet.svg, which
|
||||
# doesn't exist in that size dir) — a minor packaging bug in the theme
|
||||
# itself. Harmless: GTK's icon lookup just falls through to the theme's
|
||||
# own Inherits= chain (breeze-dark, breeze, Adwaita, hicolor) for those few
|
||||
# mimetypes. Nixpkgs' default noBrokenSymlinks fixup check would otherwise
|
||||
# fail the whole build over it.
|
||||
# Upstream ships a handful of dangling symlinks under mimetypes/16 (e.g. a
|
||||
# target that doesn't exist in that size dir) — harmless, GTK's own
|
||||
# Inherits= chain (breeze-dark, breeze, Adwaita, hicolor) covers the
|
||||
# fallback. Nixpkgs' default noBrokenSymlinks check would otherwise fail
|
||||
# the build over it.
|
||||
dontCheckForBrokenSymlinks = true;
|
||||
|
||||
# gtk3's setup hook strips icon-theme.cache from $out by default
|
||||
|
||||
@@ -0,0 +1,142 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, dpkg
|
||||
, autoPatchelfHook
|
||||
, makeWrapper
|
||||
, wrapGAppsHook3
|
||||
, alsa-lib
|
||||
, at-spi2-atk
|
||||
, at-spi2-core
|
||||
, atk
|
||||
, cairo
|
||||
, cups
|
||||
, dbus
|
||||
, expat
|
||||
, glib
|
||||
, gtk3
|
||||
, libcap_ng
|
||||
, libdrm
|
||||
, libgbm
|
||||
, libseccomp
|
||||
, libxkbcommon
|
||||
, nspr
|
||||
, nss
|
||||
, pango
|
||||
, systemd
|
||||
, libx11
|
||||
, libxcb
|
||||
, libxcomposite
|
||||
, libxdamage
|
||||
, libxext
|
||||
, libxfixes
|
||||
, libxrandr
|
||||
, libxtst
|
||||
, libGL
|
||||
, libayatana-appindicator
|
||||
, libnotify
|
||||
, libpulseaudio
|
||||
, libsecret
|
||||
, pipewire
|
||||
, wayland
|
||||
, qemu_kvm
|
||||
, xdg-utils
|
||||
}:
|
||||
|
||||
# Anthropic's official Linux build (Debian .deb), patchelf'd in place. The
|
||||
# bundled Electron binary is kept rather than swapped for nixpkgs' electron:
|
||||
# app.asar ships a V8 code cache (compile-cache/*.jsc) tied to that exact build.
|
||||
#
|
||||
# Cowork looks for qemu on $PATH but for OVMF and virtiofsd only at fixed
|
||||
# Debian paths; services/desktop/claude-desktop.nix symlinks those into /usr.
|
||||
#
|
||||
# Bump: take the highest `Version:` listed in
|
||||
# https://downloads.claude.ai/claude-desktop/apt/stable/dists/stable/main/binary-amd64/Packages
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "claude-desktop";
|
||||
version = "2.42304.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://downloads.claude.ai/claude-desktop/apt/stable/pool/main/c/claude-desktop/claude-desktop_${finalAttrs.version}_amd64.deb";
|
||||
hash = "sha256-dM0szCnSQWUUTkVcvIcsbMKiSiY7g+c0IOlfiRZtSqQ=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ dpkg autoPatchelfHook makeWrapper wrapGAppsHook3 ];
|
||||
|
||||
buildInputs = [
|
||||
alsa-lib
|
||||
at-spi2-atk
|
||||
at-spi2-core
|
||||
atk
|
||||
cairo
|
||||
cups
|
||||
dbus
|
||||
expat
|
||||
glib
|
||||
gtk3
|
||||
libcap_ng # bundled virtiofsd
|
||||
libdrm
|
||||
libgbm
|
||||
libseccomp # bundled virtiofsd
|
||||
libxkbcommon
|
||||
nspr
|
||||
nss
|
||||
pango
|
||||
pipewire # claude-native-binding.node
|
||||
stdenv.cc.cc.lib # node-pty
|
||||
systemd
|
||||
libx11
|
||||
libxcb
|
||||
libxcomposite
|
||||
libxdamage
|
||||
libxext
|
||||
libxfixes
|
||||
libxrandr
|
||||
libxtst
|
||||
];
|
||||
|
||||
# dlopen'd by Chromium, so not in any DT_NEEDED.
|
||||
runtimeDependencies = [
|
||||
libGL
|
||||
libayatana-appindicator
|
||||
libnotify
|
||||
libpulseaudio
|
||||
libsecret
|
||||
pipewire
|
||||
systemd
|
||||
wayland
|
||||
];
|
||||
|
||||
dontWrapGApps = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/lib $out/bin
|
||||
cp -r usr/lib/claude-desktop $out/lib/
|
||||
cp -r usr/share $out/share
|
||||
rm -r $out/share/lintian
|
||||
|
||||
# Setuid is impossible in the store; Chromium falls back to its userns sandbox.
|
||||
rm $out/lib/claude-desktop/chrome-sandbox
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
# Chromium doesn't recognise Hyprland, falls back to basic_text, and logins don't persist.
|
||||
makeWrapper $out/lib/claude-desktop/claude-desktop $out/bin/claude-desktop \
|
||||
"''${gappsWrapperArgs[@]}" \
|
||||
--add-flags "--password-store=gnome-libsecret" \
|
||||
--prefix PATH : ${lib.makeBinPath [ qemu_kvm xdg-utils ]}
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Desktop application for Claude.ai";
|
||||
homepage = "https://claude.ai";
|
||||
license = lib.licenses.unfree;
|
||||
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
mainProgram = "claude-desktop";
|
||||
};
|
||||
})
|
||||
@@ -0,0 +1,11 @@
|
||||
{ writeShellApplication, coreutils, curl, jq, util-linux }:
|
||||
|
||||
# Prints the Claude subscription's rate-limit windows as one JSON line, for the
|
||||
# rail's CLD panel. Reuses Claude Code's OAuth login rather than a key of its
|
||||
# own, so there is nothing to provision; always exits 0 with `{"error": ...}`
|
||||
# so the panel can show why instead of going blank.
|
||||
writeShellApplication {
|
||||
name = "claude-usage";
|
||||
runtimeInputs = [ coreutils curl jq util-linux ];
|
||||
text = builtins.readFile ./claude-usage.sh;
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
creds="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/.credentials.json"
|
||||
|
||||
fail() {
|
||||
jq -cn --arg e "$1" '{error: $e}'
|
||||
exit 0
|
||||
}
|
||||
|
||||
[ -r "$creds" ] || fail "not logged in"
|
||||
|
||||
# Identify as Claude Code: the suspected cause of refreshes failing with 429.
|
||||
version="$(claude --version 2>/dev/null | cut -d" " -f1)" || true
|
||||
ua="claude-cli/${version:-2.1.0} (external, cli)"
|
||||
|
||||
# The refresh token rotates, so the new one must be written back or the CLI's
|
||||
# next refresh fails and forces a re-login.
|
||||
refresh() {
|
||||
local rt scope body code tmp
|
||||
rt="$(jq -r '.claudeAiOauth.refreshToken // empty' "$creds")"
|
||||
[ -n "$rt" ] || fail "no refresh token"
|
||||
scope="$(jq -r '.claudeAiOauth.scopes // [] | join(" ")' "$creds")"
|
||||
body="$(mktemp)"
|
||||
code="$(jq -cn --arg rt "$rt" --arg s "$scope" \
|
||||
'{grant_type: "refresh_token", refresh_token: $rt,
|
||||
client_id: "9d1c250a-e61b-44d9-88ed-5944d1962f5e", scope: $s}' \
|
||||
| curl -s -m 20 -o "$body" -w '%{http_code}' \
|
||||
https://platform.claude.com/v1/oauth/token \
|
||||
-H 'Content-Type: application/json' -A "$ua" --data-binary @-)" || code=000
|
||||
if [ "$code" != 200 ]; then
|
||||
rm -f "$body"
|
||||
fail "token refresh HTTP $code"
|
||||
fi
|
||||
tmp="$(mktemp "$creds.XXXXXX")"
|
||||
chmod 600 "$tmp"
|
||||
jq --slurpfile r "$body" '.claudeAiOauth += {
|
||||
accessToken: $r[0].access_token,
|
||||
refreshToken: ($r[0].refresh_token // .claudeAiOauth.refreshToken),
|
||||
expiresAt: (now * 1000 + $r[0].expires_in * 1000 | floor)
|
||||
}' "$creds" > "$tmp" && mv "$tmp" "$creds"
|
||||
rm -f "$body" "$tmp"
|
||||
}
|
||||
|
||||
expired() {
|
||||
jq -e '(.claudeAiOauth.expiresAt // 0) < (now * 1000 + 300000)' "$creds" >/dev/null
|
||||
}
|
||||
|
||||
if expired; then
|
||||
exec 9>"${XDG_RUNTIME_DIR:-/tmp}/claude-usage.lock"
|
||||
flock 9
|
||||
# Another run may have refreshed while this one waited.
|
||||
if expired; then refresh; fi
|
||||
fi
|
||||
|
||||
token="$(jq -r '.claudeAiOauth.accessToken // empty' "$creds")"
|
||||
[ -n "$token" ] || fail "not logged in"
|
||||
|
||||
body="$(curl -s -m 20 -w '\n%{http_code}' https://api.anthropic.com/api/oauth/usage \
|
||||
-H "Authorization: Bearer $token" \
|
||||
-H 'anthropic-beta: oauth-2025-04-20' -A "$ua")" || fail "usage request failed"
|
||||
code="${body##*$'\n'}"
|
||||
[ "$code" = 200 ] || fail "usage HTTP $code"
|
||||
printf '%s' "${body%$'\n'*}" | jq -c . || fail "bad usage response"
|
||||
@@ -0,0 +1,96 @@
|
||||
{ lib, stdenvNoCC, librsvg, xcursorgen, hyprcursor }:
|
||||
|
||||
# HyprChrome cursors, drawn as the "HyprChrome Cursors" design canvas
|
||||
# (claude.ai/artifact/Ls3fchoxzc2o9F5jFCuJBy). One 32px-grid SVG per shape in
|
||||
# ./hyprchrome-cursors; built as both XCursor (X11/XWayland, GTK, Steam) and
|
||||
# hyprcursor (SVG, so it stays sharp at any size) in a single theme dir.
|
||||
let
|
||||
name = "HyprChrome";
|
||||
xcursorSizes = [ 24 32 36 48 ];
|
||||
|
||||
# hotspot on the 32px grid, as in the canvas; aliases are the X11/CSS names
|
||||
# that should resolve to this shape.
|
||||
shapes = {
|
||||
default = { hs = [ 5 3 ]; aliases = [ "left_ptr" "arrow" "top_left_arrow" "left_arrow" ]; };
|
||||
pointer = { hs = [ 13 3 ]; aliases = [ "hand2" "hand1" "hand" "pointing_hand" ]; };
|
||||
text = { hs = [ 16 16 ]; aliases = [ "xterm" "ibeam" "vertical-text" ]; };
|
||||
crosshair = { hs = [ 16 16 ]; aliases = [ "cross" "tcross" "cross_reverse" "diamond_cross" "cell" "plus" ]; };
|
||||
wait = { hs = [ 16 16 ]; aliases = [ "watch" "clock" ]; };
|
||||
progress = { hs = [ 4 2 ]; aliases = [ "left_ptr_watch" "half-busy" ]; };
|
||||
help = { hs = [ 4 2 ]; aliases = [ "question_arrow" "whats_this" "left_ptr_help" ]; };
|
||||
context-menu = { hs = [ 4 2 ]; aliases = [ ]; };
|
||||
copy = { hs = [ 4 2 ]; aliases = [ "dnd-copy" ]; };
|
||||
alias = { hs = [ 4 2 ]; aliases = [ "dnd-link" "link" ]; };
|
||||
move = { hs = [ 16 16 ]; aliases = [ "fleur" "all-scroll" "size_all" "dnd-move" "pointer-move" ]; };
|
||||
grab = { hs = [ 16 16 ]; aliases = [ "openhand" ]; };
|
||||
grabbing = { hs = [ 16 16 ]; aliases = [ "closedhand" "dnd-none" ]; };
|
||||
not-allowed = { hs = [ 16 16 ]; aliases = [ "no-drop" "forbidden" "circle" "crossed_circle" "dnd-no-drop" ]; };
|
||||
zoom-in = { hs = [ 13 11 ]; aliases = [ "zoom_in" ]; };
|
||||
zoom-out = { hs = [ 13 11 ]; aliases = [ "zoom_out" ]; };
|
||||
ew-resize = { hs = [ 16 16 ]; aliases = [ "e-resize" "w-resize" "col-resize" "sb_h_double_arrow" "h_double_arrow" "size_hor" "split_h" "left_side" "right_side" ]; };
|
||||
ns-resize = { hs = [ 16 16 ]; aliases = [ "n-resize" "s-resize" "row-resize" "sb_v_double_arrow" "v_double_arrow" "double_arrow" "size_ver" "split_v" "top_side" "bottom_side" ]; };
|
||||
nwse-resize = { hs = [ 16 16 ]; aliases = [ "nw-resize" "se-resize" "size_fdiag" "bd_double_arrow" "top_left_corner" "bottom_right_corner" ]; };
|
||||
nesw-resize = { hs = [ 16 16 ]; aliases = [ "ne-resize" "sw-resize" "size_bdiag" "fd_double_arrow" "top_right_corner" "bottom_left_corner" ]; };
|
||||
};
|
||||
|
||||
# same rounding hyprcursor applies to its fractional hotspots
|
||||
px = size: v: toString (builtins.floor (v * size / 32.0 + 0.5));
|
||||
frac = v: toString (v / 32.0);
|
||||
|
||||
buildShape = shape: { hs, aliases }: let x = lib.elemAt hs 0; y = lib.elemAt hs 1; in ''
|
||||
mkdir -p work/hyprcursors/${shape}
|
||||
cp ${shape}.svg work/hyprcursors/${shape}/
|
||||
cat > work/hyprcursors/${shape}/meta.hl <<EOF
|
||||
resize_algorithm = bilinear
|
||||
hotspot_x = ${frac x}
|
||||
hotspot_y = ${frac y}
|
||||
${lib.concatMapStrings (a: "define_override = ${a}\n") aliases}define_size = 0, ${shape}.svg
|
||||
EOF
|
||||
|
||||
: > ${shape}.cfg
|
||||
${lib.concatMapStrings (s: ''
|
||||
rsvg-convert -w ${toString s} -h ${toString s} ${shape}.svg -o ${shape}-${toString s}.png
|
||||
echo "${toString s} ${px s x} ${px s y} ${shape}-${toString s}.png" >> ${shape}.cfg
|
||||
'') xcursorSizes}
|
||||
xcursorgen ${shape}.cfg "$theme/cursors/${shape}"
|
||||
${lib.concatMapStrings (a: "ln -s ${shape} \"$theme/cursors/${a}\"\n") aliases}
|
||||
'';
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "hyprchrome-cursors";
|
||||
version = "0.1";
|
||||
|
||||
src = ./hyprchrome-cursors;
|
||||
|
||||
nativeBuildInputs = [ librsvg xcursorgen hyprcursor ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
theme="$out/share/icons/${name}"
|
||||
mkdir -p "$theme/cursors" work
|
||||
|
||||
cat > "$theme/index.theme" <<EOF
|
||||
[Icon Theme]
|
||||
Name=${name}
|
||||
Comment=HyprChrome cursors for terra
|
||||
EOF
|
||||
|
||||
cat > work/manifest.hl <<EOF
|
||||
name = ${name}
|
||||
description = HyprChrome cursors for terra
|
||||
version = 0.1
|
||||
cursors_directory = hyprcursors
|
||||
EOF
|
||||
|
||||
${lib.concatStrings (lib.mapAttrsToList buildShape shapes)}
|
||||
|
||||
hyprcursor-util --create work --output .
|
||||
cp -r theme_${name}/. "$theme/"
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "HyprChrome cursor theme (XCursor + hyprcursor)";
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<g transform="scale(.82)"><path d="M4 2 V23 L8.5 18.5 L12.5 27.5 L16 26 L12 17.5 H19.5 L14 12 H12 V10 Z" fill="#0a0a0a" stroke="#e8722a" stroke-width="1.3" stroke-linejoin="miter"/>
|
||||
<path d="M6.2 8 V17.5 M7.8 12 V15" stroke="#858585" stroke-width="0.9"/>
|
||||
<path d="M16.5 21 H21.5 L20 23 H15 Z" fill="#e8722a"/></g>
|
||||
<path d="M17 19 H26 L29 22 V29 H20 L17 26 Z" fill="#0a0a0a" stroke="#858585" stroke-width="1.1"/>
|
||||
<path d="M26 19 L29 22" stroke="#e8722a" stroke-width="1.4"/>
|
||||
<path d="M20.4 27 L25.4 22 M21.8 22 H25.4 V25.6" fill="none" stroke="#e8722a" stroke-width="1.3"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 664 B |
@@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<g transform="scale(.82)"><path d="M4 2 V23 L8.5 18.5 L12.5 27.5 L16 26 L12 17.5 H19.5 L14 12 H12 V10 Z" fill="#0a0a0a" stroke="#e8722a" stroke-width="1.3" stroke-linejoin="miter"/>
|
||||
<path d="M6.2 8 V17.5 M7.8 12 V15" stroke="#858585" stroke-width="0.9"/>
|
||||
<path d="M16.5 21 H21.5 L20 23 H15 Z" fill="#e8722a"/></g>
|
||||
<path d="M17 19 H26 L29 22 V29 H20 L17 26 Z" fill="#0a0a0a" stroke="#858585" stroke-width="1.1"/>
|
||||
<path d="M26 19 L29 22" stroke="#e8722a" stroke-width="1.4"/>
|
||||
<path d="M20 22.4 H26 M20 24.8 H26 M20 27.2 H24" stroke="#e8722a" stroke-width="1.1"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 652 B |
@@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<g transform="scale(.82)"><path d="M4 2 V23 L8.5 18.5 L12.5 27.5 L16 26 L12 17.5 H19.5 L14 12 H12 V10 Z" fill="#0a0a0a" stroke="#e8722a" stroke-width="1.3" stroke-linejoin="miter"/>
|
||||
<path d="M6.2 8 V17.5 M7.8 12 V15" stroke="#858585" stroke-width="0.9"/>
|
||||
<path d="M16.5 21 H21.5 L20 23 H15 Z" fill="#e8722a"/></g>
|
||||
<path d="M17 19 H26 L29 22 V29 H20 L17 26 Z" fill="#0a0a0a" stroke="#858585" stroke-width="1.1"/>
|
||||
<path d="M26 19 L29 22" stroke="#e8722a" stroke-width="1.4"/>
|
||||
<path d="M22.3 21.2 H23.7 V23.3 H25.8 V24.7 H23.7 V26.8 H22.3 V24.7 H20.2 V23.3 H22.3 Z" fill="#e8722a"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 671 B |
@@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<g fill="none" stroke="#0a0a0a" stroke-width="3.4">
|
||||
<path d="M6 10.5 V6 H10.5 M21.5 6 H26 V10.5 M26 21.5 V26 H21.5 M10.5 26 H6 V21.5"/>
|
||||
<path d="M16 4 V11 M16 21 V28 M4 16 H11 M21 16 H28"/>
|
||||
</g>
|
||||
<path d="M6 10.5 V6 H10.5 M21.5 6 H26 V10.5 M26 21.5 V26 H21.5 M10.5 26 H6 V21.5" fill="none" stroke="#e8722a" stroke-width="1.5"/>
|
||||
<path d="M16 4 V11 M16 21 V28 M4 16 H11 M21 16 H28" stroke="#858585" stroke-width="1.3"/>
|
||||
<rect x="15" y="15" width="2" height="2" fill="#e8722a"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 566 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<path d="M4 2 V23 L8.5 18.5 L12.5 27.5 L16 26 L12 17.5 H19.5 L14 12 H12 V10 Z" fill="#0a0a0a" stroke="#e8722a" stroke-width="1.3" stroke-linejoin="miter"/>
|
||||
<path d="M6.2 8 V17.5 M7.8 12 V15" stroke="#858585" stroke-width="0.9"/>
|
||||
<path d="M16.5 21 H21.5 L20 23 H15 Z" fill="#e8722a"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 375 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<path d="M10 14.5 H22 V17.5 H10 Z" fill="#0a0a0a" stroke="#858585" stroke-width="1"/>
|
||||
<rect x="15.1" y="15.1" width="1.8" height="1.8" fill="#e8722a"/>
|
||||
<path d="M3 16 L9 10 V22 Z M29 16 L23 22 V10 Z" fill="#e8722a" stroke="#0a0a0a" stroke-width="1"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 342 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<path d="M5 15 L6 14 H9 V9 L10 8 H12 V6.5 L13 5.5 H17 L18 6.5 V7 H20 L21 8 V9 H23 L24 10 V22 L20 28 H12 L5 21 Z" fill="#0a0a0a" stroke="#e8722a" stroke-width="1.3"/>
|
||||
<path d="M12 9 V16 M15 6 V16 M18 7.5 V16 M21 9.5 V16" stroke="#858585" stroke-width="0.9"/>
|
||||
<rect x="17.6" y="20.6" width="1.8" height="1.8" fill="#e8722a"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 415 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<path d="M6 17 L9 14.5 V13 L10 12 H23 L24 13 V22 L20 28 H12 L6 21.5 Z" fill="#0a0a0a" stroke="#e8722a" stroke-width="1.3"/>
|
||||
<path d="M12.5 12 V16 M16 12 V16 M19.5 12 V16 M11 19 H21" stroke="#858585" stroke-width="0.9"/>
|
||||
<rect x="17.6" y="21.6" width="1.8" height="1.8" fill="#e8722a"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 377 B |
@@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<g transform="scale(.82)"><path d="M4 2 V23 L8.5 18.5 L12.5 27.5 L16 26 L12 17.5 H19.5 L14 12 H12 V10 Z" fill="#0a0a0a" stroke="#e8722a" stroke-width="1.3" stroke-linejoin="miter"/>
|
||||
<path d="M6.2 8 V17.5 M7.8 12 V15" stroke="#858585" stroke-width="0.9"/>
|
||||
<path d="M16.5 21 H21.5 L20 23 H15 Z" fill="#e8722a"/></g>
|
||||
<path d="M17 19 H26 L29 22 V29 H20 L17 26 Z" fill="#0a0a0a" stroke="#858585" stroke-width="1.1"/>
|
||||
<path d="M26 19 L29 22" stroke="#e8722a" stroke-width="1.4"/>
|
||||
<path d="M21 21.6 H25.4 V24.6 H23.6 V25.6 H22.4 V23.4 H24.2 V22.8 H21 Z M22.4 26.6 H23.6 V27.8 H22.4 Z" fill="#e8722a"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 686 B |
@@ -0,0 +1,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<path d="M16 8 V12 M16 20 V24 M8 16 H12 M20 16 H24" stroke="#0a0a0a" stroke-width="3.2"/>
|
||||
<path d="M16 8 V12 M16 20 V24 M8 16 H12 M20 16 H24" stroke="#858585" stroke-width="1.2"/>
|
||||
<path d="M16 12 L20 16 L16 20 L12 16 Z" fill="#0a0a0a" stroke="#e8722a" stroke-width="1.3"/>
|
||||
<rect x="15.1" y="15.1" width="1.8" height="1.8" fill="#e8722a"/>
|
||||
<path d="M16 3 L20.5 7.5 H11.5 Z M16 29 L11.5 24.5 H20.5 Z M3 16 L7.5 11.5 V20.5 Z M29 16 L24.5 20.5 V11.5 Z" fill="#e8722a" stroke="#0a0a0a" stroke-width="1"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 591 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<g transform="rotate(-45 16 16)"><path d="M10 14.5 H22 V17.5 H10 Z" fill="#0a0a0a" stroke="#858585" stroke-width="1"/>
|
||||
<rect x="15.1" y="15.1" width="1.8" height="1.8" fill="#e8722a"/>
|
||||
<path d="M3 16 L9 10 V22 Z M29 16 L23 22 V10 Z" fill="#e8722a" stroke="#0a0a0a" stroke-width="1"/></g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 379 B |
@@ -0,0 +1,4 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<path fill-rule="evenodd" d="M12 4 H20 L28 12 V20 L20 28 H12 L4 20 V12 Z M13.2 7.5 L7.5 13.2 V18.8 L13.2 24.5 H18.8 L24.5 18.8 V13.2 L18.8 7.5 Z" fill="#ff6b4a" stroke="#0a0a0a" stroke-width="1"/>
|
||||
<path d="M9.5 11.6 L11.6 9.5 L22.5 20.4 L20.4 22.5 Z" fill="#ff6b4a" stroke="#0a0a0a" stroke-width="1"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 393 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<g transform="rotate(90 16 16)"><path d="M10 14.5 H22 V17.5 H10 Z" fill="#0a0a0a" stroke="#858585" stroke-width="1"/>
|
||||
<rect x="15.1" y="15.1" width="1.8" height="1.8" fill="#e8722a"/>
|
||||
<path d="M3 16 L9 10 V22 Z M29 16 L23 22 V10 Z" fill="#e8722a" stroke="#0a0a0a" stroke-width="1"/></g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 378 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<g transform="rotate(45 16 16)"><path d="M10 14.5 H22 V17.5 H10 Z" fill="#0a0a0a" stroke="#858585" stroke-width="1"/>
|
||||
<rect x="15.1" y="15.1" width="1.8" height="1.8" fill="#e8722a"/>
|
||||
<path d="M3 16 L9 10 V22 Z M29 16 L23 22 V10 Z" fill="#e8722a" stroke="#0a0a0a" stroke-width="1"/></g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 378 B |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<path d="M11 4 L12 3 H14 L15 4 V12 L16 11 H17.5 L18.5 12 L19.5 11.5 H21 L22 12.5 L23 12 H24.5 L26 13.5 V23 L22 28 H13 L7 22 V18.5 L8 17.5 H9 L11 19.5 Z" fill="#0a0a0a" stroke="#e8722a" stroke-width="1.3"/>
|
||||
<path d="M15 15 V18 M18.5 14 V18 M22 14 V18 M13 21.5 H20" stroke="#858585" stroke-width="0.9"/>
|
||||
<path d="M12 5.4 H14" stroke="#e8722a" stroke-width="1.4"/>
|
||||
<rect x="21.6" y="20.8" width="1.8" height="1.8" fill="#e8722a"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 519 B |
@@ -0,0 +1,10 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<g transform="scale(.82)"><path d="M4 2 V23 L8.5 18.5 L12.5 27.5 L16 26 L12 17.5 H19.5 L14 12 H12 V10 Z" fill="#0a0a0a" stroke="#e8722a" stroke-width="1.3" stroke-linejoin="miter"/>
|
||||
<path d="M6.2 8 V17.5 M7.8 12 V15" stroke="#858585" stroke-width="0.9"/>
|
||||
<path d="M16.5 21 H21.5 L20 23 H15 Z" fill="#e8722a"/></g>
|
||||
<path d="M17 19 H26 L29 22 V29 H20 L17 26 Z" fill="#0a0a0a" stroke="#858585" stroke-width="1.1"/>
|
||||
<path d="M26 19 L29 22" stroke="#e8722a" stroke-width="1.4"/>
|
||||
<rect x="19.6" y="22" width="1.8" height="4" fill="#e8722a"/>
|
||||
<rect x="22.2" y="22" width="1.8" height="4" fill="#e8722a"/>
|
||||
<rect x="24.8" y="22" width="1.8" height="4" fill="rgba(222,222,222,.18)"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 765 B |