From 50fc67917268aacce1e177aadab4e02b1e4d2e0b Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Sat, 2 Nov 2024 17:09:11 +0000 Subject: [PATCH] cleanup: gettign rid of the gitlab runner config --- applications/git/gitlab_runner.nix | 123 ----------------------------- machines/wheatly.nix | 7 -- 2 files changed, 130 deletions(-) delete mode 100644 applications/git/gitlab_runner.nix diff --git a/applications/git/gitlab_runner.nix b/applications/git/gitlab_runner.nix deleted file mode 100644 index f5041bf..0000000 --- a/applications/git/gitlab_runner.nix +++ /dev/null @@ -1,123 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: -with lib; let - name = "gitlab_runner"; - cfg = config.services.skynet."${name}"; -in { - imports = [ - ]; - - options.services.skynet."${name}" = { - enable = mkEnableOption "Skynet Gitlab Runner"; - - runner = { - name = mkOption { - type = types.str; - }; - - gitlab = mkOption { - default = "https://gitlab.skynet.ie"; - type = types.str; - }; - - description = mkOption { - default = cfg.runner.name; - type = types.str; - }; - - docker = { - image = mkOption { - default = "alpine:latest"; - type = types.str; - }; - - cleanup_dates = mkOption { - # https://man.archlinux.org/man/systemd.time.7#CALENDAR_EVENTS - # it will use a lot of storage so clear it daily, may change to hourly if required - default = "daily"; - type = types.str; - }; - }; - }; - }; - - config = mkIf cfg.enable { - # https://search.nixos.org/options?from=0&size=50&sort=alpha_desc&type=packages&query=services.gitlab-runner. - environment.systemPackages = [ - pkgs.gitlab-runner - ]; - - age.secrets.runner_01_nix.file = ../../secrets/gitlab/runners/runner01.age; - age.secrets.runner_02_general.file = ../../secrets/gitlab/runners/runner02.age; - - boot.kernel.sysctl."net.ipv4.ip_forward" = true; # 1 - virtualisation.docker.enable = true; - - # taken from https://github.com/NixOS/nixpkgs/issues/245365#issuecomment-1663854128 - virtualisation.docker.listenOptions = ["/run/docker.sock" "127.0.0.1:2375"]; - - services.gitlab-runner = { - enable = true; - - # clear-docker-cache = { - # enable = true; - # dates = cfg.runner.docker.cleanup_dates; - # }; - - services = { - # might make a function later to have multiple runners, might never need it though - runner_nix = { - cloneUrl = cfg.runner.gitlab; - description = "For Nix only"; - registrationFlags = ["--docker-host" "tcp://127.0.0.1:2375"]; - registrationConfigFile = config.age.secrets.runner_01_nix.path; - dockerImage = cfg.runner.docker.image; - - # from https://nixos.wiki/wiki/Gitlab_runner - dockerVolumes = [ - "/nix/store:/nix/store:ro" - "/nix/var/nix/db:/nix/var/nix/db:ro" - "/nix/var/nix/daemon-socket:/nix/var/nix/daemon-socket:ro" - ]; - dockerDisableCache = true; - preBuildScript = pkgs.writeScript "setup-container" '' - mkdir -p -m 0755 /nix/var/log/nix/drvs - mkdir -p -m 0755 /nix/var/nix/gcroots - mkdir -p -m 0755 /nix/var/nix/profiles - mkdir -p -m 0755 /nix/var/nix/temproots - mkdir -p -m 0755 /nix/var/nix/userpool - mkdir -p -m 1777 /nix/var/nix/gcroots/per-user - mkdir -p -m 1777 /nix/var/nix/profiles/per-user - mkdir -p -m 0755 /nix/var/nix/profiles/per-user/root - mkdir -p -m 0700 "$HOME/.nix-defexpr" - . ${pkgs.nix}/etc/profile.d/nix-daemon.sh - ${pkgs.nix}/bin/nix-channel --add https://nixos.org/channels/nixos-unstable nixpkgs - ${pkgs.nix}/bin/nix-channel --update nixpkgs - ${pkgs.nix}/bin/nix-env -i ${concatStringsSep " " (with pkgs; [lix cacert git openssh])} - nix --version - ''; - environmentVariables = { - ENV = "/etc/profile"; - USER = "root"; - NIX_REMOTE = "daemon"; - PATH = "/nix/var/nix/profiles/default/bin:/nix/var/nix/profiles/default/sbin:/bin:/sbin:/usr/bin:/usr/sbin"; - NIX_SSL_CERT_FILE = "/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt"; - }; - tagList = ["nix"]; - }; - - runner_general = { - cloneUrl = cfg.runner.gitlab; - description = "General Runner"; - registrationFlags = ["--docker-host" "tcp://127.0.0.1:2375"]; - registrationConfigFile = config.age.secrets.runner_02_general.path; - dockerImage = cfg.runner.docker.image; - }; - }; - }; - }; -} diff --git a/machines/wheatly.nix b/machines/wheatly.nix index a2cab80..cbd6d4f 100644 --- a/machines/wheatly.nix +++ b/machines/wheatly.nix @@ -25,7 +25,6 @@ Notes: }; in { imports = [ - # ../applications/git/gitlab_runner.nix ../applications/git/forgejo_runner.nix ]; @@ -40,12 +39,6 @@ in { services.skynet = { host = host; backup.enable = true; - - # gitlab_runner = { - # enable = true; - # runner.name = "runner01"; - # }; - forgejo_runner.enable = true; }; }