From 8db4d60b17ff2ad9bb6c9f3dc194714475f069f4 Mon Sep 17 00:00:00 2001 From: Infinidoge Date: Fri, 4 Feb 2022 10:50:42 -0500 Subject: [PATCH] module: add soft-serve --- modules/functionality/soft-serve.nix | 36 ++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 modules/functionality/soft-serve.nix diff --git a/modules/functionality/soft-serve.nix b/modules/functionality/soft-serve.nix new file mode 100644 index 0000000..02d7826 --- /dev/null +++ b/modules/functionality/soft-serve.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: +with lib; +with lib.hlissner; +let + cfg = config.services.soft-serve; +in +{ + options.services.soft-serve = with types; { + enable = mkBoolOpt false; + + path = mkOpt path "/srv/soft-serve"; + + port = mkOpt port 23231; + host = mkOpt str "0.0.0.0"; + key_path = mkOpt path "${cfg.path}/soft_serve_server_ed25519"; + repo_path = mkOpt path "${cfg.path}/repos"; + initial_admin_key = mkOpt (nullOr str) null; + }; + + config = mkIf cfg.enable { + systemd.services.soft-serve = { + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + description = "SSH Git server and TUI"; + environment = { + SOFT_SERVE_PORT = toString cfg.port; + SOFT_SERVE_HOST = cfg.host; + SOFT_SERVE_KEY_PATH = cfg.key_path; + SOFT_SERVE_REPO_PATH = cfg.repo_path; + SOFT_SERVE_INITIAL_ADMIN_KEY = cfg.initial_admin_key; + }; + script = "${pkgs.soft-serve}/bin/soft"; + serviceConfig.Type = "exec"; + }; + }; +}