config/profiles/http/services/microbin.nix

61 lines
1.5 KiB
Nix
Raw Normal View History

2023-06-26 21:03:25 +02:00
{ config, lib, pkgs, ... }:
let
name = "microbin";
user = name;
group = name;
host = "127.0.0.1";
port = 6743;
domain = "i.kuklef.se";
#domain = mkDomain "microbin";
in
{
2023-10-04 01:36:11 +02:00
# TODO: use the module instead come 23.11
2023-06-26 21:03:25 +02:00
systemd.services.microbin = {
description = "Microbin - pastebin and url shortener";
wantedBy = ["multi-user.target"];
after = ["network.target"];
serviceConfig = {
ExecStart = lib.escapeShellArgs [
"${pkgs.microbin}/bin/microbin"
"--title" "spis meg"
"--editable"
"--hide-footer"
"--highlightsyntax"
"--no-listing"
"--wide"
"--qr"
"--gc-days" "0"
"--enable-burn-after"
"-b" "${host}"
"-p" "${builtins.toString port}"
"--public-path" "https://${domain}/"
];
# https://github.com/szabodanika/microbin/issues/106
2023-10-15 23:42:36 +02:00
#EnvironmentFile = "/run/secrets/microbin-env"; # TODO: sops
2023-06-26 21:03:25 +02:00
#Environment.MICROBIN_AUTH_USERNAME="foo";
#Environment.MICROBIN_AUTH_PASSWORD="bar";
DynamicUser = true;
StateDirectory = "microbin";
WorkingDirectory = "/var/lib/microbin";
Type = "simple";
Restart = "always";
ProtectProc = "invisible";
};
};
services.nginx.virtualHosts.${domain} = {
forceSSL = true; # addSSL = true;
enableACME = true; #useACMEHost = acmeDomain;
locations."/" = {
proxyPass = "http://${host}:${toString port}";
#proxyWebsockets = true;
};
};
}