NixOS/pkgs/stash.nix
2024-09-22 15:00:39 -06:00

48 lines
1.1 KiB
Nix

{
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 ];
}