diff options
Diffstat (limited to '')
-rw-r--r-- | modules/by-name/ba/back/module.nix | 17 |
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 { |