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 |
@@ -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,6 +234,10 @@ 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.
|
||||
@@ -248,3 +276,27 @@ kept its ssh host key. Run it after ANY change to the kexec paths.
|
||||
`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`.
|
||||
|
||||
@@ -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
|
||||
@@ -105,6 +105,8 @@ on it, hence the index loops in `HyprChromeShell`.
|
||||
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
|
||||
|
||||
@@ -10,6 +10,13 @@ Item {
|
||||
|
||||
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
|
||||
@@ -139,9 +146,9 @@ Item {
|
||||
id: panel
|
||||
|
||||
width: root.width
|
||||
panelId: "LGN"
|
||||
title: "SESSION // " + root.hostName.toUpperCase()
|
||||
meta: "GREETD"
|
||||
panelId: root.panelId
|
||||
title: root.title
|
||||
meta: root.meta
|
||||
busy: root.busy
|
||||
|
||||
ColumnLayout {
|
||||
@@ -220,7 +227,7 @@ Item {
|
||||
|
||||
anchors.fill: parent
|
||||
verticalAlignment: TextInput.AlignVCenter
|
||||
enabled: !root.busy && root.inputPrompt === ""
|
||||
enabled: root.userEditable && !root.busy && root.inputPrompt === ""
|
||||
color: Theme.text
|
||||
selectionColor: Theme.accent
|
||||
selectedTextColor: Theme.surface
|
||||
@@ -292,12 +299,12 @@ Item {
|
||||
Layout.fillWidth: true
|
||||
spacing: 14
|
||||
|
||||
MicroText { text: "ENTER LOG IN" }
|
||||
MicroText { text: "TAB SWITCH FIELD" }
|
||||
MicroText { text: "ENTER " + root.submitLabel }
|
||||
MicroText { text: "TAB SWITCH FIELD"; visible: root.userEditable }
|
||||
Item { Layout.fillWidth: true }
|
||||
|
||||
PowerChip { label: "REBOOT"; action: "reboot" }
|
||||
PowerChip { label: "POWER OFF"; action: "poweroff" }
|
||||
PowerChip { label: "REBOOT"; action: "reboot"; visible: root.showPower }
|
||||
PowerChip { label: "POWER OFF"; action: "poweroff"; visible: root.showPower }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,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: {
|
||||
@@ -141,7 +142,7 @@ 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"
|
||||
@@ -253,7 +254,7 @@ Scope {
|
||||
|
||||
// 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,
|
||||
|
||||
@@ -253,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)
|
||||
@@ -266,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 }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
@@ -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 {}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ Scope {
|
||||
// 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,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
|
||||
}
|
||||
@@ -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": 1791913330,
|
||||
"narHash": "sha256-TxALg0lw01Y3YJOqnMZ++FpAb1GjMPXaVqDL/CCr4aM=",
|
||||
"lastModified": 1794238815,
|
||||
"narHash": "sha256-ITaU80ncGp9K/OqoRBbiuxVgMyFHU5sJ9W4FeU6oyiE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "authentik-nix",
|
||||
"rev": "3f55f381aa5bc1de4c065df149a874b8ab58e9c7",
|
||||
"rev": "6441c8b2b900260ac4e9520ab1ce5be6ff1ff39e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -30,16 +30,16 @@
|
||||
"authentik-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1789678329,
|
||||
"narHash": "sha256-wt6cjarJI5NXSHgpONjqE9JiltBqkCoPyLLiIS83kuI=",
|
||||
"lastModified": 1792581414,
|
||||
"narHash": "sha256-gdhGKCfsMUrWyFnf5TaaHM2ZQ1WYgTLOgGg4DlCaUHU=",
|
||||
"owner": "goauthentik",
|
||||
"repo": "authentik",
|
||||
"rev": "e5a0d2f7572cb776eee7a3e9355937ce38973761",
|
||||
"rev": "4ec0d19b98da3c329781894cd550da95d3033954",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "goauthentik",
|
||||
"ref": "version/2026.8.3",
|
||||
"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": 1789770686,
|
||||
"narHash": "sha256-uZkBR7yHdIKUFB5SZdfgh1qkGfI3XmYmI/lTiquxbck=",
|
||||
"lastModified": 1794328522,
|
||||
"narHash": "sha256-h2BYMW4nTFpIqnMd8gwAPFmJAp/1wWLQ6vT0NfL5qt4=",
|
||||
"owner": "nix-community",
|
||||
"repo": "disko",
|
||||
"rev": "725ea35e410ad83be4931d1bff7e090eacaf3563",
|
||||
"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": 1790898470,
|
||||
"narHash": "sha256-zTwuwezD0w3hpga6a6P8emidzAZFyWqlNeRBlpWOOl8=",
|
||||
"lastModified": 1793576659,
|
||||
"narHash": "sha256-V1h85lUaJBQoHFrB2vpXZOE0Ju1MYSnIpsehoVZYlDo=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "024633cd702b10285db5cb19b40ad48d2399ba60",
|
||||
"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": 1791938526,
|
||||
"narHash": "sha256-yNYK2pdk3bCtJrpblrNYA6hZKdybWUeyTtx74+OEJFo=",
|
||||
"lastModified": 1794251182,
|
||||
"narHash": "sha256-R2sZBXiOJo3HAnvTiVkbbHDJy//JMlAwUKEiPbfqPXk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "32904dfe1cf86039f3c8c9f41f94e1cfd76dbb34",
|
||||
"rev": "6eb2d33d1d0c95a37ef6443c88e6c1686012ee8b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -196,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": 1791189215,
|
||||
"narHash": "sha256-CjAU2ThV33M86mHbf+9YfIsAgPymmj9VGd+bNV7fXpc=",
|
||||
"lastModified": 1793773829,
|
||||
"narHash": "sha256-YbenBjZd0WfPQ9Djtd7D460JmJzXiWeyBf2rYc4YE6A=",
|
||||
"owner": "vrtmrz",
|
||||
"repo": "livesync-bridge",
|
||||
"rev": "5645cf6a74e863ccc29bc2e9dedef1c4941e096b",
|
||||
"rev": "1c252305bbddcacd200b8560d3bb786afe0906e9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -252,6 +332,87 @@
|
||||
"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": 1791644268,
|
||||
@@ -267,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": [
|
||||
@@ -303,14 +491,14 @@
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
"treefmt-nix": "treefmt-nix_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1791357754,
|
||||
"narHash": "sha256-Ux5asuuHjDEq7Z12g99g6Nt4Vu4WByPHASMUGTDjAU0=",
|
||||
"lastModified": 1793171667,
|
||||
"narHash": "sha256-8h9MU32SjnFWIWRdtP9vYVNV5QrVbai8Oo1LW1rAmwc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixos-anywhere",
|
||||
"rev": "b6be7b277b468d55082584441cbef1fed8530eb3",
|
||||
"rev": "58132e1d1f813b845382a2aeca4203b18d2ac807",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -359,11 +547,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1791456040,
|
||||
"narHash": "sha256-H83yz/do+hjOO0uujHyH8RgtIQP2v7Mw+cLwcZK/xKc=",
|
||||
"lastModified": 1794042290,
|
||||
"narHash": "sha256-ziZn2PvCJE5JEEpqTdxXwJpPB+L3YqoCpTAMCzyaP3U=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "e7439b6b14ad3cc35d05608ebca9bce01a25f5f8",
|
||||
"rev": "f4a03c008967841f2a0b3cb7c436fc6fc31671f6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -373,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": 1790477367,
|
||||
"narHash": "sha256-oujbxmVKDhci2E4EM3KyAbRUgp5/IsCoiA/LfEF7OOk=",
|
||||
"lastModified": 1793504054,
|
||||
"narHash": "sha256-ThkfL3D/FhCiZFc9+3BtxwuMmpuK+/bGtXCSo1+yVew=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "f7cd230690d9fc982d06129f9189b101fddcfa3b",
|
||||
"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": {
|
||||
@@ -390,11 +609,11 @@
|
||||
},
|
||||
"nixpkgs-unstable": {
|
||||
"locked": {
|
||||
"lastModified": 1791637130,
|
||||
"narHash": "sha256-TuvwvSjJrpqyIYdjhQ7Wu+ADVfeOpO2Um21/V7TOubw=",
|
||||
"lastModified": 1794644783,
|
||||
"narHash": "sha256-3GnIGIy15bMduoS9RnWqKTmsJLWThla42UFtm0S7+us=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ca1659429c950a11a565b5764e37a1b704e17ec8",
|
||||
"rev": "5d2b81a7a3be3e2f832879028e4d60abbf58e9a0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -406,11 +625,24 @@
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1791883866,
|
||||
"narHash": "sha256-yvkDdToRZ4IgPc9tSBzzCYJvTLf8n5eE3rgUkpCuD5A=",
|
||||
"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": "a033e66ab94a6bedf2c3d58d93a36319d3cbbbaf",
|
||||
"rev": "f1e5c356f35d07e7b71a6b5e6c9338e0b029e0c0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -436,11 +668,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1790565003,
|
||||
"narHash": "sha256-q4W45pwcae0gK41vxzqfmXOnODGKfduLJJdraPHYXcY=",
|
||||
"lastModified": 1793820911,
|
||||
"narHash": "sha256-cc2EX2rfojnhcvqPQh4JEFGm2Mn/VoJyw5hTJTaw7Wo=",
|
||||
"owner": "pyproject-nix",
|
||||
"repo": "build-system-pkgs",
|
||||
"rev": "c84c47bba26ea303eaefc137ab48307fe57a1be1",
|
||||
"rev": "947b2b0c973de462b19577715f04ba8d6f48ed7e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -486,11 +718,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788394333,
|
||||
"narHash": "sha256-xYOP0Xym1eVGUaHFx+eJEaycFGoiCbst3fZf0xFHP78=",
|
||||
"lastModified": 1793820880,
|
||||
"narHash": "sha256-NUMabnvaL/0Ah9WM9pBMXEp+dQjMSYjezZ/fNjXouLQ=",
|
||||
"owner": "pyproject-nix",
|
||||
"repo": "pyproject.nix",
|
||||
"rev": "6a8a7881d75b6f98967e7b8069f4ead331384301",
|
||||
"rev": "d43f0e74444c1f266c640fc49ce6ce6fb69d33c3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -527,17 +759,20 @@
|
||||
"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",
|
||||
"turtle-beach-swarm-re": "turtle-beach-swarm-re"
|
||||
"tome": "tome"
|
||||
}
|
||||
},
|
||||
"sops-nix": {
|
||||
@@ -547,11 +782,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1791710405,
|
||||
"narHash": "sha256-mVD4XIc5JkqMW2K04IkFUzHgHmyJZlzw5ktfgMDCbKU=",
|
||||
"lastModified": 1794624949,
|
||||
"narHash": "sha256-3q/hxp/flW1PnV3Dx+H3p8kHGEHJ7251BqVMNsAAB9E=",
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"rev": "ee48786c6f9160d2c1a084aac841f68195b8420c",
|
||||
"rev": "11e5885d241743ff0193465d533b20e754bc3ce0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -582,27 +817,27 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1791840443,
|
||||
"narHash": "sha256-wfk8wE8xKzxi3MswzEnBeKu+0Na0TFX8z1h8sVBgVZY=",
|
||||
"lastModified": 1793410258,
|
||||
"narHash": "sha256-MMfosPFbaOEEEZsfR3IdtbVrAft+HX+xvznK4ouzXH4=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "9a4c12883b36c8a9a860a6c121308c0763af662b",
|
||||
"revCount": 30,
|
||||
"rev": "4b02ee62d4f4ede5378d140c39154e6cb5aeef92",
|
||||
"revCount": 46,
|
||||
"type": "git",
|
||||
"url": "file:///mnt/hdd_01/data/Dev/repos/openbeach"
|
||||
"url": "file:///mnt/hdd_01/dev/repos/openbeach"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "file:///mnt/hdd_01/data/Dev/repos/openbeach"
|
||||
"url": "file:///mnt/hdd_01/dev/repos/openbeach"
|
||||
}
|
||||
},
|
||||
"tome": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1792101524,
|
||||
"narHash": "sha256-fiYalAxQkztsJ71a45Fk9oWD4jVrCohc2rWN2SEz+XI=",
|
||||
"lastModified": 1793641410,
|
||||
"narHash": "sha256-Rab2elFs1E8pJJ90y+omA5I+Vou8wf+70BGrH3HClDs=",
|
||||
"ref": "refs/heads/master",
|
||||
"rev": "011a69e82eb9ab9bd9f8ffb7bd8f6d27148c76cb",
|
||||
"revCount": 52,
|
||||
"rev": "5274abdc96772669c736992a9dfcbb9497557edb",
|
||||
"revCount": 53,
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.mgaction.town:2222/darman/TOME.git"
|
||||
},
|
||||
@@ -614,16 +849,16 @@
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixos-anywhere",
|
||||
"nix-citizen",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1790542030,
|
||||
"narHash": "sha256-U6m0B5+ALyOLYG4OVvtguLdem7iYgN6cIP5Q1RhM+g8=",
|
||||
"lastModified": 1791885023,
|
||||
"narHash": "sha256-C3alQ2MEt0zVrUSho5NUDo3jmhbff72++bfwoqT9Omo=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "6aca3b3649eb1edf472eca3e91e6bcc0c84a6ad3",
|
||||
"rev": "0d6d739a833ba9a9c93034862e4a7b061a062a1c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -632,24 +867,25 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"turtle-beach-swarm-re": {
|
||||
"treefmt-nix_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixos-anywhere",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1791720939,
|
||||
"narHash": "sha256-8MayzYPTXurGlD6nnI5QpRqZlu2Yt7x3OTjMccOYrjM=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "a75d5121fc38a21349a34b4fd054c3d5140bdae1",
|
||||
"revCount": 98,
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.mgaction.town:2222/darman/turtle-beach-swarm-re.git"
|
||||
"lastModified": 1791885023,
|
||||
"narHash": "sha256-C3alQ2MEt0zVrUSho5NUDo3jmhbff72++bfwoqT9Omo=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "0d6d739a833ba9a9c93034862e4a7b061a062a1c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "ssh://gitea@git.mgaction.town:2222/darman/turtle-beach-swarm-re.git"
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"uv2nix": {
|
||||
@@ -664,11 +900,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1791593997,
|
||||
"narHash": "sha256-+PDPo9ZEgLo2cH0oBOBTzVp47qzRT8dCm0KvvWaC/LQ=",
|
||||
"lastModified": 1793272761,
|
||||
"narHash": "sha256-3CE1CEwprYlHRlRVkXDkhqec0jjF9Cti7tdk8vVDsCM=",
|
||||
"owner": "pyproject-nix",
|
||||
"repo": "uv2nix",
|
||||
"rev": "ee223531ba79d2522b2e549acf9243886157fbf3",
|
||||
"rev": "c361746c7d630d98b972378290547c8d35542a7a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -67,19 +67,37 @@
|
||||
url = "git+ssh://gitea@git.mgaction.town:2222/darman/honcho-console.git";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# Turtle Beach Swarm II RE (KB7/KP7); terra uses its `release` module to
|
||||
# take the KB7 out of host control after a warm reboot from Windows.
|
||||
turtle-beach-swarm-re = {
|
||||
url = "git+ssh://gitea@git.mgaction.town:2222/darman/turtle-beach-swarm-re.git";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# tbctl (openbeach): KB7/KP7/Kone II Air CLI + desktop GUI on terra.
|
||||
# Local checkout for now (resolved path: Nix rejects the ~/Data symlink);
|
||||
# upstream is git+ssh://git@github.com/darman96/openbeach.git?ref=main.
|
||||
# Local checkout for now; upstream is git+ssh://git@github.com/darman96/openbeach.git?ref=main.
|
||||
tbctl = {
|
||||
url = "git+file:///mnt/hdd_01/data/Dev/repos/openbeach";
|
||||
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:
|
||||
@@ -135,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 {
|
||||
@@ -533,11 +565,35 @@
|
||||
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 as a store copy (`xdg.configFile`),
|
||||
# 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.
|
||||
#
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# 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";
|
||||
|
||||
@@ -45,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";
|
||||
|
||||
@@ -57,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.
|
||||
@@ -69,6 +84,16 @@ in
|
||||
nix-direnv.enable = true;
|
||||
};
|
||||
|
||||
# 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.
|
||||
@@ -92,7 +117,6 @@ 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
|
||||
@@ -1,7 +1,8 @@
|
||||
{ lib, pkgs, config, inputs, ... }:
|
||||
{ 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
|
||||
@@ -9,11 +10,6 @@ let
|
||||
cursorName = config.home.pointerCursor.name;
|
||||
cursorSize = toString config.home.pointerCursor.size;
|
||||
|
||||
# Wallpapers aren't checked into this repo (binaries) — pulled from the
|
||||
# Wallhaven library on /mnt/hdd_01. Picked once here since hyprpaper has
|
||||
# no built-in "random" mode.
|
||||
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 = {
|
||||
@@ -42,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; }
|
||||
@@ -50,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";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -76,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 = {
|
||||
@@ -128,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 = {
|
||||
@@ -169,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) ----
|
||||
@@ -195,19 +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.
|
||||
]
|
||||
# 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,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"; }
|
||||
@@ -279,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; }
|
||||
@@ -304,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.";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -2,13 +2,19 @@
|
||||
|
||||
# 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 { };
|
||||
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 { };
|
||||
|
||||
iconTheme = "Amy-Dark-Icons";
|
||||
iconThemePackage = amyDarkIcons;
|
||||
iconThemeFolder = "${iconThemePackage}/share/icons/${iconTheme}";
|
||||
# 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 = {
|
||||
@@ -29,9 +35,9 @@ in
|
||||
# bind-mounted in though, so the ~/.icons symlink `dotIcons` drops still
|
||||
# resolves — same fix as the flatpak workaround below.
|
||||
home.pointerCursor = {
|
||||
name = "Bibata-Modern-Classic";
|
||||
package = pkgs.bibata-cursors;
|
||||
size = 24;
|
||||
name = "HyprChrome";
|
||||
package = hyprchromeCursors;
|
||||
size = 36;
|
||||
gtk.enable = true;
|
||||
hyprcursor.enable = true;
|
||||
};
|
||||
@@ -41,7 +47,11 @@ in
|
||||
# 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 = iconThemeFolder;
|
||||
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";
|
||||
@@ -26,6 +26,7 @@
|
||||
../../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
|
||||
|
||||
@@ -55,6 +55,28 @@
|
||||
sops.secrets.sabnzbd_eweka_username.owner = "sabnzbd";
|
||||
sops.secrets.sabnzbd_eweka_password.owner = "sabnzbd";
|
||||
|
||||
# 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.
|
||||
|
||||
@@ -11,8 +11,10 @@
|
||||
./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
|
||||
|
||||
@@ -38,9 +38,10 @@ let
|
||||
# it's inside Hermes's own write-safe root (HERMES_WRITE_SAFE_ROOT).
|
||||
dropboxDir = "/mnt/jupiter/AppData/hermes-dropbox";
|
||||
|
||||
# v2026.9.14, pinned by index digest rather than floating
|
||||
# v0.23.1, pinned by index digest rather than floating
|
||||
# :latest, so bumping Hermes is an explicit edit here, not silent drift.
|
||||
hermesImage = "docker.io/nousresearch/hermes-agent@sha256:99641e57ec762c59e54cb44aa6746b7fc68c18b3c5ddb088af54234c613d9294";
|
||||
# Its Python is 3.14 — the in-process STT venv below must match it.
|
||||
hermesImage = "docker.io/nousresearch/hermes-agent@sha256:276d44685c65c0cb2a25f190b63c65c8906f9dc76486fb1c05ae71b5826bda08";
|
||||
|
||||
# Kept identical to jupiter's instance purely so nothing else needs to
|
||||
# change if state ever gets migrated over.
|
||||
@@ -78,9 +79,6 @@ let
|
||||
builtins.readFile ./gitea-pr-review-prompt.md
|
||||
);
|
||||
|
||||
# Mnemosyne memory provider: third-party plugin, not in the image.
|
||||
mnemosyneEnv = pkgs.callPackage ../../pkgs/mnemosyne-env.nix { };
|
||||
|
||||
# KittenTTS voice provider inputs (CPU-only; model + wheel hash-pinned).
|
||||
# Provisioning unit near the bottom of this file; background on why the
|
||||
# deps deviate from upstream's declaration lives in
|
||||
@@ -97,12 +95,26 @@ let
|
||||
kittenttsReqs = pkgs.writeText "kittentts-requirements.txt" (
|
||||
builtins.readFile ./kittentts/requirements.txt
|
||||
);
|
||||
# STT add-on: faster-whisper (CPU) for Telegram voice-note transcription,
|
||||
# same side-venv, appended by the provisioning unit. Keeps one venv + one
|
||||
# stamp for the whole local-audio stack. See kittentts/stt-requirements.txt.
|
||||
# STT: faster-whisper (CPU) for voice-note transcription, in its own venv:
|
||||
# Hermes imports it in-process, so it must be built for the IMAGE's Python
|
||||
# (3.14), while KittenTTS runs its venv's own 3.13 interpreter as a command.
|
||||
# Same provisioning unit and stamp. See kittentts/stt-requirements.txt.
|
||||
kittenttsSttReqs = pkgs.writeText "kittentts-stt-requirements.txt" (
|
||||
builtins.readFile ./kittentts/stt-requirements.txt
|
||||
);
|
||||
# stt.local.model "base", staged into the same offline HF cache: re-delivery
|
||||
# replaces that whole tree, so an unpinned download would be wiped with it.
|
||||
whisperRev = "ebe41f70d5b6dfa9166e2c581c45c9c0cfc57b66";
|
||||
whisperFile = name: hash: pkgs.fetchurl {
|
||||
url = "https://huggingface.co/Systran/faster-whisper-base/resolve/${whisperRev}/${name}";
|
||||
inherit hash;
|
||||
};
|
||||
whisperModel = pkgs.linkFarm "faster-whisper-base" {
|
||||
"config.json" = whisperFile "config.json" "sha256-VqbYEQ0xHxnI8EceVigyx1J/FGtWcnW/yln898GE2po=";
|
||||
"model.bin" = whisperFile "model.bin" "sha256-0BwwFIgcnG8xM8GC89KIfrbKHHiadTjFwAcZaFegpqk=";
|
||||
"tokenizer.json" = whisperFile "tokenizer.json" "sha256-+3tjGR6bsEUILHn9dCoxBqEsmVE6sw30oNR/pstv0Ks=";
|
||||
"vocabulary.txt" = whisperFile "vocabulary.txt" "sha256-NM4/4cUEECez+NQpEicJk/mG28S7NM8n+VHjSh5FORM=";
|
||||
};
|
||||
kittenttsStub = pkgs.writeText "kitten-tts-stub.py" (
|
||||
builtins.readFile ./kittentts/kitten-misaki-stub.py
|
||||
);
|
||||
@@ -145,10 +157,12 @@ in
|
||||
users.groups.hermes.gid = 983;
|
||||
users.users.darman.extraGroups = [ "hermes" ];
|
||||
|
||||
# `hermes <args>` == `sudo podman exec -it hermes-agent hermes <args>`. sudo
|
||||
# is needed because oci-containers runs rootful podman, a separate
|
||||
# namespace from darman's own rootless one.
|
||||
programs.zsh.shellAliases.hermes = "sudo podman exec -it hermes-agent hermes";
|
||||
# `hermes <args>` runs the CLI in the container. sudo is needed because
|
||||
# oci-containers runs rootful podman, a separate namespace from darman's own
|
||||
# rootless one. `-u hermes`: run as root, `hermes pm`/`plugins` leave
|
||||
# root-owned state under /opt/data/installs that the gateway then can't
|
||||
# write ("install state is not writable by this user"; 2026-10-21).
|
||||
programs.zsh.shellAliases.hermes = "sudo podman exec -it -u hermes -w /opt/data hermes-agent hermes";
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${stateDir} 0750 root hermes -"
|
||||
@@ -330,6 +344,11 @@ in
|
||||
mv -f "$f.new" "$f"
|
||||
' _ ${hermesHome}/honcho.json
|
||||
write_env_key API_SERVER_KEY < ${config.sops.secrets.hermes_api_server_key.path}
|
||||
write_env_key MATRIX_ACCESS_TOKEN < ${config.sops.secrets.matrix_access_token.path}
|
||||
# Not a secret, but with gateway.multiplex_profiles on the authorization check
|
||||
# reads only the profile's .env; from the container env it answered with a
|
||||
# pairing code instead.
|
||||
printf %s "@darman:mgaction.town" | write_env_key MATRIX_ALLOWED_USERS
|
||||
|
||||
# Pinned: overwritten every start, so dashboard edits and her own approved
|
||||
# edits don't survive (a broken one corrupted it on 2026-09-24). Persona
|
||||
@@ -410,12 +429,22 @@ in
|
||||
HF_HOME = "/opt/data/kittentts-hf";
|
||||
HF_HUB_OFFLINE = "1";
|
||||
|
||||
# STT (local whisper): expose the side-venv's site-packages to Hermes's
|
||||
# STT (local whisper): expose the STT venv's site-packages to Hermes's
|
||||
# own interpreter so faster-whisper imports in-process. PYTHONPATH dirs
|
||||
# don't run .pth auto-imports, but faster-whisper has no dead imports —
|
||||
# it imports cleanly from a plain path injection (unlike kittentts,
|
||||
# which is driven through the command wrapper for exactly that reason).
|
||||
PYTHONPATH = "/opt/data/kittentts-venv/lib/python3.13/site-packages";
|
||||
PYTHONPATH = "/opt/data/stt-venv/lib/python3.14/site-packages";
|
||||
|
||||
# Matrix as @luna:mgaction.town, alongside Telegram (which keeps cron
|
||||
# delivery). Device ID must match the token's; E2EE state is in
|
||||
# /opt/data/platforms/matrix/store.
|
||||
MATRIX_HOMESERVER = "https://matrix.mgaction.town";
|
||||
MATRIX_USER_ID = "@luna:mgaction.town";
|
||||
MATRIX_DEVICE_ID = "HERMES";
|
||||
MATRIX_E2EE_MODE = "optional";
|
||||
# First start bootstraps cross-signing and writes its recovery key here once.
|
||||
MATRIX_RECOVERY_KEY_OUTPUT_FILE = "/opt/data/matrix-recovery-key";
|
||||
};
|
||||
environmentFiles = [ config.sops.templates."hermes-agent.env".path ];
|
||||
cmd = [ "gateway" "run" ];
|
||||
@@ -431,7 +460,11 @@ in
|
||||
# prepare-dirs is an inactive oneshot, and switch-to-configuration only
|
||||
# restarts ACTIVE units — so editing its script otherwise lands nowhere
|
||||
# until something else happens to restart the container.
|
||||
restartTriggers = [ config.systemd.services.hermes-agent-prepare-dirs.script ];
|
||||
# Same for the KittenTTS/STT provisioner, which the restart pulls in first.
|
||||
restartTriggers = [
|
||||
config.systemd.services.hermes-agent-prepare-dirs.script
|
||||
config.systemd.services.hermes-agent-kittentts-provision.script
|
||||
];
|
||||
};
|
||||
|
||||
# The two Gitea webhook routes, written as config (not via `hermes webhook
|
||||
@@ -480,7 +513,7 @@ in
|
||||
# sticks until the next restart.
|
||||
#
|
||||
# Routes not named here are left alone (the merge below is per-key);
|
||||
# retire one with `sudo podman exec hermes-agent hermes webhook remove <name>`.
|
||||
# retire one with `hermes webhook remove <name>` (the alias above).
|
||||
systemd.services.hermes-agent-webhook-routes = {
|
||||
description = "Write Hermes's Gitea webhook route config";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
@@ -568,35 +601,6 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
# Hermes discovers memory providers under $HERMES_HOME/plugins; the target
|
||||
# is a store path, readable in the container via the /nix/store ro mount.
|
||||
# wantedBy, not requiredBy: a failure leaves Hermes on built-in memory.
|
||||
systemd.services.hermes-agent-mnemosyne-plugin = {
|
||||
description = "Link Mnemosyne provider into the Hermes plugin dir";
|
||||
before = [ "podman-hermes-agent.service" ];
|
||||
wantedBy = [ "podman-hermes-agent.service" ];
|
||||
after = [ "hermes-agent-prepare-dirs.service" ];
|
||||
requires = [ "hermes-agent-prepare-dirs.service" ];
|
||||
path = [ pkgs.coreutils ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
};
|
||||
script = ''
|
||||
set -euo pipefail
|
||||
pluginsDir=${hermesHome}/plugins
|
||||
pluginDir=$pluginsDir/mnemosyne
|
||||
target=${mnemosyneEnv}/${mnemosyneEnv.sitePackages}/hermes_memory_provider
|
||||
[ -d "$target" ] || { echo "$target missing" >&2; exit 1; }
|
||||
|
||||
mkdir -p "$pluginsDir"
|
||||
chown ${hermesUid}:${hermesGid} "$pluginsDir"
|
||||
ln -sfn "$target" "$pluginDir.new"
|
||||
mv -Tf "$pluginDir.new" "$pluginDir"
|
||||
chown -h ${hermesUid}:${hermesGid} "$pluginDir"
|
||||
'';
|
||||
};
|
||||
|
||||
# ---- KittenTTS voice provider ------------------------------------------
|
||||
# CPU-only onnxruntime TTS (no GPU on mars), mini model per darman. The
|
||||
# upstream `misaki[en]` declaration is deliberately not honored — it pulls
|
||||
@@ -605,7 +609,7 @@ in
|
||||
# .pth-registered stub (kitten-misaki-stub.py) that fails loudly if misaki
|
||||
# is ever actually used.
|
||||
#
|
||||
# Provisioner invariants (shaped by the Mnemosyne + KittenTTS review rounds):
|
||||
# Provisioner invariants (shaped by its review rounds):
|
||||
# - Build in a ROOT-OWNED staging dir (/var/lib/hermes-kittentts, 0755 so
|
||||
# the uid-986 delivery step can read it; nothing in it is secret):
|
||||
# stamp, staging venv, uv cache and staging model copies all live there.
|
||||
@@ -624,7 +628,7 @@ in
|
||||
# - Idempotency stamp keyed on the FULL input set (requirements + wheel +
|
||||
# stub + model files), not just requirements (review #5); a deleted
|
||||
# delivered file falls out of the fast path and re-provisions cheaply.
|
||||
# - Order after prepare-dirs (review #6) — mirrors the mnemosyne unit.
|
||||
# - Order after prepare-dirs (review #6).
|
||||
#
|
||||
# Trust boundary: the DELIVERED venv lives inside hermesHome
|
||||
# (HERMES_WRITE_SAFE_ROOT), so luna can alter her own TTS engine — and a
|
||||
@@ -639,17 +643,15 @@ in
|
||||
wants = [ "network-online.target" ];
|
||||
# after prepare-dirs (review #6): on a fresh state dir this unit must not
|
||||
# create hermesHome root-owned before prepare-dirs sets the ownership
|
||||
# layout — same ordering contract the mnemosyne unit has. PLUS
|
||||
# network-online ordering (review2 #3): this unit CAN download at boot
|
||||
# (unlike mnemosyne's store-path build), so uv must not run before the
|
||||
# network is actually up.
|
||||
# layout. PLUS network-online ordering (review2 #3): this unit CAN
|
||||
# download at boot, so uv must not run before the network is actually up.
|
||||
after = [
|
||||
"network-online.target"
|
||||
"hermes-agent-prepare-dirs.service"
|
||||
];
|
||||
requires = [ "hermes-agent-prepare-dirs.service" ];
|
||||
# diffutils: `cmp` in the fast path; missing, it silently re-delivers every boot.
|
||||
path = [ pkgs.uv pkgs.coreutils pkgs.diffutils pkgs.util-linux pkgs.auto-patchelf pkgs.patchelf ];
|
||||
path = [ pkgs.uv pkgs.coreutils pkgs.findutils pkgs.diffutils pkgs.util-linux pkgs.patchelf ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
TimeoutStartSec = 600;
|
||||
@@ -671,34 +673,59 @@ in
|
||||
# into hermesHome, and only after being validated. Root doesn't follow
|
||||
# any uid-986-writable path while running as root.
|
||||
stageDir=/var/lib/hermes-kittentts
|
||||
# Copied, not uv's default hardlinks: patchelf edits files in place, so
|
||||
# hardlinked venvs had rewritten the CACHED wheels — av's RPATH pointed
|
||||
# into a long-deleted venv in every venv built after. Hence also a fresh
|
||||
# cache dir (the old one was deleted 2026-10-21).
|
||||
export UV_CACHE_DIR=$stageDir/uv-cache-v2 UV_LINK_MODE=copy
|
||||
# Root-side staging of the DELIVERED TREE (venv + full HF hub layout
|
||||
# including refs/main) — everything root writes lives here.
|
||||
# review2 #4: root never writes into hermesHome; delivery happens as
|
||||
# the container uid via setpriv, copying from these root-owned sources.
|
||||
stageVenv=$stageDir/venv
|
||||
stageStt=$stageDir/stt-venv
|
||||
sttVenv=${hermesHome}/stt-venv
|
||||
stageHub=$stageDir/kittentts-hf
|
||||
stageSnap=$stageDir/hf-model
|
||||
whisperDir=models--Systran--faster-whisper-base
|
||||
# Input key: requirements + wheel + stub + model files + resolved script.
|
||||
# Review #5 — a miss on the old requirements-only stamp let a changed
|
||||
# wheel/stub/model URL keep running the stale install forever.
|
||||
inputHash=$({ cat ${kittenttsReqs} ${kittenttsSttReqs} ${kittenttsWheel} ${kittenttsStub} \
|
||||
${kittenttsModelOnnx} ${kittenttsModelVoices} ${kittenttsModelConfig}
|
||||
echo ${kittenttsRuntimeLibs}; } | sha256sum | cut -d' ' -f1)
|
||||
echo ${kittenttsRuntimeLibs} ${pkgs.python314} ${whisperModel}; } | sha256sum | cut -d' ' -f1)
|
||||
stampFile=$stageDir/provision.stamp
|
||||
|
||||
# Appends Nix's libstdc++/zlib to every ELF's RPATH. Not auto-patchelf: it
|
||||
# resolved the wheels' own vendored libs (av.libs) to absolute STAGING
|
||||
# paths, gone once the venv is copied into hermesHome — STT then failed
|
||||
# with "libavformat-….so: cannot open shared object file" (2026-10).
|
||||
# --force-rpath keeps DT_RPATH, which unlike DT_RUNPATH also covers the
|
||||
# vendored libs' own deps (libctranslate2 -> its bundled libgomp).
|
||||
add_nix_rpath() {
|
||||
find "$1" -type f -name '*.so*' -print0 | while IFS= read -r -d "" so; do
|
||||
patchelf --print-rpath "$so" >/dev/null 2>&1 || continue
|
||||
patchelf --force-rpath --add-rpath ${pkgs.lib.replaceStrings [ " " ] [ ":" ] kittenttsRuntimeLibs} "$so"
|
||||
done
|
||||
}
|
||||
|
||||
# Idempotent early exit: stamp matches the full input hash, staging venv
|
||||
# validated, delivered copy intact check runs below.
|
||||
if [ -f "$stampFile" ] && [ "$(cat "$stampFile")" = "$inputHash" ] \
|
||||
&& [ -x "$stageVenv/bin/python" ] \
|
||||
&& [ -x "$stageStt/bin/python" ] \
|
||||
&& [ -f "$stageSnap/config.json" ]; then
|
||||
# Delivered artifacts in hermesHome must ALSO match the staging copy:
|
||||
# luna can rewrite her copy, that's fine — but then the missing file
|
||||
# forces a re-provision (cheap copy, not a rebuild) so deletions
|
||||
# cannot wedge the gateway without a voice.
|
||||
if [ -x "$venv/bin/python" ] \
|
||||
&& [ -x "$sttVenv/bin/python" ] \
|
||||
&& cmp -s "$stageSnap/config.json" "$snap/config.json" 2>/dev/null \
|
||||
&& cmp -s "$stageSnap/kitten_tts_mini_v0_8.onnx" "$snap/kitten_tts_mini_v0_8.onnx" 2>/dev/null \
|
||||
&& cmp -s "$stageSnap/voices.npz" "$snap/voices.npz" 2>/dev/null; then
|
||||
&& cmp -s "$stageSnap/voices.npz" "$snap/voices.npz" 2>/dev/null \
|
||||
&& cmp -s ${whisperModel}/model.bin \
|
||||
"${hermesHome}/kittentts-hf/hub/$whisperDir/snapshots/${whisperRev}/model.bin" 2>/dev/null; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
@@ -724,16 +751,13 @@ in
|
||||
|| ! [ -x "$stageVenv/bin/python" ] \
|
||||
|| ! [ -f "$stageVenv/lib/python3.13/site-packages/kitten_tts_stub.py" ]; then
|
||||
rm -rf "$stageVenv"
|
||||
UV_CACHE_DIR=$stageDir/uv-cache \
|
||||
uv venv "$stageVenv" --python ${pkgs.python313}/bin/python3 --quiet
|
||||
UV_CACHE_DIR=$stageDir/uv-cache \
|
||||
uv pip install --python "$stageVenv/bin/python" --quiet \
|
||||
--requirement ${kittenttsReqs}
|
||||
uv venv "$stageVenv" --python ${pkgs.python313}/bin/python3 --quiet
|
||||
uv pip install --python "$stageVenv/bin/python" --quiet \
|
||||
--requirement ${kittenttsReqs}
|
||||
# kittentts --no-deps: its overlay of spacy/misaki[en] is what drags in
|
||||
# the CUDA tree; the requirements freeze already covers its real needs.
|
||||
UV_CACHE_DIR=$stageDir/uv-cache \
|
||||
uv pip install --python "$stageVenv/bin/python" --quiet --no-deps \
|
||||
${kittenttsWheelFile}
|
||||
uv pip install --python "$stageVenv/bin/python" --quiet --no-deps \
|
||||
${kittenttsWheelFile}
|
||||
|
||||
# Dead-import shim: .pth auto-loads kitten_tts_stub at interpreter
|
||||
# start so `from misaki import en, espeak` resolves without the real
|
||||
@@ -744,17 +768,18 @@ in
|
||||
|
||||
# PyPI manylinux .so's (numpy, onnxruntime) need libstdc++, which the
|
||||
# Nix loader never finds, on the host or in the container.
|
||||
auto-patchelf --paths "$stageVenv" --libs ${kittenttsRuntimeLibs}
|
||||
add_nix_rpath "$stageVenv"
|
||||
fi
|
||||
|
||||
# STT add-on: faster-whisper into the SAME venv (shares the
|
||||
# numpy/onnxruntime pins; see kittentts/stt-requirements.txt).
|
||||
UV_CACHE_DIR=$stageDir/uv-cache \
|
||||
uv pip install --python "$stageVenv/bin/python" --quiet \
|
||||
--requirement ${kittenttsSttReqs}
|
||||
# av's bundled ffmpeg libs also need the stdc++/zlib link (already
|
||||
# covered by the auto-patchelf pass above — rerun it so the newly
|
||||
# installed ctranslate2/av binaries get RPATHs too).
|
||||
auto-patchelf --paths "$stageVenv" --libs ${kittenttsRuntimeLibs}
|
||||
# STT venv on the image's Python; the KittenTTS freeze as constraints keeps
|
||||
# the shared numpy/onnxruntime/tokenizers pins.
|
||||
if [ "$(cat "$stampFile" 2>/dev/null)" != "$inputHash" ] \
|
||||
|| ! [ -x "$stageStt/bin/python" ]; then
|
||||
rm -rf "$stageStt"
|
||||
uv venv "$stageStt" --python ${pkgs.python314}/bin/python3 --quiet
|
||||
uv pip install --python "$stageStt/bin/python" --quiet \
|
||||
--requirement ${kittenttsSttReqs} --constraint ${kittenttsReqs}
|
||||
add_nix_rpath "$stageStt"
|
||||
fi
|
||||
|
||||
# Stage the full delivered hub tree (exact hf_hub_download layout:
|
||||
@@ -768,6 +793,12 @@ in
|
||||
# No blobs/ indirection: kittentts reads paths RETURNED by
|
||||
# hf_hub_download, which serves the resolved snapshot file directly
|
||||
# (prefer-dir layout works offline for fully-materialized files).
|
||||
stageWhisper=$stageHub/hub/$whisperDir
|
||||
mkdir -p "$stageWhisper/refs" "$stageWhisper/snapshots/${whisperRev}"
|
||||
printf '%s' "${whisperRev}" > "$stageWhisper/refs/main"
|
||||
for f in config.json model.bin tokenizer.json vocabulary.txt; do
|
||||
install -m 0444 ${whisperModel}/$f "$stageWhisper/snapshots/${whisperRev}/$f"
|
||||
done
|
||||
|
||||
# Root-side sanity: the staged interpreter must construct the model
|
||||
# END-TO-END offline (review2 minor — import alone doesn't exercise
|
||||
@@ -778,6 +809,8 @@ in
|
||||
PHONEMIZER_ESPEAK_LIBRARY="$("$stageVenv/bin/python" -c 'import espeakng_loader,pathlib;print(pathlib.Path(espeakng_loader.get_library_path()))')" \
|
||||
PHONEMIZER_ESPEAK_DATA_PATH="$("$stageVenv/bin/python" -c 'import espeakng_loader,pathlib;print(pathlib.Path(espeakng_loader.get_data_path()))')" \
|
||||
"$stageVenv/bin/python" -c 'from kittentts import KittenTTS; KittenTTS("KittenML/kitten-tts-mini-0.8"); print("kittentts offline build ok")' >/dev/null
|
||||
HF_HOME=$stageHub HF_HUB_OFFLINE=1 \
|
||||
"$stageStt/bin/python" -c 'from faster_whisper import WhisperModel; WhisperModel("base", device="cpu", compute_type="int8")'
|
||||
|
||||
# ---- deliver AS THE CONTAINER USER (review2 #4): root never writes
|
||||
# into hermesHome, so no symlink race and no `chown` step. setpriv
|
||||
@@ -787,14 +820,21 @@ in
|
||||
setpriv --reuid=${hermesUid} --regid=${hermesGid} --clear-groups \
|
||||
${pkgs.runtimeShell} -c '
|
||||
set -eu
|
||||
rm -rf "$1" "$2"
|
||||
rm -rf "$1" "$2" "$5"
|
||||
cp -a "$3" "$1"
|
||||
cp -a "$4" "$2"
|
||||
cp -a "$6" "$5"
|
||||
# From the DELIVERED paths: the staging checks above passed while
|
||||
# STT was broken, because only the copy had lost its libraries.
|
||||
"$1/bin/python" -c "import numpy, onnxruntime"
|
||||
"$5/bin/python" -c "import faster_whisper, av, ctranslate2"
|
||||
' _ \
|
||||
"${hermesHome}/kittentts-venv" \
|
||||
"${hermesHome}/kittentts-hf" \
|
||||
"$stageVenv" \
|
||||
"$stageHub"
|
||||
"$stageHub" \
|
||||
"$sttVenv" \
|
||||
"$stageStt"
|
||||
|
||||
# Stamp LAST, root-owned outside hermesHome — luna can delete it (which
|
||||
# forces a cheap re-delivery on next boot), not tamper via symlink.
|
||||
|
||||
@@ -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" ];
|
||||
};
|
||||
}
|
||||
@@ -1,17 +1,11 @@
|
||||
# STT add-on pins for the KittenTTS side-venv on mars (faster-whisper CPU).
|
||||
# STT pins for mars's in-process faster-whisper venv (stt-venv).
|
||||
#
|
||||
# APPENDED to hosts/mars/kittentts/requirements.txt by the provisioning unit
|
||||
# (see hermes-agent.nix, KittenTTS section) so ONE venv covers the entire
|
||||
# local-audio stack: TTS (KittenTTS) + STT (faster-whisper). Shares the
|
||||
# numpy/onnxruntime pins already frozen there — no version conflicts.
|
||||
# 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.
|
||||
#
|
||||
# faster-whisper runs CTranslate2 on CPU; the tiny/base model (~150 MB)
|
||||
# downloads once from the HF hub then works fully offline. Validated
|
||||
# 2026-09-19 with a live Telegram voice note transcribed on i5-4460 CPU.
|
||||
#
|
||||
# NOTE on av: PyP AV 18.x needs libz/libstdc++ from the host. On NixOS those
|
||||
# come via the nix store — the provisioning unit exports LD_LIBRARY_PATH with
|
||||
# them at runtime (see hermes-agent.nix's kittenttsLDLibraryPath).
|
||||
# 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
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
@@ -56,6 +56,15 @@
|
||||
"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}
|
||||
|
||||
@@ -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) ----
|
||||
|
||||
@@ -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,23 +12,19 @@ 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/claude-desktop.nix
|
||||
../../services/desktop/librechat.nix
|
||||
../../profiles/workstation.nix
|
||||
../../services/desktop/luna-voice.nix
|
||||
../../services/dev/turtle-beach-re.nix
|
||||
inputs.turtle-beach-swarm-re.nixosModules.release
|
||||
../../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
|
||||
];
|
||||
|
||||
# Swarm leaves the KB7 in host control after a warm reboot from Windows.
|
||||
services.turtle-beach-release.enable = true;
|
||||
|
||||
# tbctl CLI + GUI + tbd daemon/agent for the KB7/KP7/Kone II Air.
|
||||
services.tbctl = {
|
||||
enable = true;
|
||||
@@ -38,8 +34,36 @@ in
|
||||
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
|
||||
# hosts/terra/home/hyprland.nix for the push-to-talk binds.
|
||||
# home/desktop/hyprland.nix for the push-to-talk binds.
|
||||
homelab.lunaVoice = {
|
||||
enable = true;
|
||||
hermesKeyFile = config.sops.secrets.hermes_api_server_key.path;
|
||||
@@ -81,91 +105,69 @@ in
|
||||
'';
|
||||
};
|
||||
|
||||
# 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";
|
||||
|
||||
homelab.greeter = {
|
||||
monitors = config.home-manager.users.darman.wayland.windowManager.hyprland.settings.monitor;
|
||||
primaryOutput = "DP-2";
|
||||
defaultUser = "darman";
|
||||
keyboardLayout = "de";
|
||||
};
|
||||
|
||||
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"; }
|
||||
{ appId = "md.obsidian.Obsidian"; 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
|
||||
'';
|
||||
};
|
||||
|
||||
# run0 waits on systemd over D-Bus, whose 25s default call timeout runs out
|
||||
# while the polkit dialog is still open (slow typing, a vault lookup).
|
||||
# Scoped to run0 so a hung systemctl doesn't also wait 5min.
|
||||
programs.zsh.shellAliases.run0 = "SYSTEMD_BUS_TIMEOUT=5min run0";
|
||||
|
||||
# ---- 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;
|
||||
|
||||
# JetBrains IDEs installed via Toolbox bundle a JBR that aborts with
|
||||
# `libX11.so.6: cannot open shared object file` under the default (X11-less)
|
||||
# nix-ld set. Additive — merges with the module's own base list (zlib etc).
|
||||
programs.nix-ld.libraries = with pkgs; [
|
||||
freetype
|
||||
fontconfig
|
||||
libGL
|
||||
libxkbcommon
|
||||
wayland
|
||||
libsecret
|
||||
libx11
|
||||
libxext
|
||||
libxi
|
||||
libxrender
|
||||
libxtst
|
||||
libxcursor
|
||||
libxrandr
|
||||
libxinerama
|
||||
libxcb
|
||||
icu
|
||||
];
|
||||
|
||||
# NixOS only ships /bin/sh; envfs serves /bin and /usr/bin from PATH so
|
||||
# third-party scripts hardcoding `#!/bin/bash` (e.g. JetBrains Toolbox's
|
||||
# generated launchers) still resolve.
|
||||
services.envfs.enable = true;
|
||||
|
||||
# ---- home-manager (user-level config for darman) ----
|
||||
# Base settings + shared zsh baseline live in common.nix + home/common.nix
|
||||
# (every host); this layers terra's desktop profile on top (imports merge).
|
||||
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;
|
||||
|
||||
# Lets `nix build` target mercury (aarch64) from here — 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 — host user needs render group for
|
||||
# rootless podman GPU containers (Vulkan whisper.cpp/llama.cpp).
|
||||
users.users.darman.extraGroups = [ "render" "video" ];
|
||||
|
||||
# ---- 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";
|
||||
@@ -178,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";
|
||||
}
|
||||
|
||||
@@ -4,29 +4,17 @@
|
||||
# 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.
|
||||
# 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.
|
||||
@@ -38,9 +26,4 @@
|
||||
# files; see CLAUDE.md.
|
||||
sops.secrets.hermes_api_server_key.owner = "darman";
|
||||
sops.secrets.elevenlabs_api_key.owner = "darman";
|
||||
|
||||
sops.secrets.librechat_creds_key = { };
|
||||
sops.secrets.librechat_creds_iv = { };
|
||||
sops.secrets.librechat_jwt_secret = { };
|
||||
sops.secrets.librechat_jwt_refresh_secret = { };
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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 |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<path d="M10 4 H22 L20 6.5 H17.5 V25.5 H20 L22 28 H10 L12 25.5 H14.5 V6.5 H12 Z" fill="#0a0a0a" stroke="#e8722a" stroke-width="1.3"/>
|
||||
<path d="M16 9 V23" stroke="#858585" stroke-width="1"/>
|
||||
<rect x="15.2" y="15.2" width="1.6" height="1.6" fill="#e8722a"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 347 B |
@@ -0,0 +1,11 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<path d="M5 9 H24 L27 12 V23 H8 L5 20 Z" fill="#0a0a0a" stroke="#858585" stroke-width="1.1"/>
|
||||
<path d="M25 8 H28 V11 Z M4 21 V24 H7 Z" fill="#e8722a"/>
|
||||
<g stroke-width="0.6">
|
||||
<rect x="8.2" y="13.5" width="2.4" height="6" fill="#e8722a"/>
|
||||
<rect x="11.8" y="13.5" width="2.4" height="6" fill="#e8722a"/>
|
||||
<rect x="15.4" y="13.5" width="2.4" height="6" fill="#e8722a"/>
|
||||
<rect x="19" y="13.5" width="2.4" height="6" fill="rgba(222,222,222,.06)" stroke="rgba(222,222,222,.18)"/>
|
||||
<rect x="22.6" y="13.5" width="2.4" height="6" fill="rgba(222,222,222,.06)" stroke="rgba(222,222,222,.18)"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 678 B |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<path d="M18.5 20.6 L20.6 18.5 L28.5 26.4 L26.4 28.5 Z" fill="#0a0a0a" stroke="#858585" stroke-width="1.1"/>
|
||||
<path d="M21.5 23.6 L23.6 21.5 M23.5 25.6 L25.6 23.5" stroke="#e8722a" stroke-width="1"/>
|
||||
<path d="M10 3 H17 L22 8 V15 L17 20 H10 L5 15 V8 Z" fill="#0a0a0a" stroke="#e8722a" stroke-width="1.3"/>
|
||||
<path d="M12.8 8.2 H14.2 V10.8 H16.8 V12.2 H14.2 V14.8 H12.8 V12.2 H10.2 V10.8 H12.8 Z" fill="#e8722a"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 500 B |
@@ -0,0 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
<path d="M18.5 20.6 L20.6 18.5 L28.5 26.4 L26.4 28.5 Z" fill="#0a0a0a" stroke="#858585" stroke-width="1.1"/>
|
||||
<path d="M21.5 23.6 L23.6 21.5 M23.5 25.6 L25.6 23.5" stroke="#e8722a" stroke-width="1"/>
|
||||
<path d="M10 3 H17 L22 8 V15 L17 20 H10 L5 15 V8 Z" fill="#0a0a0a" stroke="#e8722a" stroke-width="1.3"/>
|
||||
<rect x="10.2" y="10.8" width="6.6" height="1.4" fill="#e8722a"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 461 B |
@@ -0,0 +1,229 @@
|
||||
{ lib, stdenvNoCC, gtk3, baseTheme }:
|
||||
|
||||
# HyprChrome folders, drawn as the first artboard of the "HyprChrome Folders"
|
||||
# design canvas (claude.ai/artifact/W2jmmhXLUzt2isUpGEraB6): 20 folder icons on
|
||||
# a 32px grid in its two finishes, each shipped as its own theme. Only folders
|
||||
# are drawn; everything else comes from baseTheme via Inherits=.
|
||||
let
|
||||
accent = "#e8722a";
|
||||
accentHot = "#ff6b4a";
|
||||
|
||||
# LIT: accent tab over a selection-grey hull, accent emblems.
|
||||
# SOLID: accent hull, surface-ink emblems.
|
||||
themes = {
|
||||
"HyprChrome-Folders" = acc: {
|
||||
inherit acc;
|
||||
tab = acc; hull = "#1a1c1f"; seam = ''stroke="#dedede" stroke-opacity="0.12"'';
|
||||
ink = acc; sub = ''stroke="#858585"''; hole = "#1a1c1f";
|
||||
};
|
||||
"HyprChrome-Folders-Solid" = acc: {
|
||||
inherit acc;
|
||||
tab = "#292c30"; hull = acc; seam = ''stroke="#0a0a0a" stroke-opacity="0.35"'';
|
||||
ink = "#0a0a0a"; sub = ''stroke="#0a0a0a" stroke-opacity="0.5"''; hole = acc;
|
||||
};
|
||||
};
|
||||
|
||||
bases = {
|
||||
closed = f: ''
|
||||
<path d="M3 5 H11.5 L13.5 7 H21 L23 9 V11 H3 Z" fill="${f.tab}" stroke="#0a0a0a" stroke-width="0.8"/>
|
||||
<path d="M3 10 H25 L29 14 V27 H7 L3 23 Z" fill="${f.hull}" stroke="#0a0a0a" stroke-width="0.8"/>
|
||||
<path d="M3.6 13 H27.4" ${f.seam} stroke-width="0.8"/>
|
||||
<path d="M25.9 9.1 H29.9 V13.1 Z M2.1 23.9 V27.9 H6.1 Z" fill="${f.acc}"/>
|
||||
'';
|
||||
open = f: ''
|
||||
<path d="M3 9 H25 L29 13 V27 H7 L3 23 Z" fill="#292c30" stroke="#0a0a0a" stroke-width="0.8"/>
|
||||
<path d="M3 5 H11.5 L13.5 7 H21 L23 9 V11 H3 Z" fill="${f.tab}" stroke="#0a0a0a" stroke-width="0.8"/>
|
||||
<path d="M5.25 8.5 H20.5 V24 H5.25 Z" fill="#dedede" stroke="#0a0a0a" stroke-width="0.6"/>
|
||||
<path d="M7.75 10.6 H16.5" stroke="#858585" stroke-width="0.9"/>
|
||||
<path d="M3 13 H25 L29 17 V27 H7 L3 23 Z" fill="${f.hull}" stroke="#0a0a0a" stroke-width="0.8"/>
|
||||
<path d="M3.6 16 H27.4" ${f.seam} stroke-width="0.8"/>
|
||||
<path d="M25.85 8.15 H29.85 V12.15 Z M2.15 23.85 V27.85 H6.15 Z" fill="${f.acc}"/>
|
||||
'';
|
||||
};
|
||||
|
||||
# the canvas's k / kf / sb / hl classes
|
||||
paint = f: {
|
||||
k = ''fill="none" stroke="${f.ink}"'';
|
||||
kf = ''fill="${f.ink}"'';
|
||||
sb = ''fill="none" ${f.sub}'';
|
||||
hl = ''fill="${f.hole}"'';
|
||||
};
|
||||
|
||||
can = p: ''
|
||||
<path ${p.k} d="M11.5 16.3 H20.5" stroke-width="1.4"/>
|
||||
<path ${p.k} d="M14.5 16 V15 H17.5 V16" stroke-width="1"/>
|
||||
<path ${p.k} d="M12.8 17.8 H19.2 V24.5 H13.8 L12.8 23.5 Z" stroke-width="1.2"/>
|
||||
'';
|
||||
|
||||
emblems = {
|
||||
none = p: "";
|
||||
homelab = p: ''
|
||||
<path ${p.k} d="M11.5 15 H20.5 V24.5 H11.5 Z" stroke-width="1.2"/>
|
||||
<path ${p.k} d="M11.5 18.2 H20.5 M11.5 21.4 H20.5" stroke-width="1"/>
|
||||
<rect ${p.kf} x="12.8" y="16" width="1.6" height="1.3"/>
|
||||
<rect ${p.kf} x="12.8" y="19.2" width="1.6" height="1.3"/>
|
||||
<rect ${p.kf} x="12.8" y="22.4" width="1.6" height="1.3"/>
|
||||
<path ${p.sb} d="M15.6 16.6 H19.2 M15.6 19.8 H19.2 M15.6 23 H17.4" stroke-width="0.9"/>
|
||||
'';
|
||||
home = p: ''
|
||||
<path ${p.k} d="M11.5 19.5 L16 15 L20.5 19.5 M13 18 V24 H19 V18" stroke-width="1.3"/>
|
||||
<rect ${p.kf} x="15.1" y="21" width="1.8" height="3"/>
|
||||
'';
|
||||
desktop = p: ''
|
||||
<path ${p.k} d="M11.5 15.5 H20.5 V21.5 H11.5 Z" stroke-width="1.2"/>
|
||||
<path ${p.k} d="M16 21.5 V23.5 M13.5 24 H18.5" stroke-width="1.2"/>
|
||||
<path ${p.sb} d="M13 17.3 H16.5" stroke-width="0.9"/>
|
||||
<rect ${p.kf} x="17.6" y="18.4" width="1.6" height="1.6"/>
|
||||
'';
|
||||
documents = p: ''
|
||||
<path ${p.k} d="M12.5 15 H18 L20 17 V24.5 H12.5 Z" stroke-width="1.2"/>
|
||||
<path ${p.sb} d="M14.3 19 H18.2 M14.3 21 H18.2 M14.3 23 H16.5" stroke-width="0.9"/>
|
||||
'';
|
||||
download = p: ''
|
||||
<path ${p.k} d="M16 15 V21.5 M13 18.8 L16 21.8 L19 18.8" stroke-width="1.4"/>
|
||||
<rect ${p.kf} x="12.5" y="23" width="7" height="1.4"/>
|
||||
'';
|
||||
music = p: ''
|
||||
<path ${p.k} d="M14.3 17.2 L19.3 15.7 V22 M14.3 17.2 V23.5" stroke-width="1.2"/>
|
||||
<rect ${p.kf} x="11.9" y="22.5" width="2.8" height="2"/>
|
||||
<rect ${p.kf} x="16.9" y="21" width="2.8" height="2"/>
|
||||
'';
|
||||
pictures = p: ''
|
||||
<path ${p.k} d="M11.5 15.5 H20.5 V23.5 H11.5 Z" stroke-width="1.2"/>
|
||||
<path ${p.sb} d="M12.3 22.7 L15 19.5 L17 21.5 L18.2 20.3 L19.7 21.8" stroke-width="1"/>
|
||||
<rect ${p.kf} x="17.6" y="17" width="1.6" height="1.6"/>
|
||||
'';
|
||||
videos = p: ''
|
||||
<path ${p.k} d="M11.5 15.5 H20.5 V23.5 H11.5 Z" stroke-width="1.2"/>
|
||||
<path ${p.kf} d="M14.6 17.3 V21.7 L18.4 19.5 Z"/>
|
||||
<path ${p.sb} d="M12.6 17 V22 M19.4 17 V22" stroke-width="0.8" stroke-dasharray="1 1"/>
|
||||
'';
|
||||
templates = p: ''
|
||||
<path ${p.k} d="M12.5 15 H18 L20 17 V24.5 H12.5 Z" stroke-width="1.1" stroke-dasharray="1.4 1"/>
|
||||
<rect ${p.kf} x="14.3" y="18.6" width="3.6" height="1.3"/>
|
||||
<path ${p.sb} d="M14.3 21.6 H18.2" stroke-width="0.9"/>
|
||||
'';
|
||||
publicshare = p: ''
|
||||
<path ${p.sb} d="M13.2 19.7 L19 16.2 M13.2 19.7 L19 23.2" stroke-width="1"/>
|
||||
<rect ${p.kf} x="12" y="18.5" width="2.4" height="2.4"/>
|
||||
<rect ${p.kf} x="17.8" y="15" width="2.4" height="2.4"/>
|
||||
<rect ${p.kf} x="17.8" y="22" width="2.4" height="2.4"/>
|
||||
'';
|
||||
git = p: ''
|
||||
<path ${p.k} d="M13 16 V23.6 M19 16 V17.5 L13.5 23" stroke-width="1.3"/>
|
||||
<rect ${p.kf} x="11.8" y="14.8" width="2.4" height="2.4"/>
|
||||
<rect ${p.kf} x="11.8" y="22.6" width="2.4" height="2.4"/>
|
||||
<rect ${p.kf} x="17.8" y="14.8" width="2.4" height="2.4"/>
|
||||
'';
|
||||
projects = p: ''
|
||||
<path ${p.k} d="M12 16.5 L15 19.5 L12 22.5" stroke-width="1.5"/>
|
||||
<rect ${p.kf} x="16" y="21.8" width="4.5" height="1.5"/>
|
||||
'';
|
||||
remote = p: ''
|
||||
<path ${p.sb} d="M11.5 20.5 H14.5 V23.5 H11.5 Z M17.5 15.5 H20.5 V18.5 H17.5 Z" stroke-width="1"/>
|
||||
<path ${p.k} d="M14.5 22 H15.5 L19 18.5" stroke-width="1.3"/>
|
||||
<rect ${p.kf} x="12.4" y="21.4" width="1.2" height="1.2"/>
|
||||
<rect ${p.kf} x="18.4" y="16.4" width="1.2" height="1.2"/>
|
||||
'';
|
||||
saved-search = p: ''
|
||||
<path ${p.k} d="M14 15 H17 L18.5 16.5 V19.5 L17 21 H14 L12.5 19.5 V16.5 Z" stroke-width="1.3"/>
|
||||
<path ${p.k} d="M18 20.5 L20.5 23" stroke-width="2"/>
|
||||
'';
|
||||
locked = p: ''
|
||||
<path ${p.k} d="M14 19 V16.6 L15 15.6 H17 L18 16.6 V19" stroke-width="1.3"/>
|
||||
<rect ${p.kf} x="12.5" y="19" width="7" height="5.5"/>
|
||||
<rect ${p.hl} x="15.5" y="20.8" width="1" height="2"/>
|
||||
'';
|
||||
important = p: ''
|
||||
<path ${p.k} d="M16 15 L20.5 23.5 H11.5 Z" stroke-width="1.3" stroke-linejoin="miter"/>
|
||||
<rect ${p.kf} x="15.4" y="18.2" width="1.2" height="2.8"/>
|
||||
<rect ${p.kf} x="15.4" y="21.7" width="1.2" height="1.1"/>
|
||||
'';
|
||||
trash = p: can p + ''
|
||||
<path ${p.sb} d="M15 19.3 V23 M17 19.3 V23" stroke-width="0.9"/>
|
||||
'';
|
||||
trash-full = p: can p + ''
|
||||
<rect ${p.kf} x="14.2" y="19.2" width="1.4" height="3.9"/>
|
||||
<rect ${p.kf} x="16.4" y="19.2" width="1.4" height="3.9"/>
|
||||
'';
|
||||
};
|
||||
|
||||
# aliases: the other names apps (and baseTheme) use for the same folder, so
|
||||
# those don't fall through to baseTheme's own drawing.
|
||||
icons = {
|
||||
folder = { emblem = "none"; aliases = [ "inode-directory" "gtk-directory" "gnome-fs-directory" "gnome-folder" "stock_folder" ]; };
|
||||
folder-open = { base = "open"; emblem = "none"; aliases = [ "folder-drag-accept" "folder-visiting" "gnome-fs-directory-accept" ]; };
|
||||
folder-homelab = { emblem = "homelab"; };
|
||||
user-home = { emblem = "home"; aliases = [ "folder-home" "folder_home" "gnome-fs-home" ]; };
|
||||
user-desktop = { emblem = "desktop"; aliases = [ "folder-desktop" "gnome-fs-desktop" ]; };
|
||||
folder-documents = { emblem = "documents"; };
|
||||
folder-download = { emblem = "download"; aliases = [ "folder-downloads" ]; };
|
||||
folder-music = { emblem = "music"; };
|
||||
folder-pictures = { emblem = "pictures"; aliases = [ "folder-images" "folder-image" "folder-picture" ]; };
|
||||
folder-videos = { emblem = "videos"; aliases = [ "folder-video" ]; };
|
||||
folder-templates = { emblem = "templates"; };
|
||||
folder-publicshare = { emblem = "publicshare"; aliases = [ "folder-public" ]; };
|
||||
folder-git = { emblem = "git"; };
|
||||
folder-projects = { emblem = "projects"; aliases = [ "folder-development" ]; };
|
||||
folder-remote = { emblem = "remote"; aliases = [ "folder-network" ]; };
|
||||
folder-saved-search = { emblem = "saved-search"; };
|
||||
folder-locked = { emblem = "locked"; aliases = [ "folder-encrypted" ]; };
|
||||
folder-important = { emblem = "important"; hot = true; };
|
||||
user-trash = { emblem = "trash"; aliases = [ "trash-empty" "gnome-fs-trash-empty" ]; };
|
||||
user-trash-full = { emblem = "trash-full"; aliases = [ "gnome-fs-trash-full" ]; };
|
||||
};
|
||||
|
||||
svg = finish: name: { emblem, base ? "closed", hot ? false, ... }:
|
||||
let f = finish (if hot then accentHot else accent); in
|
||||
builtins.toFile "${name}.svg" ''
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">
|
||||
${bases.${base} f}${emblems.${emblem} (paint f)}</svg>
|
||||
'';
|
||||
|
||||
buildTheme = theme: finish: ''
|
||||
dir="$out/share/icons/${theme}"
|
||||
mkdir -p "$dir/places/scalable"
|
||||
cat > "$dir/index.theme" <<EOF
|
||||
[Icon Theme]
|
||||
Name=${theme}
|
||||
Comment=HyprChrome folders for terra, over ${baseTheme}
|
||||
Inherits=${baseTheme},hicolor
|
||||
Directories=places/scalable
|
||||
|
||||
[places/scalable]
|
||||
Context=Places
|
||||
Size=32
|
||||
MinSize=16
|
||||
MaxSize=512
|
||||
Type=Scalable
|
||||
EOF
|
||||
|
||||
${lib.concatStrings (lib.mapAttrsToList (name: icon: ''
|
||||
cp ${svg finish name icon} "$dir/places/scalable/${name}.svg"
|
||||
${lib.concatMapStrings (a: "ln -s ${name}.svg \"$dir/places/scalable/${a}.svg\"\n") (icon.aliases or [ ])}
|
||||
'') icons)}
|
||||
gtk-update-icon-cache --force "$dir"
|
||||
'';
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "hyprchrome-folders";
|
||||
version = "0.1";
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
nativeBuildInputs = [ gtk3 ];
|
||||
|
||||
# gtk3's setup hook strips icon-theme.cache from $out by default
|
||||
dontDropIconThemeCache = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
${lib.concatStrings (lib.mapAttrsToList buildTheme themes)}
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "HyprChrome folder icon themes (lit + solid finishes)";
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
# Mnemosyne memory provider for Hermes. Built here rather than pip-installed:
|
||||
# the image's Python has no pip and is PEP 668 managed.
|
||||
#
|
||||
# Core deps only: the embeddings extra (fastembed/onnxruntime) is optional at
|
||||
# runtime, and recall falls back to FTS5.
|
||||
{
|
||||
python3,
|
||||
fetchPypi,
|
||||
}:
|
||||
|
||||
let
|
||||
mnemosyneMemory = python3.pkgs.buildPythonPackage rec {
|
||||
pname = "mnemosyne-memory";
|
||||
version = "3.15.1";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchPypi {
|
||||
pname = "mnemosyne_memory";
|
||||
inherit version;
|
||||
hash = "sha256-lspUMxc0pUSkhSUrNdiiO5OJ1NMC/S853EYSanXtXKM=";
|
||||
};
|
||||
|
||||
build-system = with python3.pkgs; [ setuptools ];
|
||||
dependencies = with python3.pkgs; [ pyyaml ];
|
||||
|
||||
doCheck = false; # tests want a live Hermes + LLM key
|
||||
# Ships the Hermes plugin package too, not just the core.
|
||||
pythonImportsCheck = [
|
||||
"mnemosyne"
|
||||
"hermes_memory_provider"
|
||||
];
|
||||
};
|
||||
|
||||
mnemosyneHermes = python3.pkgs.buildPythonPackage rec {
|
||||
pname = "mnemosyne-hermes";
|
||||
version = "0.5.0";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchPypi {
|
||||
pname = "mnemosyne_hermes";
|
||||
inherit version;
|
||||
hash = "sha256-CzEvnUw5oPFtT5bHQQ/GBdy2C/E7qShQn32irIRYKqw=";
|
||||
};
|
||||
|
||||
build-system = with python3.pkgs; [ setuptools ];
|
||||
# Upstream asks for mnemosyne-memory[embeddings]; see the header.
|
||||
dependencies = [ mnemosyneMemory ] ++ (with python3.pkgs; [ pyyaml ]);
|
||||
|
||||
doCheck = false;
|
||||
pythonImportsCheck = [ "mnemosyne_hermes" ];
|
||||
};
|
||||
in
|
||||
python3.withPackages (_: [
|
||||
mnemosyneMemory
|
||||
mnemosyneHermes
|
||||
])
|
||||
@@ -0,0 +1,16 @@
|
||||
{ lib, rustPlatform }:
|
||||
|
||||
# Wiring (user, socket, policy, secrets) lives in services/identity/pass-broker.nix.
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "pass-broker";
|
||||
version = "0.1.0";
|
||||
|
||||
src = ./pass-broker;
|
||||
cargoLock.lockFile = ./pass-broker/Cargo.lock;
|
||||
|
||||
meta = {
|
||||
description = "Telegram-approved access to a Proton Pass agent session";
|
||||
mainProgram = "pass-broker";
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
[package]
|
||||
name = "pass-broker"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
axum = { version = "0.8", default-features = false, features = ["http1", "json", "query", "tokio"] }
|
||||
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
sha2 = "0.10"
|
||||
tokio = { version = "1", features = ["rt-multi-thread", "macros", "net", "sync", "time", "process", "io-util"] }
|
||||
|
||||
[profile.release]
|
||||
opt-level = 2
|
||||
@@ -0,0 +1,128 @@
|
||||
use crate::config::ApprovalConfig;
|
||||
use crate::telegram::{Telegram, Verdict};
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use serde_json::{json, Value};
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
/// Shows a prompt and waits for its verdict: via this broker's own bot, or
|
||||
/// via the gateway that owns the shared one.
|
||||
pub enum Approver {
|
||||
Direct { tg: Telegram, host: String },
|
||||
Gateway(GatewayClient),
|
||||
}
|
||||
|
||||
pub struct GatewayClient {
|
||||
http: reqwest::Client,
|
||||
url: String,
|
||||
token: String,
|
||||
}
|
||||
|
||||
impl Approver {
|
||||
pub fn new(cfg: &ApprovalConfig, host: &str) -> Result<Self> {
|
||||
Ok(match cfg {
|
||||
ApprovalConfig::Telegram(t) => {
|
||||
Approver::Direct { tg: Telegram::new(t)?, host: host.to_string() }
|
||||
}
|
||||
ApprovalConfig::Gateway(g) => Approver::Gateway(GatewayClient {
|
||||
http: reqwest::Client::builder().timeout(Duration::from_secs(40)).build()?,
|
||||
url: g.url.trim_end_matches('/').to_string(),
|
||||
token: std::fs::read_to_string(&g.token_file)
|
||||
.with_context(|| format!("reading {}", g.token_file.display()))?
|
||||
.trim()
|
||||
.to_string(),
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
/// `body` is the prompt without its "🔑 host:" header; the gateway adds
|
||||
/// that itself, from the token.
|
||||
pub async fn ask(
|
||||
&self,
|
||||
body: &str,
|
||||
timeout: Duration,
|
||||
gone: Pin<&mut impl Future<Output = ()>>,
|
||||
) -> Result<Verdict> {
|
||||
match self {
|
||||
Approver::Direct { tg, host } => tg.ask(&format!("🔑 {host}: {body}"), timeout, gone).await,
|
||||
Approver::Gateway(g) => g.ask(body, timeout, gone).await,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl GatewayClient {
|
||||
async fn ask(
|
||||
&self,
|
||||
body: &str,
|
||||
timeout: Duration,
|
||||
mut gone: Pin<&mut impl Future<Output = ()>>,
|
||||
) -> Result<Verdict> {
|
||||
let resp: Value = self
|
||||
.http
|
||||
.post(format!("{}/ask", self.url))
|
||||
.bearer_auth(&self.token)
|
||||
.json(&json!({ "text": body, "timeout_secs": timeout.as_secs() }))
|
||||
.send()
|
||||
.await
|
||||
.and_then(|r| r.error_for_status())
|
||||
.map_err(|e| anyhow!("gateway: {}", e.without_url()))?
|
||||
.json()
|
||||
.await
|
||||
.map_err(|e| anyhow!("gateway: {}", e.without_url()))?;
|
||||
let id = resp["id"].as_str().ok_or_else(|| anyhow!("gateway returned no id"))?.to_string();
|
||||
|
||||
// The gateway expires the prompt itself; this only bounds a gateway
|
||||
// that stopped answering.
|
||||
let give_up = Instant::now() + timeout + Duration::from_secs(30);
|
||||
while Instant::now() < give_up {
|
||||
let polled = tokio::select! {
|
||||
biased;
|
||||
_ = gone.as_mut() => {
|
||||
let _ = self
|
||||
.http
|
||||
.delete(format!("{}/ask/{id}", self.url))
|
||||
.bearer_auth(&self.token)
|
||||
.send()
|
||||
.await;
|
||||
return Ok(Verdict::Cancelled);
|
||||
}
|
||||
r = self.status(&id) => r,
|
||||
};
|
||||
match polled {
|
||||
Ok(Some(v)) => return Ok(v),
|
||||
Ok(None) => {}
|
||||
Err(e) => {
|
||||
eprintln!("{e:#}");
|
||||
tokio::time::sleep(Duration::from_secs(2)).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(Verdict::Expired)
|
||||
}
|
||||
|
||||
/// None while pending.
|
||||
async fn status(&self, id: &str) -> Result<Option<Verdict>> {
|
||||
let resp = self
|
||||
.http
|
||||
.get(format!("{}/ask/{id}?wait=25", self.url))
|
||||
.bearer_auth(&self.token)
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| anyhow!("gateway: {}", e.without_url()))?;
|
||||
// A restarted gateway has forgotten the prompt.
|
||||
if resp.status() == reqwest::StatusCode::NOT_FOUND {
|
||||
return Ok(Some(Verdict::Expired));
|
||||
}
|
||||
let v: Value = resp
|
||||
.error_for_status()
|
||||
.map_err(|e| anyhow!("gateway: {}", e.without_url()))?
|
||||
.json()
|
||||
.await
|
||||
.map_err(|e| anyhow!("gateway: {}", e.without_url()))?;
|
||||
match v["status"].as_str() {
|
||||
Some("pending") => Ok(None),
|
||||
_ => Ok(Some(serde_json::from_value(v["status"].clone())?)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
use crate::proto::{Reply, Request, DEFAULT_SOCKET};
|
||||
use anyhow::Result;
|
||||
use std::time::Duration;
|
||||
use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};
|
||||
use tokio::net::UnixStream;
|
||||
|
||||
const FIRST_REPLY: Duration = Duration::from_secs(30);
|
||||
|
||||
/// Prints the value on stdout. Exit 1 = refused/failed, 2 = usage or no broker.
|
||||
pub async fn get(args: &[String]) -> Result<()> {
|
||||
let mut req = Request {
|
||||
vault: None,
|
||||
item: String::new(),
|
||||
field: "password".into(),
|
||||
reason: String::new(),
|
||||
};
|
||||
let mut it = args.iter();
|
||||
while let Some(flag) = it.next() {
|
||||
let Some(val) = it.next() else { usage() };
|
||||
match flag.as_str() {
|
||||
"--vault" => req.vault = Some(val.clone()),
|
||||
"--item" => req.item = val.clone(),
|
||||
"--field" => req.field = val.clone(),
|
||||
"--reason" => req.reason = val.clone(),
|
||||
_ => usage(),
|
||||
}
|
||||
}
|
||||
if req.item.is_empty() || req.reason.trim().is_empty() {
|
||||
usage();
|
||||
}
|
||||
|
||||
let path = std::env::var("PASS_BROKER_SOCKET").unwrap_or_else(|_| DEFAULT_SOCKET.into());
|
||||
let stream = match UnixStream::connect(&path).await {
|
||||
Ok(s) => s,
|
||||
Err(e) => {
|
||||
eprintln!("pass-broker: cannot reach {path}: {e}");
|
||||
std::process::exit(2);
|
||||
}
|
||||
};
|
||||
let (rd, mut wr) = stream.into_split();
|
||||
let mut line = serde_json::to_string(&req)?;
|
||||
line.push('\n');
|
||||
wr.write_all(line.as_bytes()).await?;
|
||||
|
||||
let mut lines = BufReader::new(rd).lines();
|
||||
// Bounds only the first reply: after Pending the daemon times the prompt
|
||||
// out itself. A crash-looping broker still accepts via the socket unit,
|
||||
// so without this the client would wait forever.
|
||||
let mut pending = false;
|
||||
loop {
|
||||
let next = if pending {
|
||||
lines.next_line().await?
|
||||
} else {
|
||||
match tokio::time::timeout(FIRST_REPLY, lines.next_line()).await {
|
||||
Ok(r) => r?,
|
||||
Err(_) => {
|
||||
eprintln!(
|
||||
"pass-broker: no answer within {}s; see journalctl -u pass-broker",
|
||||
FIRST_REPLY.as_secs()
|
||||
);
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
};
|
||||
let Some(line) = next else { break };
|
||||
match serde_json::from_str::<Reply>(&line)? {
|
||||
Reply::Pending { message } => {
|
||||
pending = true;
|
||||
eprintln!(">> pass-broker: {message}");
|
||||
}
|
||||
Reply::Ok { value } => {
|
||||
println!("{value}");
|
||||
return Ok(());
|
||||
}
|
||||
Reply::Error { error } => {
|
||||
eprintln!("pass-broker: {error}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
eprintln!("pass-broker: daemon closed the connection without an answer");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
fn usage() -> ! {
|
||||
eprintln!("{}", crate::USAGE);
|
||||
std::process::exit(2);
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
use anyhow::{bail, Context, Result};
|
||||
use serde::Deserialize;
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Written by services/identity/pass-broker.nix; path in $PASS_BROKER_CONFIG.
|
||||
#[derive(Deserialize)]
|
||||
pub struct Config {
|
||||
pub host: String,
|
||||
pub default_vault: String,
|
||||
/// Peer uids are checked against these; root is always allowed.
|
||||
pub allowed_users: Vec<String>,
|
||||
pub pass_cli: String,
|
||||
pub session_dir: PathBuf,
|
||||
pub pat_file: PathBuf,
|
||||
pub approval_timeout_secs: u64,
|
||||
pub approval: ApprovalConfig,
|
||||
/// First match wins; no match means deny.
|
||||
pub rules: Vec<Rule>,
|
||||
}
|
||||
|
||||
/// Who shows the prompt: this broker's own bot, or the shared gateway.
|
||||
#[derive(Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ApprovalConfig {
|
||||
Telegram(TelegramConfig),
|
||||
Gateway(GatewayClientConfig),
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct TelegramConfig {
|
||||
pub api_base: String,
|
||||
pub token_file: PathBuf,
|
||||
pub chat_id_file: PathBuf,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct GatewayClientConfig {
|
||||
pub url: String,
|
||||
pub token_file: PathBuf,
|
||||
}
|
||||
|
||||
/// Written by services/identity/pass-broker-gateway.nix; path in
|
||||
/// $PASS_BROKER_GATEWAY_CONFIG.
|
||||
#[derive(Deserialize)]
|
||||
pub struct GatewayConfig {
|
||||
pub listen: String,
|
||||
pub telegram: TelegramConfig,
|
||||
/// Hashes only: the gateway host never holds a broker's token.
|
||||
pub hosts: Vec<GatewayHost>,
|
||||
pub max_timeout_secs: u64,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct GatewayHost {
|
||||
pub name: String,
|
||||
pub token_sha256: String,
|
||||
}
|
||||
|
||||
pub fn load<T: serde::de::DeserializeOwned>(var: &str) -> Result<T> {
|
||||
let path = std::env::var(var).with_context(|| format!("{var} unset"))?;
|
||||
let text = std::fs::read_to_string(&path).with_context(|| format!("reading {path}"))?;
|
||||
serde_json::from_str(&text).with_context(|| format!("parsing {path}"))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Rule {
|
||||
pub vault: Option<String>,
|
||||
/// Item title; `*` matches any run of characters.
|
||||
pub item: String,
|
||||
pub approval: Approval,
|
||||
/// After an approval, further requests for the item skip the prompt for this long.
|
||||
pub grant_minutes: u64,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Copy, PartialEq, Debug)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Approval {
|
||||
Auto,
|
||||
Ask,
|
||||
Deny,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn load() -> Result<Self> {
|
||||
load("PASS_BROKER_CONFIG")
|
||||
}
|
||||
|
||||
pub fn rule_for(&self, vault: &str, item: &str) -> Option<&Rule> {
|
||||
self.rules.iter().find(|r| {
|
||||
r.vault.as_deref().unwrap_or(&self.default_vault) == vault && glob(&r.item, item)
|
||||
})
|
||||
}
|
||||
|
||||
/// Resolved once at startup: a user added later needs a broker restart.
|
||||
pub fn allowed_uids(&self) -> Result<Vec<u32>> {
|
||||
let passwd = std::fs::read_to_string("/etc/passwd")?;
|
||||
let mut uids = vec![0];
|
||||
for name in &self.allowed_users {
|
||||
let uid = passwd
|
||||
.lines()
|
||||
.map(|l| l.split(':').collect::<Vec<_>>())
|
||||
.find(|f| f.len() > 2 && f[0] == name)
|
||||
.and_then(|f| f[2].parse().ok());
|
||||
match uid {
|
||||
Some(uid) => uids.push(uid),
|
||||
None => bail!("allowed user {name:?} not in /etc/passwd"),
|
||||
}
|
||||
}
|
||||
Ok(uids)
|
||||
}
|
||||
}
|
||||
|
||||
fn glob(pat: &str, s: &str) -> bool {
|
||||
let parts: Vec<&str> = pat.split('*').collect();
|
||||
if parts.len() == 1 {
|
||||
return pat == s;
|
||||
}
|
||||
let (first, last) = (parts[0], parts[parts.len() - 1]);
|
||||
if !s.starts_with(first) || s.len() < first.len() + last.len() || !s.ends_with(last) {
|
||||
return false;
|
||||
}
|
||||
let mut rest = &s[first.len()..s.len() - last.len()];
|
||||
for mid in &parts[1..parts.len() - 1] {
|
||||
match rest.find(mid) {
|
||||
Some(i) => rest = &rest[i + mid.len()..],
|
||||
None => return false,
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::glob;
|
||||
|
||||
#[test]
|
||||
fn globs() {
|
||||
assert!(glob("root@*", "root@jupiter"));
|
||||
assert!(!glob("root@*", "darman@jupiter"));
|
||||
assert!(glob("*", ""));
|
||||
assert!(glob("a*b*c", "aXbYc"));
|
||||
assert!(!glob("a*b*c", "acb"));
|
||||
assert!(!glob("ab*ba", "aba"));
|
||||
assert!(glob("exact", "exact"));
|
||||
assert!(!glob("exact", "exact2"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
use crate::config::{Approval, Config};
|
||||
use crate::pass::Pass;
|
||||
use crate::proto::{Reply, Request};
|
||||
use crate::approver::Approver;
|
||||
use crate::telegram::Verdict;
|
||||
use anyhow::{bail, Context, Result};
|
||||
use std::collections::HashMap;
|
||||
use std::future::Future;
|
||||
use std::os::fd::FromRawFd;
|
||||
use std::pin::Pin;
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
use tokio::io::{AsyncBufReadExt, AsyncReadExt, AsyncWriteExt, BufReader};
|
||||
use tokio::net::unix::{OwnedReadHalf, OwnedWriteHalf};
|
||||
use tokio::net::{UnixListener, UnixStream};
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
struct State {
|
||||
cfg: Config,
|
||||
uids: Vec<u32>,
|
||||
pass: Pass,
|
||||
approver: Approver,
|
||||
/// "vault\0item" -> when the last approval stops covering it.
|
||||
grants: Mutex<HashMap<String, Instant>>,
|
||||
/// One prompt per host at a time; direct mode polls getUpdates in ask.
|
||||
asking: Mutex<()>,
|
||||
}
|
||||
|
||||
pub async fn run() -> Result<()> {
|
||||
let cfg = Config::load()?;
|
||||
let state = Arc::new(State {
|
||||
uids: cfg.allowed_uids()?,
|
||||
pass: Pass::new(&cfg),
|
||||
approver: Approver::new(&cfg.approval, &cfg.host)?,
|
||||
grants: Mutex::new(HashMap::new()),
|
||||
asking: Mutex::new(()),
|
||||
cfg,
|
||||
});
|
||||
// Not fatal: a stale PAT should show up in the journal, not stop the socket.
|
||||
if let Err(e) = state.pass.ensure_session().await {
|
||||
eprintln!("initial login failed: {e:#}");
|
||||
}
|
||||
|
||||
let listener = listener()?;
|
||||
eprintln!("pass-broker ready");
|
||||
loop {
|
||||
let (stream, _) = listener.accept().await?;
|
||||
let state = state.clone();
|
||||
tokio::spawn(async move {
|
||||
if let Err(e) = handle(state, stream).await {
|
||||
eprintln!("connection: {e:#}");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// From pass-broker.socket. The socket is 0666; access control is the peer
|
||||
/// uid check in handle(), so a new client needs no re-login for a group.
|
||||
fn listener() -> Result<UnixListener> {
|
||||
let ours = std::env::var("LISTEN_PID").ok() == Some(std::process::id().to_string());
|
||||
if !ours || std::env::var("LISTEN_FDS").ok().as_deref() != Some("1") {
|
||||
bail!("expected exactly one socket from systemd (pass-broker.socket)");
|
||||
}
|
||||
let l = unsafe { std::os::unix::net::UnixListener::from_raw_fd(3) };
|
||||
l.set_nonblocking(true)?;
|
||||
Ok(UnixListener::from_std(l)?)
|
||||
}
|
||||
|
||||
async fn handle(state: Arc<State>, stream: UnixStream) -> Result<()> {
|
||||
let cred = stream.peer_cred()?;
|
||||
let (mut rd, mut wr) = stream.into_split();
|
||||
// Read before refusing, or the client's write hits a closed socket and
|
||||
// it reports EPIPE instead of the reason.
|
||||
let mut line = String::new();
|
||||
BufReader::new((&mut rd).take(64 * 1024)).read_line(&mut line).await?;
|
||||
if !state.uids.contains(&cred.uid()) {
|
||||
eprintln!("refused uid {}", cred.uid());
|
||||
return send(&mut wr, Reply::Error { error: "uid not allowed".into() }).await;
|
||||
}
|
||||
|
||||
let req: Request = serde_json::from_str(&line).context("bad request")?;
|
||||
let vault = req.vault.clone().unwrap_or_else(|| state.cfg.default_vault.clone());
|
||||
// A client killed while queued (the broker restarting) leaves its request
|
||||
// in the socket; nobody would see the answer or know who asked.
|
||||
let who = match cred.pid().and_then(|pid| requester(pid, cred.uid())) {
|
||||
Some(who) if !closed(&rd) => who,
|
||||
_ => {
|
||||
eprintln!("dropped {vault}/{}: requester went away", req.item);
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
eprintln!(
|
||||
"request {vault}/{} ({}) reason={:?} by {}",
|
||||
req.item,
|
||||
req.field,
|
||||
req.reason,
|
||||
who.summary()
|
||||
);
|
||||
|
||||
let gone = client_gone(&rd);
|
||||
tokio::pin!(gone);
|
||||
let reply = match decide(&state, &mut wr, gone.as_mut(), &vault, &req, &who).await {
|
||||
Ok(()) if closed(&rd) => Reply::Error { error: "requester went away".into() },
|
||||
Ok(()) => {
|
||||
let reason = format!("{} (pass-broker on {})", req.reason, state.cfg.host);
|
||||
match state.pass.get(&vault, &req.item, &req.field, &reason).await {
|
||||
Ok(value) => Reply::Ok { value },
|
||||
Err(e) => Reply::Error { error: format!("{e:#}") },
|
||||
}
|
||||
}
|
||||
Err(e) => Reply::Error { error: format!("{e:#}") },
|
||||
};
|
||||
match &reply {
|
||||
Reply::Ok { .. } => eprintln!("served {vault}/{}", req.item),
|
||||
Reply::Error { error } => eprintln!("refused {vault}/{}: {error}", req.item),
|
||||
Reply::Pending { .. } => {}
|
||||
}
|
||||
if closed(&rd) {
|
||||
return Ok(());
|
||||
}
|
||||
send(&mut wr, reply).await
|
||||
}
|
||||
|
||||
async fn decide(
|
||||
state: &State,
|
||||
wr: &mut OwnedWriteHalf,
|
||||
mut gone: Pin<&mut impl Future<Output = ()>>,
|
||||
vault: &str,
|
||||
req: &Request,
|
||||
who: &Requester,
|
||||
) -> Result<()> {
|
||||
let Some(rule) = state.cfg.rule_for(vault, &req.item) else {
|
||||
bail!("no rule allows {vault}/{}", req.item);
|
||||
};
|
||||
match rule.approval {
|
||||
Approval::Deny => bail!("policy denies {vault}/{}", req.item),
|
||||
Approval::Auto => return Ok(()),
|
||||
Approval::Ask => {}
|
||||
}
|
||||
|
||||
let key = format!("{vault}\0{}", req.item);
|
||||
let granted = |grants: &HashMap<String, Instant>| grants.get(&key).is_some_and(|t| *t > Instant::now());
|
||||
if granted(&*state.grants.lock().await) {
|
||||
eprintln!("covered by an earlier approval");
|
||||
return Ok(());
|
||||
}
|
||||
// Before the lock, so a client queued behind another prompt hears from us.
|
||||
let _ = send(wr, Reply::Pending { message: "waiting for approval on Telegram".into() }).await;
|
||||
// Biased: a client that already hung up must lose even to a free lock,
|
||||
// or it would get a prompt.
|
||||
let _asking = tokio::select! {
|
||||
biased;
|
||||
_ = gone.as_mut() => bail!("requester went away"),
|
||||
guard = state.asking.lock() => guard,
|
||||
};
|
||||
// A concurrent request for the same item may have been approved meanwhile.
|
||||
if granted(&*state.grants.lock().await) {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let grant = match rule.grant_minutes {
|
||||
0 => "Approves this request only.".to_string(),
|
||||
n => format!("Approving covers further requests for {n} min."),
|
||||
};
|
||||
let body = format!(
|
||||
"{vault} / {item} ({field})\nReason: {reason}\nBy: {by}\nCommand: {command}\nChain: {chain}\n{grant}",
|
||||
item = req.item,
|
||||
field = req.field,
|
||||
reason = req.reason,
|
||||
by = who.who,
|
||||
command = who.command,
|
||||
chain = who.chain,
|
||||
);
|
||||
let timeout = Duration::from_secs(state.cfg.approval_timeout_secs);
|
||||
match state.approver.ask(&body, timeout, gone).await? {
|
||||
Verdict::Approved => {
|
||||
if rule.grant_minutes > 0 {
|
||||
let until = Instant::now() + Duration::from_secs(rule.grant_minutes * 60);
|
||||
state.grants.lock().await.insert(key, until);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
Verdict::Denied => bail!("denied on Telegram"),
|
||||
Verdict::Expired => bail!("no answer on Telegram within {}s", timeout.as_secs()),
|
||||
Verdict::Cancelled => bail!("requester went away"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Resolves once the client hangs up. It sends nothing after its request, so
|
||||
/// readable means EOF; stray bytes are discarded.
|
||||
async fn client_gone(rd: &OwnedReadHalf) {
|
||||
while rd.readable().await.is_ok() {
|
||||
if closed(rd) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn closed(rd: &OwnedReadHalf) -> bool {
|
||||
match rd.try_read(&mut [0u8; 64]) {
|
||||
Ok(0) => true,
|
||||
Ok(_) => false,
|
||||
Err(e) => e.kind() != std::io::ErrorKind::WouldBlock,
|
||||
}
|
||||
}
|
||||
|
||||
async fn send(wr: &mut OwnedWriteHalf, reply: Reply) -> Result<()> {
|
||||
let mut line = serde_json::to_string(&reply)?;
|
||||
line.push('\n');
|
||||
wr.write_all(line.as_bytes()).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Who is asking, for the prompt and the journal. A hint, not identity: any
|
||||
/// process of the same uid can make itself look like anything.
|
||||
struct Requester {
|
||||
/// "darman via Claude Code", "darman via foot", …
|
||||
who: String,
|
||||
/// The client's parent, i.e. the caller (the client is `pass-broker get`).
|
||||
command: String,
|
||||
chain: String,
|
||||
}
|
||||
|
||||
impl Requester {
|
||||
fn summary(&self) -> String {
|
||||
format!("{} [{}] chain: {}", self.who, self.command, self.chain)
|
||||
}
|
||||
}
|
||||
|
||||
/// None when the client has already exited.
|
||||
fn requester(pid: i32, uid: u32) -> Option<Requester> {
|
||||
let client = stat(pid)?;
|
||||
let command = std::fs::read(format!("/proc/{}/cmdline", client.ppid))
|
||||
.map(|b| {
|
||||
let s = String::from_utf8_lossy(&b);
|
||||
let args: Vec<&str> = s.split('\0').filter(|a| !a.is_empty()).map(short_path).collect();
|
||||
truncate(&args.join(" "), 200)
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
let mut ancestors = vec![];
|
||||
let mut p = client.ppid;
|
||||
while p > 1 && ancestors.len() < 12 {
|
||||
let Some(s) = stat(p) else { break };
|
||||
let comm = std::fs::read_to_string(format!("/proc/{p}/comm")).unwrap_or_default();
|
||||
ancestors.push((comm.trim().to_string(), s.tty));
|
||||
p = s.ppid;
|
||||
}
|
||||
|
||||
// Claude Code's own process is `claude`. Otherwise the origin is whatever
|
||||
// holds the terminal: the first ancestor without a tty (foot, sshd-session,
|
||||
// the desktop app's terminal panel).
|
||||
let via = if ancestors.iter().any(|(c, _)| c == "claude") {
|
||||
"Claude Code".to_string()
|
||||
} else if client.tty == 0 {
|
||||
"no terminal".to_string()
|
||||
} else {
|
||||
match ancestors.iter().find(|(_, tty)| *tty == 0).map(|(c, _)| c.as_str()) {
|
||||
Some("claude-desktop") => "Claude desktop's terminal".to_string(),
|
||||
Some(c) => c.to_string(),
|
||||
None => "unknown".to_string(),
|
||||
}
|
||||
};
|
||||
|
||||
let chain = ancestors.iter().take(8).map(|(c, _)| c.as_str()).collect::<Vec<_>>().join(" ← ");
|
||||
Some(Requester { who: format!("{} via {via}", user_name(uid)), command, chain })
|
||||
}
|
||||
|
||||
struct Stat {
|
||||
ppid: i32,
|
||||
tty: i32,
|
||||
}
|
||||
|
||||
fn stat(pid: i32) -> Option<Stat> {
|
||||
let stat = std::fs::read_to_string(format!("/proc/{pid}/stat")).ok()?;
|
||||
// comm may contain spaces and parens; fields resume after the last ')':
|
||||
// state ppid pgrp session tty_nr …
|
||||
let f: Vec<&str> = stat.rsplit_once(')')?.1.split_whitespace().collect();
|
||||
Some(Stat { ppid: f.get(1)?.parse().ok()?, tty: f.get(4)?.parse().ok()? })
|
||||
}
|
||||
|
||||
fn user_name(uid: u32) -> String {
|
||||
std::fs::read_to_string("/etc/passwd")
|
||||
.ok()
|
||||
.and_then(|p| {
|
||||
p.lines().find_map(|l| {
|
||||
let f: Vec<&str> = l.split(':').collect();
|
||||
(f.len() > 2 && f[2] == uid.to_string()).then(|| f[0].to_string())
|
||||
})
|
||||
})
|
||||
.unwrap_or_else(|| format!("uid {uid}"))
|
||||
}
|
||||
|
||||
/// `/nix/store/…-bash-5.3/bin/bash` and profile paths down to `bash`.
|
||||
fn short_path(arg: &str) -> &str {
|
||||
const PREFIXES: [&str; 4] = ["/nix/store/", "/run/current-system/", "/run/wrappers/", "/etc/profiles/"];
|
||||
if PREFIXES.iter().any(|p| arg.starts_with(p)) && arg.contains("/bin/") {
|
||||
arg.rsplit('/').next().unwrap_or(arg)
|
||||
} else {
|
||||
arg
|
||||
}
|
||||
}
|
||||
|
||||
fn truncate(s: &str, max: usize) -> String {
|
||||
match s.char_indices().nth(max) {
|
||||
Some((i, _)) => format!("{}…", &s[..i]),
|
||||
None => s.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::short_path;
|
||||
|
||||
#[test]
|
||||
fn short_paths() {
|
||||
assert_eq!(short_path("/nix/store/abc-bash-interactive-5.3p9/bin/bash"), "bash");
|
||||
assert_eq!(short_path("/run/current-system/sw/bin/try-get"), "try-get");
|
||||
assert_eq!(short_path("/run/wrappers/bin/sudo"), "sudo");
|
||||
assert_eq!(short_path("/nix/store/abc-config.json"), "/nix/store/abc-config.json");
|
||||
assert_eq!(short_path("./scripts/deploy"), "./scripts/deploy");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
//! `pass-broker gateway`: the one owner of the approval bot, shared by every
|
||||
//! host's broker over the tailnet. It sees prompts and verdicts, never items.
|
||||
|
||||
use crate::config::{load, GatewayConfig};
|
||||
use crate::telegram::{nonce, Telegram, Verdict};
|
||||
use anyhow::{Context, Result};
|
||||
use axum::extract::{Path, Query, State};
|
||||
use axum::http::{HeaderMap, StatusCode};
|
||||
use axum::routing::{get, post};
|
||||
use axum::{Json, Router};
|
||||
use serde::Deserialize;
|
||||
use serde_json::{json, Value};
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::{Duration, Instant};
|
||||
use tokio::sync::watch;
|
||||
|
||||
struct Prompt {
|
||||
host: String,
|
||||
text: String,
|
||||
message_id: i64,
|
||||
deadline: Instant,
|
||||
verdict: watch::Sender<Option<Verdict>>,
|
||||
decided_at: Option<Instant>,
|
||||
}
|
||||
|
||||
struct Gateway {
|
||||
tg: Telegram,
|
||||
/// sha256(token) -> host name.
|
||||
hosts: HashMap<String, String>,
|
||||
max_timeout: Duration,
|
||||
prompts: Mutex<HashMap<String, Prompt>>,
|
||||
}
|
||||
|
||||
pub async fn run() -> Result<()> {
|
||||
let cfg: GatewayConfig = load("PASS_BROKER_GATEWAY_CONFIG")?;
|
||||
let gw = Arc::new(Gateway {
|
||||
tg: Telegram::new(&cfg.telegram)?,
|
||||
hosts: cfg.hosts.into_iter().map(|h| (h.token_sha256.to_lowercase(), h.name)).collect(),
|
||||
max_timeout: Duration::from_secs(cfg.max_timeout_secs),
|
||||
prompts: Mutex::new(HashMap::new()),
|
||||
});
|
||||
|
||||
let poller = gw.clone();
|
||||
tokio::spawn(async move {
|
||||
loop {
|
||||
let live = |n: &str| {
|
||||
poller.prompts.lock().unwrap().get(n).is_some_and(|p| p.decided_at.is_none())
|
||||
};
|
||||
match poller.tg.taps(25, live).await {
|
||||
Ok(taps) => {
|
||||
for t in taps {
|
||||
poller.decide(&t.nonce, t.verdict).await;
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("{e:#}");
|
||||
tokio::time::sleep(Duration::from_secs(2)).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let sweeper = gw.clone();
|
||||
tokio::spawn(async move {
|
||||
loop {
|
||||
tokio::time::sleep(Duration::from_secs(1)).await;
|
||||
let now = Instant::now();
|
||||
let expired: Vec<String> = {
|
||||
let mut map = sweeper.prompts.lock().unwrap();
|
||||
// Decided prompts linger so a broker polling late still gets its verdict.
|
||||
map.retain(|_, p| p.decided_at.is_none_or(|t| now - t < Duration::from_secs(600)));
|
||||
map.iter()
|
||||
.filter(|(_, p)| p.decided_at.is_none() && p.deadline <= now)
|
||||
.map(|(id, _)| id.clone())
|
||||
.collect()
|
||||
};
|
||||
for id in expired {
|
||||
sweeper.decide(&id, Verdict::Expired).await;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let app = Router::new()
|
||||
.route("/ask", post(ask))
|
||||
.route("/ask/{id}", get(status).delete(cancel))
|
||||
.with_state(gw);
|
||||
let listener = tokio::net::TcpListener::bind(&cfg.listen)
|
||||
.await
|
||||
.with_context(|| format!("binding {}", cfg.listen))?;
|
||||
eprintln!("pass-broker gateway listening on {}", cfg.listen);
|
||||
axum::serve(listener, app).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
impl Gateway {
|
||||
fn host(&self, headers: &HeaderMap) -> Option<String> {
|
||||
let token = headers.get("authorization")?.to_str().ok()?.strip_prefix("Bearer ")?;
|
||||
let hash: String =
|
||||
Sha256::digest(token.trim().as_bytes()).iter().map(|b| format!("{b:02x}")).collect();
|
||||
self.hosts.get(&hash).cloned()
|
||||
}
|
||||
|
||||
/// First verdict wins; later ones are no-ops.
|
||||
async fn decide(&self, id: &str, verdict: Verdict) {
|
||||
let decided = {
|
||||
let mut map = self.prompts.lock().unwrap();
|
||||
match map.get_mut(id) {
|
||||
Some(p) if p.decided_at.is_none() => {
|
||||
p.decided_at = Some(Instant::now());
|
||||
p.verdict.send_replace(Some(verdict));
|
||||
Some((p.host.clone(), p.message_id, p.text.clone()))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
};
|
||||
if let Some((host, message_id, text)) = decided {
|
||||
eprintln!("{host}: {id} {verdict:?}");
|
||||
self.tg.conclude(message_id, &text, verdict).await;
|
||||
}
|
||||
}
|
||||
|
||||
/// Another host's prompt looks exactly like a missing one.
|
||||
fn owns(&self, id: &str, host: &str) -> bool {
|
||||
self.prompts.lock().unwrap().get(id).is_some_and(|p| p.host == host)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct AskBody {
|
||||
text: String,
|
||||
timeout_secs: u64,
|
||||
}
|
||||
|
||||
async fn ask(
|
||||
State(gw): State<Arc<Gateway>>,
|
||||
headers: HeaderMap,
|
||||
Json(body): Json<AskBody>,
|
||||
) -> Result<Json<Value>, StatusCode> {
|
||||
let host = gw.host(&headers).ok_or(StatusCode::UNAUTHORIZED)?;
|
||||
let id = nonce().map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
|
||||
// Labelled from the token, not the request, so no host can pose as another.
|
||||
let text = format!("🔑 {host}: {}", body.text);
|
||||
let message_id = gw.tg.prompt(&text, &id).await.map_err(|e| {
|
||||
eprintln!("{host}: {e:#}");
|
||||
StatusCode::BAD_GATEWAY
|
||||
})?;
|
||||
let timeout = Duration::from_secs(body.timeout_secs).min(gw.max_timeout);
|
||||
let (verdict, _) = watch::channel(None);
|
||||
gw.prompts.lock().unwrap().insert(
|
||||
id.clone(),
|
||||
Prompt {
|
||||
host: host.clone(),
|
||||
text,
|
||||
message_id,
|
||||
deadline: Instant::now() + timeout,
|
||||
verdict,
|
||||
decided_at: None,
|
||||
},
|
||||
);
|
||||
eprintln!("{host}: {id} asked");
|
||||
Ok(Json(json!({ "id": id })))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Wait {
|
||||
wait: Option<u64>,
|
||||
}
|
||||
|
||||
async fn status(
|
||||
State(gw): State<Arc<Gateway>>,
|
||||
headers: HeaderMap,
|
||||
Path(id): Path<String>,
|
||||
Query(q): Query<Wait>,
|
||||
) -> Result<Json<Value>, StatusCode> {
|
||||
let host = gw.host(&headers).ok_or(StatusCode::UNAUTHORIZED)?;
|
||||
let mut rx = {
|
||||
let map = gw.prompts.lock().unwrap();
|
||||
match map.get(&id) {
|
||||
Some(p) if p.host == host => p.verdict.subscribe(),
|
||||
_ => return Err(StatusCode::NOT_FOUND),
|
||||
}
|
||||
};
|
||||
let wait = Duration::from_secs(q.wait.unwrap_or(0).min(30));
|
||||
let verdict = match tokio::time::timeout(wait, rx.wait_for(Option::is_some)).await {
|
||||
Ok(Ok(v)) => *v,
|
||||
_ => None,
|
||||
};
|
||||
Ok(Json(match verdict {
|
||||
Some(v) => json!({ "status": v }),
|
||||
None => json!({ "status": "pending" }),
|
||||
}))
|
||||
}
|
||||
|
||||
async fn cancel(
|
||||
State(gw): State<Arc<Gateway>>,
|
||||
headers: HeaderMap,
|
||||
Path(id): Path<String>,
|
||||
) -> StatusCode {
|
||||
let Some(host) = gw.host(&headers) else { return StatusCode::UNAUTHORIZED };
|
||||
if !gw.owns(&id, &host) {
|
||||
return StatusCode::NOT_FOUND;
|
||||
}
|
||||
gw.decide(&id, Verdict::Cancelled).await;
|
||||
StatusCode::NO_CONTENT
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//! pass-broker — hands Proton Pass items to darman's processes (Claude
|
||||
//! included) only after a Telegram approval.
|
||||
//!
|
||||
//! The daemon runs as its own system user and holds the only pass-cli session
|
||||
//! (an agent PAT), so nothing running as darman can read it directly. Clients
|
||||
//! talk to it over a unix socket; see services/identity/pass-broker.nix. The
|
||||
//! prompt comes from its own bot or from the shared gateway (gateway.rs).
|
||||
|
||||
mod approver;
|
||||
mod client;
|
||||
mod config;
|
||||
mod daemon;
|
||||
mod gateway;
|
||||
mod pass;
|
||||
mod proto;
|
||||
mod telegram;
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
const USAGE: &str = "usage: pass-broker get --item <title> --reason <why> [--vault <name>] [--field <name>]
|
||||
pass-broker daemon
|
||||
pass-broker gateway";
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
let args: Vec<String> = std::env::args().skip(1).collect();
|
||||
match args.first().map(String::as_str) {
|
||||
Some("daemon") => daemon::run().await,
|
||||
Some("gateway") => gateway::run().await,
|
||||
Some("get") => client::get(&args[1..]).await,
|
||||
_ => {
|
||||
eprintln!("{USAGE}");
|
||||
std::process::exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
use crate::config::Config;
|
||||
use anyhow::{anyhow, bail, Context, Result};
|
||||
use std::path::PathBuf;
|
||||
use std::process::Stdio;
|
||||
use tokio::process::Command;
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
/// The broker's own pass-cli session. pass-cli calls are serialised: they
|
||||
/// share one session dir and a re-login mid-lookup would race.
|
||||
pub struct Pass {
|
||||
bin: String,
|
||||
session_dir: PathBuf,
|
||||
pat_file: PathBuf,
|
||||
lock: Mutex<()>,
|
||||
}
|
||||
|
||||
impl Pass {
|
||||
pub fn new(cfg: &Config) -> Self {
|
||||
Self {
|
||||
bin: cfg.pass_cli.clone(),
|
||||
session_dir: cfg.session_dir.clone(),
|
||||
pat_file: cfg.pat_file.clone(),
|
||||
lock: Mutex::new(()),
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn ensure_session(&self) -> Result<()> {
|
||||
let _g = self.lock.lock().await;
|
||||
self.ensure_session_locked().await
|
||||
}
|
||||
|
||||
async fn ensure_session_locked(&self) -> Result<()> {
|
||||
if self.run(&["info"], &[]).await.is_ok() {
|
||||
return Ok(());
|
||||
}
|
||||
eprintln!("no pass-cli session, logging in with the PAT");
|
||||
let pat = std::fs::read_to_string(&self.pat_file)
|
||||
.with_context(|| format!("reading {}", self.pat_file.display()))?;
|
||||
let _ = self.run(&["logout", "--force"], &[]).await;
|
||||
// Via env, not `--pat`: argv is world-readable in /proc.
|
||||
self.run(&["login"], &[("PROTON_PASS_PERSONAL_ACCESS_TOKEN", pat.trim())])
|
||||
.await
|
||||
.context("pass-cli login")?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn get(&self, vault: &str, title: &str, field: &str, reason: &str) -> Result<String> {
|
||||
let _g = self.lock.lock().await;
|
||||
self.ensure_session_locked().await?;
|
||||
|
||||
// `item view --item-title` has no state filter and can return a
|
||||
// trashed duplicate, so resolve the id among active items first.
|
||||
let list = self
|
||||
.run(
|
||||
&["item", "list", "--vault-name", vault, "--filter-state", "active", "--output", "human"],
|
||||
&[],
|
||||
)
|
||||
.await?;
|
||||
let id = list
|
||||
.lines()
|
||||
.find_map(|l| {
|
||||
// - [ITEM_ID]: the title (state=Active)
|
||||
let rest = l.strip_prefix("- [")?;
|
||||
let (id, rest) = rest.split_once("]: ")?;
|
||||
let t = match rest.rfind(" (state=") {
|
||||
Some(i) if rest.ends_with(')') => &rest[..i],
|
||||
_ => rest,
|
||||
};
|
||||
(t == title).then(|| id.to_string())
|
||||
})
|
||||
.ok_or_else(|| anyhow!("no active item {title:?} in vault {vault:?}"))?;
|
||||
|
||||
let out = self
|
||||
.run(
|
||||
&["item", "view", "--vault-name", vault, "--item-id", &id, "--field", field, "--output", "human"],
|
||||
&[("PROTON_PASS_AGENT_REASON", reason)],
|
||||
)
|
||||
.await?;
|
||||
let value = out.lines().next().unwrap_or("").to_string();
|
||||
if value.is_empty() {
|
||||
bail!("{title:?} has an empty {field} field");
|
||||
}
|
||||
Ok(value)
|
||||
}
|
||||
|
||||
async fn run(&self, args: &[&str], env: &[(&str, &str)]) -> Result<String> {
|
||||
let out = Command::new(&self.bin)
|
||||
.args(args)
|
||||
.envs(env.iter().copied())
|
||||
.env("PROTON_PASS_SESSION_DIR", &self.session_dir)
|
||||
.stdin(Stdio::null())
|
||||
.kill_on_drop(true)
|
||||
.output()
|
||||
.await
|
||||
.with_context(|| format!("running {}", self.bin))?;
|
||||
if !out.status.success() {
|
||||
let err = String::from_utf8_lossy(&out.stderr);
|
||||
bail!("pass-cli {} failed ({}): {}", args[0], out.status, err.trim());
|
||||
}
|
||||
Ok(String::from_utf8(out.stdout)?)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub const DEFAULT_SOCKET: &str = "/run/pass-broker.sock";
|
||||
|
||||
/// One JSON line from the client.
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct Request {
|
||||
pub vault: Option<String>,
|
||||
pub item: String,
|
||||
pub field: String,
|
||||
pub reason: String,
|
||||
}
|
||||
|
||||
/// JSON lines from the daemon: any number of `Pending`, then one final reply.
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(tag = "status", rename_all = "snake_case")]
|
||||
pub enum Reply {
|
||||
Pending { message: String },
|
||||
Ok { value: String },
|
||||
Error { error: String },
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
use crate::config::TelegramConfig;
|
||||
use anyhow::{anyhow, bail, Context, Result};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{json, Value};
|
||||
use std::future::Future;
|
||||
use std::io::Read;
|
||||
use std::pin::Pin;
|
||||
use std::sync::atomic::{AtomicI64, Ordering};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
/// Approval prompts with Approve/Deny buttons. A bot has one getUpdates
|
||||
/// consumer, so exactly one process may own it: a host's broker in direct
|
||||
/// mode, or the gateway (gateway.rs) for every host.
|
||||
pub struct Telegram {
|
||||
http: reqwest::Client,
|
||||
/// Contains the token: never print it, and strip it from reqwest errors.
|
||||
base: String,
|
||||
chat_id: i64,
|
||||
offset: AtomicI64,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Verdict {
|
||||
Approved,
|
||||
Denied,
|
||||
Expired,
|
||||
Cancelled,
|
||||
}
|
||||
|
||||
impl Verdict {
|
||||
fn outcome(self) -> &'static str {
|
||||
match self {
|
||||
Verdict::Approved => "✅ approved",
|
||||
Verdict::Denied => "❌ denied",
|
||||
Verdict::Expired => "⌛ expired",
|
||||
Verdict::Cancelled => "🚫 cancelled: the requester went away",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// An owner's tap on a live prompt's button.
|
||||
pub struct Tap {
|
||||
pub nonce: String,
|
||||
pub verdict: Verdict,
|
||||
}
|
||||
|
||||
impl Telegram {
|
||||
pub fn new(cfg: &TelegramConfig) -> Result<Self> {
|
||||
let token = std::fs::read_to_string(&cfg.token_file)
|
||||
.with_context(|| format!("reading {}", cfg.token_file.display()))?;
|
||||
let chat_id = std::fs::read_to_string(&cfg.chat_id_file)
|
||||
.with_context(|| format!("reading {}", cfg.chat_id_file.display()))?
|
||||
.trim()
|
||||
.parse()
|
||||
.context("telegram chat id is not a number")?;
|
||||
Ok(Self {
|
||||
http: reqwest::Client::builder().timeout(Duration::from_secs(40)).build()?,
|
||||
base: format!("{}/bot{}", cfg.api_base.trim_end_matches('/'), token.trim()),
|
||||
chat_id,
|
||||
offset: AtomicI64::new(0),
|
||||
})
|
||||
}
|
||||
|
||||
async fn call(&self, method: &str, body: Value) -> Result<Value> {
|
||||
let resp = self
|
||||
.http
|
||||
.post(format!("{}/{method}", self.base))
|
||||
.json(&body)
|
||||
.send()
|
||||
.await
|
||||
.map_err(|e| anyhow!("telegram {method}: {}", e.without_url()))?;
|
||||
let v: Value = resp
|
||||
.json()
|
||||
.await
|
||||
.map_err(|e| anyhow!("telegram {method}: {}", e.without_url()))?;
|
||||
if v["ok"] != json!(true) {
|
||||
bail!("telegram {method}: {}", v["description"]);
|
||||
}
|
||||
Ok(v["result"].clone())
|
||||
}
|
||||
|
||||
/// Sends the prompt; returns its message id.
|
||||
pub async fn prompt(&self, text: &str, nonce: &str) -> Result<i64> {
|
||||
let msg = self
|
||||
.call(
|
||||
"sendMessage",
|
||||
json!({
|
||||
"chat_id": self.chat_id,
|
||||
"text": text,
|
||||
"reply_markup": { "inline_keyboard": [[
|
||||
{ "text": "Approve", "callback_data": format!("ok:{nonce}") },
|
||||
{ "text": "Deny", "callback_data": format!("no:{nonce}") },
|
||||
]]},
|
||||
}),
|
||||
)
|
||||
.await?;
|
||||
msg["message_id"].as_i64().ok_or_else(|| anyhow!("sendMessage returned no message_id"))
|
||||
}
|
||||
|
||||
/// One long poll. Every tap is answered; the owner's taps on prompts
|
||||
/// `live` still knows are returned.
|
||||
pub async fn taps(&self, timeout_secs: u64, live: impl Fn(&str) -> bool) -> Result<Vec<Tap>> {
|
||||
let updates = self
|
||||
.call(
|
||||
"getUpdates",
|
||||
json!({
|
||||
"offset": self.offset.load(Ordering::SeqCst),
|
||||
"timeout": timeout_secs,
|
||||
"allowed_updates": ["callback_query"],
|
||||
}),
|
||||
)
|
||||
.await?;
|
||||
let mut taps = vec![];
|
||||
for u in updates.as_array().into_iter().flatten() {
|
||||
if let Some(id) = u["update_id"].as_i64() {
|
||||
self.offset.fetch_max(id + 1, Ordering::SeqCst);
|
||||
}
|
||||
let cq = &u["callback_query"];
|
||||
let Some(cq_id) = cq["id"].as_str() else { continue };
|
||||
let data = cq["data"].as_str().unwrap_or("");
|
||||
let tap = match data.split_once(':') {
|
||||
Some(("ok", n)) => Some((n, Verdict::Approved)),
|
||||
Some(("no", n)) => Some((n, Verdict::Denied)),
|
||||
_ => None,
|
||||
}
|
||||
.filter(|(n, _)| live(n));
|
||||
// The button lives in our chat, but the bot can be added
|
||||
// elsewhere and a forwarded message keeps its buttons.
|
||||
let from_owner = cq["from"]["id"].as_i64() == Some(self.chat_id);
|
||||
let note = match (&tap, from_owner) {
|
||||
(_, false) => "Not yours.",
|
||||
(None, true) => "Expired.",
|
||||
(Some(_), true) => "",
|
||||
};
|
||||
let _ = self
|
||||
.call("answerCallbackQuery", json!({ "callback_query_id": cq_id, "text": note }))
|
||||
.await;
|
||||
if let (Some((n, verdict)), true) = (tap, from_owner) {
|
||||
taps.push(Tap { nonce: n.to_string(), verdict });
|
||||
}
|
||||
}
|
||||
Ok(taps)
|
||||
}
|
||||
|
||||
/// Appends the outcome; without reply_markup this also drops the buttons.
|
||||
pub async fn conclude(&self, message_id: i64, text: &str, verdict: Verdict) {
|
||||
let _ = self
|
||||
.call(
|
||||
"editMessageText",
|
||||
json!({
|
||||
"chat_id": self.chat_id,
|
||||
"message_id": message_id,
|
||||
"text": format!("{text}\n\n{}", verdict.outcome()),
|
||||
}),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
|
||||
/// Direct mode: prompt and poll in one call. Callers must not ask
|
||||
/// concurrently. `gone` resolving (the client hung up) withdraws it.
|
||||
pub async fn ask(
|
||||
&self,
|
||||
text: &str,
|
||||
timeout: Duration,
|
||||
mut gone: Pin<&mut impl Future<Output = ()>>,
|
||||
) -> Result<Verdict> {
|
||||
let nonce = nonce()?;
|
||||
let message_id = self.prompt(text, &nonce).await?;
|
||||
|
||||
let deadline = Instant::now() + timeout;
|
||||
let verdict = 'poll: loop {
|
||||
let left = deadline.saturating_duration_since(Instant::now());
|
||||
if left.is_zero() {
|
||||
break Verdict::Expired;
|
||||
}
|
||||
let polled = tokio::select! {
|
||||
biased;
|
||||
_ = gone.as_mut() => break 'poll Verdict::Cancelled,
|
||||
r = self.taps(left.as_secs().min(25), |n| n == nonce) => r,
|
||||
};
|
||||
match polled {
|
||||
Ok(taps) => {
|
||||
if let Some(t) = taps.first() {
|
||||
break t.verdict;
|
||||
}
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("{e:#}");
|
||||
tokio::time::sleep(Duration::from_secs(2)).await;
|
||||
}
|
||||
}
|
||||
};
|
||||
self.conclude(message_id, text, verdict).await;
|
||||
Ok(verdict)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn nonce() -> Result<String> {
|
||||
let mut buf = [0u8; 16];
|
||||
std::fs::File::open("/dev/urandom")?.read_exact(&mut buf)?;
|
||||
Ok(buf.iter().map(|b| format!("{b:02x}")).collect())
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
{ config, pkgs, lib, inputs, ... }:
|
||||
|
||||
# Hyprland workstation shared by terra (desktop) and titan (laptop):
|
||||
# everything that isn't tied to one machine's hardware or desk. Hosts set
|
||||
# home-manager.users.darman.homelab.desktop (home/desktop/options.nix) for
|
||||
# their monitors.
|
||||
let
|
||||
unstable = import inputs.nixpkgs-unstable {
|
||||
inherit (pkgs.stdenv.hostPlatform) system;
|
||||
config = pkgs.config;
|
||||
};
|
||||
hm = config.home-manager.users.darman;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
../services/containers.nix
|
||||
../services/vpn/tailscale.nix
|
||||
../services/monitoring/node-exporter.nix
|
||||
../services/desktop/desktop-hyprland.nix
|
||||
../services/desktop/desktop-apps.nix
|
||||
../services/desktop/claude-desktop.nix
|
||||
../services/identity/pass-broker.nix
|
||||
];
|
||||
|
||||
homelab.greeter = {
|
||||
monitors = hm.wayland.windowManager.hyprland.settings.monitor;
|
||||
primaryOutput = hm.homelab.desktop.primaryOutput;
|
||||
defaultUser = "darman";
|
||||
keyboardLayout = "de";
|
||||
cursor = { inherit (hm.home.pointerCursor) name size package; };
|
||||
};
|
||||
|
||||
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"; }
|
||||
{ appId = "md.obsidian.Obsidian"; origin = "flathub"; }
|
||||
];
|
||||
};
|
||||
|
||||
environment.systemPackages = [ unstable.proton-pass-cli ];
|
||||
|
||||
# Proton Pass for scripts/deploy and Claude, one Telegram tap per use via
|
||||
# the gateway on mars. Your own pass-cli stays logged out here: the
|
||||
# broker's session is the only one.
|
||||
homelab.passBroker = {
|
||||
enable = true;
|
||||
passCli = unstable.proton-pass-cli;
|
||||
patFile = config.sops.secrets.pass_broker_pat.path;
|
||||
gateway.tokenFile = config.sops.secrets.pass_broker_gateway_token.path;
|
||||
};
|
||||
|
||||
# Owner pass-broker, so darman cannot read them. The token's sha256 is in
|
||||
# hosts/mars/pass-broker-gateway.nix.
|
||||
sops.secrets.pass_broker_pat.owner = "pass-broker";
|
||||
sops.secrets.pass_broker_gateway_token.owner = "pass-broker";
|
||||
|
||||
# run0 waits on systemd over D-Bus, whose 25s default call timeout runs out
|
||||
# while the polkit dialog is still open (slow typing, a vault lookup).
|
||||
# Scoped to run0 so a hung systemctl doesn't also wait 5min.
|
||||
programs.zsh.shellAliases.run0 = "SYSTEMD_BUS_TIMEOUT=5min run0";
|
||||
|
||||
# ---- 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;
|
||||
|
||||
# JetBrains IDEs installed via Toolbox bundle a JBR that aborts with
|
||||
# `libX11.so.6: cannot open shared object file` under the default (X11-less)
|
||||
# nix-ld set. Additive — merges with the module's own base list (zlib etc).
|
||||
programs.nix-ld.libraries = with pkgs; [
|
||||
freetype
|
||||
fontconfig
|
||||
libGL
|
||||
libxkbcommon
|
||||
wayland
|
||||
libsecret
|
||||
libx11
|
||||
libxext
|
||||
libxi
|
||||
libxrender
|
||||
libxtst
|
||||
libxcursor
|
||||
libxrandr
|
||||
libxinerama
|
||||
libxcb
|
||||
icu
|
||||
];
|
||||
|
||||
# NixOS only ships /bin/sh; envfs serves /bin and /usr/bin from PATH so
|
||||
# third-party scripts hardcoding `#!/bin/bash` (e.g. JetBrains Toolbox's
|
||||
# generated launchers) still resolve.
|
||||
services.envfs.enable = true;
|
||||
|
||||
# ---- home-manager (user-level config for darman) ----
|
||||
# Base settings + shared zsh baseline live in common.nix + home/common.nix
|
||||
# (every host); this layers the desktop profile on top (imports merge).
|
||||
home-manager.extraSpecialArgs = { inherit unstable inputs; };
|
||||
home-manager.users.darman.imports = [ ../home/desktop ];
|
||||
|
||||
# ---- Boot (UEFI) ----
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# Lets `nix build` target mercury (aarch64) from here — see CLAUDE.md's
|
||||
# aarch64 gotcha.
|
||||
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
|
||||
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
|
||||
# /dev/dri/renderD128 is root:render 0660 — host user needs render group for
|
||||
# rootless podman GPU containers (Vulkan whisper.cpp/llama.cpp).
|
||||
users.users.darman.extraGroups = [ "render" "video" ];
|
||||
|
||||
# jupiter's samba share (services/network/samba.nix) — mounted on demand so
|
||||
# boot/login don't stall 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"
|
||||
];
|
||||
};
|
||||
|
||||
# samba_password mirrors jupiter's own samba_password secret (services/network/samba.nix) —
|
||||
# same value, just also encrypted to each workstation 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}
|
||||
'';
|
||||
}
|
||||
@@ -18,7 +18,8 @@
|
||||
# at ~/.config/homelab/<config>/ssh_host_ed25519_key. Runs from a non-NixOS host too.
|
||||
#
|
||||
# Password prompts auto-fill from the "HomeLab" Proton Pass vault, keyed by
|
||||
# <config> not <host> (darman@<config> for sudo, root@<config> for ssh).
|
||||
# <config> not <host> (darman@<config> for sudo, root@<config> for ssh), via
|
||||
# pass-broker (Telegram-approved) where it runs, else your own pass-cli session.
|
||||
# Override with HOMELAB_PASS_ITEM / HOMELAB_PASS_ROOT_ITEM / HOMELAB_PASS_VAULT.
|
||||
set -euo pipefail
|
||||
shopt -s nullglob
|
||||
@@ -386,6 +387,15 @@ require_tracked() {
|
||||
# real on darman@neptun, which had both an Active and a Trashed copy).
|
||||
proton_pass_password() {
|
||||
local title="$1" vault="${HOMELAB_PASS_VAULT:-HomeLab}" id pw
|
||||
|
||||
# Where pass-broker runs (services/identity/pass-broker.nix), it is the only
|
||||
# source: a refused tap must not fall through to someone's own session.
|
||||
if [ -S /run/pass-broker.sock ] && command -v pass-broker >/dev/null 2>&1; then
|
||||
pass-broker get --vault "$vault" --item "$title" \
|
||||
--reason "scripts/deploy ${SCRIPT_ARGS[*]}" || true
|
||||
return 0
|
||||
fi
|
||||
|
||||
command -v pass-cli >/dev/null 2>&1 || return 0
|
||||
|
||||
# Lines look like: - [ITEM_ID]: the title (state=Active)
|
||||
|
||||
@@ -16,6 +16,14 @@ sabnzbd_eweka_username: ENC[AES256_GCM,data:eLsTZoM8T8fAlGaXWlDaoQ==,iv:eawyGhN7
|
||||
sabnzbd_eweka_password: ENC[AES256_GCM,data:Mt3ZHAe2wzacCQq3x9Uy8WxjrVNad1SmU6sl8ZgrkMLymfq2eP4JzO/uPdD33A==,iv:PnFT95Zxqz4QBpPF5PRloKpoa15AU7Ef/Owwy+iDotw=,tag:/uRX00RzHLJN3gws5Qz8SA==,type:str]
|
||||
gitea_hermes_webhook_secret: ENC[AES256_GCM,data:Q8e+mj05MJI7CEJwRonpOmQphAZ0CfnZFoGxrDSSiyHoH3BNhqBU5gBmzuu+6NK9OS33kN+JnFvrwCeEzVxooA==,iv:mdsKOMD5B0Jzh1YRmRh71P8Io9RFtI6aqAky5x+WxOQ=,tag:v3LKz5a8ayl7WAzIPbwj6Q==,type:str]
|
||||
couchdb_admin_password: ENC[AES256_GCM,data:QHkCFUwLbQdd5yKETI5qAz4CkEfsPcl2iCU8F9mX3PA=,iv:2dPNKjjoXEgm7wfC6MlhQTMvAXSNDtaXnjWl2ldl4fk=,tag:1ZltqH94Q5/6GbXAnaIgdg==,type:str]
|
||||
pass_broker_pat: ENC[AES256_GCM,data:4rO5srDthuvDObbhVkHCCm5vblkwbIDtT3c/Eg0KxiVavfoQbmK2RBPOylBLR3v/9wcXEkdQzk8f0N98SkaSr9dB4oe8CbZc91aA9zgCnI8qR7coWCmBJin/wYjcVhX91sxg9Xz81sBWZK3PtrgELFo=,iv:znQrJzdWcsBtK4Rnz/vUIQcU8M3anRm1UGlCJQ/t35U=,tag:fHZLaMm3a3Y/4kf/KEL12A==,type:str]
|
||||
synapse_signing_key: ENC[AES256_GCM,data:EiccDw3y+gjoCNCYjtrUNd7xkjcqm1IOSDnWfAerA7HI9O0EBJaBkra9Yu9SdrImNT9a/UqHENLMbw==,iv:7G/F9MZKU8BPGP2o+rrnEBvpCy3wor3HkgEjR5gQ0Nw=,tag:uUZfJb3MzMmug8Sv+lNaDA==,type:str]
|
||||
synapse_macaroon_secret_key: ENC[AES256_GCM,data:wqARXZK555HvnC3oA0zvHiWqT0RoFVqAgR2rfN1JCwBvuUVCfIgGSCv26UwWl8f9CTLvoGylS8TR4zqrNpgFNA==,iv:IwnkRJwvuLY5bhlCJwWPPN1RobEu15TUEiBJ42Ursic=,tag:3GOYYImBpbVR1ux4IRP31w==,type:str]
|
||||
synapse_form_secret: ENC[AES256_GCM,data:cHFQco6+akxN/OcSxJPeILY25BIVIy7q9rVj1PFmdhoFoczfmcu0l97zO69PsgtPTeH9e09onepyNMFTn9R+Nw==,iv:fCy43xQFP2GlbwOQpvcv90FfBPUWuOIjkF5oD/wDqD8=,tag:JMopCPNzAAjuEKlQDoEUCA==,type:str]
|
||||
mas_shared_secret: ENC[AES256_GCM,data:Jb5ueYVtm/hcr43jtyIBGLcmIxBks4WfYLX60ig0emssqMegQjE4kjtC2w556mJPRfkBesSO4J6xl6Egho8KhQ==,iv:8Ajn0tOWK3fofDspZHj13yAJTBneHojkuXnQjdEEg+0=,tag:T2gemWQnNu2GyiOlWO5Piw==,type:str]
|
||||
mas_encryption_secret: ENC[AES256_GCM,data:v0Xjjtyhkdj3qI0pm2UivbEaUs5UnCS94Rm72er5WOrhv9pscxJuD2ePJy7MI6icuUIwrzVp5bcExYLznlmMgA==,iv:BbSTBJWeO/Y/hhqRAYpK3eoI7hCu3hr0hyshcLp2wt4=,tag:cXHxDeW4gj/40R/ohpwl/Q==,type:str]
|
||||
mas_signing_key: ENC[AES256_GCM,data:vxhNOlvnk6IRvWNL8zODlZ7Z3+B+AAx82+GQm57z2/2JEv5XNHEqgSL8T+xrfIO4fN0nTJ6sLz2bRYv7qA4ZgXsuahfhRlflY8CH8sdh3UhRTDpAu6Q5cyGyLLD2NMYFEfBhIKAs+LAza3OaBNSK7LCrrDrbc7dvTG6RDIBHiQAQrc0Dp1qGXNXhyd/lbcKjiWPsUkKcOp3b9Ofj0vze7bVj+i5pUo0jjUbX5TraK06ZXCJKb8La6lbrBoeZi+yNSIQMMt53guWdNnQY7NGamYHBtXzOMB0pN6Cmqeb9U5e3UCjLvq1TqL6PG/rIrCdPjCchjkkhcHVIU+Hjh+UEDtDUC50UUx0Y5VOX44DPS64ep/Ltjb++CvNRx/VEFkPlERCMWN6boocJFsVjVMnGqbQdXe5eEv5LAOo+d/QnHwsP/puFMHEZEvtPGz9qGSres72kvzNb6gWJ66zc70D7HW+CdAnMd+ue5CGS0FT/N047mkmgEniTdwL/6BWUDXcC+c/OIEDY4Wq1kSlXkdvR2brt6gAbOjCUvAp80Q5g6LQt1nJ3NIfCU7Klza7Gv2h+1/v7C4vf3qzco53bCBtXd5gx+IXhvz+UULKG3mhHa6Led5W76k0hAQY4K5qRYetF/seqLn8olVUZPWw/o7Pd6Q5sqedGmkisnIXPEeFemIZ4MbZuwcb9jkn7lagfIVZ6fSNQFNWvBdV3dNfAIV6areyyCErS8eNBjvClsfQDTzrI3lI4xUlfxkUBkn+u9Hh4FDqav21Fm86JNqPOWLH1cvGsMjl7RcCV6s68nM5eBdDIbmKbOV2B9k20i2QY0uO30GKVa8DLpXIQlPr+CrUJ2AO2CfG7MOCyx40olKxjGbZg9sk4GntYlSIVAZJXcQAa/ZZ5QSdZzMH8TUVWqKRK97+PZyGcRWpr+/a00KiOOoDTlCQP0OaE4GowRF5enpWDttpOD+g6+fFIgfgvCh0lPFCZv1LYWGORJvfwvtAi/9W+MILdXSoT50JzJSSA72rlECA6fd3P6KzIqS4ZyuhXZCOpHK7jDb6DB+mBj/6suAZk74WvY4NeiD7fQQ0TGBMuPkmjSUL/g8L/YE3JqGjgUBpxt/P69RJcVGNCHxsafZmgfXzEIlF2tp8+0Kp4OpvuVr4qink3xy2aNxCB1DqbP/EbQu34UhgQO+BfeloSo2hv0pZBFDiyIt8KoB2Wn4znF3lw2cHWPcapXezBQZeWSPZ3JXMQpVp7B86intq5iMox2dbr3beBdcyD2QbLdZGCMioKx7T0o7k8/04oSeHTuU4/LbUjFmo1pqxIm0byBucxyJVNkI5oYrEhL48nwf77FSooZkoZWn1O7xnlvMb/+9BR+soEO6bUWQfcpwMBGXE2w8mEvt9WFvxoqVoi+hunsSFtyUuoq//2PFCqZa/kIAnGfwfI4rhppMSDJMqdai9p0/c2EMWoSxUXVS6wcdUsBxtRqBPUYcKxYwqRQa21RInJL2GUOFb8U6w8lJd4/aeHFN1JShHJBxK5qxauhxPo60gZM2lU+Hcm9VFX1R/palGGfISwZFkChUNxoo1jduUFXYEIS+i/WaR7EUdUeXM0Gq1Rch5ZxQF34MolYDi9y8w8C1XJ/udFHA4HgF0MgCqOO7JLQcSRv0jmmgU69nbgn0mruEOrZiT2k8bIp6AhG94kIiWvVROa3rM4Op/+p9jEE//WY1TerqPSyZIw9kkf+NqdUxkC4jq7b8qcUSZm8A3YqOLGxkYX6Fu06+gCpC9ZQUcGRok0b0GgPzuK7KV7vZhF40HFr3OR/iw4qdbEhlkqizT8a0Uu4VguGqEPDGGiZYdhtyEfflriLnGtVytSqpvHNjGVKZg1CRDMM8jMPiNqN1In8wVu7FqT5kFCceRZYUpTRWRYWNniyUSDHLDxiYXar7Q+Eo2cXuApSR+HnGK635WELrvE4muYCGqKY6Kh9qornzarr4MZKhE3axcOzymOBd8XJm+xMi8pD8gtJFOMg+nVknL2gRiUphLr5FRO5u+D1lPZi8fFqGCwIYmL3pUhZJ4OnSCP/mIdoFdYNAUcM9IO6hAv5F1hwgbIk8WgN40JfnDv65hxWccw0JYb3QlrY4s2c7XL11kMOPWZ/l+YXBMnrC4W7T+Moqns84mSY+RspXWz+XTeb51JeukTrv2KUZEzRViVwJ+qFaeSWiKRmTph4PLDsVuTzSObFI3ZF9MMtoILUWum2RdYNYg3204YkWngL49f3JWA4szVF2aate/r0PUR3bPupzxg4b3GVzdIQJWnuEKwZ7KczzKYl5HeaM/EiKu6vcYzvMMpccaX0xE8gEYdGogsl8GTkYiOB9pgYJeu9Ag7LKrFT0vnAIu9V8uFOBB1EkRvaFQr6wDvM4KpfO8INbp2Oqebjux4xDaNYRtickIRmkWOPVuRgmeBOOj7UhsNJcUPoIUCddawa0S+U6sEtGTy8ErbwwGMVBcpZ6XLGp3jWVG/OiAllfkfbvLwuz1OVllSW1/GIPPuVkrsCkK+98n3aLmBuju8SQTEoQ83XGJB3+E9PmyonoQHTs3kfpj/Y0j3TCtc55zmygPQCtI9ZglSwDsugnahoVEBEn19qIQQatrsuDYCIwf2fygMUQa+rUaO3k6fwiUn6ndX0SYhc1taDHyaN8S4SWNp1GLb5XzvfxDLnsFjyJUfZ50NTe7AavOJk4OboC776LqLd/v5M74rU+1AyzCaq8Ix0bpCAKLIthEtwgTv3YZrZuzQFrMZtNJfYZ+If36E09pM9d6eBiCk54fYhSvdjNrBBpaS4C224diBumjdELEDhjjkaRd1FcX5Y48Ew29yDzgvDozldLdEmcTM4FKD+/O1pqTD/Sv+MciHrkNDvJSnhJ5rZecaJKsBkvo0YvtSTGB9Mqw1WFZ8BN2vLpGdWI6sJpsCwFJAfQSLJaIqQxVL8HljBoGBTjz0eIB9lYL6GmB+E+fFM1xlmdRaMLCO6l2JTO0V7ahMPB8H89RY5Ah5GBkDqa9cCJb+ixw/7WGFBVz0yRZfOYlCSYfEIK9UD6+vyVw6QGsJPC930GseV/BX+eZ1xKENiSWs8eLzo182AOPxD35D1u9cHPO1xxT6po2IZXL4nxK1hFXda76Tsij4ESY5tjFBh3rwAv9Sw7oi/sCvCVozcMXAK9tYDxzMt4dt/i7smVvXMRyOMqLS5XaelYahyk7v+nfr444eEJJxdiY3Yx5X5Lpf4tAyV5m5GM461s583L9/Kj2mS4R/La+GGm3nqBwayEtdeHneGeyZ6pRDbAalJL1M08glNMwYZIjA8cuiQ91aPgQnvUq8QQJXUADAoGrUGUgfVKMBxg6vvn9iZd4A5ghduJL1lPNMJPUJ2zakxi9Xaj7X9LAAghf8VRxIpJwL6eflVXceIRBT+bEinmPGrykLrVdLqUY73ml2ZibwD5fK5LdmAdQm6Qw2rbYaRW7C/NFC7kqb0XvxRG7MKw9newcKtDcwFgVVAdzbptftLqpIN9b3zmz2RXXiUYaUL/XAS2FoyItSdJLu9wT/Do/YuOBV5v5QwPD70+Boz1akqRp8MfASq0+MhrVNMTc5U/Af4XPHbCieWGvlcPr+jhf5nO+B/u/ro3QZuxCXfp/Ba51jxw2gw2AXIVemR59IQe5murpeHwTcCwvWG6FIgABHdK6PSIJ4B86nqJnMEgEVtni+tATnafKJ4qE3IrF7cNkGsUmo4t3F8k9x0JsELnOjvMK24EzEQY4l1UB7jZPZV2JnB8N6MSoBh9N2VGO92TUIdsrF5LfEkYV+NhEEq+P20eUo1erfnBTKRqal3FE/9uVcD7GZ0trUJAYpjZScO8/4IPZWS71jwJ59GjkVbYwZKJZk6LYuIOSLWxnPn7szhe2cKVFncEumQy6M5Z4JIR9lL987SWIgQ6q/qrhtRjRhY92hof5GNsvy5P0YKZ12m6cXH+6pguGqR8AJCBMxjGftZhwr4SXZx64cXOrB2oqpXF6MRCDUONlMI25J7oJ+0Gtt0EP2Tnl0+wlkb2MB5WYLzdtqhR4JNZutcOBwZeym+q0ljRL76RKOs2gSxBuDzucTywSLegdmgH0eBLqmDru83Krsr2kLi3duCNuhoIvkeWvPwf5xqnq3Jx8qj2gmv/WSGFfD0QDBhnJRbssCqpzlOdyBm/ptfwv24BbhN1nDgGCeA6RseKwk1SJksSGhhM5MuToX3P3z3o0dTV37v8J0pC8co22QJm2k9afxgFESm3lf03zUI59Ldm0jCj2lXrAfr2X10m6SJ6GyYlbv36OFEz/LsWcj5Ht8XU4K1t/lKJiI/Q/GEyElKrW8PxUmgn5n4hayKUSJGVXTjoIeAnI=,iv:HWZabaltKmKqdPoPfBYnwzl+HEAtTL5mMvSKBYJrXNo=,tag:iWcmWHBX+yxa+Q1gC1KgEg==,type:str]
|
||||
matrix_oidc_client_secret: ENC[AES256_GCM,data:0f6Am5JQJCvG8dw3f15/qMl+iu6O2DXqMMD0SNOlvwRm/V/dGvjUsHyPWIkAYR2qOSP1r8/1sfnyoP3PUJheEnd0Ek4v1ocalDCsj68HIBkz4efq2NM5GswSbf0czMacbU2XGAHPGMk7XFzHIYoysWCkAoUEWROsnnLLV8ZNnng=,iv:mC5f1dLIPLz4oNr+AlUzpvAAF5ju5itHoix2CmsiiE0=,tag:fA/3a/IEtHhOMrurEjj5ew==,type:str]
|
||||
sops:
|
||||
age:
|
||||
- enc: |
|
||||
@@ -36,7 +44,7 @@ sops:
|
||||
CzjSDQZTcseEXZNwuzZcfB5Mvq0BQvjOj7lGuxzuE4qwWkdJWGfVLQ==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
recipient: age1zak7glavmg4026p2389fyqe769vqm4jrryknuqckgqq4merz5f7q44rkkt
|
||||
lastmodified: "2026-08-25T20:39:37Z"
|
||||
mac: ENC[AES256_GCM,data:Z59BCw8gETfddXqul4LXrq6V3LBJA1itF7A1VNUERwK4NfaUGwWUhbl9h7YF/srzgtg9yGjbFB/f5kwmT3k/TWTG+C0M/4KOyTVs4y5UvB9gI4g8awYbtnFDPRAcqqcxoMD0sgapgVcNh48KWv76ndF6UGn+QfWn9eF4KBP+ZzQ=,iv:57myu1aTMMSLTz+1ldwxdusnzh8cyPwrLiEIx3rLS9w=,tag:isthpdOydD4ZNoFZyflViw==,type:str]
|
||||
lastmodified: "2026-10-21T10:29:28Z"
|
||||
mac: ENC[AES256_GCM,data:oUJMbaDKpYsnOCDUQSAUTyJZo7lOj4QYzvTW3LaEk5/jfdJXjRpsM0Euxup8EP+wH3hOeymVmnOjm4U0s9kCok1NNeWu16ElbdRP6lz6OtAP9tbDCvb1Lj1JChg53tOQmyoO5LS2UwxjteSS0FWiqfJek8nsKwgpRc+4XwjSnyo=,iv:j/YBxILwRVQiMHjEl+vbOma/QRxmH7M+S54qVKqK0xo=,tag:z0r6fzQ7uYwT4f79D4AcLA==,type:str]
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.13.3
|
||||
|
||||
@@ -11,6 +11,11 @@ obsidian_luna_passphrase: ENC[AES256_GCM,data:fqHtP3g4J40ddYL9lzCixrisdC/DEJJerm
|
||||
elevenlabs_api_key: ENC[AES256_GCM,data:2oJeClO4/SFsbLwRgMe3bFXrmuDX7YOc57VfSjElV5A3vaIQqfN9eHzo/cm0vISxYgUv,iv:eIeKQJ6odDnmGLjHSLV3HbErVnLr7tatOtV83TvB2QA=,tag:XPkXRfDJ2ZK98TYXKeK/CA==,type:str]
|
||||
hermes_api_server_key: ENC[AES256_GCM,data:Au80iziwdryFTCLnggC9DdjjZPrGPKpmRFgkXe/l9RQ7on9nXb1dvQ==,iv:hWvv4fLkhRgVTT2btI+TvpNBHfMOg9y4BQKn+ht7XDo=,tag:2dEZEys8vsTwc7w0ZiBK1w==,type:str]
|
||||
openrouter_api_key: ENC[AES256_GCM,data:klv/11iORtM8nbUv7RB79AyVM996V8vCU6hrTqgREnTkRW3b5PcOWXl0XdW2fr5JW4lvm6V4qYUsP62cJuVyCL3d6qA2dZCdJQ==,iv:bKMYMpbP0xsipt79sMCKuJoh5T+9GiUKwDVNZe3Sa7Q=,tag:iNOy3X0cygMlkllyWTwphg==,type:str]
|
||||
pass_broker_pat: ENC[AES256_GCM,data:9fg2TG4RvmcAbd4xI1lPIRURVTNUrakTYsjfssa/v7se6RJvmX0Op6FPzufPHo8J412Fr62emGQcbPc1DFk2tEEUIJIuAGEGXp/2MADIo5XA8eM71DczzI5BTfyk67B32MfGr1hvW7AWCQWA719mg1c=,iv:1i3nA+t/Jh1vE4gHu47fAd1hsC70HB1yWywHITRLlE8=,tag:S/nIlHP4UbrQnbL+4SVqTQ==,type:str]
|
||||
pass_broker_telegram_token: ENC[AES256_GCM,data:l50+HIyGDQ5V9S9sD/r0z5lP2krPRV1BhrWHSAK5kQoFceQLV9GRkx5JMICTww==,iv:zuL7nXGFjYmZFVqo1rjkSNFQqE1JOlybNmCBr1rirc0=,tag:ogpFMy8txSyuGfys86k9QA==,type:str]
|
||||
darman_telegram_user_id: ENC[AES256_GCM,data:jdi/eFS8ZoQ=,iv:1aFs4vJjdXA2eXKxLJymcRUQtBRFyMVBNXGaTrcToo8=,tag:zpAqSpYdgs02J3WOzJwwNg==,type:str]
|
||||
matrix_access_token: ENC[AES256_GCM,data:P/vKj7WNzZVusTlyeoUknZ5WcbCbhJJV92iSEnmUwAvxntb+AUVXFis=,iv:Pk6cZSqSG7LZ5Hs/Iir9do7SuP+cahnnZsNM9iwxi+g=,tag:6tN7Y/OrHsFUNQ5LlsLqew==,type:str]
|
||||
honcho_gate_token: ENC[AES256_GCM,data:nyTUDJr2+MK75QBMInMbOkRAWO1tL7MTwgC3bFLQXLbOZcmmQy30y9Vd8DyMsS6g/+0t0B9z8gvTGwufkAAELA==,iv:cQANdsBMRW6FJpqHPIRXi3Djpn3/KmoRQyVS2MQGoyM=,tag:HZ3G+saeTpmvNVGee31BZA==,type:str]
|
||||
sops:
|
||||
age:
|
||||
- enc: |
|
||||
@@ -31,7 +36,7 @@ sops:
|
||||
oyJ7PS3lW+PxH5AZkeeU7gXO/pz2oDku0aDOds7kaD3n0+qSWicQ+Q==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
recipient: age1eapjg6tdrr0fuvmgs3q3nlvnjkaxez298qynqqqxt0lpcv0lrsyq7ayxjk
|
||||
lastmodified: "2026-10-02T18:30:32Z"
|
||||
mac: ENC[AES256_GCM,data:AHtMRFzzIfZQMHDaA1lV2geJ/O7CWgOJigS8IKk/8Y66H1gFQ4LPVBs86MpSaEmutSx7wzc/lTq+m0MPbVC9zoRidYjbhTzG2wbW0jxKvbPwqoBhE2x+UOTF7eWDPEKU2uttkjzlmHC2HT9G+zldEj7seW+6ElY5IQUG6WZ0Ils=,iv:Xr7iphCHeQd8sD06KQ2yo3ezvuHHDjOaDabisJUb3oc=,tag:vpbJigbu8Sek7m+rXw614A==,type:str]
|
||||
lastmodified: "2026-11-16T04:50:04Z"
|
||||
mac: ENC[AES256_GCM,data:a/eVtueQofcPV1Eb58+gGGuEtmUzeHtHY4HDCEIEWv0q3vaG0+jC5kCU8W73yMeCpnDAVQBetXNI+Pt18LUz8oXL5WI4B065yEMTDZ64X/lMOn7jmuFrZRb0ji5GvGqe9IOMcK2VQBbzRx2y6Hb5cf3Tzb7Q5ErAWxhKqiSyGgM=,iv:FZ3z5Ga0LGf5GvUuIE84hHRXrs9KV1/7O+wVVJor7jE=,tag:8H+iUI1eBD3IYzoJiHg08w==,type:str]
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.13.3
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
darman_password: ENC[AES256_GCM,data:iZQERcXtyH+91yUc3r7U6jnFYrGQPFeCPk/9ZDfxOhPLlGMX3/iEZ+SzZ7a7rDKUeUAaQUsrqANLDLclRYm4Ngo09EkbDxBx5x2GpQwlqSAS45LHnTen9LTzisWghdy79Xnilq322eaB3g==,iv:ozx/BPLR8nZTKHZroKrrh2z6ZlVCuLydQ3aNY4XvcIg=,tag:CSrq5ZipYxtXTT8RintuHQ==,type:str]
|
||||
pihole_webpassword: ENC[AES256_GCM,data:5iOTqD0CcbOCnM1b4+RbajMTyAU=,iv:2ZRW7dshnPzWkuudrn6n92y4Z2n/6fdnBB7BO5/ypS4=,tag:8UZSqJM6dVECQgrF6v5Fuw==,type:str]
|
||||
tailscale_authkey: ENC[AES256_GCM,data:h3jbN9SrPZwUlYJPEbydvcf9tP/qGQPegnY87AYKOj9AsqAgxeEKfLYwtNeksLgcNBvCoJ1ALk7gqfrMw6sCrW7S7IFlDYhSJDAPfFkR6iczInBDpSfISg==,iv:ML+l4nmPfmSoTGQnNWpdxGZkdaq5HKEHaUxKcblmR8w=,tag:BCAbJ6Iy5ziBNLiOuI/5PA==,type:str]
|
||||
pass_broker_pat: ENC[AES256_GCM,data:yifofOjuajr7UN045S9WlScnzgK91nmQm9f6qzhZs2eBIntjZW+jr0P/EhESD7rDp1ckN7pL8yMdERRJIcCkjI7yTqFC6Q8w/dBHVG5DmeoZXCdY4OkGvVNKoyFBbSbm1T1Hi38r/rDle4zNDOoJKjA=,iv:WJNhzDrXGI+NnJpsqcFQoEwFI0sEGysk16yPPq9HdTI=,tag:d6JgY0DXjopEgOGRd2KdeA==,type:str]
|
||||
sops:
|
||||
age:
|
||||
- enc: |
|
||||
@@ -21,7 +22,7 @@ sops:
|
||||
x6FfYadcRfqvSX60l6+TGdzq6xDpxLIZOJ8q19qZsAvB0in50HW5gg==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
recipient: age1cpty7zrgnn6l97upq00w5wa8zcvnkxkdt2jvhlj97jh83exure4slha43t
|
||||
lastmodified: "2026-09-18T19:44:32Z"
|
||||
mac: ENC[AES256_GCM,data:PYNiUnDjBTgTAvTOAMk+XQEgcFSXLXgkw/vQCw0GhZsVHfkvd7jzkpk33ER64JqU4aPw+PRWo937mVKVEGDKkYVY2pP6hl2EJeOtfgjOuL9QpTNh+BKxDhYige5KsxPeMTEvtL7Y6dSsgAneaNPBEeLfZ0wiTVq1v2RJNgdNAGU=,iv:WYbyNn3/0QWXR7X8CHBKPPdVf0tYv8E4F4CYLjnuhVo=,tag:7ABexc8r6WZfskABUsquHg==,type:str]
|
||||
lastmodified: "2026-10-18T14:38:08Z"
|
||||
mac: ENC[AES256_GCM,data:yFKYiu36FaLoL6VCOwIGB0MEYbTSk130w/8ExgZdD9CCHqKKz+jn7qHtaj5HyWpn+hgujIX+7GucDI1sPKPwszp4Ede+88XvLKXfSfn95ejYah513llNCz1UUPEIda67rh3bCwV199v1/kdE7JVeZ0n4lE8vGzRv3j3IFb7WbHA=,iv:3mGDuvi9kjEpAU4CYQGpT1oB6yR4LI0qVp3rh1x9B/M=,tag:UQ+KI1roqur4Fd1HcU1nJA==,type:str]
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.13.3
|
||||
|
||||
@@ -8,6 +8,7 @@ headplane_oidc_client_secret: ENC[AES256_GCM,data:RiEESz1WHYH/smlJKmKFpPoF5HRYp8
|
||||
headplane_headscale_api_key: ENC[AES256_GCM,data:KcwcprV100wfAkn+YM4+1oTfXkmyeAMAbXNpQKf2iIq0VxwqVep+fORrKmHiwDViciDoyxdMiT4scGlmd4vQRsWEHdDpkuH7MRHYu0hQepE3rSSQAMbK,iv:NEhmi2hiOE+uSIRZ4uXOK1UGpN+FQx/NpooWzTgwik8=,tag:KcPsD4gp51ERaFwgfA0BrQ==,type:str]
|
||||
headscale_oidc_client_secret: ENC[AES256_GCM,data:262lZGgtmuXTuk3He1WyqyjcXrdnIiwNyWlXEYCGKYbKkWe0JPbUdWcwGVlZ+wXt71pzKuRDpZjgdibVTWYd71mohD/Ni6CwJm7dhf517DqznnYrxojZaSxRYXg/sCVSkwEvVseJ5z2yf/Led1VLNd3I1PaUIlwkdm2P91ps7mM=,iv:w/hu7siWwNAIw7g14bake5BP8ouA/b1SZdeukZXa/dw=,tag:vAXqWfSHwIdGAjR78gSpRg==,type:str]
|
||||
caddy_acme_email: ENC[AES256_GCM,data:j+iPz4lt0Gqs2SKHTS53,iv:DQNfcpYy2v93sKeCvXzLOoBhAo0PjZrxHgFD1oVqYu8=,tag:1yPH/2cW/IiRi9lT8dELEg==,type:str]
|
||||
pass_broker_pat: ENC[AES256_GCM,data:SSyRLiGgDV0A/qVvIYjX1OfmqnsAaZ4vfenAluMC00AlB9r6vfmFWk5+LKYuaq0tGDWw4s2pOxkNvju66o8a0JOR2wqXKLuK51BxrpR9Fruuew2tIs4+ydXu0jqhZE6APhOU9+QcDt5IbHQZPXbO/JA=,iv:l1RFTjV1N6q2whj5LKOylkOZ+ZcNzh29ury+XhquKRU=,tag:O9xKHZQ1fgkbmEjsNF66bg==,type:str]
|
||||
sops:
|
||||
age:
|
||||
- enc: |
|
||||
@@ -28,7 +29,7 @@ sops:
|
||||
Wptkf76aP9UpjhgNkxzedRebQPB7ti+UiVqCvLVimtuHcsm/NJPcRg==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
recipient: age1hp72xyx2cnd05937e4eww95g5kdtn0wsf9j2nypw330pa69gfdxqn0lpkp
|
||||
lastmodified: "2026-08-21T23:14:15Z"
|
||||
mac: ENC[AES256_GCM,data:O1wp0QLbfi7hn7+IoKkk+xqGYLX95y9KgVCsjyDjsv6eqiP+RPz5PmEqXapt926HREEPi4vcDW2FbaBMTqtsojbhWMTG0lYmV6zSQ4aDueL9/GmDqdOJDtQdbXhJH9gpAVhwGQzNoRDQ/5wjknDI8GSBVO077aSaaiGbreuuzBQ=,iv:yecrpLaDNFqt7XxHv/KDTXgjOs+5fk/6UXCSxPMuoJ0=,tag:m7co54lvtnZIYqSMX2c3kQ==,type:str]
|
||||
lastmodified: "2026-10-18T14:38:08Z"
|
||||
mac: ENC[AES256_GCM,data:Glw0Yv31UElvb7JIvzCL1TMMYd0QYUHFkwHdFtJVead9SXaEmxZQWP+hIEbo8e/HNTWRv3LvVUBUlNS5LzccbgVK+oN2ZPrEgex/dIEcqVVj/X1Y6H+89gvf0n/DCgqGVoXQdiAxZcgoigT0Kiau7zrr3dbH7OQZP6TplO+dFAk=,iv:2SXBwEuTpp/vySo1V85mwNduGbMBv5af755Ebbx+dd0=,tag:HarYC6Blbmo9yM7V0cdLkw==,type:str]
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.13.2
|
||||
version: 3.13.3
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
tailscale_authkey: ENC[AES256_GCM,data:B2J+PbFv6o3Dt4em0nCV/9a77VxZ2TFnRFj1QDaaUutDjbKtbO+WXID/kE2kVQhnD5xBmhU5inytytbiP8LYKIcNlklqO5c8hJCzAvFx8xpBfpjxcQrojQ==,iv:aPGqQG14LnUabgan1QYUL0Lf6cIJfMDOQS/XBekoxaM=,tag:A0oKUfwvHZvf5e/NDIWSZQ==,type:str]
|
||||
darman_password: ENC[AES256_GCM,data:G3ZM+NMxvKq5twblcBvyC+MiUX+X7nz+s1GqBHBkJQy1YgW4KN6rpbdj10F9jWxHph5dJ9j9fG6L7UlEg5W5zUYeLFdEx2xJGE1fxksch+6BB9FT6LKkhJ7MmbJmhNHYwJOZO3LM1f/oRw==,iv:abQTRe9kRyYj+TL0rtoxM6JFBaIBmxu7y77qt1h4eME=,tag:OgKrB3SUgSNJjmtJyrmh/Q==,type:str]
|
||||
samba_password: ENC[AES256_GCM,data:UkJLUa2hW1iZ++sfJAcg6G1RJMM=,iv:/HbZ9F+GxCydUP50PNBtJknPlmDWh1DAE26N9FJUyb0=,tag:z1cbwUaVdyfwEIU8LINEcw==,type:str]
|
||||
librechat_creds_key: ENC[AES256_GCM,data:e2Ptf41yHu0KxfzjW4DP04CSJfbtdsJ8bwrgJyv9up4/JSCbBzjPFmOi7jsHUL4jT0AGVuHG5w3y+YOil9EeNA==,iv:zneozNSkXsb4Vy/sq21b8HWCKpDkXVTxyLY2Zh0bwP0=,tag:6CxR5sIspbfzHlfdx+45Iw==,type:str]
|
||||
librechat_creds_iv: ENC[AES256_GCM,data:iuW1Rxfu7Ei8zHVG7wsBTYYznbtErj7DC9B71OiiWGA=,iv:Ngs88C44gcSzxQZU1lMiy5kn9mM/ckuWKRRGOFJeeoQ=,tag:Q9B8vM4YMkIP3RyYVWSQqg==,type:str]
|
||||
librechat_jwt_secret: ENC[AES256_GCM,data:f/gljrQPZIXeLHXtqKCCYGEu2pXgbZd69CjyEhSVJ+AMuaVj7DWVclD5IMsEVERBHw5a7OndBSfLvgXRaKN6Gg==,iv:DG5CwCbQLCTv1++APCdFzAiWGKiEJl+9MhKIM2ykJQM=,tag:wdpY6l+5h4UtsluIncsyhA==,type:str]
|
||||
librechat_jwt_refresh_secret: ENC[AES256_GCM,data:N/yAPtaodJX4t2C2A0bZ/LQaVc8SBMgg3KYJrWRyXCM6HAmgHtSQ9nWJO2fl+7A966mMtYvpATYcBIPj/K5nig==,iv:k5ZYi2OKjL9Z+lhVgdNsmGVQm+iCqmF15H3TUTbofWk=,tag:NVTdvlL1lpwVhjo2c2phpg==,type:str]
|
||||
hermes_api_server_key: ENC[AES256_GCM,data:NU+6zVmUeM9+m5eZCPdCiMLo76GqbsRxNM7EmVM2TmKTOUL2af7Msg==,iv:EMd7JKhQ3ZkFPi2xMGZ+mHHK05qQVDR+ZCbiYcWdhHU=,tag:JaElU4CyvD5qQbehHbM5qQ==,type:str]
|
||||
elevenlabs_api_key: ENC[AES256_GCM,data:4IBKKMxor1sJ1skh1pgLrQnNX31cgQFiy89O1TZn71QHaq+xY7p+7JLtmGkhbZ10l12m,iv:Ww5RLYuv09xD1deFgM89u0wZ3hZ/0Pndda0kreMx2aQ=,tag:opgIPsDwSc+rLqseqjP6Gg==,type:str]
|
||||
pass_broker_pat: ENC[AES256_GCM,data:A4NrFBQIL6waKSaVB4EZnxLp4RWkm1hGZcHGBd5qSh+BPv7gvj+g9vjFhkCwXgAinBekxo0GOhf/Ip4zK+KWZwNTzF8MXjAkSARnFQgXiFAncaEVzXGho1TVYvYAN1PRQxEu79bYS0IG5+ZOw0VVpjw=,iv:vLiojJJrl6yC83stsNoXLZX762z8nM0Jx164lx7XVjs=,tag:K8zFZ5bb8QeADmsLf0o6pw==,type:str]
|
||||
pass_broker_gateway_token: ENC[AES256_GCM,data:OSM2iCIi+GymGzIS3T2vN06H0q8GvSuQ2RWkatSfIyIrQpVKaeU/GUEkD6S4okedKBtXXYN9cnc2Ro3H7d+S0g==,iv:9hgYqlTonbDlAu8WpjUUTqhqbpfAxb1ZAuQUUac2QC4=,tag:skIctluEWh4hMnmR4Y7g6w==,type:str]
|
||||
protonvpn_wg_private_key: ENC[AES256_GCM,data:aTfP7xyStfy/kmLuJA8L32J8uJ5Y0eA5c8XySiiozFLau+PxU7t8sSremQ8=,iv:pbkMKmPhRmTat5swTsjf29ZOEHSTjWvUXMsdbFgF3PY=,tag:OAyEkFthYwv6lkr6M/EWkA==,type:str]
|
||||
honcho_gate_token: ENC[AES256_GCM,data:rHPBC+UujQFiPAFfvNd9Zf9CmkmR1IgkuelKgfEFwPxHEWRZiiiCgUrPiFZbY/teqJ6F3j4RhFpgVNKRv8UX4g==,iv:rTI7shOVdJ0VrGzlhK5w1dnR6Q0ZcGMLOhT2ZFqb20E=,tag:UViCmLukzNFDQ5QHPp9W5Q==,type:str]
|
||||
sops:
|
||||
age:
|
||||
- enc: |
|
||||
@@ -27,7 +27,7 @@ sops:
|
||||
sHjKfw8VrrmAR4pQf1dsY+wcyh4FsZxhP3Q+QIVq3eCIXS9PeJkGAg==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
recipient: age1rfcmu6zh40v4260l9hnf8ajs9vly0s06rx3ey76eu78dp9t7getqyhmkut
|
||||
lastmodified: "2026-09-20T20:02:50Z"
|
||||
mac: ENC[AES256_GCM,data:fEgOKCOYrpnojw9yl3b7ZgJFCcmAs+DmY7etHgD5KNBtoZ3QgQUiTY5+kXvO5HMoENve+bUfyHymUDNjLlb45lItl9ZkAMKvTxGOe+5t0MR2X8BkB/2tjl/fS7CRBTJ0D4S84mH1hB2V2cfKcnGoKNsQyRJddi6OOey534QeV44=,iv:nQuRLkGklMXwkh8LpMC/Tmz1ewRiv8iKbK6IA88r2fA=,tag:LnzQc1sjrIdZ26AtH1Laxw==,type:str]
|
||||
lastmodified: "2026-11-16T04:50:04Z"
|
||||
mac: ENC[AES256_GCM,data:nfT0BFIO+LcJP+GHYYeUjLsoTJIwNgtk17HTGxtswyasz2zGEKfKvTfuPkkVt4iHwzF1xYxWZXWpreACnB7pBQfFYJROkHF3YzfS/0VmpcLMyPMU1NwQKVnpMtO80fPstpV+Att1kY5Fj3VBgIOTrbI/9+/AtYVinU9ntppKgrQ=,iv:hs3REfnm67brJ4vvWYOf2BgVAuZOruaTEDCH2rBojOQ=,tag:RfsoTwBhPjKR1ddTIrq0vg==,type:str]
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.13.2
|
||||
version: 3.13.3
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
tailscale_authkey: ENC[AES256_GCM,data:IMPUuTAo1T/suiEKm9FhNTPaJF1FjdIH5dZw6vzjjzH/eqoKbJ0LyWZ5psGLhJb+5b1T6y9p+OgLVD5g4KaSiW05tIgiMXE7DKF+eHZq3r32guKOymTB9g==,iv:YLODeA1yD+/xyXNygwrvDOG9C+QpO6yTD/JyOsVV64g=,tag:94XPWgNuHeLE3vaN2IvinQ==,type:str]
|
||||
darman_password: ENC[AES256_GCM,data:GI2aBID+NUkKsmWY6+4igchMVKy5U3CK5kxST15aoE9yd7z01Xf2TZwA73MZnH/PY2nqmPQdBexdPRusGXrU3YgRF4tqkngblMA+NVqiZvYzeETtza7aSI034Y1AfBJboVvOX+fOq1TF+Q==,iv:EFne3Dl49lAp8Wufurv3pjoT99tRcSaVrJmA85i6qSU=,tag:S4CevQN/zmpGJ3SOVB4ahw==,type:str]
|
||||
samba_password: ENC[AES256_GCM,data:UEi/qgYVlBM2xelRvAw42WvAvk4=,iv:Ho9td+rD96VpX/l4RmuQrtUCSQj8YG5zXMKITwcDXC8=,tag:CVRbasHUBZO257P9YSdSXg==,type:str]
|
||||
pass_broker_pat: ENC[AES256_GCM,data:askNNSjnr0aaFQ==,iv:9JSmZt0t5A/IFUXDPJ49abbboVZMzy7+u5OkoZkYbuk=,tag:yjTDxqcwd4O6m8d5g6hM3g==,type:str]
|
||||
pass_broker_gateway_token: ENC[AES256_GCM,data:JyWNufgUi80n1CiclM/ZPQT5llgo3u78sYfuzgQeDosuvBOH29s3ga5sSUl2Mz+r5sDIvAkmvwf1SY9aMT8YBQ==,iv:aBYR5F3Mnfs23B3QrCxe8nWm4lE7La6JwFsAkDdVDhs=,tag:ccpx2i9GMog+FbKNouGisQ==,type:str]
|
||||
sops:
|
||||
age:
|
||||
- enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBieFFKUlNRTUFtb0xVcndl
|
||||
blFzejI2Qk5KTmd6MUlldTd0OGUzMlgvSmxnCkxqMXdISThHOGtjNUJBeHdxa0dp
|
||||
Z1hSMC9JeitNeTc2Q3YxRGUyTmpBSmcKLS0tIFlGaHhMQlVYSzRacXAxS2FkMTlM
|
||||
SVptN011NDNkSWNkQURWNHNJdThLdHMKY9bmqFH2MtBNQNEr1D/xB9Ux8J7vbhFI
|
||||
kYSsC2Offuykxl3qdrvnYtqYi9THiDPmyQOAouhg4axYRBi+h1JWCw==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
recipient: age1cekcqyf7073fsytcjxaa9dr9zwkmn4vjg36rv2tgxdglzfv4jvxqvcj6z2
|
||||
- enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBpb0t5TkpXeHBnQXpNTlhZ
|
||||
MG1DQWlDcG9YR0VhMFFXVm53L2ZpalAvLzFnClM0TWU2VWtrcUhuTk9wN1hjZ0lL
|
||||
alJMWTlsSlkrZXFlSUJ5bnRjQ05wMXMKLS0tIEJvRVpJYldrVjE4TGZTb3d4RS9D
|
||||
STlYNGZ2NjJBc0pmV3NJRzhnUHI4aUkKBp9y370pgIRuYr1zNXfXrm2q5g6H4qRZ
|
||||
xxQw11N8OGw4tA1nPY8ahD2LAQRcZo72mOrdAe2DR1OT1BSLEwoh3A==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
recipient: age1qm6ne4mrgwkj7eea5j3vn0qmtw4p5h4eu78vvahhfnd4pk04qausn3qgv2
|
||||
lastmodified: "2026-10-18T14:38:08Z"
|
||||
mac: ENC[AES256_GCM,data:MSLE2u3ebHFIBmcCfORk/QxP33VD1idHsyfWPkIMiEzAOROMFe8ldwAqNfZL04dhI41r8CbpwV4awHnDTHoI0tyldvaHsCqzbiwSySzc97YC5XQDMZzk7NGqsUWmtQ0q6e3tB7QCeW3BClQLEPiXN+fgQgmNDN7KM7Bkh/Mq4GU=,iv:yYRv75odGFVZGToTatkjdsWf9CnMJq/RUOnSAX2kF0I=,tag:LIwXHxK47nciemETsOFsWA==,type:str]
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.13.3
|
||||
@@ -0,0 +1,46 @@
|
||||
{ config, lib, ... }:
|
||||
|
||||
# Public side of services/comms/matrix.nix, on neptun. User IDs are
|
||||
# @user:mgaction.town; the apex only serves delegation, so federation and clients
|
||||
# both land on matrix.mgaction.town:443 (no :8448, no SRV records).
|
||||
let
|
||||
upstream = config.homelab.matrixProxy.upstream;
|
||||
in
|
||||
{
|
||||
options.homelab.matrixProxy.upstream = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "jupiter.orbit.sol";
|
||||
};
|
||||
|
||||
config.services.caddy.virtualHosts = {
|
||||
"mgaction.town".extraConfig = ''
|
||||
header /.well-known/matrix/* Content-Type application/json
|
||||
header /.well-known/matrix/client Access-Control-Allow-Origin *
|
||||
respond /.well-known/matrix/server `{"m.server":"matrix.mgaction.town:443"}`
|
||||
respond /.well-known/matrix/client `{"m.homeserver":{"base_url":"https://matrix.mgaction.town"}}`
|
||||
respond 404
|
||||
'';
|
||||
|
||||
# /_synapse/admin and /_synapse/mas stay tailnet-only.
|
||||
"matrix.mgaction.town".extraConfig = ''
|
||||
request_body {
|
||||
max_size 100MB
|
||||
}
|
||||
@mas path_regexp ^/_matrix/client/[^/]+/(login|logout|refresh)
|
||||
handle @mas {
|
||||
reverse_proxy http://${upstream}:8080
|
||||
}
|
||||
@synapse path /_matrix/* /_synapse/client/*
|
||||
handle @synapse {
|
||||
reverse_proxy http://${upstream}:8008
|
||||
}
|
||||
handle {
|
||||
respond 404
|
||||
}
|
||||
'';
|
||||
|
||||
"account.mgaction.town".extraConfig = ''
|
||||
reverse_proxy http://${upstream}:8080
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
# VM test for matrix.nix + matrix-proxy.nix. Run:
|
||||
# nix build .#checks.x86_64-linux.matrix -L
|
||||
#
|
||||
# jupiter runs Synapse + MAS on postgres with /mnt/data's real traversal perms;
|
||||
# neptun runs the public caddy vhosts (local CA). Authentik isn't in the loop: the
|
||||
# test user comes from `mas manage register-user` and logs in with a compat token.
|
||||
{ pkgs }:
|
||||
let
|
||||
# Throwaway, generated per build.
|
||||
keys = pkgs.runCommand "matrix-test-keys" { nativeBuildInputs = [ pkgs.openssl ]; } ''
|
||||
mkdir $out
|
||||
printf %s "ed25519 a_test $(openssl rand 32 | base64 | tr -d '=')" > $out/signing.key
|
||||
printf %s "$(openssl rand -hex 32)" > $out/macaroon
|
||||
printf %s "$(openssl rand -hex 32)" > $out/form
|
||||
printf %s "$(openssl rand -hex 32)" > $out/mas-shared
|
||||
printf %s "$(openssl rand -hex 32)" > $out/mas-encryption
|
||||
openssl genrsa -out $out/mas-rsa.pem 2048
|
||||
printf dummy > $out/oidc
|
||||
'';
|
||||
|
||||
secret = name: user: group: mode: {
|
||||
source = "${keys}/${name}";
|
||||
inherit user group mode;
|
||||
};
|
||||
in
|
||||
pkgs.testers.runNixOSTest {
|
||||
name = "matrix";
|
||||
|
||||
nodes.jupiter = { config, ... }: {
|
||||
imports = [ ./matrix.nix ];
|
||||
virtualisation.memorySize = 2048;
|
||||
|
||||
environment.etc = {
|
||||
"matrix/signing.key" = secret "signing.key" "matrix-synapse" "matrix-synapse" "0400";
|
||||
"matrix/macaroon" = secret "macaroon" "matrix-synapse" "matrix-synapse" "0400";
|
||||
"matrix/form" = secret "form" "matrix-synapse" "matrix-synapse" "0400";
|
||||
"matrix/mas-shared" = secret "mas-shared" "matrix-synapse" "matrix-synapse" "0440";
|
||||
"matrix/mas-encryption" = secret "mas-encryption" "matrix-authentication-service" "matrix-authentication-service" "0400";
|
||||
"matrix/mas-rsa.pem" = secret "mas-rsa.pem" "matrix-authentication-service" "matrix-authentication-service" "0400";
|
||||
"matrix/oidc" = secret "oidc" "matrix-authentication-service" "matrix-authentication-service" "0400";
|
||||
};
|
||||
homelab.matrix = {
|
||||
signingKeyFile = "/etc/matrix/signing.key";
|
||||
macaroonSecretFile = "/etc/matrix/macaroon";
|
||||
formSecretFile = "/etc/matrix/form";
|
||||
masSecretFile = "/etc/matrix/mas-shared";
|
||||
masEncryptionFile = "/etc/matrix/mas-encryption";
|
||||
masSigningKeyFile = "/etc/matrix/mas-rsa.pem";
|
||||
oidcClientSecretFile = "/etc/matrix/oidc";
|
||||
};
|
||||
|
||||
# jupiter's /mnt/data/AppData is drwx--x--- darman:users; the non-root owner
|
||||
# matters (tmpfiles' unsafe-path-transition check).
|
||||
users.users.darman = { isNormalUser = true; group = "users"; };
|
||||
systemd.tmpfiles.rules = [ "d /mnt/data/AppData 0710 darman users -" ];
|
||||
# Stand-in for the trusted tailscale0.
|
||||
networking.firewall.allowedTCPPorts = [ 8008 8080 ];
|
||||
};
|
||||
|
||||
nodes.neptun = {
|
||||
imports = [ ../network/caddy.nix ./matrix-proxy.nix ];
|
||||
homelab.matrixProxy.upstream = "jupiter";
|
||||
services.caddy.globalConfig = ''
|
||||
local_certs
|
||||
skip_install_trust
|
||||
'';
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
import json
|
||||
import re
|
||||
from urllib.parse import quote
|
||||
|
||||
start_all()
|
||||
|
||||
jupiter.wait_for_unit("matrix-synapse.service")
|
||||
jupiter.wait_for_unit("matrix-authentication-service.service")
|
||||
jupiter.wait_for_open_port(8008)
|
||||
jupiter.wait_for_open_port(8080)
|
||||
neptun.wait_for_unit("caddy.service")
|
||||
neptun.wait_for_open_port(443)
|
||||
|
||||
with subtest("synapse database has C collation"):
|
||||
out = jupiter.succeed(
|
||||
"sudo -u postgres psql -tAc \"SELECT datcollate || ',' || datctype FROM pg_database WHERE datname = 'matrix-synapse'\""
|
||||
).strip()
|
||||
assert out == "C,C", out
|
||||
|
||||
def req(path, host="matrix.mgaction.town", args=""):
|
||||
return neptun.succeed(
|
||||
f"curl -sSf -k --resolve {host}:443:127.0.0.1 {args} 'https://{host}{path}'"
|
||||
)
|
||||
|
||||
def status(path, host="matrix.mgaction.town"):
|
||||
return neptun.succeed(
|
||||
f"curl -s -k -o /dev/null -w '%{{http_code}}' --resolve {host}:443:127.0.0.1 'https://{host}{path}'"
|
||||
)
|
||||
|
||||
with subtest("apex delegates to matrix.mgaction.town"):
|
||||
assert json.loads(req("/.well-known/matrix/server", "mgaction.town")) == {
|
||||
"m.server": "matrix.mgaction.town:443"
|
||||
}
|
||||
assert json.loads(req("/.well-known/matrix/client", "mgaction.town")) == {
|
||||
"m.homeserver": {"base_url": "https://matrix.mgaction.town"}
|
||||
}
|
||||
headers = req("/.well-known/matrix/client", "mgaction.town", "-D - -o /dev/null").lower()
|
||||
assert "access-control-allow-origin: *" in headers, headers
|
||||
assert status("/", "mgaction.town") == "404"
|
||||
|
||||
with subtest("clients are pointed at MAS, SSO only"):
|
||||
meta = json.loads(req("/_matrix/client/v1/auth_metadata"))
|
||||
assert meta["issuer"] == "https://account.mgaction.town/", meta
|
||||
flows = [f["type"] for f in json.loads(req("/_matrix/client/v3/login"))["flows"]]
|
||||
assert "m.login.sso" in flows and "m.login.password" not in flows, flows
|
||||
req("/.well-known/openid-configuration", "account.mgaction.town")
|
||||
|
||||
with subtest("admin API is not public"):
|
||||
assert status("/_synapse/admin/v1/server_version") == "404"
|
||||
jupiter.succeed("curl -sf http://localhost:8008/_synapse/admin/v1/server_version")
|
||||
|
||||
with subtest("user registered in MAS can chat"):
|
||||
jupiter.succeed("sudo -u matrix-authentication-service mas manage register-user alice --yes --display-name Alice")
|
||||
out = jupiter.succeed("sudo -u matrix-authentication-service mas manage issue-compatibility-token alice 2>&1")
|
||||
m = re.search(r"mct_\w+", out)
|
||||
assert m, out
|
||||
token = m.group(0)
|
||||
auth = f"-H 'Authorization: Bearer {token}'"
|
||||
|
||||
# Provisioning into synapse is an async MAS job.
|
||||
neptun.wait_until_succeeds(
|
||||
f"curl -sSf -k --resolve matrix.mgaction.town:443:127.0.0.1 {auth} https://matrix.mgaction.town/_matrix/client/v3/account/whoami | grep -F '@alice:mgaction.town'",
|
||||
timeout=60,
|
||||
)
|
||||
room = json.loads(req("/_matrix/client/v3/createRoom", args=f"{auth} -X POST -d '{{}}'"))["room_id"]
|
||||
r = quote(room)
|
||||
req(f"/_matrix/client/v3/rooms/{r}/send/m.room.message/t1",
|
||||
args=f"""{auth} -X PUT -d '{{"msgtype":"m.text","body":"hello from the vm"}}'""")
|
||||
msgs = req(f"/_matrix/client/v3/rooms/{r}/messages?dir=b", args=auth)
|
||||
assert "hello from the vm" in msgs, msgs
|
||||
|
||||
with subtest("media upload lands on the array"):
|
||||
neptun.succeed("head -c 5000000 /dev/urandom > /tmp/blob")
|
||||
up = json.loads(req("/_matrix/media/v3/upload?filename=blob",
|
||||
args=f"{auth} -X POST -H 'Content-Type: application/octet-stream' --data-binary @/tmp/blob"))
|
||||
assert up["content_uri"].startswith("mxc://mgaction.town/"), up
|
||||
jupiter.succeed("find /mnt/data/AppData/matrix-synapse -type f -size +4M | grep -q .")
|
||||
|
||||
with subtest("survives a restart"):
|
||||
jupiter.succeed("systemctl restart matrix-authentication-service matrix-synapse")
|
||||
jupiter.wait_for_open_port(8008)
|
||||
jupiter.wait_for_open_port(8080)
|
||||
neptun.wait_until_succeeds(
|
||||
f"curl -sSf -k --resolve matrix.mgaction.town:443:127.0.0.1 {auth} https://matrix.mgaction.town/_matrix/client/v3/account/whoami",
|
||||
timeout=60,
|
||||
)
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
# Matrix homeserver for mgaction.town: Synapse + Matrix Authentication Service (MAS),
|
||||
# both on jupiter's postgres. Published by neptun (services/comms/matrix-proxy.nix).
|
||||
#
|
||||
# Login is OIDC only: MAS owns every login and delegates to Authentik (app slug
|
||||
# `matrix`, client id below). Element X only supports SSO through MAS, not through
|
||||
# Synapse's own oidc_providers, and adding MAS later is a one-way migration.
|
||||
# Admin: `sudo -u matrix-authentication-service mas manage promote-admin <user>`.
|
||||
let
|
||||
cfg = config.homelab.matrix;
|
||||
mas = pkgs.matrix-authentication-service;
|
||||
synapseUser = config.users.users.matrix-synapse.name;
|
||||
masUser = "matrix-authentication-service";
|
||||
mediaDir = "/mnt/data/AppData/matrix-synapse";
|
||||
|
||||
# Only file paths in here, the config itself is world-readable in the store.
|
||||
masConfig = (pkgs.formats.yaml { }).generate "mas-config.yaml" {
|
||||
http = {
|
||||
public_base = "https://account.mgaction.town/";
|
||||
# neptun proxies over the tailnet, outside MAS's default private ranges.
|
||||
trusted_proxies = [ "127.0.0.0/8" "::1/128" "100.64.0.0/10" "fd7a:115c:a1e0::/48" ];
|
||||
listeners = [{
|
||||
name = "web";
|
||||
resources = map (name: { inherit name; })
|
||||
[ "discovery" "human" "oauth" "compat" "graphql" "assets" ];
|
||||
binds = [{ address = "[::]:8080"; }];
|
||||
}];
|
||||
};
|
||||
database = {
|
||||
socket = "/run/postgresql";
|
||||
username = masUser;
|
||||
database = masUser;
|
||||
};
|
||||
matrix = {
|
||||
kind = "synapse";
|
||||
homeserver = "mgaction.town";
|
||||
endpoint = "http://localhost:8008";
|
||||
secret_file = cfg.masSecretFile;
|
||||
};
|
||||
secrets = {
|
||||
encryption_file = cfg.masEncryptionFile;
|
||||
keys = [{ key_file = cfg.masSigningKeyFile; }];
|
||||
};
|
||||
passwords.enabled = false;
|
||||
upstream_oauth2.providers = [{
|
||||
id = "01M5EYGX82FRWPDQDB8EY79JYW"; # stable, part of the Authentik redirect URI
|
||||
human_name = "Authentik";
|
||||
issuer = "https://auth.mgaction.town/application/o/matrix/";
|
||||
client_id = cfg.oidcClientId;
|
||||
client_secret_file = cfg.oidcClientSecretFile;
|
||||
token_endpoint_auth_method = "client_secret_basic";
|
||||
scope = "openid profile email";
|
||||
claims_imports = {
|
||||
# Matrix localparts must be lowercase; fixed at first login.
|
||||
localpart = { action = "require"; template = "{{ user.preferred_username | lower }}"; };
|
||||
displayname = { action = "force"; template = "{{ user.name }}"; };
|
||||
email = { action = "force"; template = "{{ user.email }}"; };
|
||||
};
|
||||
# Otherwise "sign out" bounces straight back in through Authentik's session.
|
||||
additional_authorization_parameters.prompt = "{% if logged_out %}login{% endif %}";
|
||||
}];
|
||||
};
|
||||
|
||||
masCli = pkgs.writeShellScriptBin "mas" ''
|
||||
MAS_CONFIG=${masConfig} exec ${mas}/bin/mas-cli "$@"
|
||||
'';
|
||||
in
|
||||
{
|
||||
options.homelab.matrix = {
|
||||
signingKeyFile = lib.mkOption { type = lib.types.str; description = "Synapse federation signing key; losing it breaks federation under mgaction.town."; };
|
||||
macaroonSecretFile = lib.mkOption { type = lib.types.str; };
|
||||
formSecretFile = lib.mkOption { type = lib.types.str; };
|
||||
masSecretFile = lib.mkOption { type = lib.types.str; description = "Shared Synapse<->MAS secret, readable by group matrix-synapse."; };
|
||||
masEncryptionFile = lib.mkOption { type = lib.types.str; description = "64 hex chars; never change after first start."; };
|
||||
masSigningKeyFile = lib.mkOption { type = lib.types.str; description = "RSA private key (PEM)."; };
|
||||
oidcClientId = lib.mkOption { type = lib.types.str; default = "matrix"; };
|
||||
oidcClientSecretFile = lib.mkOption { type = lib.types.str; };
|
||||
};
|
||||
|
||||
config = {
|
||||
services.matrix-synapse = {
|
||||
enable = true;
|
||||
settings = {
|
||||
server_name = "mgaction.town";
|
||||
public_baseurl = "https://matrix.mgaction.town/";
|
||||
listeners = [
|
||||
{
|
||||
# Not in allowedTCPPorts: only neptun reaches it, via trusted tailscale0.
|
||||
port = 8008;
|
||||
bind_addresses = [ "::" ]; # dual-stack, covers IPv4 too
|
||||
type = "http";
|
||||
tls = false;
|
||||
x_forwarded = true;
|
||||
resources = [{ names = [ "client" "federation" ]; compress = false; }];
|
||||
}
|
||||
{
|
||||
port = 9001;
|
||||
bind_addresses = [ "127.0.0.1" ];
|
||||
type = "metrics";
|
||||
tls = false;
|
||||
resources = [ ];
|
||||
}
|
||||
];
|
||||
enable_metrics = true;
|
||||
report_stats = false;
|
||||
|
||||
signing_key_path = cfg.signingKeyFile;
|
||||
macaroon_secret_key_path = cfg.macaroonSecretFile;
|
||||
form_secret_path = cfg.formSecretFile;
|
||||
|
||||
matrix_authentication_service = {
|
||||
enabled = true;
|
||||
endpoint = "http://localhost:8080/";
|
||||
secret_path = cfg.masSecretFile;
|
||||
};
|
||||
password_config.enabled = false; # MAS refuses to start alongside it
|
||||
|
||||
media_store_path = mediaDir;
|
||||
max_upload_size = "100M";
|
||||
# Federated rooms cache every remote image forever otherwise.
|
||||
media_retention.remote_media_lifetime = "90d";
|
||||
|
||||
# Federation is open, so keep members' profiles to people they share rooms with.
|
||||
require_auth_for_profile_requests = true;
|
||||
limit_profile_requests_to_users_who_share_rooms = true;
|
||||
# No public room directory on a friends & family server.
|
||||
room_list_publication_rules = [{ action = "deny"; }];
|
||||
};
|
||||
};
|
||||
|
||||
users.users.matrix-synapse.extraGroups = [ "users" ]; # traverse /mnt/data/AppData
|
||||
systemd.services.matrix-synapse.unitConfig.RequiresMountsFor = [ mediaDir ];
|
||||
|
||||
users.users.${masUser} = {
|
||||
isSystemUser = true;
|
||||
group = masUser;
|
||||
extraGroups = [ synapseUser ]; # read cfg.masSecretFile
|
||||
};
|
||||
users.groups.${masUser} = { };
|
||||
|
||||
systemd.services.matrix-authentication-service = {
|
||||
description = "Matrix Authentication Service";
|
||||
after = [ "postgresql.target" "network-online.target" ];
|
||||
requires = [ "postgresql.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
environment.MAS_CONFIG = masConfig;
|
||||
serviceConfig = {
|
||||
User = masUser;
|
||||
Group = masUser;
|
||||
ExecStart = "${mas}/bin/mas-cli server";
|
||||
Restart = "on-failure";
|
||||
NoNewPrivileges = true;
|
||||
PrivateTmp = true;
|
||||
PrivateDevices = true;
|
||||
ProtectSystem = "strict";
|
||||
ProtectHome = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectControlGroups = true;
|
||||
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" ];
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [ masCli ];
|
||||
|
||||
# Synapse requires C collation, so its DB can't come from ensureDatabases (cluster
|
||||
# default locale); immich's existing cluster also means initialScript never runs.
|
||||
services.postgresql = {
|
||||
enable = true;
|
||||
ensureDatabases = [ masUser ];
|
||||
ensureUsers = [
|
||||
{ name = synapseUser; }
|
||||
{ name = masUser; ensureDBOwnership = true; }
|
||||
];
|
||||
};
|
||||
systemd.services.postgresql-setup.serviceConfig.ExecStartPost =
|
||||
let
|
||||
sqlFile = pkgs.writeText "matrix-synapse-db.sql" ''
|
||||
SELECT format('CREATE DATABASE %I OWNER %I TEMPLATE template0 ENCODING %L LC_COLLATE %L LC_CTYPE %L',
|
||||
'${synapseUser}', '${synapseUser}', 'UTF8', 'C', 'C')
|
||||
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = '${synapseUser}') \gexec
|
||||
'';
|
||||
in
|
||||
[ "${lib.getExe' config.services.postgresql.package "psql"} -d postgres -f ${sqlFile}" ];
|
||||
|
||||
# A missing ReadWritePaths entry fails synapse's namespace setup. One level only:
|
||||
# tmpfiles skips anything nested under a dir owned by another non-root user
|
||||
# ("unsafe path transition"), and AppData is darman's.
|
||||
systemd.tmpfiles.rules = [ "d ${mediaDir} 0700 matrix-synapse matrix-synapse -" ];
|
||||
};
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
{ pkgs, lib, ... }:
|
||||
{ pkgs, lib, inputs, ... }:
|
||||
|
||||
let
|
||||
rishot = pkgs.callPackage ../../pkgs/rishot.nix { };
|
||||
in
|
||||
|
||||
# Desktop applications for a workstation host (currently: terra). Split from
|
||||
# Desktop applications for a workstation host (terra, titan). Split from
|
||||
# desktop-hyprland.nix, which owns the *session* (compositor, greeter, audio,
|
||||
# portals); this owns the things the user actually launches inside it.
|
||||
{
|
||||
@@ -15,15 +15,26 @@ in
|
||||
"steam"
|
||||
"steam-unwrapped"
|
||||
"steam-run"
|
||||
"rsi-launcher" # services/desktop/star-citizen.nix (terra)
|
||||
"rsi-installer"
|
||||
"epic-games-launcher" # services/desktop/epic-games-launcher.nix (terra)
|
||||
"epic-games-launcher-unwrapped"
|
||||
"teamspeak6-client" # terra
|
||||
"7zz" # nexusmods-app-unfree (terra): RAR support
|
||||
"uasm" # builds 7zz
|
||||
"claude-code"
|
||||
"claude-desktop" # services/desktop/claude-desktop.nix
|
||||
"proton-pass-cli"
|
||||
"vivaldi"
|
||||
"mongodb" # librechat's local db (services/desktop/librechat.nix) — SSPL
|
||||
"nvidia-x11" # titan's RTX 2060
|
||||
"nvidia-settings"
|
||||
];
|
||||
|
||||
nixpkgs.overlays = [ inputs.millennium.overlays.default ];
|
||||
|
||||
programs.steam = {
|
||||
enable = true;
|
||||
package = pkgs.millennium-steam; # Steam + Millennium (themes/plugins)
|
||||
remotePlay.openFirewall = true;
|
||||
dedicatedServer.openFirewall = false;
|
||||
gamescopeSession.enable = true;
|
||||
@@ -31,6 +42,9 @@ in
|
||||
};
|
||||
hardware.graphics.enable32Bit = true;
|
||||
|
||||
# Rocket League LAN (UE3): 14001 discovery, 7777 game
|
||||
networking.firewall.allowedUDPPorts = [ 7777 14001 ];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
alacritty
|
||||
zed-editor
|
||||
@@ -45,7 +59,6 @@ in
|
||||
jq
|
||||
dotnetCorePackages.sdk_10_0
|
||||
nodejs
|
||||
yaak # desktop API client (REST/GraphQL/gRPC)
|
||||
# pkgsRocm, not plain blender: Cycles needs HIP to render on the RX 6800 XT.
|
||||
pkgsRocm.blender
|
||||
];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
# Hyprland (wayland) desktop: compositor, login manager, audio, portals.
|
||||
{
|
||||
@@ -9,6 +9,20 @@
|
||||
services.gnome.gnome-keyring.enable = true;
|
||||
security.pam.services.login.enableGnomeKeyring = true;
|
||||
security.pam.services.greetd.enableGnomeKeyring = true;
|
||||
# Quickshell lock screen (dotfiles/quickshell/HyprChrome/Widgets/Lock).
|
||||
security.pam.services.hyprchrome-lock = { };
|
||||
|
||||
# The daemon PAM spawns inside greetd's session dies unseen, and Vivaldi then
|
||||
# D-Bus-activates a locked one. Run it from the (lingering) user manager so
|
||||
# PAM unlocks that one instead; nixpkgs builds it without socket activation.
|
||||
systemd.user.services.gnome-keyring-daemon = {
|
||||
description = "GNOME Keyring daemon";
|
||||
wantedBy = [ "default.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${config.security.wrapperDir}/gnome-keyring-daemon --foreground --components=pkcs11,secrets --control-directory=%t/keyring";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
|
||||
# Audio (pipewire replaces pulseaudio/jack).
|
||||
security.rtkit.enable = true;
|
||||
@@ -20,12 +34,24 @@
|
||||
|
||||
xdg.portal = {
|
||||
enable = true;
|
||||
extraPortals = [ pkgs.xdg-desktop-portal-hyprland pkgs.xdg-desktop-portal-cosmic ];
|
||||
extraPortals = [ pkgs.xdg-desktop-portal-hyprland pkgs.xdg-desktop-portal-cosmic pkgs.xdg-desktop-portal-gtk ];
|
||||
config.common.default = [ "hyprland" "cosmic" ];
|
||||
# OpenURI (xdg-open via xdgOpenUsePortal, apps opening links) is only
|
||||
# exported when some backend implements AppChooser; only gtk does.
|
||||
config.common."org.freedesktop.impl.portal.AppChooser" = [ "gtk" ];
|
||||
# Steam's private /tmp hides vivaldi's singleton socket; links opened there
|
||||
# started a second browser on the same profile.
|
||||
xdgOpenUsePortal = true;
|
||||
};
|
||||
|
||||
hardware.graphics.enable = true; # OpenGL/Vulkan for the compositor + apps
|
||||
services.libinput.enable = true;
|
||||
|
||||
networking.networkmanager.enable = true;
|
||||
networking.networkmanager.dns = "systemd-resolved";
|
||||
# Fallback only applies when DHCP gave no DNS; networks that block public :53 still work.
|
||||
services.resolved = {
|
||||
enable = true;
|
||||
settings.Resolve.FallbackDNS = [ "1.1.1.1" "9.9.9.9" ];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
# Epic Games Launcher Preview (EGLv2): Epic's .deb, run unpatched in the same
|
||||
# Steam-runtime FHS env as heroic, since the GE-Proton it downloads to
|
||||
# ~/.local/share/com.epicgames.eglv2/compat needs those libraries too.
|
||||
# Bump: version + commit from the 303 Location of
|
||||
# https://launcher-public-service-prod06.ol.epicgames.com/launcher/api/installer/download/EpicGamesLauncher-x86_64.deb
|
||||
let
|
||||
version = "0.115.0";
|
||||
commit = "gd6d2ef8";
|
||||
|
||||
unwrapped = pkgs.stdenvNoCC.mkDerivation {
|
||||
pname = "epic-games-launcher-unwrapped";
|
||||
inherit version;
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://content-download-egs.distro.on.epicgames.com/Builds/EGLv2/${version}%2B${commit}/Linux/EpicGamesLauncher-x86_64.deb";
|
||||
hash = "sha256-YYrcC8x3i7sfSXOBENXCGehh7Uy3rbcrJPtVAxVqbWM=";
|
||||
};
|
||||
nativeBuildInputs = [ pkgs.dpkg ];
|
||||
unpackCmd = "dpkg-deb -x $curSrc root";
|
||||
dontBuild = true;
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
# RUNPATH $ORIGIN/../lib/epic-games-launcher finds the EOS SDK in place.
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r usr/* $out/
|
||||
substituteInPlace $out/share/applications/epic-games-launcher.desktop \
|
||||
--replace-fail "Exec=EpicGamesLauncher" "Exec=epic-games-launcher"
|
||||
'';
|
||||
meta = {
|
||||
description = "Epic Games Launcher Preview";
|
||||
homepage = "https://store.epicgames.com/download";
|
||||
license = lib.licenses.unfree;
|
||||
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
launcher = pkgs.steam.buildRuntimeEnv {
|
||||
pname = "epic-games-launcher";
|
||||
inherit version;
|
||||
inherit (unwrapped) meta;
|
||||
|
||||
runScript = "${unwrapped}/bin/EpicGamesLauncher";
|
||||
|
||||
extraPkgs = p: with p; [
|
||||
webkitgtk_4_1
|
||||
libsoup_3
|
||||
gtk3
|
||||
libayatana-appindicator
|
||||
libsecret # tokens go to gnome-keyring via org.freedesktop.secrets
|
||||
xdg-utils
|
||||
];
|
||||
|
||||
# Its updater would write into the store.
|
||||
extraEnv.EGL_DISABLE_SELF_UPDATE = "1";
|
||||
|
||||
extraInstallCommands = ''
|
||||
mkdir -p $out/share
|
||||
ln -s ${unwrapped}/share/applications $out/share
|
||||
ln -s ${unwrapped}/share/icons $out/share
|
||||
'';
|
||||
|
||||
privateTmp = false;
|
||||
};
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [ launcher ];
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
{ config, ... }:
|
||||
|
||||
# LibreChat — web chat UI, talking to the local ollama server (see
|
||||
# hosts/terra/configuration.nix) over its OpenAI-compatible /v1 route.
|
||||
# Only reachable over the tailnet (networking.firewall.trustedInterfaces =
|
||||
# [ "tailscale0" ] in services/vpn/tailscale.nix) — openFirewall stays off.
|
||||
{
|
||||
services.librechat = {
|
||||
enable = true;
|
||||
enableLocalDB = true; # spins up a local, unauthenticated-on-localhost mongodb
|
||||
|
||||
# LibreChat's isEnabled() treats an unset var as false, not true (despite
|
||||
# .env.example suggesting true is the default), so this must be explicit.
|
||||
# Fine to leave open since it's tailnet-only; flip to false once your
|
||||
# account exists to lock it down.
|
||||
env.ALLOW_REGISTRATION = true;
|
||||
|
||||
credentials = {
|
||||
CREDS_KEY = config.sops.secrets.librechat_creds_key.path;
|
||||
CREDS_IV = config.sops.secrets.librechat_creds_iv.path;
|
||||
JWT_SECRET = config.sops.secrets.librechat_jwt_secret.path;
|
||||
JWT_REFRESH_SECRET = config.sops.secrets.librechat_jwt_refresh_secret.path;
|
||||
};
|
||||
|
||||
settings = {
|
||||
version = "1.2.1";
|
||||
endpoints.custom = [
|
||||
{
|
||||
name = "Ollama";
|
||||
# required field but unchecked by ollama's OpenAI-compat shim
|
||||
apiKey = "ollama";
|
||||
baseURL = "http://127.0.0.1:11434/v1";
|
||||
models = {
|
||||
# Schema requires >=1 entry even though fetch=true overwrites this at
|
||||
# runtime with whatever's pulled (hosts/terra/configuration.nix) —
|
||||
# kept roughly in sync so the UI has sane names before the first fetch.
|
||||
default = [ "gemma4:12b" "qwen3.6:35b-a3b" "VladimirGav/qwen3.8-27B-14GB-IQ4:latest" ];
|
||||
fetch = true; # pull the model list from ollama at startup
|
||||
};
|
||||
titleConvo = true;
|
||||
}
|
||||
];
|
||||
|
||||
# Persistent memory is opt-in at the config level — omitting this block
|
||||
# leaves it off regardless of the user's Settings > Personalization toggle.
|
||||
# `agent.provider` must match endpoints.custom[].name above exactly.
|
||||
memory = {
|
||||
personalize = true; # still needs a per-user opt-in toggle in the UI
|
||||
# instructions REPLACES the default extraction prompt, not appends to it —
|
||||
# needed because the smaller llama3.2:3b (since dropped) kept saving its
|
||||
# own assistant boilerplate as memories, a capability ceiling rather than
|
||||
# a prompting gap. validKeys whitelists what can be stored.
|
||||
validKeys = [ "user_preferences" "personal_info" "ongoing_projects" "technical_context" ];
|
||||
agent = {
|
||||
enabled = true;
|
||||
provider = "Ollama";
|
||||
# same model as the chat endpoint's primary driver — when that's
|
||||
# the active chat model, extraction needs no second model swapped
|
||||
# into VRAM alongside it.
|
||||
model = "gemma4:12b";
|
||||
instructions = ''
|
||||
Save memory ONLY using the keys below, and only when the user's
|
||||
message states something durable and genuinely useful to recall
|
||||
in a LATER, unrelated conversation. Small talk, greetings, and
|
||||
anything about what the assistant said or is capable of are NOT
|
||||
memories — if nothing meets the bar, save nothing.
|
||||
|
||||
set_memory REPLACES the entire value stored at a key — it does
|
||||
NOT append to it. Before calling set_memory for a key, check the
|
||||
"Existing memory" section below. If that key already has a
|
||||
value, your new value MUST merge the old and new information
|
||||
into one complete sentence or short paragraph — calling
|
||||
set_memory with only the newest fact silently ERASES everything
|
||||
already stored under that key. Only drop prior details if the
|
||||
user is explicitly correcting or replacing them.
|
||||
|
||||
- user_preferences: explicitly stated preferences (tools, formats, style).
|
||||
- personal_info: durable facts about the user (name, role, timezone).
|
||||
- ongoing_projects: projects or tasks the user is actively working on.
|
||||
- technical_context: durable facts about the user's setup/stack
|
||||
relevant to future answers (e.g. "runs NixOS", "GPU is AMD ROCm").
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{ pkgs, inputs, ... }:
|
||||
|
||||
# NexusMods.App (dev): nixpkgs' package built from the local checkout instead
|
||||
# of the v0.21.1 release, for the Baldur's Gate 3 load order (modsettings.lsx)
|
||||
# work on the feat/bg3-load-order branch. Builds the branch's last commit, so
|
||||
# commit there, then `nix flake update nexusmods-app` here.
|
||||
#
|
||||
# The branch is based on a main commit after v0.21.1 with the same
|
||||
# Directory.Packages.props, so nixpkgs' NuGet lock (deps.json) still applies.
|
||||
# If a build fails restoring packages, regenerate it with the package's
|
||||
# passthru.fetch-deps.
|
||||
let
|
||||
version = "0.21.1-bg3";
|
||||
nexusmods-app = pkgs.nexusmods-app-unfree.overrideAttrs (old: {
|
||||
inherit version;
|
||||
src = inputs.nexusmods-app;
|
||||
# nixpkgs links the release tag, which a local checkout doesn't have
|
||||
meta = old.meta // {
|
||||
changelog = "https://github.com/Nexus-Mods/NexusMods.App/blob/main/CHANGELOG.md";
|
||||
};
|
||||
});
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [ nexusmods-app ];
|
||||
|
||||
# Upstream discontinued the app, which nixpkgs flags as a known vulnerability.
|
||||
nixpkgs.config.permittedInsecurePackages = [ "nexusmods-app-unfree-${version}" ];
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
# VM test for qbittorrent-vpn.nix. Run:
|
||||
# nix build .#checks.x86_64-linux.qbittorrent-vpn -L
|
||||
#
|
||||
# vpn plays Proton: WireGuard peer at 10.2.0.1 with DNS, a fake NAT-PMP
|
||||
# gateway and an HTTP echo of the caller's address. client runs the module
|
||||
# with Qt offscreen. Keys are throwaway, test-only.
|
||||
{ pkgs }:
|
||||
let
|
||||
clientKey = "sD38/QEAIwOEVNFlvNy7k0w/E/PJ9yA6twXF1Ef461Y=";
|
||||
clientPub = "apnW/TFK+Jx6LDCwSZUgPLYN9+U4b65CHdrGVqfJiEs=";
|
||||
serverKey = "IHQiVlBcfl2fKus+QiQ5Z6ubIFfg4lb0glszV0vIHnQ=";
|
||||
serverPub = "4esStqi/GKbgHQpWOwKLLtf3pc/7JvXgeTv+eJ+poE0=";
|
||||
mappedPort = 41234;
|
||||
|
||||
natpmp = pkgs.writers.writePython3 "fake-natpmp" { } ''
|
||||
import socket
|
||||
import struct
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
s.bind(("0.0.0.0", 5351))
|
||||
while True:
|
||||
req, addr = s.recvfrom(64)
|
||||
op = req[1]
|
||||
if op == 0:
|
||||
resp = struct.pack("!BBHI4s", 0, 128, 0, 1,
|
||||
socket.inet_aton("1.2.3.4"))
|
||||
else:
|
||||
priv = struct.unpack("!H", req[4:6])[0]
|
||||
resp = struct.pack("!BBHIHHI", 0, 128 + op, 0, 1, priv,
|
||||
${toString mappedPort}, 60)
|
||||
s.sendto(resp, addr)
|
||||
'';
|
||||
|
||||
echo = pkgs.writers.writePython3 "echo-addr" { } ''
|
||||
from http.server import BaseHTTPRequestHandler, HTTPServer
|
||||
|
||||
|
||||
class H(BaseHTTPRequestHandler):
|
||||
def do_GET(self):
|
||||
self.send_response(200)
|
||||
self.end_headers()
|
||||
self.wfile.write(self.client_address[0].encode())
|
||||
|
||||
|
||||
HTTPServer(("0.0.0.0", 80), H).serve_forever()
|
||||
'';
|
||||
in
|
||||
pkgs.testers.runNixOSTest {
|
||||
name = "qbittorrent-vpn";
|
||||
|
||||
nodes.vpn = {
|
||||
networking.wireguard.interfaces.wg0 = {
|
||||
ips = [ "10.2.0.1/24" ];
|
||||
listenPort = 51820;
|
||||
privateKeyFile = "${pkgs.writeText "server.key" serverKey}";
|
||||
peers = [{ publicKey = clientPub; allowedIPs = [ "10.2.0.2/32" ]; }];
|
||||
};
|
||||
networking.firewall.allowedUDPPorts = [ 51820 ];
|
||||
networking.firewall.allowedTCPPorts = [ 80 ];
|
||||
networking.firewall.trustedInterfaces = [ "wg0" ];
|
||||
|
||||
services.dnsmasq = {
|
||||
enable = true;
|
||||
resolveLocalQueries = false;
|
||||
settings = {
|
||||
interface = "wg0";
|
||||
bind-dynamic = true;
|
||||
no-resolv = true;
|
||||
address = "/tracker.test/10.2.0.1";
|
||||
};
|
||||
};
|
||||
systemd.services.fake-natpmp = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig.ExecStart = natpmp;
|
||||
};
|
||||
systemd.services.echo-addr = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig.ExecStart = echo;
|
||||
};
|
||||
};
|
||||
|
||||
nodes.client = { nodes, lib, ... }: {
|
||||
imports = [ ./qbittorrent-vpn.nix ];
|
||||
|
||||
users.users.darman = { isNormalUser = true; uid = 1000; };
|
||||
environment.systemPackages = [ pkgs.curl pkgs.jq ];
|
||||
environment.etc."wg/client.key" = { text = clientKey; mode = "0400"; };
|
||||
|
||||
homelab.qbittorrentVpn = {
|
||||
enable = true;
|
||||
downloadDir = "/mnt/data/Torrents";
|
||||
privateKeyFile = "/etc/wg/client.key";
|
||||
peerPublicKey = serverPub;
|
||||
endpoint = "${nodes.vpn.networking.primaryIPAddress}:51820";
|
||||
};
|
||||
systemd.services.qbittorrent-vpn.environment.QT_QPA_PLATFORM = lib.mkForce "offscreen";
|
||||
|
||||
# Things the sandbox must hide; the "Wayland socket" is a plain file, only
|
||||
# its bind is checked.
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /mnt/data 0755 darman users -"
|
||||
"f /mnt/data/other.txt 0644 darman users - other"
|
||||
"d /home/darman/.ssh 0700 darman users -"
|
||||
"f /home/darman/.ssh/id_ed25519 0600 darman users - key"
|
||||
"d /run/user/1000 0700 darman users -"
|
||||
"f /run/user/1000/wayland-1 0600 darman users -"
|
||||
"f /run/user/1000/bus 0600 darman users -"
|
||||
"f /run/pass-broker.sock 0666 root root -"
|
||||
"d /run/secrets 0755 root root -"
|
||||
"f /run/secrets/mine 0400 darman users - secret"
|
||||
];
|
||||
};
|
||||
|
||||
testScript = { nodes, ... }: let vpnIP = nodes.vpn.networking.primaryIPAddress; in ''
|
||||
import json
|
||||
|
||||
start_all()
|
||||
vpn.wait_for_unit("wireguard-wg0.service")
|
||||
vpn.wait_for_unit("dnsmasq.service")
|
||||
vpn.wait_for_unit("fake-natpmp.service")
|
||||
vpn.wait_for_unit("echo-addr.service")
|
||||
client.wait_for_unit("multi-user.target")
|
||||
|
||||
def ns(cmd):
|
||||
return client.succeed(f"ip netns exec proton {cmd}")
|
||||
|
||||
def api(path):
|
||||
return ns(f"curl -sf http://127.0.0.1:8080/api/v2/{path}")
|
||||
|
||||
with subtest("darman starts it via polkit, launcher queues a magnet"):
|
||||
client.succeed(
|
||||
"runuser -u darman -- qbittorrent-vpn "
|
||||
"'magnet:?xt=urn:btih:0123456789abcdef0123456789abcdef01234567&dn=t'"
|
||||
)
|
||||
client.wait_for_unit("qbittorrent-vpn.service")
|
||||
client.wait_for_unit("proton-netns.service")
|
||||
client.wait_until_succeeds("ip netns exec proton curl -sf http://127.0.0.1:8080/api/v2/app/version")
|
||||
|
||||
with subtest("sandbox: own state and downloads only"):
|
||||
pid = client.succeed("systemctl show -p MainPID --value qbittorrent-vpn").strip()
|
||||
|
||||
def inside(cmd):
|
||||
return f"nsenter -t {pid} -m -S 1000 -G 100 sh -c '{cmd}'"
|
||||
|
||||
client.succeed(inside("[ -e /run/qbittorrent-vpn/wayland ]"))
|
||||
client.succeed(inside("touch /mnt/data/Torrents/w /home/darman/.config/qBittorrent/w"))
|
||||
# InaccessiblePaths leaves a mode-000 node behind, so access, not
|
||||
# existence, is what's checked.
|
||||
for hidden in ["/home/darman/.ssh/id_ed25519", "/mnt/data/other.txt",
|
||||
"/run/user/1000/bus", "/run/pass-broker.sock", "/run/secrets/mine"]:
|
||||
client.fail(inside(f"cat {hidden}"))
|
||||
for hidden in ["/home/darman/.ssh", "/run/user/1000", "/run/secrets"]:
|
||||
client.fail(inside(f"ls {hidden}"))
|
||||
client.fail(inside("touch /home/darman/x.sh /etc/x"))
|
||||
client.succeed(f"! tr '\\0' '\\n' < /proc/{pid}/environ | grep -q DBUS_SESSION_BUS_ADDRESS")
|
||||
|
||||
with subtest("magnet is picked up from the watch folder"):
|
||||
client.wait_until_succeeds(
|
||||
"ip netns exec proton curl -sf http://127.0.0.1:8080/api/v2/torrents/info"
|
||||
" | jq -e 'length == 1'"
|
||||
)
|
||||
client.succeed("[ -z \"$(ls -A /home/darman/.local/share/qbittorrent-vpn/watch)\" ]")
|
||||
|
||||
with subtest("NAT-PMP port lands in qBittorrent"):
|
||||
client.wait_until_succeeds(
|
||||
"ip netns exec proton curl -sf http://127.0.0.1:8080/api/v2/app/preferences"
|
||||
" | jq -e '.listen_port == ${toString mappedPort}'"
|
||||
)
|
||||
prefs = json.loads(api("app/preferences"))
|
||||
assert prefs["current_network_interface"] == "wg-proton", prefs["current_network_interface"]
|
||||
assert prefs["save_path"].rstrip("/") == "/mnt/data/Torrents", prefs["save_path"]
|
||||
|
||||
with subtest("traffic leaves through the tunnel only"):
|
||||
assert ns("curl -sf --max-time 5 http://${vpnIP}/") == "10.2.0.2"
|
||||
# Root namespace still goes direct.
|
||||
assert client.succeed("curl -sf --max-time 5 http://${vpnIP}/") != "10.2.0.2"
|
||||
|
||||
with subtest("qBittorrent resolves via tunnel DNS, not host nscd"):
|
||||
pid = client.succeed("systemctl show -p MainPID --value qbittorrent-vpn").strip()
|
||||
out = client.succeed(f"nsenter -t {pid} -m -n getent hosts tracker.test")
|
||||
assert out.startswith("10.2.0.1"), out
|
||||
client.succeed(f"nsenter -t {pid} -m sh -c '! [ -S /run/nscd/socket ]'")
|
||||
client.fail("getent hosts tracker.test")
|
||||
|
||||
with subtest("tunnel down = no connectivity, no fallback"):
|
||||
vpn.succeed("ip link set wg0 down")
|
||||
client.fail("ip netns exec proton curl -sf --max-time 5 http://${vpnIP}/")
|
||||
vpn.succeed("ip link set wg0 up && ip addr replace 10.2.0.1/24 dev wg0")
|
||||
client.wait_until_succeeds("ip netns exec proton curl -sf --max-time 5 http://${vpnIP}/")
|
||||
|
||||
with subtest("stopping the GUI tears the namespace down"):
|
||||
client.succeed("runuser -u darman -- systemctl stop qbittorrent-vpn.service")
|
||||
client.wait_until_succeeds("! systemctl is-active proton-netns.service")
|
||||
client.succeed("! systemctl is-active proton-portforward.service")
|
||||
client.succeed("! [ -e /run/netns/proton ]")
|
||||
|
||||
with subtest("polkit grants only this unit"):
|
||||
client.fail("runuser -u darman -- systemctl start proton-netns.service")
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,280 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
# qBittorrent GUI confined to a ProtonVPN WireGuard network namespace: its
|
||||
# only route is the tunnel, so a dropped VPN stalls torrents instead of
|
||||
# leaking them. qbittorrent is deliberately NOT on PATH — an unconfined
|
||||
# launch would bypass all of this; `qbittorrent-vpn` (and the .desktop
|
||||
# entry, magnet/.torrent handler) start it as a system unit instead.
|
||||
let
|
||||
cfg = config.homelab.qbittorrentVpn;
|
||||
ns = "proton";
|
||||
iface = "wg-proton";
|
||||
gateway = "10.2.0.1"; # Proton's in-tunnel DNS + NAT-PMP
|
||||
webuiPort = 8080; # netns-local only
|
||||
user = config.users.users.${cfg.user};
|
||||
# Outside the netns, so the launcher can hand torrents to a running GUI.
|
||||
stateDir = "${user.home}/.local/share/qbittorrent-vpn";
|
||||
watchDir = "${stateDir}/watch";
|
||||
envFile = "${stateDir}/session.env";
|
||||
qb = pkgs.qbittorrent;
|
||||
|
||||
launcher = pkgs.writeShellApplication {
|
||||
name = "qbittorrent-vpn";
|
||||
runtimeInputs = [ pkgs.coreutils pkgs.systemd pkgs.gnugrep ];
|
||||
text = ''
|
||||
mkdir -p ${watchDir}
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
magnet:*) printf '%s\n' "$arg" > "${watchDir}/$(printf '%s' "$arg" | sha1sum | cut -c1-16).magnet" ;;
|
||||
file://*) p="''${arg#file://}"; cp -- "$(printf '%b' "''${p//%/\\x}")" ${watchDir}/ ;;
|
||||
*) cp -- "$arg" ${watchDir}/ ;;
|
||||
esac
|
||||
done
|
||||
# The sandbox binds this one socket by name.
|
||||
if [ "''${WAYLAND_DISPLAY:-${cfg.waylandDisplay}}" != ${cfg.waylandDisplay} ]; then
|
||||
echo "qbittorrent-vpn: session is $WAYLAND_DISPLAY, sandbox binds ${cfg.waylandDisplay} (homelab.qbittorrentVpn.waylandDisplay)" >&2
|
||||
exit 1
|
||||
fi
|
||||
env | grep -E '^(XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XCURSOR_[A-Z]+|QT_[A-Z_]+|LANG|LC_[A-Z]+|PATH)=' \
|
||||
> ${envFile} || true
|
||||
exec systemctl start qbittorrent-vpn.service
|
||||
'';
|
||||
};
|
||||
|
||||
desktopItem = pkgs.makeDesktopItem {
|
||||
name = "qbittorrent-vpn";
|
||||
desktopName = "qBittorrent (ProtonVPN)";
|
||||
exec = "qbittorrent-vpn %U";
|
||||
icon = "${qb}/share/icons/hicolor/scalable/apps/qbittorrent.svg";
|
||||
categories = [ "Network" "FileTransfer" "P2P" ];
|
||||
mimeTypes = [ "application/x-bittorrent" "x-scheme-handler/magnet" ];
|
||||
};
|
||||
|
||||
# The only paths qBittorrent can write; the rest of $HOME is invisible.
|
||||
writable = [
|
||||
"${user.home}/.config/qBittorrent"
|
||||
"${user.home}/.local/share/qBittorrent"
|
||||
"${user.home}/.cache/qBittorrent"
|
||||
watchDir
|
||||
cfg.downloadDir
|
||||
];
|
||||
# Theme, icons and cursor, read-only; "-" = skip if absent.
|
||||
themes = map (p: "-${user.home}/${p}") [
|
||||
".config/qt5ct" ".config/qt6ct" ".config/Kvantum" ".config/fontconfig"
|
||||
".config/gtk-3.0" ".config/kdeglobals" ".icons" ".local/share/icons"
|
||||
".local/share/mime" ".nix-profile" ".local/state/nix/profile"
|
||||
];
|
||||
|
||||
# Unsandboxed, as the user: bind sources must exist before the sandbox is
|
||||
# built. Also re-applies the settings the confinement relies on, since the
|
||||
# GUI owns qBittorrent.conf and writes it back on exit.
|
||||
prepare = pkgs.writeShellScript "qbittorrent-vpn-prepare" ''
|
||||
set -eu
|
||||
dir="$HOME/.config/qBittorrent"
|
||||
mkdir -p ${lib.escapeShellArgs writable}
|
||||
set_() { ${pkgs.crudini}/bin/crudini --ini-options=nospace --set "$dir/qBittorrent.conf" "$1" "$2" "$3"; }
|
||||
set_ BitTorrent 'Session\Interface' ${iface}
|
||||
set_ BitTorrent 'Session\InterfaceName' ${iface}
|
||||
set_ BitTorrent 'Session\DefaultSavePath' ${cfg.downloadDir}
|
||||
set_ Network PortForwardingEnabled false
|
||||
set_ Preferences 'WebUI\Enabled' true
|
||||
set_ Preferences 'WebUI\Address' 127.0.0.1
|
||||
set_ Preferences 'WebUI\Port' ${toString webuiPort}
|
||||
set_ Preferences 'WebUI\LocalHostAuth' false
|
||||
# The WebUI refuses to start without credentials; LocalHostAuth=false means
|
||||
# they're never checked, so a random hash nobody knows the password to.
|
||||
${pkgs.crudini}/bin/crudini --get "$dir/qBittorrent.conf" Preferences 'WebUI\Password_PBKDF2' >/dev/null 2>&1 ||
|
||||
set_ Preferences 'WebUI\Password_PBKDF2' \
|
||||
"@ByteArray($(head -c16 /dev/urandom | base64 -w0):$(head -c64 /dev/urandom | base64 -w0))"
|
||||
[ -e "$dir/watched_folders.json" ] ||
|
||||
echo '{"${watchDir}":{"add_torrent_params":{},"recursive":false}}' > "$dir/watched_folders.json"
|
||||
'';
|
||||
|
||||
# Proton's documented NAT-PMP loop (60s lease, renewed every 45s); the
|
||||
# mapped port is pushed into qBittorrent whenever it changes.
|
||||
portForward = pkgs.writeShellScript "proton-portforward" ''
|
||||
set -u
|
||||
api=http://127.0.0.1:${toString webuiPort}/api/v2/app
|
||||
while :; do
|
||||
port=$(${pkgs.libnatpmp}/bin/natpmpc -g ${gateway} -a 1 0 udp 60 \
|
||||
| ${pkgs.gnused}/bin/sed -n 's/.*Mapped public port \([0-9]*\).*/\1/p')
|
||||
${pkgs.libnatpmp}/bin/natpmpc -g ${gateway} -a 1 0 tcp 60 >/dev/null
|
||||
if [ -n "$port" ]; then
|
||||
cur=$(${pkgs.curl}/bin/curl -sf $api/preferences | ${pkgs.jq}/bin/jq -r .listen_port) &&
|
||||
[ "$cur" != "$port" ] &&
|
||||
${pkgs.curl}/bin/curl -sf --data "json={\"listen_port\":$port}" $api/setPreferences &&
|
||||
echo "listen port $cur -> $port"
|
||||
else
|
||||
echo "NAT-PMP mapping failed (is this a P2P server?)" >&2
|
||||
fi
|
||||
sleep 45
|
||||
done
|
||||
'';
|
||||
in
|
||||
{
|
||||
options.homelab.qbittorrentVpn = {
|
||||
enable = lib.mkEnableOption "qBittorrent GUI confined to a ProtonVPN netns";
|
||||
user = lib.mkOption { type = lib.types.str; default = "darman"; };
|
||||
# Fixed at build time: the sandbox binds the Wayland socket by path.
|
||||
uid = lib.mkOption { type = lib.types.int; default = 1000; };
|
||||
waylandDisplay = lib.mkOption { type = lib.types.str; default = "wayland-1"; };
|
||||
downloadDir = lib.mkOption { type = lib.types.str; };
|
||||
privateKeyFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = "WireGuard PrivateKey from the Proton config.";
|
||||
};
|
||||
address = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "10.2.0.2/32";
|
||||
description = "IPv4 [Interface] Address. IPv6 is left out: no v6 route, so no v6 leak.";
|
||||
};
|
||||
peerPublicKey = lib.mkOption { type = lib.types.str; };
|
||||
endpoint = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "[Peer] Endpoint, ip:port — an IP, so no DNS is needed to bring it up.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [ launcher desktopItem ];
|
||||
xdg.mime.defaultApplications = {
|
||||
"application/x-bittorrent" = "qbittorrent-vpn.desktop";
|
||||
"x-scheme-handler/magnet" = "qbittorrent-vpn.desktop";
|
||||
};
|
||||
|
||||
# `ip netns exec` would bind this over /etc/resolv.conf; systemd's
|
||||
# NetworkNamespacePath does not, so the units below do it themselves.
|
||||
environment.etc."netns/${ns}/resolv.conf".text = "nameserver ${gateway}\n";
|
||||
|
||||
# The interface is created in the root namespace and then moved, so its
|
||||
# UDP socket stays outside (where the internet is) while the interface
|
||||
# is the netns's only way out.
|
||||
systemd.services.proton-netns = {
|
||||
description = "ProtonVPN WireGuard network namespace";
|
||||
after = [ "network-online.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
path = [ pkgs.iproute2 pkgs.wireguard-tools ];
|
||||
unitConfig.StopWhenUnneeded = true;
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStop = "${pkgs.iproute2}/bin/ip netns del ${ns}";
|
||||
};
|
||||
script = ''
|
||||
ip netns del ${ns} 2>/dev/null || true
|
||||
ip netns add ${ns}
|
||||
ip -n ${ns} link set lo up
|
||||
ip link add ${iface} type wireguard
|
||||
ip link set ${iface} netns ${ns}
|
||||
ip netns exec ${ns} wg set ${iface} \
|
||||
private-key ${cfg.privateKeyFile} \
|
||||
peer ${cfg.peerPublicKey} endpoint ${cfg.endpoint} \
|
||||
allowed-ips 0.0.0.0/0 persistent-keepalive 25
|
||||
ip -n ${ns} addr add ${cfg.address} dev ${iface}
|
||||
ip -n ${ns} link set ${iface} up
|
||||
ip -n ${ns} route add default dev ${iface}
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.services.qbittorrent-vpn-prepare = {
|
||||
description = "Prepare qBittorrent (ProtonVPN netns) state";
|
||||
unitConfig.RequiresMountsFor = [ cfg.downloadDir ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
User = cfg.user;
|
||||
ExecStart = prepare;
|
||||
};
|
||||
};
|
||||
|
||||
# Sandboxed so a compromised client (it's internet-facing) gets its own
|
||||
# state and downloads, not ~/.ssh, the sops age key or the session.
|
||||
systemd.services.qbittorrent-vpn = {
|
||||
description = "qBittorrent (ProtonVPN netns)";
|
||||
bindsTo = [ "proton-netns.service" ];
|
||||
requires = [ "qbittorrent-vpn-prepare.service" ];
|
||||
after = [ "proton-netns.service" "qbittorrent-vpn-prepare.service" ];
|
||||
wants = [ "proton-portforward.service" ];
|
||||
unitConfig.RequiresMountsFor = [ cfg.downloadDir ];
|
||||
environment = {
|
||||
QT_QPA_PLATFORM = "wayland";
|
||||
XDG_RUNTIME_DIR = "/run/qbittorrent-vpn";
|
||||
WAYLAND_DISPLAY = "/run/qbittorrent-vpn/wayland";
|
||||
};
|
||||
serviceConfig = {
|
||||
User = cfg.user;
|
||||
EnvironmentFile = "-${envFile}";
|
||||
ExecStart = "${qb}/bin/qbittorrent --confirm-legal-notice";
|
||||
NetworkNamespacePath = "/run/netns/${ns}";
|
||||
|
||||
RuntimeDirectory = "qbittorrent-vpn";
|
||||
RuntimeDirectoryMode = "0700";
|
||||
# Hides /home and /run/user; only the paths bound below come back. No
|
||||
# session bus: through it, systemd --user runs anything unsandboxed.
|
||||
ProtectHome = "tmpfs";
|
||||
TemporaryFileSystem = [ "/mnt:ro" "/media:ro" ];
|
||||
BindPaths = writable
|
||||
++ [ "-/run/user/${toString cfg.uid}/${cfg.waylandDisplay}:/run/qbittorrent-vpn/wayland" ];
|
||||
BindReadOnlyPaths = themes
|
||||
++ [ "/etc/netns/${ns}/resolv.conf:/etc/resolv.conf" ];
|
||||
InaccessiblePaths = [
|
||||
# nscd and resolved answer from the ROOT namespace — reachable through
|
||||
# their sockets, they would resolve outside the tunnel.
|
||||
"-/run/nscd"
|
||||
"-/run/systemd/resolve"
|
||||
# darman-owned sops secrets, and sockets that act on darman's behalf.
|
||||
"-/run/secrets"
|
||||
"-/run/secrets.d"
|
||||
"-/run/pass-broker.sock"
|
||||
"-/run/tailscale"
|
||||
"-/run/ssh-unix-local"
|
||||
];
|
||||
|
||||
ProtectSystem = "strict";
|
||||
PrivateTmp = true;
|
||||
PrivateDevices = true;
|
||||
PrivatePIDs = true;
|
||||
ProtectProc = "invisible";
|
||||
NoNewPrivileges = true;
|
||||
CapabilityBoundingSet = "";
|
||||
RestrictSUIDSGID = true;
|
||||
ProtectKernelTunables = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelLogs = true;
|
||||
ProtectControlGroups = true;
|
||||
ProtectClock = true;
|
||||
ProtectHostname = true;
|
||||
RestrictNamespaces = true;
|
||||
RestrictRealtime = true;
|
||||
LockPersonality = true;
|
||||
SystemCallArchitectures = "native";
|
||||
RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" "AF_NETLINK" ];
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.proton-portforward = {
|
||||
description = "ProtonVPN NAT-PMP port forwarding for qBittorrent";
|
||||
bindsTo = [ "qbittorrent-vpn.service" ];
|
||||
after = [ "qbittorrent-vpn.service" ];
|
||||
serviceConfig = {
|
||||
ExecStart = portForward;
|
||||
DynamicUser = true;
|
||||
Restart = "always";
|
||||
RestartSec = 10;
|
||||
NetworkNamespacePath = "/run/netns/${ns}";
|
||||
BindReadOnlyPaths = [ "/etc/netns/${ns}/resolv.conf:/etc/resolv.conf" ];
|
||||
InaccessiblePaths = [ "-/run/nscd" "-/run/systemd/resolve" ];
|
||||
};
|
||||
};
|
||||
|
||||
security.polkit.enable = true;
|
||||
security.polkit.extraConfig = ''
|
||||
polkit.addRule(function(action, subject) {
|
||||
if (action.id == "org.freedesktop.systemd1.manage-units" &&
|
||||
action.lookup("unit") == "qbittorrent-vpn.service" &&
|
||||
["start", "stop", "restart"].indexOf(action.lookup("verb")) >= 0 &&
|
||||
subject.user == "${cfg.user}")
|
||||
return polkit.Result.YES;
|
||||
});
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -7,6 +7,7 @@ let
|
||||
cfg = config.homelab.greeter;
|
||||
hyprland = config.programs.hyprland.package;
|
||||
toLua = lib.generators.toLua { };
|
||||
greeterHome = config.users.users.greeter.home;
|
||||
|
||||
shellDir = ../../dotfiles/quickshell;
|
||||
|
||||
@@ -32,6 +33,12 @@ let
|
||||
hl.env("QS_GREETER_USER", ${toLua cfg.defaultUser})
|
||||
hl.env("QS_GREETER_HOST", ${toLua config.networking.hostName})
|
||||
hl.env("QS_GREETER_SESSION", "start-hyprland")
|
||||
${lib.optionalString (cfg.cursor != null) ''
|
||||
hl.env("HYPRCURSOR_THEME", ${toLua cfg.cursor.name})
|
||||
hl.env("HYPRCURSOR_SIZE", "${toString cfg.cursor.size}")
|
||||
hl.env("XCURSOR_THEME", ${toLua cfg.cursor.name})
|
||||
hl.env("XCURSOR_SIZE", "${toString cfg.cursor.size}")
|
||||
''}
|
||||
|
||||
hl.on("hyprland.start", function()
|
||||
hl.exec_cmd("${session}")
|
||||
@@ -58,6 +65,11 @@ in
|
||||
type = lib.types.str;
|
||||
default = "us";
|
||||
};
|
||||
cursor = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.attrs;
|
||||
default = null;
|
||||
description = "{ name, size, package } cursor theme; reuse the user's pointerCursor.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
@@ -72,5 +84,12 @@ in
|
||||
home = "/var/lib/greeter";
|
||||
createHome = true;
|
||||
};
|
||||
|
||||
# ~/.icons is searched by both hyprcursor and libXcursor; the greeter's
|
||||
# XDG_DATA_DIRS isn't something we control.
|
||||
systemd.tmpfiles.rules = lib.optionals (cfg.cursor != null) [
|
||||
"d ${greeterHome}/.icons 0755 greeter greeter -"
|
||||
"L+ ${greeterHome}/.icons/${cfg.cursor.name} - - - - ${cfg.cursor.package}/share/icons/${cfg.cursor.name}"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
{ inputs, pkgs, ... }:
|
||||
|
||||
let
|
||||
sc = inputs.nix-citizen.packages.${pkgs.stdenv.hostPlatform.system};
|
||||
in
|
||||
|
||||
# Star Citizen via nix-citizen's RSI Launcher (wine-astral). The module also
|
||||
# sets the LUG prerequisites: vm.max_map_count, file limits, joystick udev, ntsync.
|
||||
{
|
||||
imports = [ inputs.nix-citizen.nixosModules.StarCitizen ];
|
||||
|
||||
nix.settings = {
|
||||
substituters = [ "https://nix-citizen.cachix.org" ];
|
||||
trusted-public-keys = [ "nix-citizen.cachix.org-1:lPMkWc2X8XD4/7YPEEwXKKBg+SVbYTVrAaLA2wQTKCo=" ];
|
||||
};
|
||||
|
||||
programs.rsi-launcher = {
|
||||
enable = true;
|
||||
# The overlay rebuilds wine-astral + mingw gcc against our nixpkgs (no cache
|
||||
# hit; froze terra), and its fallback indexes packages by the platform attrset.
|
||||
includeOverlay = false;
|
||||
package = sc.rsi-launcher;
|
||||
wine = sc.wine-astral;
|
||||
location = "/mnt/ssd_01/games/rsi-launcher"; # ~130G, wants an SSD
|
||||
# No gamescope: nested it has no clipboard sync and a us keymap, and it can't
|
||||
# wrap just the game (the launcher spawns it). Workspace: home/desktop/hyprland.nix.
|
||||
# Back onto wine's X11 driver: the Wayland one's clipboard dies on Hyprland
|
||||
# ("opcode 3 of zwlr_data_control_device_v1 is NULL"). Runs after the script disables it.
|
||||
preCommands = ''WINEDLLOVERRIDES="''${WINEDLLOVERRIDES%;winex11.drv=d}"'';
|
||||
};
|
||||
|
||||
# The game peaks above terra's 32G and has no swap to fall back on.
|
||||
zramSwap = {
|
||||
enable = true;
|
||||
memoryPercent = 50;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
{ pkgs, lib, inputs, ... }:
|
||||
|
||||
# Unreal Engine: Epic's prebuilt Linux zip in an FHS env. The zip is behind an
|
||||
# Epic login, so it's unpacked by hand to engineDir rather than fetched by Nix.
|
||||
let
|
||||
engineDir = "/mnt/ssd_01/unreal/UE_5.8.4";
|
||||
|
||||
fhs = name: runScript: pkgs.buildFHSEnv {
|
||||
inherit name runScript;
|
||||
targetPkgs = p: with p; [
|
||||
# Editor
|
||||
vulkan-loader
|
||||
vulkan-tools # vulkaninfo, to debug from unreal-shell
|
||||
libGL
|
||||
libxkbcommon
|
||||
wayland
|
||||
alsa-lib
|
||||
libpulseaudio
|
||||
udev
|
||||
fontconfig
|
||||
freetype
|
||||
zlib
|
||||
stdenv.cc.cc.lib
|
||||
libxcrypt-legacy
|
||||
util-linux.lib
|
||||
libx11
|
||||
libxcb
|
||||
libxcursor
|
||||
libxext
|
||||
libxfixes
|
||||
libxi
|
||||
libxinerama
|
||||
libxrandr
|
||||
libxrender
|
||||
libxscrnsaver
|
||||
libxtst
|
||||
libsm
|
||||
libice
|
||||
|
||||
# CEF (Fab, web browser widgets)
|
||||
at-spi2-atk
|
||||
at-spi2-core
|
||||
atk
|
||||
cairo
|
||||
cups
|
||||
dbus
|
||||
expat
|
||||
glib
|
||||
gtk3
|
||||
libdrm
|
||||
libgbm
|
||||
libxcomposite
|
||||
libxdamage
|
||||
nspr
|
||||
nss
|
||||
pango
|
||||
|
||||
# UnrealBuildTool (bundled .NET) and C++ project builds
|
||||
icu
|
||||
krb5
|
||||
openssl
|
||||
bash
|
||||
coreutils
|
||||
file
|
||||
findutils
|
||||
gawk
|
||||
git
|
||||
gnugrep
|
||||
gnumake
|
||||
gnused
|
||||
rsync
|
||||
which
|
||||
xdg-utils
|
||||
];
|
||||
# The session exports wayland; the editor's windowing targets X11.
|
||||
# hyprchrome-claude's LD_LIBRARY_PATH needs a newer glibc than this env's.
|
||||
profile = ''
|
||||
export SDL_VIDEODRIVER=x11
|
||||
unset LD_LIBRARY_PATH
|
||||
'';
|
||||
};
|
||||
|
||||
editor = fhs "unreal-editor" "${engineDir}/Engine/Binaries/Linux/UnrealEditor";
|
||||
shell = fhs "unreal-shell" "bash"; # RunUAT, project builds, debugging
|
||||
|
||||
# nixpkgs 26.05 has Blender 5.1; the game-dev harness (projects/.harness) wants
|
||||
# the newest one. pkgsRocm, as in desktop-apps: Cycles needs HIP on the RX 6800 XT.
|
||||
# hiPrio wins the bin/blender collision with desktop-apps.nix's pkgsRocm.blender.
|
||||
unstable = import inputs.nixpkgs-unstable {
|
||||
inherit (pkgs.stdenv.hostPlatform) system;
|
||||
config = pkgs.config;
|
||||
};
|
||||
|
||||
desktopItem = pkgs.makeDesktopItem {
|
||||
name = "unreal-editor";
|
||||
desktopName = "Unreal Editor";
|
||||
exec = "unreal-editor %F";
|
||||
categories = [ "Development" "IDE" ];
|
||||
startupWMClass = "UnrealEditor";
|
||||
};
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [
|
||||
editor
|
||||
shell
|
||||
desktopItem
|
||||
pkgs.python3 # the harness tools (ue, blender, asset_pipe, ...) are Python
|
||||
(lib.hiPrio unstable.pkgsRocm.blender)
|
||||
pkgs.git-lfs # the project repos (LANfall, ...) keep their assets in LFS
|
||||
];
|
||||
|
||||
# The game-dev harness's commands (ue, blender, asset_pipe, tripo_studio, ...). First on PATH: its `blender`
|
||||
# wraps the real one (and finds it further down PATH). The harness's own setup is .harness/setup.sh.
|
||||
environment.extraInit = ''
|
||||
export PATH="/mnt/ssd_01/unreal/projects/.harness/bin:$PATH"
|
||||
'';
|
||||
environment.sessionVariables.TRIPO_ANALYTICS_ENABLED = "0"; # Tripo CLI telemetry off
|
||||
|
||||
systemd.tmpfiles.rules = [ "d /mnt/ssd_01/unreal 0755 darman users -" ];
|
||||
}
|
||||
@@ -61,6 +61,9 @@ in
|
||||
START_SSH_SERVER = true;
|
||||
SSH_PORT = 2222;
|
||||
SSH_LISTEN_PORT = 2222;
|
||||
# LFS objects over the ssh connection itself; otherwise git-lfs fetches
|
||||
# them from ROOT_URL, i.e. through neptun, even on an ssh remote.
|
||||
LFS_ALLOW_PURE_SSH = true;
|
||||
};
|
||||
service = {
|
||||
DISABLE_REGISTRATION = true;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{ pkgs, ... }:
|
||||
|
||||
# Host permissions for reverse engineering Turtle Beach Swarm II devices
|
||||
# (/mnt/hdd_01/data/Dev/repos/turtle-beach-swarm-re/nixos/turtle-beach-re.nix).
|
||||
# (/mnt/hdd_01/dev/repos/openbeach-re/protocol/nixos/turtle-beach-re.nix).
|
||||
{
|
||||
# USB traffic capture (/dev/usbmonN), readable by the 'wireshark' group
|
||||
boot.kernelModules = [ "usbmon" ];
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
# Fakes shared by pass-broker-test.nix and pass-broker-gateway-test.nix: a
|
||||
# pass-cli that only logs in with the expected PAT (and refuses one on its
|
||||
# command line), and a Telegram API on 127.0.0.1:8081 whose button presses
|
||||
# the test script injects via /test/press.
|
||||
{ pkgs }:
|
||||
{
|
||||
passCli = pkgs.writeShellScriptBin "pass-cli" ''
|
||||
set -eu
|
||||
case "$*" in *pst_*) echo "PAT on the command line" >&2; exit 99 ;; esac
|
||||
s="$PROTON_PASS_SESSION_DIR"; mkdir -p "$s"
|
||||
case "$1" in
|
||||
info) [ -f "$s/ok" ] ;;
|
||||
logout) rm -f "$s/ok" ;;
|
||||
login) [ "''${PROTON_PASS_PERSONAL_ACCESS_TOKEN:-}" = "pst_test::key" ] && touch "$s/ok" ;;
|
||||
item)
|
||||
[ -f "$s/ok" ] || { echo "not logged in" >&2; exit 1; }
|
||||
case "$2" in
|
||||
list) printf '%s\n' \
|
||||
'- [id1]: darman@jupiter (state=Active)' \
|
||||
'- [id2]: root@jupiter (state=Active)' \
|
||||
'- [id4]: secret-note (state=Active)' \
|
||||
'- [id5]: auto-item (state=Active)' ;;
|
||||
view)
|
||||
[ -n "''${PROTON_PASS_AGENT_REASON:-}" ] || { echo "reason required" >&2; exit 1; }
|
||||
echo "$PROTON_PASS_AGENT_REASON" >> "$HOME/reasons"
|
||||
case "$*" in
|
||||
*"--item-id id1 "*) echo hunter2 ;;
|
||||
*"--item-id id2 "*) echo rootpw ;;
|
||||
*"--item-id id5 "*) echo autopw ;;
|
||||
*) exit 1 ;;
|
||||
esac ;;
|
||||
esac ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
'';
|
||||
|
||||
telegram = pkgs.writers.writePython3Bin "fake-telegram" { flakeIgnore = [ "E501" "E701" "E704" ]; } ''
|
||||
import json
|
||||
import threading
|
||||
import time
|
||||
from http.server import ThreadingHTTPServer, BaseHTTPRequestHandler
|
||||
from urllib.parse import urlparse, parse_qs
|
||||
|
||||
PREFIX = "/bot123:test/"
|
||||
cv = threading.Condition()
|
||||
state = {"messages": [], "edits": [], "answers": []}
|
||||
updates = []
|
||||
|
||||
|
||||
class H(BaseHTTPRequestHandler):
|
||||
def reply(self, obj, code=200):
|
||||
b = json.dumps(obj).encode()
|
||||
self.send_response(code)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.send_header("Content-Length", str(len(b)))
|
||||
self.end_headers()
|
||||
self.wfile.write(b)
|
||||
|
||||
def do_GET(self):
|
||||
with cv: self.reply(state)
|
||||
|
||||
def do_POST(self):
|
||||
n = int(self.headers.get("Content-Length", 0))
|
||||
body = json.loads(self.rfile.read(n) or b"{}")
|
||||
u = urlparse(self.path)
|
||||
if u.path == "/test/press":
|
||||
q = parse_qs(u.query)
|
||||
with cv:
|
||||
uid = len(updates) + 1
|
||||
updates.append({"update_id": uid, "callback_query": {
|
||||
"id": "cq%d" % uid, "from": {"id": int(q["from"][0])}, "data": q["data"][0]}})
|
||||
cv.notify_all()
|
||||
return self.reply({"ok": True})
|
||||
if not u.path.startswith(PREFIX):
|
||||
return self.reply({"ok": False, "description": "Unauthorized"}, 401)
|
||||
method = u.path[len(PREFIX):]
|
||||
with cv:
|
||||
if method == "sendMessage":
|
||||
body["message_id"] = len(state["messages"]) + 1
|
||||
state["messages"].append(body)
|
||||
return self.reply({"ok": True, "result": {"message_id": body["message_id"]}})
|
||||
if method in ("editMessageText", "answerCallbackQuery"):
|
||||
state["edits" if method == "editMessageText" else "answers"].append(body)
|
||||
return self.reply({"ok": True, "result": True})
|
||||
if method == "getUpdates":
|
||||
deadline = time.time() + min(body.get("timeout", 0), 5)
|
||||
while True:
|
||||
pending = [x for x in updates if x["update_id"] >= body.get("offset", 0)]
|
||||
if pending or time.time() >= deadline:
|
||||
return self.reply({"ok": True, "result": pending})
|
||||
cv.wait(deadline - time.time())
|
||||
self.reply({"ok": False, "description": "unknown method"}, 404)
|
||||
|
||||
def log_message(self, *a): pass
|
||||
|
||||
|
||||
ThreadingHTTPServer(("127.0.0.1", 8081), H).serve_forever()
|
||||
'';
|
||||
|
||||
# try-get <tag> <item>: result lands in /tmp/r/<tag>.{out,err,rc}. The tag
|
||||
# is in the reason so pkill can pick out one client.
|
||||
tryGet = pkgs.writeShellScriptBin "try-get" ''
|
||||
pass-broker get --item "$2" --reason "vm test $1" >/tmp/r/$1.out 2>/tmp/r/$1.err
|
||||
echo $? >/tmp/r/$1.rc
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
# VM test for pass-broker-gateway.nix with a broker in gateway mode. Run:
|
||||
# nix build .#checks.x86_64-linux.pass-broker-gateway -L
|
||||
#
|
||||
# Two nodes: mars runs the gateway and the fake Telegram API, terra a broker
|
||||
# whose prompts go through mars. A third token, titan's, is used only via
|
||||
# curl, to check that hosts can't see or cancel each other's prompts.
|
||||
{ pkgs }:
|
||||
let
|
||||
fakes = import ./pass-broker-fakes.nix { inherit pkgs; };
|
||||
sha256 = builtins.hashString "sha256";
|
||||
in
|
||||
pkgs.testers.runNixOSTest {
|
||||
name = "pass-broker-gateway";
|
||||
|
||||
nodes.mars = {
|
||||
imports = [ ./pass-broker-gateway.nix ];
|
||||
|
||||
environment.systemPackages = [ pkgs.curl pkgs.jq ];
|
||||
networking.firewall.allowedTCPPorts = [ 8097 ];
|
||||
|
||||
environment.etc = {
|
||||
"pb/token" = { text = "123:test\n"; mode = "0400"; user = "pass-broker-gateway"; };
|
||||
"pb/chat" = { text = "4242\n"; mode = "0400"; user = "pass-broker-gateway"; };
|
||||
};
|
||||
|
||||
homelab.passBrokerGateway = {
|
||||
enable = true;
|
||||
telegram = {
|
||||
apiBase = "http://127.0.0.1:8081";
|
||||
tokenFile = "/etc/pb/token";
|
||||
chatIdFile = "/etc/pb/chat";
|
||||
};
|
||||
hosts = {
|
||||
terra.tokenSha256 = sha256 "terra-token";
|
||||
titan.tokenSha256 = sha256 "titan-token";
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.fake-telegram = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
before = [ "pass-broker-gateway.service" ];
|
||||
serviceConfig.ExecStart = "${fakes.telegram}/bin/fake-telegram";
|
||||
};
|
||||
};
|
||||
|
||||
nodes.terra = {
|
||||
imports = [ ./pass-broker.nix ];
|
||||
|
||||
users.users.darman.isNormalUser = true;
|
||||
environment.systemPackages = [ pkgs.curl pkgs.jq fakes.tryGet ];
|
||||
systemd.tmpfiles.rules = [ "d /tmp/r 1777 root root -" ];
|
||||
|
||||
environment.etc = {
|
||||
"pb/pat" = { text = "pst_test::key\n"; mode = "0400"; user = "pass-broker"; };
|
||||
"pb/gateway" = { text = "terra-token\n"; mode = "0400"; user = "pass-broker"; };
|
||||
};
|
||||
|
||||
homelab.passBroker = {
|
||||
enable = true;
|
||||
passCli = fakes.passCli;
|
||||
patFile = "/etc/pb/pat";
|
||||
approvalTimeout = 6;
|
||||
gateway = {
|
||||
url = "http://mars:8097";
|
||||
tokenFile = "/etc/pb/gateway";
|
||||
};
|
||||
rules = [
|
||||
{ item = "darman@*"; }
|
||||
{ item = "root@*"; grantMinutes = 0; }
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
testScript = /* python */ ''
|
||||
import json
|
||||
|
||||
def tg():
|
||||
return json.loads(mars.succeed("curl -s http://127.0.0.1:8081/"))
|
||||
|
||||
def wait_messages(n):
|
||||
mars.wait_until_succeeds(f"curl -s http://127.0.0.1:8081/ | jq -e '.messages | length == {n}'")
|
||||
return tg()["messages"][-1]
|
||||
|
||||
def button(msg, i):
|
||||
return msg["reply_markup"]["inline_keyboard"][0][i]["callback_data"]
|
||||
|
||||
def press(data):
|
||||
mars.succeed(f"curl -s -X POST 'http://127.0.0.1:8081/test/press?data={data}&from=4242'")
|
||||
|
||||
def start(tag, item):
|
||||
terra.succeed(f"su darman -c 'try-get {tag} {item}' >/dev/null 2>&1 &")
|
||||
|
||||
def result(tag):
|
||||
terra.wait_for_file(f"/tmp/r/{tag}.rc", timeout=60)
|
||||
rc = int(terra.succeed(f"cat /tmp/r/{tag}.rc"))
|
||||
return rc, terra.succeed(f"cat /tmp/r/{tag}.out").strip(), terra.succeed(f"cat /tmp/r/{tag}.err")
|
||||
|
||||
def api(method, path, token, body=None):
|
||||
data = f"-H 'Content-Type: application/json' -d '{json.dumps(body)}'" if body else ""
|
||||
out = terra.succeed(
|
||||
f"curl -s -o /tmp/api.out -w '%{{http_code}}' -X {method} {data} "
|
||||
f"-H 'Authorization: Bearer {token}' http://mars:8097{path}"
|
||||
)
|
||||
return int(out), terra.succeed("cat /tmp/api.out")
|
||||
|
||||
start_all()
|
||||
mars.wait_for_unit("pass-broker-gateway.service")
|
||||
mars.wait_for_open_port(8097)
|
||||
terra.wait_for_unit("pass-broker.socket")
|
||||
|
||||
with subtest("a broker's prompt arrives through the gateway, labelled by its token"):
|
||||
start("a", "darman@jupiter")
|
||||
msg = wait_messages(1)
|
||||
assert msg["text"].startswith("🔑 terra: HomeLab / darman@jupiter (password)"), msg
|
||||
assert "vm test a" in msg["text"], msg
|
||||
press(button(msg, 0))
|
||||
assert result("a")[:2] == (0, "hunter2"), result("a")
|
||||
assert tg()["edits"][-1]["text"].endswith("approved")
|
||||
|
||||
with subtest("deny refuses"):
|
||||
start("b", "root@jupiter")
|
||||
press(button(wait_messages(2), 1))
|
||||
rc, out, err = result("b")
|
||||
assert rc == 1 and "denied" in err, (rc, out, err)
|
||||
|
||||
with subtest("a client that hangs up withdraws its prompt on the gateway"):
|
||||
start("c", "root@jupiter")
|
||||
wait_messages(3)
|
||||
terra.wait_until_succeeds("grep -q 'waiting for approval' /tmp/r/c.err")
|
||||
terra.succeed("pkill -f 'vm test c'")
|
||||
mars.wait_until_succeeds(
|
||||
"curl -s http://127.0.0.1:8081/ | jq -e '.edits[-1].text | endswith(\"went away\")'"
|
||||
)
|
||||
|
||||
with subtest("no answer expires on the gateway's clock"):
|
||||
start("d", "root@jupiter")
|
||||
wait_messages(4)
|
||||
rc, out, err = result("d")
|
||||
assert rc == 1 and "no answer" in err, (rc, out, err)
|
||||
assert tg()["edits"][-1]["text"].endswith("expired")
|
||||
|
||||
with subtest("tokens: unknown is refused, hosts can't see or cancel each other's prompts"):
|
||||
code, _ = api("POST", "/ask", "wrong-token", {"text": "x", "timeout_secs": 30})
|
||||
assert code == 401, code
|
||||
code, out = api("POST", "/ask", "titan-token", {"text": "terra: trust me", "timeout_secs": 300})
|
||||
assert code == 200, (code, out)
|
||||
titan_id = json.loads(out)["id"]
|
||||
assert wait_messages(5)["text"] == "🔑 titan: terra: trust me"
|
||||
assert api("GET", f"/ask/{titan_id}", "terra-token")[0] == 404
|
||||
assert api("DELETE", f"/ask/{titan_id}", "terra-token")[0] == 404
|
||||
assert json.loads(api("GET", f"/ask/{titan_id}", "titan-token")[1]) == {"status": "pending"}
|
||||
|
||||
with subtest("a tap resolves only its own prompt"):
|
||||
start("e", "root@jupiter")
|
||||
terra_msg = wait_messages(6)
|
||||
press(button(terra_msg, 0))
|
||||
assert result("e")[:2] == (0, "rootpw")
|
||||
assert json.loads(api("GET", f"/ask/{titan_id}", "titan-token")[1]) == {"status": "pending"}
|
||||
assert api("DELETE", f"/ask/{titan_id}", "titan-token")[0] == 204
|
||||
assert json.loads(api("GET", f"/ask/{titan_id}", "titan-token")[1]) == {"status": "cancelled"}
|
||||
|
||||
with subtest("gateway down refuses instead of hanging"):
|
||||
mars.succeed("systemctl stop pass-broker-gateway.service")
|
||||
start("f", "root@jupiter")
|
||||
rc, out, err = result("f")
|
||||
assert rc == 1 and "gateway" in err, (rc, out, err)
|
||||
'';
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
# The approval gateway: sole owner of the pass-broker Telegram bot, so every
|
||||
# host's broker (pass-broker.nix with `gateway`) prompts in the same chat. It
|
||||
# relays prompts and taps and never sees an item. Tailnet-only: tailscale0 is
|
||||
# a trusted interface (services/vpn/tailscale.nix) and nothing opens the port
|
||||
# elsewhere.
|
||||
#
|
||||
# Brokers authenticate with a per-host token; only its sha256 is here, so this
|
||||
# host holds no broker's credential. The prompt is labelled with the host the
|
||||
# token belongs to, not what the request claims.
|
||||
|
||||
let
|
||||
cfg = config.homelab.passBrokerGateway;
|
||||
pass-broker = pkgs.callPackage ../../pkgs/pass-broker.nix { };
|
||||
|
||||
configFile = pkgs.writeText "pass-broker-gateway.json" (builtins.toJSON {
|
||||
listen = "0.0.0.0:${toString cfg.port}";
|
||||
telegram = {
|
||||
api_base = cfg.telegram.apiBase;
|
||||
token_file = cfg.telegram.tokenFile;
|
||||
chat_id_file = cfg.telegram.chatIdFile;
|
||||
};
|
||||
hosts = lib.mapAttrsToList (name: h: { inherit name; token_sha256 = h.tokenSha256; }) cfg.hosts;
|
||||
max_timeout_secs = cfg.maxTimeout;
|
||||
});
|
||||
in
|
||||
{
|
||||
options.homelab.passBrokerGateway = {
|
||||
enable = lib.mkEnableOption "pass-broker approval gateway";
|
||||
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 8097;
|
||||
};
|
||||
|
||||
telegram = {
|
||||
apiBase = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "https://api.telegram.org";
|
||||
};
|
||||
tokenFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = "Bot token of a bot nothing else polls.";
|
||||
};
|
||||
chatIdFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = "Your Telegram user id; only its taps count.";
|
||||
};
|
||||
};
|
||||
|
||||
hosts = lib.mkOption {
|
||||
description = "Brokers allowed to prompt, by the name shown in the prompt.";
|
||||
type = lib.types.attrsOf (lib.types.submodule {
|
||||
options.tokenSha256 = lib.mkOption {
|
||||
type = lib.types.strMatching "[0-9a-f]{64}";
|
||||
description = "sha256 of that host's gateway token, hex.";
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
maxTimeout = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 600;
|
||||
description = "Cap on how long a broker may keep a prompt open, in seconds.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
users.users.pass-broker-gateway = {
|
||||
isSystemUser = true;
|
||||
group = "pass-broker-gateway";
|
||||
};
|
||||
users.groups.pass-broker-gateway = { };
|
||||
|
||||
systemd.services.pass-broker-gateway = {
|
||||
description = "pass-broker approval gateway (Telegram)";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
environment.PASS_BROKER_GATEWAY_CONFIG = configFile;
|
||||
|
||||
serviceConfig = {
|
||||
ExecStart = "${pass-broker}/bin/pass-broker gateway";
|
||||
User = "pass-broker-gateway";
|
||||
Group = "pass-broker-gateway";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 5;
|
||||
|
||||
NoNewPrivileges = true;
|
||||
ProtectSystem = "strict";
|
||||
ProtectHome = true;
|
||||
PrivateTmp = true;
|
||||
PrivateDevices = true;
|
||||
ProtectProc = "invisible";
|
||||
ProtectKernelTunables = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectControlGroups = true;
|
||||
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
|
||||
RestrictNamespaces = true;
|
||||
LockPersonality = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
SystemCallArchitectures = "native";
|
||||
UMask = "0077";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,221 @@
|
||||
# VM test for pass-broker.nix. Run:
|
||||
# nix build .#checks.x86_64-linux.pass-broker -L
|
||||
#
|
||||
# Real pass-cli and Telegram need network and real secrets, so both are
|
||||
# faked (pass-broker-fakes.nix).
|
||||
{ pkgs }:
|
||||
let
|
||||
fakes = import ./pass-broker-fakes.nix { inherit pkgs; };
|
||||
inherit (fakes) tryGet;
|
||||
fakePassCli = fakes.passCli;
|
||||
fakeTelegram = fakes.telegram;
|
||||
|
||||
# Stand-in for Claude Code, whose process name is `claude`.
|
||||
fakeClaude = pkgs.writeShellScriptBin "claude" ''
|
||||
pass-broker get --item auto-item --reason "from claude"
|
||||
'';
|
||||
|
||||
# ghost: send a request and hang up before the broker reads it, like a
|
||||
# client killed while queued. silent: a socket that never answers, like a
|
||||
# crash-looping broker behind its socket unit.
|
||||
sockProbe = pkgs.writers.writePython3Bin "sock-probe" { flakeIgnore = [ "E501" ]; } ''
|
||||
import json
|
||||
import socket
|
||||
import sys
|
||||
import time
|
||||
|
||||
s = socket.socket(socket.AF_UNIX)
|
||||
if sys.argv[1] == "ghost":
|
||||
s.connect("/run/pass-broker.sock")
|
||||
req = {"vault": None, "item": "root@jupiter", "field": "password", "reason": "ghost"}
|
||||
s.sendall(json.dumps(req).encode() + b"\n")
|
||||
s.close()
|
||||
else:
|
||||
s.bind("/tmp/silent.sock")
|
||||
s.listen(8)
|
||||
time.sleep(3600)
|
||||
'';
|
||||
in
|
||||
pkgs.testers.runNixOSTest {
|
||||
name = "pass-broker";
|
||||
|
||||
nodes.machine = {
|
||||
imports = [ ./pass-broker.nix ];
|
||||
|
||||
users.users.darman.isNormalUser = true;
|
||||
users.users.eve.isNormalUser = true;
|
||||
environment.systemPackages = [ pkgs.curl pkgs.jq tryGet sockProbe fakeClaude ];
|
||||
systemd.tmpfiles.rules = [ "d /tmp/r 1777 root root -" ];
|
||||
|
||||
environment.etc = {
|
||||
"pb/pat" = { text = "pst_test::key\n"; mode = "0400"; user = "pass-broker"; };
|
||||
"pb/token" = { text = "123:test\n"; mode = "0400"; user = "pass-broker"; };
|
||||
"pb/chat" = { text = "4242\n"; mode = "0400"; user = "pass-broker"; };
|
||||
};
|
||||
|
||||
homelab.passBroker = {
|
||||
enable = true;
|
||||
passCli = fakePassCli;
|
||||
patFile = "/etc/pb/pat";
|
||||
approvalTimeout = 8;
|
||||
telegram = {
|
||||
apiBase = "http://127.0.0.1:8081";
|
||||
tokenFile = "/etc/pb/token";
|
||||
chatIdFile = "/etc/pb/chat";
|
||||
};
|
||||
rules = [
|
||||
{ item = "darman@*"; }
|
||||
{ item = "root@*"; grantMinutes = 0; }
|
||||
{ item = "secret-*"; approval = "deny"; }
|
||||
{ item = "auto-*"; approval = "auto"; }
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services.fake-telegram = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig.ExecStart = "${fakeTelegram}/bin/fake-telegram";
|
||||
};
|
||||
};
|
||||
|
||||
testScript = /* python */ ''
|
||||
import json
|
||||
import shlex
|
||||
|
||||
def tg():
|
||||
return json.loads(machine.succeed("curl -s http://127.0.0.1:8081/"))
|
||||
|
||||
def wait_messages(n):
|
||||
machine.wait_until_succeeds(f"curl -s http://127.0.0.1:8081/ | jq -e '.messages | length == {n}'")
|
||||
return tg()["messages"][-1]
|
||||
|
||||
def button(msg, i):
|
||||
return msg["reply_markup"]["inline_keyboard"][0][i]["callback_data"]
|
||||
|
||||
def press(data, sender=4242):
|
||||
machine.succeed(f"curl -s -X POST 'http://127.0.0.1:8081/test/press?data={data}&from={sender}'")
|
||||
|
||||
def start(tag, item, user="darman"):
|
||||
machine.succeed(f"su {user} -c 'try-get {tag} {item}' >/dev/null 2>&1 &")
|
||||
|
||||
def result(tag):
|
||||
machine.wait_for_file(f"/tmp/r/{tag}.rc", timeout=30)
|
||||
rc = int(machine.succeed(f"cat /tmp/r/{tag}.rc"))
|
||||
return rc, machine.succeed(f"cat /tmp/r/{tag}.out").strip(), machine.succeed(f"cat /tmp/r/{tag}.err")
|
||||
|
||||
machine.wait_for_unit("pass-broker.socket")
|
||||
machine.wait_for_open_port(8081)
|
||||
|
||||
with subtest("approval on Telegram serves the item, only the owner's tap counts"):
|
||||
start("a", "darman@jupiter")
|
||||
msg = wait_messages(1)
|
||||
assert "darman@jupiter" in msg["text"] and "vm test" in msg["text"], msg
|
||||
assert "\nBy: darman via " in msg["text"], msg
|
||||
assert "\nCommand: bash try-get a darman@jupiter\n" in msg["text"], msg
|
||||
assert msg["chat_id"] == 4242, msg
|
||||
press(button(msg, 0), sender=999)
|
||||
machine.sleep(2)
|
||||
machine.fail("test -e /tmp/r/a.rc")
|
||||
assert any(a["text"] == "Not yours." for a in tg()["answers"])
|
||||
press(button(msg, 0))
|
||||
assert result("a")[:2] == (0, "hunter2"), result("a")
|
||||
assert tg()["edits"][-1]["text"].endswith("approved")
|
||||
|
||||
with subtest("the grant covers the next request without asking"):
|
||||
out = machine.succeed("su darman -c 'pass-broker get --item darman@jupiter --reason again'")
|
||||
assert out.strip() == "hunter2"
|
||||
assert len(tg()["messages"]) == 1
|
||||
|
||||
with subtest("deny refuses"):
|
||||
start("c", "root@jupiter")
|
||||
press(button(wait_messages(2), 1))
|
||||
rc, out, err = result("c")
|
||||
assert rc == 1 and out == "" and "denied" in err, (rc, out, err)
|
||||
|
||||
with subtest("grantMinutes = 0 asks every time; no answer expires; stale buttons are ignored"):
|
||||
start("d", "root@jupiter")
|
||||
press(button(wait_messages(3), 0))
|
||||
assert result("d")[:2] == (0, "rootpw")
|
||||
start("e", "root@jupiter")
|
||||
wait_messages(4)
|
||||
press(button(tg()["messages"][0], 0))
|
||||
rc, out, err = result("e")
|
||||
assert rc == 1 and "no answer" in err, (rc, out, err)
|
||||
assert any(a["text"] == "Expired." for a in tg()["answers"])
|
||||
assert tg()["edits"][-1]["text"].endswith("expired")
|
||||
|
||||
with subtest("policy: deny, unmatched and auto need no tap"):
|
||||
err = machine.fail("su darman -c 'pass-broker get --item secret-note --reason x' 2>&1")
|
||||
assert "policy denies" in err, err
|
||||
err = machine.fail("su darman -c 'pass-broker get --item unlisted --reason x' 2>&1")
|
||||
assert "no rule allows" in err, err
|
||||
out = machine.succeed("su darman -c 'pass-broker get --item auto-item --reason x'")
|
||||
assert out.strip() == "autopw"
|
||||
assert len(tg()["messages"]) == 4
|
||||
|
||||
def views():
|
||||
return int(machine.succeed("wc -l < /var/lib/pass-broker/reasons"))
|
||||
|
||||
def journal_has(text):
|
||||
machine.wait_until_succeeds(f"journalctl -u pass-broker | grep -qF {shlex.quote(text)}")
|
||||
|
||||
with subtest("a client that hangs up mid-prompt withdraws it, and nothing is fetched"):
|
||||
before = views()
|
||||
start("f", "root@jupiter")
|
||||
wait_messages(5)
|
||||
machine.succeed("pkill -f 'vm test f'")
|
||||
machine.wait_until_succeeds(
|
||||
"curl -s http://127.0.0.1:8081/ | jq -e '.edits[-1].text | endswith(\"went away\")'"
|
||||
)
|
||||
journal_has("refused HomeLab/root@jupiter: requester went away")
|
||||
assert views() == before
|
||||
|
||||
with subtest("a client queued behind another prompt can hang up without ever being asked"):
|
||||
start("g", "root@jupiter")
|
||||
msg = wait_messages(6)
|
||||
start("h", "root@jupiter")
|
||||
journal_has('reason="vm test h"')
|
||||
machine.wait_until_succeeds("grep -q 'waiting for approval' /tmp/r/h.err")
|
||||
machine.succeed("pkill -f 'vm test h'")
|
||||
machine.wait_until_succeeds(
|
||||
"test $(journalctl -u pass-broker | grep -c 'refused HomeLab/root@jupiter: requester went away') = 2"
|
||||
)
|
||||
press(button(msg, 0))
|
||||
assert result("g")[:2] == (0, "rootpw")
|
||||
assert len(tg()["messages"]) == 6
|
||||
|
||||
with subtest("a request whose client already hung up is dropped without a prompt"):
|
||||
before = views()
|
||||
# Frozen broker = the crash-loop case: the request waits in the socket
|
||||
# while its client exits, and only then gets read.
|
||||
machine.succeed("systemctl kill --signal=SIGSTOP pass-broker.service")
|
||||
machine.succeed("sock-probe ghost")
|
||||
machine.succeed("systemctl kill --signal=SIGCONT pass-broker.service")
|
||||
journal_has("dropped HomeLab/root@jupiter: requester went away")
|
||||
machine.sleep(2)
|
||||
assert len(tg()["messages"]) == 6
|
||||
assert views() == before
|
||||
|
||||
with subtest("the client gives up on a broker that never answers"):
|
||||
machine.succeed("sock-probe silent >/dev/null 2>&1 &")
|
||||
machine.wait_for_file("/tmp/silent.sock")
|
||||
machine.succeed("chmod 666 /tmp/silent.sock")
|
||||
err = machine.fail(
|
||||
"su darman -c 'PASS_BROKER_SOCKET=/tmp/silent.sock pass-broker get --item x --reason y' 2>&1"
|
||||
)
|
||||
assert "no answer within 30s" in err, err
|
||||
|
||||
with subtest("a request from under Claude Code is labelled as such"):
|
||||
assert machine.succeed("su darman -c claude").strip() == "autopw"
|
||||
journal_has('reason="from claude" by darman via Claude Code [bash claude]')
|
||||
|
||||
with subtest("other users are refused, and darman cannot read the session"):
|
||||
err = machine.fail("su eve -c 'pass-broker get --item auto-item --reason x' 2>&1")
|
||||
assert "uid not allowed" in err, err
|
||||
machine.fail("su darman -c 'ls /var/lib/pass-broker'")
|
||||
machine.fail("su darman -c 'cat /etc/pb/pat'")
|
||||
machine.succeed("systemctl show -p User pass-broker | grep -qx User=pass-broker")
|
||||
|
||||
with subtest("pass-cli gets the reason, tagged with the host"):
|
||||
machine.succeed("grep -qx 'vm test a (pass-broker on machine)' /var/lib/pass-broker/reasons")
|
||||
'';
|
||||
}
|
||||