Files
homelab/profiles/workstation.nix
T
darmanandClaude Opus 5.5 e95726d69c feat(mars): pass-broker approval gateway for every host
A Telegram bot has a single getUpdates consumer, so a broker per host
would split approval taps between them. mars now runs the gateway: the
bot's only poller, relaying prompts and taps for terra's and titan's
brokers over the tailnet (:8097) without ever seeing an item. Each broker
authenticates with its own pass_broker_gateway_token; mars holds only the
sha256, and the prompt is labelled with the host that token belongs to.

The bot token and chat id move to mars and are dropped from the other
hosts' sops files (terra.yaml also loses its leftover LibreChat keys and
gains protonvpn_wg_private_key, which a later commit uses). Covered by
checks.pass-broker-gateway (two nodes: labels, cancel, expiry, per-host
token isolation, gateway down); the fakes are shared with checks.pass-broker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 11:34:19 +02:00

146 lines
5.2 KiB
Nix

{ 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}
'';
}