1
0
Fork 0

modularize cinny and ente-auth, add package ente-auth-web

The previous was more of a workaround not fitting in the spirit of
nixos, this fixes this and makes proper modules out of them. Sadly
ente-web-auth has to be build with a env var and therefore can't be
configured before properly.
This commit is contained in:
Philipp 2025-05-08 11:39:14 +02:00
parent 7d8e0da9ec
commit b0c86faf29
Signed by: Philipp
GPG key ID: 9EBD8439AFBAB750
5 changed files with 186 additions and 61 deletions

View file

@ -0,0 +1,64 @@
{
lib,
pkgs,
config,
namespace,
...
}:
with lib;
with lib.${namespace};
let
cfg = config.${namespace}.services.cinny;
in
{
options.${namespace}.services.cinny = {
enable = mkEnableOption "Cinny";
package = mkOption {
description = "The package of Cinny to use.";
type = types.package;
default = pkgs.cinny-unwrapped;
};
port = mkOption {
description = "The port to serve Cinny on.";
type = types.nullOr types.int;
default = 8686;
};
};
config = mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [
cfg.port
];
services.caddy = {
enable = true;
virtualHosts.":${builtins.toString cfg.port}" = {
extraConfig = ''
root * ${cfg.package}
file_server
@index {
not path /index.html
not path /public/*
not path /assets/*
not path /config.json
not path /manifest.json
not path /sw.js
not path /pdf.worker.min.js
not path /olm.wasm
path /*
}
rewrite /*/olm.wasm /olm.wasm
rewrite @index /index.html
'';
};
};
};
}