From f81c71a328995b79f4c8cb5377c321f24b7eda85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sun, 10 Sep 2023 10:11:50 +0000 Subject: [PATCH] add some example nixos configuration --- examples/default.nix | 29 ++++++++++++++++++++++++----- flake.nix | 2 +- nix/master.nix | 3 +++ nix/worker.nix | 1 - 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/examples/default.nix b/examples/default.nix index c647c55..50aa6b6 100644 --- a/examples/default.nix +++ b/examples/default.nix @@ -1,7 +1,7 @@ { nixpkgs, system, buildbot-nix, ... }: let # some example configuration to make it eval - dummy = { config, ... }: { + dummy = { config, modulesPath, ... }: { networking.hostName = "example-common"; system.stateVersion = config.system.nixos.version; users.users.root.initialPassword = "fnord23"; @@ -11,21 +11,40 @@ let inherit (nixpkgs) lib; inherit (lib) nixosSystem; - in { - # General - example-master = nixosSystem { + example-master = lib.makeOverridable nixosSystem { inherit system; modules = [ dummy + { + services.buildbot-nix.master = { + enable = true; + url = "https://buildbot.thalheim.io"; + workersFile = "/home/mic92/buildbot-nix/workers.json"; + github = { + tokenFile = "/home/mic92/git/buildbot-nix/github-token"; + webhookSecretFile = "/home/mic92/buildbot-nix/github-webhook-secret"; + oauthSecretFile = "/home/mic92/buildbot-nix/github-oauth-secret"; + oauthId = "2516248ec6289e4d9818122cce0cbde39e4b788d"; + githubUser = "mic92-buildbot"; + githubAdmins = [ "Mic92" ]; + }; + }; + } buildbot-nix.nixosModules.buildbot-master ]; }; - example-worker = nixosSystem { + example-worker = lib.makeOverridable nixosSystem { inherit system; modules = [ dummy + { + services.buildbot-nix.worker = { + enable = true; + workerPasswordFile = "/home/mic92/buildbot-nix/worker-password"; + }; + } buildbot-nix.nixosModules.buildbot-worker ]; }; diff --git a/flake.nix b/flake.nix index 41cc14b..1e8b57a 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,7 @@ outputs = inputs@{ self, flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } ({ lib, ... }: { - systems = lib.systems.flakeExposed; + systems = [ "x86_64-linux" ]; flake = { nixosModules.buildbot-master = ./nix/master.nix; nixosModules.buildbot-worker = ./nix/worker.nix; diff --git a/nix/master.nix b/nix/master.nix index b3940c2..24fbafb 100644 --- a/nix/master.nix +++ b/nix/master.nix @@ -59,10 +59,12 @@ in }; buildSystems = lib.mkOption { type = lib.types.listOf lib.types.str; + default = [ pkgs.hostPlatform.system ]; description = "Systems that we will be build"; }; evalMaxMemorySize = lib.mkOption { type = lib.types.str; + default = "2048"; description = '' Maximum memory size for nix-eval-jobs (in MiB) per worker. After the limit is reached, the worker is @@ -113,6 +115,7 @@ in }; services.postgresql = { + enable = true; ensureDatabases = [ "buildbot" ]; ensureUsers = [ { diff --git a/nix/worker.nix b/nix/worker.nix index 2ce700d..9c70e59 100644 --- a/nix/worker.nix +++ b/nix/worker.nix @@ -26,7 +26,6 @@ in }; workerPasswordFile = lib.mkOption { type = lib.types.str; - default = "/var/lib/buildbot-worker/worker-password"; description = "The buildbot worker password file."; }; };