summary refs log tree commit diff stats
path: root/modules/by-name/ba
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-12-26 18:24:10 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-12-26 18:24:10 +0100
commit0c7c8d425db55991c05539c0cbabb7bdc134be97 (patch)
tree17b136f2cd133f91e0ff2e6f40c582ce510b6399 /modules/by-name/ba
parentfix(pkgs/back): Use the errors display trait not debug (diff)
downloadnixos-server-server2.tar.gz
nixos-server-server2.zip
fix(modules/back): Update to the new config file input server2
Diffstat (limited to 'modules/by-name/ba')
-rw-r--r--modules/by-name/ba/back/module.nix17
1 files changed, 15 insertions, 2 deletions
diff --git a/modules/by-name/ba/back/module.nix b/modules/by-name/ba/back/module.nix
index 2bc5159..2ff0768 100644
--- a/modules/by-name/ba/back/module.nix
+++ b/modules/by-name/ba/back/module.nix
@@ -2,10 +2,18 @@
   config,
   lib,
   vhackPackages,
+  pkgs,
   ...
 }: let
   cfg = config.vhack.back;
 
+  mkConfigFile = repoPath:
+    (pkgs.formats.json {}).generate "config.json"
+    {
+      inherit (cfg) source_code_repository_url;
+      repository_path = repoPath;
+    };
+
   mkUnit = repoPath: port: {
     description = "Back service for ${repoPath}";
     wants = ["network-online.target"];
@@ -14,11 +22,10 @@
 
     environment = {
       ROCKET_PORT = builtins.toString port;
-      BACK_SOURCE_CODE_REPOSITORY_URL = "https://git.vhack.eu/vhack.eu/nixos-server/tree/pkgs/by-name/ba/back";
     };
 
     serviceConfig = {
-      ExecStart = "${lib.getExe vhackPackages.back} ${lib.strings.escapeShellArg repoPath}";
+      ExecStart = "${lib.getExe vhackPackages.back} ${mkConfigFile repoPath}";
 
       # Ensure that the service can read the repository
       # FIXME(@bpeetz): This has the implied assumption, that all the exposed git
@@ -78,6 +85,12 @@ in {
   options.vhack.back = {
     enable = lib.mkEnableOption "Back issue tracker (inspired by tvix's panettone)";
 
+    source_code_repository_url = lib.mkOption {
+      description = "The url to the source code of this instance of back";
+      default = "https://git.foss-syndicate.org/vhack.eu/nixos-server/tree/pkgs/by-name/ba/back";
+      type = lib.types.str;
+    };
+
     repositories = lib.mkOption {
       description = "An attibute set of repos to launch `back` services for.";
       type = lib.types.attrsOf (lib.types.submodule {