This commit is contained in:
qvalentin 2025-03-04 20:35:54 +01:00
parent 5417d4d475
commit cc2db6bdc3

52
nixos.nix Normal file
View file

@ -0,0 +1,52 @@
{
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.services.wormspace;
package = (pkgs.callPackage ./default.nix { pkgs = pkgs; });
in
{
options.services.wormspace = {
enable = mkEnableOption "wormspace service";
nginxHostname = mkOption {
type = types.str;
default = "wormspace.filefighte.de";
};
port = mkOption {
type = types.int;
default = 8999;
};
};
config = mkIf cfg.enable {
systemd.services.wormspace = {
description = "wormspace";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
ExecStart = "${package}/bin/wormspace ${
escapeShellArg (toString cfg.port)
}";
# WorkingDirectory = cfg.configPackage;
DynamicUser = true;
User = "wormspace";
};
};
services.nginx.virtualHosts.${cfg.nginxHostname} = {
locations = {
"/" = {
proxyPass = "http://127.0.0.1:${toString cfg.port}";
};
};
};
};
}