diff options
Diffstat (limited to 'nixpkgs/nixos/modules/services/web-apps/pict-rs.nix')
-rw-r--r-- | nixpkgs/nixos/modules/services/web-apps/pict-rs.nix | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/services/web-apps/pict-rs.nix b/nixpkgs/nixos/modules/services/web-apps/pict-rs.nix new file mode 100644 index 000000000000..3270715a051b --- /dev/null +++ b/nixpkgs/nixos/modules/services/web-apps/pict-rs.nix @@ -0,0 +1,48 @@ +{ lib, pkgs, config, ... }: +with lib; +let + cfg = config.services.pict-rs; +in +{ + meta.maintainers = with maintainers; [ happysalada ]; + meta.doc = ./pict-rs.md; + + options.services.pict-rs = { + enable = mkEnableOption (lib.mdDoc "pict-rs server"); + dataDir = mkOption { + type = types.path; + default = "/var/lib/pict-rs"; + description = lib.mdDoc '' + The directory where to store the uploaded images. + ''; + }; + address = mkOption { + type = types.str; + default = "127.0.0.1"; + description = lib.mdDoc '' + The IPv4 address to deploy the service to. + ''; + }; + port = mkOption { + type = types.port; + default = 8080; + description = lib.mdDoc '' + The port which to bind the service to. + ''; + }; + }; + config = lib.mkIf cfg.enable { + systemd.services.pict-rs = { + environment = { + PICTRS__PATH = cfg.dataDir; + PICTRS__ADDR = "${cfg.address}:${toString cfg.port}"; + }; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + DynamicUser = true; + StateDirectory = "pict-rs"; + ExecStart = "${pkgs.pict-rs}/bin/pict-rs"; + }; + }; + }; +} |