1
Fork 0
mirror of https://github.com/thegeneralist01/config.git synced 2026-12-04 18:56:56 +01:00

Compare commits

...

3 commits

7 changed files with 57 additions and 4 deletions

Binary file not shown.

View file

@ -16,9 +16,31 @@ in
];
environment = {
ARCHIVR_TWITTER_CREDENTIALS_FILE = "/mnt/usb/archivr/creds.txt";
ARCHIVR_CLAUDE_CLI = "/run/current-system/sw/bin/claude";
};
};
# Claude Code credentials for the archivr service user (summarization provider).
age.secrets.claudeCredentials = {
file = ./claude-credentials.age;
owner = "archivr";
group = "archivr";
};
# claude binary in the system env so the archivr user can execute it.
environment.systemPackages = with pkgs; [
claude-code
];
systemd.services.archivr-server.preStart = lib.mkAfter ''
${pkgs.coreutils}/bin/mkdir -p /var/lib/archivr-server/.claude
${pkgs.coreutils}/bin/cp ${config.age.secrets.claudeCredentials.path} /var/lib/archivr-server/.claude/.credentials.json
${pkgs.coreutils}/bin/chmod 600 /var/lib/archivr-server/.claude/.credentials.json
if [ ! -f /var/lib/archivr-server/.claude.json ]; then
${pkgs.coreutils}/bin/printf '{"hasCompletedOnboarding": true}\n' > /var/lib/archivr-server/.claude.json
fi
'';
# Ensure data directory ownership and mounts
systemd.services.archivr-data-ownership = {
description = "Prepare archivr permissions on /mnt/usb/archivr and /var/lib/archivr-server";

View file

@ -13,6 +13,7 @@
{
imports = [
./hardware-configuration.nix
./iphone-transfer.nix
./site.nix
./tailscale-ip.nix
./cache
@ -120,6 +121,14 @@
services.libinput.enable = true;
programs.firefox.enable = true;
programs.zsh.enable = true;
# NixOS needs nix-ld to run dynamically linked upstream binaries
# (Claude Code ships claude.exe linked against /lib64/ld-linux-x86-64.so.2).
programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [
stdenv.cc.cc.lib
zlib
openssl
];
# Set your time zone.
time.timeZone = "Europe/Berlin";

View file

@ -0,0 +1,9 @@
{ pkgs, ... }:
{
services.usbmuxd.enable = true;
environment.systemPackages = with pkgs; [
ifuse
libimobiledevice
];
}

View file

@ -26,7 +26,9 @@ let
locations."/" = {
proxyPass = "http://127.0.0.1:32400";
proxyWebsockets = true;
recommendedProxySettings = true;
# Disable per-location recommended headers so they don't overwrite
# the localhost X-Real-IP / X-Forwarded-For override below.
recommendedProxySettings = false;
# https://arne.me/blog/plex-on-nixos
extraConfig = ''
# Some players don't reopen a socket and playback stops totally instead of resuming after an extended pause
@ -47,9 +49,13 @@ let
# Buffering off send to the client as soon as the data is received from Plex.
proxy_redirect off;
proxy_buffering off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# This vhost only listens on Tailscale (100.108.125.63); present Tailscale
# clients as local loopback so Plex doesn't treat 100.64.0.0/10 as remote.
proxy_set_header X-Real-IP 127.0.0.1;
proxy_set_header X-Forwarded-For 127.0.0.1;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $hostname;
proxy_set_header Host $host;
'';
};
@ -86,6 +92,12 @@ in
allowedUDPPorts = [ 1900 5353 32410 32412 32413 32414 ];
};
# Allow Plex direct access from the home LAN subnet without exposing 32400 globally.
# tailscale0 is already trusted in modules/linux/tailscale.nix.
networking.firewall.extraCommands = ''
iptables -A nixos-fw -s 192.168.2.0/24 -p tcp --dport 32400 -j nixos-fw-accept
'';
services.nginx.virtualHosts = {
${domain} = config;
"100.108.125.63" = config;

View file

@ -6,7 +6,7 @@
useRoutingFeatures = "both";
openFirewall = true; # or false?
extraUpFlags = [ "--ssh" ];
extraSetFlags = [ "--advertise-routes=172.16.223.0/24" "--advertise-exit-node" ];
extraSetFlags = [ "--advertise-routes=192.168.2.0/24" "--advertise-exit-node" ];
disableTaildrop = false;
authKeyFile = config.age.secrets.tailscaleMarshall.path;
};

View file

@ -6,6 +6,7 @@ in
"hosts/thegeneralist/acme/acmeEnvironment.age".publicKeys = [ thegeneralist ];
"hosts/thegeneralist/cert.pem.age".publicKeys = [ thegeneralist ];
"hosts/thegeneralist/credentials.age".publicKeys = [ thegeneralist ];
"hosts/thegeneralist/archivr/claude-credentials.age".publicKeys = [ thegeneralist ];
"hosts/thegeneralist/cache/key.age".publicKeys = [ thegeneralist ];
"hosts/thegeneralist/forgejo/forgejo-runner-token.age".publicKeys = [ thegeneralist ];
"hosts/thegeneralist/readlater-bot-token.age".publicKeys = [ thegeneralist ];