From 7a473c821129aaf506220164b49c541182278226 Mon Sep 17 00:00:00 2001 From: Kjetil Orbekk Date: Wed, 28 Dec 2022 16:20:21 -0500 Subject: Add bridge-nightly service --- modules/bridge.nix | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'modules') diff --git a/modules/bridge.nix b/modules/bridge.nix index e26ba73..efc4b92 100644 --- a/modules/bridge.nix +++ b/modules/bridge.nix @@ -7,10 +7,39 @@ with lib; options = { orbekk.bridge = { enable = mkEnableOption "Enable bridge service"; + + port = lib.mkOption { + type = lib.types.port; + default = 40421; + description = "bridge local port"; + }; }; }; config = mkIf cfg.enable { + services.bridge-nightly = { + description = "Bridge Nightly backend"; + wantedBy = ["multi-user.target"]; + after = ["network.target"]; + + environment = { + BIND_ADDRESS = "[::]:${cfg.port}"; + RUST_BACKTRACE = "1"; + AUTHENTICATOR = "oauth"; + OPENID_ISSUER_URL= "https://auth.orbekk.com/realms/test"; + OPENID_CLIENT_ID= "test-client"; + OPENID_CLIENT_SECRET= "secret"; + APP_URL = "https://bridge-nightly.orbekk.com"; + DATABASE_URL = "postgres:///bridge_nightly"; + }; + + serviceConfig = { + User = "bridge_nightly"; + Group = "bridge_nightly"; + ExecStart = "/opt/bridge-nightly/profile/bin/server"; + }; + }; + services.postgresql = { enable = true; enableTCPIP = true; -- cgit v1.2.3