{ config, lib, pkgs, ... }: let cfg = config.services.stash; in { options = { services.stash = { enable = lib.mkEnableOption "Stash"; package = lib.mkPackageOption pkgs "stash" { }; # port = lib.mkOption { # type = lib.types.port; # default = 8080; # description = "The port of the Stash web application"; # }; }; }; config = lib.mkIf cfg.enable { systemd.services.stash = { description = "Stash"; wantedBy = [ "multi-user.target" ]; # environment = { # STASH_DIR = "/var/lib/stash"; # } // lib.optionalAttrs (cfg.databaseUrl != null) { # STASH_DATABASE_URL = cfg.databaseUrl; # }; serviceConfig = { ExecStart = "${cfg.package}/bin/stash server --address '${cfg.address}' --port '${toString cfg.port}' --webroot '${cfg.webRoot}'"; EnvironmentFile = lib.optional (cfg.environmentFile != null) cfg.environmentFile; RootDirectory = "/var/lib/stash"; }; }; }; meta.maintainers = with lib.maintainers; [ CaptainJawZ ]; }