diff --git a/modules/gitlab-runner.nix b/modules/gitlab-runner.nix index e1a0fa7..2584280 100644 --- a/modules/gitlab-runner.nix +++ b/modules/gitlab-runner.nix @@ -1,7 +1,14 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: with lib; -let cfg = config.custom.services.gitlab-runner; -in { +let + cfg = config.custom.services.gitlab-runner; +in +{ options.custom.services.gitlab-runner = { enable = mkEnableOption "gitlab-runner"; }; @@ -33,52 +40,61 @@ in { }; }; - config = let hostConfig = config; - in args@{ config, ... }: { + config = + let + hostConfig = config; + in + args@{ config, ... }: + { - nix = { - package = pkgs.nixVersions.latest; - extraOptions = '' - experimental-features = nix-command flakes + nix = { + package = pkgs.nixVersions.latest; + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; + + environment.systemPackages = with pkgs; [ + git + htop + nload + ]; + + users.groups.gitlab-runner = { }; + users.users.gitlab-runner = { + isSystemUser = true; + group = config.users.groups.gitlab-runner.name; + }; + + programs.ssh.extraConfig = '' + StrictHostKeyChecking=no + UserKnownHostsFile=/dev/null ''; - }; - environment.systemPackages = with pkgs; [ git htop nload ]; + networking.useHostResolvConf = lib.mkForce false; - users.groups.gitlab-runner = { }; - users.users.gitlab-runner = { - isSystemUser = true; - group = config.users.groups.gitlab-runner.name; - }; - - programs.ssh.extraConfig = '' - StrictHostKeyChecking=no - UserKnownHostsFile=/dev/null - ''; - - services = { - openssh.enable = true; - gitlab-runner = { - enable = true; - services = { - shell = { - registrationConfigFile = - hostConfig.sops.secrets.runnerRegistrationConfig.path; - executor = "shell"; - tagList = [ "nix" ]; + services = { + openssh.enable = true; + resolved.enable = true; + gitlab-runner = { + enable = true; + services = { + shell = { + authenticationTokenConfigFile = hostConfig.sops.secrets.runnerRegistrationConfig.path; + executor = "shell"; + }; }; }; }; - }; - systemd.services.gitlab-runner.serviceConfig = { - DynamicUser = lib.mkForce false; - User = config.users.users.gitlab-runner.name; - Group = config.users.groups.gitlab-runner.name; - }; + systemd.services.gitlab-runner.serviceConfig = { + DynamicUser = lib.mkForce false; + User = config.users.users.gitlab-runner.name; + Group = config.users.groups.gitlab-runner.name; + }; - system.stateVersion = "22.05"; - }; + system.stateVersion = "22.05"; + }; }; }; } diff --git a/secrets.enc.yml b/secrets.enc.yml index 62b300e..712c4b0 100644 --- a/secrets.enc.yml +++ b/secrets.enc.yml @@ -7,7 +7,7 @@ nix: cache_secret_key: ENC[AES256_GCM,data:Q2mRU+EuTyqjYNvbuyGLqoDSqa/7EPlzNuCJU7QUBRSozf1D4dDzAPNU47xZ2rKcjz6Eg4OhAZLlGeFw9le8SzHOSJ65UYHoMMc6Rpvv/fPhgg2s2UMArrqyO3ultj1pVe3eIIRzBQcdoFqVDg==,iv:jhMTWEO6ahcZl+Dq6mA+mWIie8T0Dq1ZYe/HHYAD5ss=,tag:2GRmd2z96+TGI7MdvOBEdA==,type:str] gitlab: password: ENC[AES256_GCM,data:+DptcLNXBmI7c8TrlF2U3+4FAeg=,iv:POtL7Cu6KvgEs9SFokR1G9yviqvqUcy8KNlB42FU9PQ=,tag:yWgsuDou+R05EEe7j8r7WA==,type:str] - runner_registration_config: ENC[AES256_GCM,data:BxkP4+moNV4eip9g2MoOFzZgWvYHELQ3qOJxMAGV9Ffdy5Fhl7mFNE85yv2I09hg2hwd68V3ThwiZ7eBoOi87bDRN82PeIyDqPtjbNA1ZcLJqE8=,iv:I/1wzcVSiz90cgRqMhGfN1wdB0EVQYVPyFn3RvSbTaw=,tag:8hMKQfmtPZf3nbs4LjnH3w==,type:str] + runner_registration_config: ENC[AES256_GCM,data:R+9UIDgrTx8xiz4DRRjB4ocyib43lIfQyxWTW+d8/UzkA87GFIraSLIjhnoDFhk57s3jQGUtmudl709z410V8+EXbLB81gl1mJqaXQ==,iv:qckhsamd24VVTB7glMcVyMsLJo9jON3Nc9JfeGOM0xI=,tag:/DOmtSrQOoIzpMHH/oBnFQ==,type:str] synapse: db_password: ENC[AES256_GCM,data:hy2BgTsRaZDQZULTW/csmnRy5ZjDEuPqxyuINv0ov5pFzDkozJVL1wut3HgBXjYZ8bqNjS5pCPQtkznw,iv:i41zKGwvPGIEZP0ZjhRaY4UMeOXBovQmLr1e1ewZhV4=,tag:3kKKYouH+lOrNxPJE5ul/Q==,type:str] macaroon_secret_key: ENC[AES256_GCM,data:6n1gCit2MC8l4VR9DSUR87BB+hY5Oza33423sbV8sNIXmZsPzhyvxaBalK/0TVjLH6Q=,iv:OgHxNG96ZW4+LPZhLAtOD01Wibad6vSX6s4BrPE67YE=,tag:OGIz/ufUwt8/pUMLvoaXtg==,type:str] @@ -69,8 +69,8 @@ sops: azure_kv: [] hc_vault: [] age: [] - lastmodified: "2024-04-23T20:29:30Z" - mac: ENC[AES256_GCM,data:6CYH1MYnM9rIYM9L5ipd3Q3ypA8n/1BnnnnecBWaADevVYQ/p1TfxHJKKlOVP7PAOLs3B2gM4Prr1vqQSe8nYHd5FAWSyXtfhpqnMOlEoNHCPuLKjK3bE4TjbvCxP9RsJIwTE3evJAQGKreWRW8/ml5mGiwkhrdTEe+MSR/n138=,iv:jvPXJK8vomDgw8wcr2nn9GIjeGlPswRQo7RFHgOSZjs=,tag:VjKJkjmmNs04h0THbAEfUA==,type:str] + lastmodified: "2024-07-08T16:25:47Z" + mac: ENC[AES256_GCM,data:xQS7zypupl05ohpgmLycHFMAH46fStNk9cAV0bW7RBTdpXyO+/Crit9D+/mbMdRxbMXy1xywi65YKq8BJpg2o2ReH0tIHdN1IZIyqHtPSyUJ5IM6D9dWZBBiSLuYM8eU0jloORqTkRLUUqIHM6nuOoDdfE+SaNFhDhIQd+j+6ZI=,iv:j3ezzOn03fS4NaAUkngQnwFzDvrg4BwUAVdkYXnwIAI=,tag:FA6LeG6PfkufRtJCdl3iTg==,type:str] pgp: - created_at: "2023-10-17T21:02:13Z" enc: |