2022-05-13 20:28:07 -04:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
{
|
2022-05-27 23:22:12 -04:00
|
|
|
# setup sops for secrets
|
|
|
|
sops.secrets."nix-asuran" = {
|
|
|
|
format = "yaml";
|
|
|
|
sopsFile = ../../secrets/gitlab-runner.yaml;
|
|
|
|
};
|
2022-05-13 20:28:07 -04:00
|
|
|
# Make sure docker containers can reach the network
|
|
|
|
boot.kernel.sysctl."net.ipv4.ip_forward" = true; # 1
|
|
|
|
# Make sure docker is enabled
|
|
|
|
virtualisation.docker.enable = true;
|
|
|
|
# Enable binfmt-misc so we can run aarch64 containers
|
|
|
|
boot.binfmt.emulatedSystems = [ "wasm32-wasi" "aarch64-linux" ];
|
2022-05-27 23:22:12 -04:00
|
|
|
services.gitlab-runner =
|
|
|
|
let
|
|
|
|
nix-shared = with lib; {
|
2022-05-28 00:38:05 -04:00
|
|
|
dockerImage = "nixpkgs/nix-flakes";
|
2022-05-13 20:28:07 -04:00
|
|
|
dockerVolumes = [
|
2022-05-28 00:55:28 -04:00
|
|
|
"/var/sharedstore:/sharedstore"
|
2022-05-13 20:28:07 -04:00
|
|
|
];
|
|
|
|
dockerDisableCache = true;
|
|
|
|
};
|
2022-05-27 23:22:12 -04:00
|
|
|
in
|
|
|
|
{
|
|
|
|
enable = true;
|
|
|
|
concurrent = 4;
|
|
|
|
checkInterval = 1;
|
|
|
|
services = {
|
|
|
|
# default-asuran = {
|
|
|
|
# registrationConfigFile = "/var/lib/secret/gitlab-runner/asuran-default";
|
|
|
|
# dockerImage = "debian:stable";
|
|
|
|
# dockerVolumes = [
|
|
|
|
# "/var/run/docker.sock:/var/run/docker.sock"
|
|
|
|
# ];
|
|
|
|
# dockerPrivileged = true;
|
|
|
|
# tagList = [ "linux-own" ];
|
|
|
|
# };
|
2022-05-13 20:28:07 -04:00
|
|
|
|
2022-05-27 23:22:12 -04:00
|
|
|
nix-asuran = nix-shared // {
|
|
|
|
registrationConfigFile = config.sops.secrets.nix-asuran.path;
|
|
|
|
tagList = [ "nix" ];
|
|
|
|
requestConcurrency = 8;
|
|
|
|
limit = 4;
|
|
|
|
runUntagged = true;
|
2022-05-13 20:28:07 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|