-
- { pkgs, config, lib, ... }:
- {
- imports = [
- ../../nixos-modules/common.nix
- ];
-
- boot.kernelPackages = pkgs.linuxPackages_latest;
-
- virtualisation.docker = {
- enable = true;
- # Clean docker images periodically
- autoPrune = {
- enable = true;
- # Do not only remove "dangling" images (orphaned layers)
- # Also remove unused
- flags = [ "--all" ];
- };
- };
-
- services.gitlab-runner = {
- enable = true;
- configFile = ./config.toml;
- };
-
- services.cron = {
- enable = true;
- systemCronJobs = [
- "@hourly root ${pkgs.docker-gc}/bin/docker-gc"
- ];
- };
-
- systemd.services.gitlab-runner-cache = {
- description = "Create gitlab-runner cache directory";
- before = [ "gitlab-runner.service" ];
- wantedBy = [ "multi-user.target" ];
- serviceConfig.Type = "oneshot";
- script = ''
- # Create cache dir next to gitlab workdir
- mkdir -p "/var/db/gitlab-runner-cache"
- chown -R "gitlab-runner":"gitlab-runner" "/var/db/gitlab-runner-cache"
- '';
- };
-
- networking.hostName = "ci.peterhk.com";
- nix.buildMachines = [
- { hostName = "localhost";
- system = "x86_64-linux";
- supportedFeatures = ["kvm" "nixos-test" "big-parallel" "benchmark"];
- maxJobs = 8;
- }
- ];
- }
-