From 9c392f468f2b341af8a83e8061ff1a92face28f5 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Thu, 1 Feb 2024 04:08:38 -0500 Subject: [PATCH] decouple nixos config --- nixos/github-runner.nix | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/nixos/github-runner.nix b/nixos/github-runner.nix index c07872a..9a845a3 100644 --- a/nixos/github-runner.nix +++ b/nixos/github-runner.nix @@ -54,8 +54,21 @@ in type = types.str; default = "gh-selfhosted-tokens"; }; + nixosConfig = lib.mkOption { + type = types.deferredModule; + description = '' + NixOS configuration for the GitHub Runner container + ''; + default = { pkgs, ... }: { + nix.settings = { + experimental-features = "nix-command flakes repl-flake"; + max-jobs = "auto"; + }; + }; + }; runnerConfig = lib.mkOption { type = types.lazyAttrsOf types.raw; + description = ''Configuration for the GitHub Runner''; default = { extraPackages = with pkgs; [ cachix @@ -104,12 +117,11 @@ in }; config = { config, pkgs, ... }: { system.stateVersion = "23.11"; - imports = [ userModule ]; - nix.settings = { - trusted-users = [ user ]; # for cachix - experimental-features = "nix-command flakes repl-flake"; - max-jobs = "auto"; - }; + imports = [ + userModule + cfg.nixosConfig + ]; + nix.settings.trusted-users = [ user ]; # for cachix services.github-runners."${name}" = cfg.runnerConfig // { enable = true; inherit user tokenFile;