rework stirling-pdf to be more generic with test

This commit is contained in:
2025-07-31 10:40:31 +07:00
parent c5c8e0050d
commit 5109c3f4fa
6 changed files with 88 additions and 34 deletions

View File

@@ -1,4 +1,4 @@
{ lib, ... }:
{ ... }:
{
_class = "clan.service";
manifest.name = "stirling-pdf";
@@ -6,43 +6,18 @@
manifest.categories = [ "System" ];
roles.default = {
interface.options = {
domain = lib.mkOption {
type = lib.types.str;
default = "pdf";
description = "Sub domain or Stirling PDF service";
};
};
perInstance =
perInstance.nixosModule =
{
settings,
lib,
...
}:
{
nixosModule =
{
config,
...
}:
let
domain = "${settings.domain}.${config.networking.fqdn}";
in
{
services.stirling-pdf = {
enable = true;
environment = {
SERVER_PORT = 8080;
};
};
services.nginx.virtualHosts."${domain}" = {
forceSSL = true;
useACMEHost = "${config.networking.fqdn}";
locations."/" = {
proxyPass = "http://localhost:${builtins.toString config.services.stirling-pdf.environment.SERVER_PORT}";
};
};
services.stirling-pdf = {
enable = lib.mkDefault true;
environment = {
SERVER_PORT = lib.mkDefault 8080;
};
};
};
};
}