spacepaste

  1.  
  2. { pkgs, config, lib, ... }:
  3. {
  4. imports = [
  5. ../../nixos-modules/common.nix
  6. ];
  7. boot.kernelPackages = pkgs.linuxPackages_latest;
  8. virtualisation.docker = {
  9. enable = true;
  10. # Clean docker images periodically
  11. autoPrune = {
  12. enable = true;
  13. # Do not only remove "dangling" images (orphaned layers)
  14. # Also remove unused
  15. flags = [ "--all" ];
  16. };
  17. };
  18. services.gitlab-runner = {
  19. enable = true;
  20. configFile = ./config.toml;
  21. };
  22. services.cron = {
  23. enable = true;
  24. systemCronJobs = [
  25. "@hourly root ${pkgs.docker-gc}/bin/docker-gc"
  26. ];
  27. };
  28. systemd.services.gitlab-runner-cache = {
  29. description = "Create gitlab-runner cache directory";
  30. before = [ "gitlab-runner.service" ];
  31. wantedBy = [ "multi-user.target" ];
  32. serviceConfig.Type = "oneshot";
  33. script = ''
  34. # Create cache dir next to gitlab workdir
  35. mkdir -p "/var/db/gitlab-runner-cache"
  36. chown -R "gitlab-runner":"gitlab-runner" "/var/db/gitlab-runner-cache"
  37. '';
  38. };
  39. networking.hostName = "ci.peterhk.com";
  40. nix.buildMachines = [
  41. { hostName = "localhost";
  42. system = "x86_64-linux";
  43. supportedFeatures = ["kvm" "nixos-test" "big-parallel" "benchmark"];
  44. maxJobs = 8;
  45. }
  46. ];
  47. }
  48.