Skip to content
Snippets Groups Projects
Commit 84847b28 authored by Ben Gamari's avatar Ben Gamari :turtle:
Browse files

Separate triage and test-tracking modules

parent 5f956bcd
No related branches found
No related tags found
1 merge request!1Separate triage and test-tracking modules
{ {
inputs.nixpkgs.url = "github:bgamari/nixpkgs/nixos-22.05-ghc"; inputs.nixpkgs.url = "github:bgamari/nixpkgs/nixos-22.05-ghc";
outputs = inputs@{ self, nixpkgs, ... }: { outputs = inputs@{ self, nixpkgs, ... }: {
nixosModules.default = import ./nixos.nix; nixosModules.ghc-triage = import ./triage-module.nix;
nixosModules.ghc-test-tracking = import ./test-tracking-module.nix;
}; };
} }
{ pkgs, config, lib, ... }:
let service = pkgs.python3Packages.callPackage ./package.nix {};
in
{
options.services.ghc-test-tracking = {
accessToken = lib.mkOption {
type = lib.types.str;
};
listenPort = lib.mkOption {
type = lib.types.int;
default = 8087;
};
};
config = {
systemd.services.gitlab-test-tracking = {
description = "GitLab test tracking service";
after = [ "postgresql.service" ];
requires = [ "postgresql.service" ];
script = ''
${service}/bin/gitlab-test-tracking-service \
--gitlab-root=https://gitlab.${config.ghc.rootDomain} \
--access-token="${config.services.ghc-test-tracking.accessToken}" \
--port=${toString config.services.ghc-test-tracking.listenPort} \
--conn-string="postgresql:///ghc_test_tracking"
'';
wantedBy = [ "multi-user.target" ];
serviceConfig.DynamicUser = true;
};
};
}
{ pkgs, config, ... }: { pkgs, config, lib, ... }:
let let service = pkgs.python3Packages.callPackage ./package.nix {};
accessToken = config.ghc-bot.gitlabAccessToken; in
{
service = pkgs.python3Packages.callPackage ./package.nix {}; options.services.ghc-triage = {
accessToken = lib.mkOption {
triage-service = { type = lib.types.str;
systemd.services.gitlab-triage-label-service = { };
description = "GitLab label triage service"; listenPort = lib.mkOption {
script = '' type = lib.types.int;
${service}/bin/gitlab-triage-label-service \ default = 8085;
--gitlab-root=https://gitlab.${config.ghc.rootDomain} \
--access-token="${accessToken}" \
--port=8085
'';
wantedBy = [ "multi-user.target" ];
}; };
}; };
test-tracking-service = { config = {
users.users.ghc-test-tracking = { users.users.ghc-test-tracking = {
description = "GitLab test tracking service"; description = "GitLab test tracking service";
isSystemUser = true; isSystemUser = true;
...@@ -26,26 +21,16 @@ let ...@@ -26,26 +21,16 @@ let
}; };
users.groups.ghc-test-tracking = {}; users.groups.ghc-test-tracking = {};
systemd.services.gitlab-test-tracking = { systemd.services.gitlab-triage-label-service = {
description = "GitLab label triage service";
serviceConfig.User = "ghc-test-tracking"; serviceConfig.User = "ghc-test-tracking";
description = "GitLab test tracking service";
after = [ "postgresql.service" ];
requires = [ "postgresql.service" ];
script = '' script = ''
${service}/bin/gitlab-test-tracking-service \ ${service}/bin/gitlab-triage-label-service \
--gitlab-root=https://gitlab.${config.ghc.rootDomain} \ --gitlab-root=https://gitlab.${config.ghc.rootDomain} \
--access-token="${accessToken}" \ --access-token="${config.services.ghc-triage.accessToken}" \
--port=8087 \ --port=${toString config.services.ghc-triage.listenPort}
--conn-string="postgresql:///ghc_test_tracking"
''; '';
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
}; };
}; };
in {
options.ghc-bot.gitlabAccessToken = pkgs.lib.mkOption {
type = pkgs.lib.types.str;
description = "GitLab access token for ghc-bot";
};
imports = [ triage-service test-tracking-service ];
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment