add octoprint

This commit is contained in:
TheWanderingCrow 2026-02-19 09:42:46 -05:00
parent 0d5c570f3e
commit 0c526c0588
3 changed files with 36 additions and 0 deletions

View file

@ -23,6 +23,7 @@ let
"/var/lib/tuwunel"
"/var/lib/paperless/export"
"/var/lib/octoprint"
];
};

View file

@ -54,6 +54,7 @@
"modules/services/fail2ban"
"modules/services/mesh/client.nix"
"modules/services/auth-provider"
"modules/services/octoprint"
"modules/services/paperless"
"modules/services/matrix"
"modules/services/forgejo"
@ -137,6 +138,14 @@
inject header Remote-User from name
inject header Remote-Role from groups
}
authorization policy octoprint {
set auth url /caddy-security/oauth2/generic
allow roles octoprint
inject headers with claims
inject header Remote-User from name
inject header Remote-Role from groups
}
}
'';
};

View file

@ -0,0 +1,26 @@
{ config, lib, ... }:
let
port = lib.custom.autoport "octoprint";
in
{
services.caddy.virtualHosts."octoprint.wanderingcrow.net".extraConfig = ''
@auth {
path /caddy-security/*
}
route @auth {
authenticate with myportal
}
route /* {
authorize with octoprint
reverse_proxy http://localhost:${builtins.toString config.services.octoprint.port}
}
'';
services.octoprint = {
inherit port;
enable = true;
openFirewall = true;
};
}