diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000000000000000000000000000000000000..e0c7e3aa75ede9bf22a2fb502b0204f83664d85f --- /dev/null +++ b/flake.nix @@ -0,0 +1,64 @@ +# Usage: +# +# { +# inputs.ghc-gitlab-runner.url = "git+https://gitlab.haskell.org/ghc/ci-config"; +# outputs = inputs: { +# nixosConfigurations.machine = nixpkgs.lib.nixosSystem { +# modules = [ +# inputs.ghc-gitlab-runner.nixosModules.ghc-runner-common +# inputs.ghc-gitlab-runner.nixosModules.ghc-runner +# inputs.ghc-gitlab-runner.nixosModules.ghc-runner-freebsd +# ]; +# { +# ghc-gitlab-runner.token = "REGISTRATION TOKEN"; +# ghc-gitlab-runner.name = "NAME"; +# } +# }; +# }; +# } + +{ + outputs = { self }: { + nixosModules.ghc-runner-common = { lib, ... }: { + config.virtualisation.docker = { + enable = true; + autoPrune = { + enable = true; + flags = [ "--force" "--all" "--volumes" ]; + dates = "daily"; + }; + }; + + options.ghc-gitlab-runner.name = lib.mkOption { + type = lib.types.str; + description = "GitLab runner name"; + }; + options.ghc-gitlab-runner.token = lib.mkOption { + type = lib.types.str; + description = "GitLab registration token"; + }; + }; + + nixosModules.ghc-runner = {config, ...}: { + imports = [ + (import ./nixos/ci-worker.nix { + name = config.ghc-gitlab-runner.name; + cores = 16; + token = config.ghc-gitlab-runner.token; + lintToken = config.ghc-gitlab-runner.token; + }) + ]; + }; + + nixosModules.ghc-runner-freebsd = {config, ...}: { + imports = [ + (import ./nixos/freebsd-runner.nix { + runnerName = config.ghc-gitlab-runner.name; + token = config.ghc-gitlab-runner.token; + cores = 4; + }) + ]; + }; + }; +} + diff --git a/nixos/freebsd-runner.nix b/nixos/freebsd-runner.nix index 2a09e5c53779a32ffd4bf7cb3a65e977f752d63c..f8de84acb5d9b7d58217ad6f073dcdd673340716 100644 --- a/nixos/freebsd-runner.nix +++ b/nixos/freebsd-runner.nix @@ -72,6 +72,8 @@ in User = "gitlab-runner"; Group = "gitlab-runner"; }; + + virtualisation.libvirtd.enable = true; users.groups.gitlab-runner = { }; users.users.gitlab-runner = {