build(nix): add Nix flake, NixOS module, and README documentation

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
m3tm3re
2026-02-04 20:39:43 +01:00
parent 1a01b46ed6
commit 3eddd66003
4 changed files with 729 additions and 0 deletions

49
nix/module.nix Normal file
View File

@@ -0,0 +1,49 @@
{ config, lib, pkgs, ... }:
with lib;
let cfg = config.services.zugferd-service;
in {
options.services.zugferd-service = {
enable = mkEnableOption "ZUGFeRD REST API service";
port = mkOption {
type = types.port;
default = 5000;
description = "Port to listen on";
};
host = mkOption {
type = types.str;
default = "127.0.0.1";
description = "Host to bind to";
};
package = mkOption {
type = types.package;
default = pkgs.zugferd-service;
description = "Package to use for the service";
};
};
config = mkIf cfg.enable {
systemd.services.zugferd-service = {
description = "ZUGFeRD REST API Service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
Type = "simple";
ExecStart =
"${cfg.package}/bin/zugferd-service --host ${cfg.host} --port ${
toString cfg.port
}";
Restart = "on-failure";
DynamicUser = true;
NoNewPrivileges = true;
ProtectSystem = "strict";
ProtectHome = true;
};
};
};
}