From 51b94c2daa1ccb18f53948c5182705f24777f735 Mon Sep 17 00:00:00 2001 From: elyth Date: Mon, 30 Sep 2024 17:17:07 +0200 Subject: [PATCH] :sparkles: (services): soft-serve --- hosts/mithrix/default.nix | 3 +- modules/nixos/opt/services/default.nix | 7 +-- modules/nixos/opt/services/soft-serve.nix | 56 +++++++++++++++++++++++ 3 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 modules/nixos/opt/services/soft-serve.nix diff --git a/hosts/mithrix/default.nix b/hosts/mithrix/default.nix index 07d1c1dd..d5201c7a 100644 --- a/hosts/mithrix/default.nix +++ b/hosts/mithrix/default.nix @@ -23,7 +23,8 @@ in vikunja.enable = true; glance.enable = true; paperless.enable = true; - radicle.enable = true; + #radicle.enable = true; + soft-serve.enable = true; }; }; tailscale.enable = true; diff --git a/modules/nixos/opt/services/default.nix b/modules/nixos/opt/services/default.nix index a9d6be44..f9452c0a 100644 --- a/modules/nixos/opt/services/default.nix +++ b/modules/nixos/opt/services/default.nix @@ -8,12 +8,13 @@ imports = [ ./cloudflared-tunnel.nix ./glance.nix - ./xserver.nix - ./kanata.nix ./immich.nix - ./radicle.nix + ./kanata.nix ./paperless.nix + ./radicle.nix + ./soft-serve.nix ./vikunja.nix + ./xserver.nix ./your_spotify.nix ]; config = { diff --git a/modules/nixos/opt/services/soft-serve.nix b/modules/nixos/opt/services/soft-serve.nix new file mode 100644 index 00000000..a024e023 --- /dev/null +++ b/modules/nixos/opt/services/soft-serve.nix @@ -0,0 +1,56 @@ +{ config, lib, ... }: +let + inherit (lib) + mkIf + mkOption + types + mkEnableOption + ; + + host = "git.elyth.xyz"; + cfg = config.opt.services.soft-serve; +in +{ + options.opt.services.soft-serve = { + enable = mkEnableOption "soft-serve"; + host = mkOption { + type = types.str; + default = "0.0.0.0"; + }; + port = mkOption { + type = types.int; + default = 9999; + }; + }; + + config = mkIf cfg.enable { + + services = { + soft-serve = { + enable = true; + settings = { + name = "elyth's repos"; + log_format = "text"; + ssh = { + listen_addr = ":${builtins.toString cfg.port}"; + public_url = "ssh://git.elyth.xyz:${builtins.toString cfg.port}"; + max_timeout = 30; + idle_timeout = 120; + }; + stats.listen_addr = ":23235"; + }; + }; + cloudflared.tunnels = { + "9f52eb17-9286-4b74-8526-28094e48f79f" = { + credentialsFile = config.sops.secrets.cloudflared-tunnel-creds.path; + default = "http_status:404"; + ingress = { + ${host} = { + service = "ssh://localhost:${builtins.toString cfg.port}"; + }; + }; + }; + }; + }; + }; +}