nixlab/config/services/upsnap.nix
2025-06-18 21:41:53 +01:00

43 lines
939 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.upsnap;
src = pkgs.fetchzip {
url = "https://github.com/seriousm4x/UpSnap/releases/download/5.0.4/UpSnap_5.0.4_linux_amd64.zip";
sha256 = "sha256:1qlav9if6f2c50rzakyilxgzmq2c5bzcs6lx1w7sffxhl440nxhs";
};
in {
options = {
services.upsnap = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Whether to enable UpSnap.
'';
};
bind = mkOption {
type = types.str;
default = "0.0.0.0:8090";
description = ''
The bind address/port
'';
};
};
};
config = mkIf cfg.enable {
systemd.services.upsnap = {
environment = {
"HOME" = "/opt/upsnap";
};
name = "upsnap.service";
enable = true;
script = "${src} serve --http ${cfg.bind}";
description = "UpSnap";
};
};
}