diff options
author | Fernando J Pando <fernando.pando@stelligent.com> | 2017-01-30 12:44:14 -0500 |
---|---|---|
committer | Fernando J Pando <fernando.pando@stelligent.com> | 2017-02-07 11:14:42 -0500 |
commit | 34b5c9a4de92120d2c302e084f0139bc3cd8f155 (patch) | |
tree | 0c01e12d896f628fa46e9473847cab604524b08d /nixos/modules/services/continuous-integration/buildbot/worker.nix | |
parent | 4853900dd3cf1908e92a6287a500368ed4752ef1 (diff) | |
download | nixpkgs-34b5c9a4de92120d2c302e084f0139bc3cd8f155.tar nixpkgs-34b5c9a4de92120d2c302e084f0139bc3cd8f155.tar.gz nixpkgs-34b5c9a4de92120d2c302e084f0139bc3cd8f155.tar.bz2 nixpkgs-34b5c9a4de92120d2c302e084f0139bc3cd8f155.tar.lz nixpkgs-34b5c9a4de92120d2c302e084f0139bc3cd8f155.tar.xz nixpkgs-34b5c9a4de92120d2c302e084f0139bc3cd8f155.tar.zst nixpkgs-34b5c9a4de92120d2c302e084f0139bc3cd8f155.zip |
buildbot: 0.9.0.post1 -> 0.9.3
- Fixes unneeded patching - Adds worker to build inputs now needed for tests - Replaces enableworker option with worker configuration module - Openssh required for tests - Fixes worker hardcoded paths - Tested on Nixos Unstable
Diffstat (limited to 'nixos/modules/services/continuous-integration/buildbot/worker.nix')
-rw-r--r-- | nixos/modules/services/continuous-integration/buildbot/worker.nix | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/nixos/modules/services/continuous-integration/buildbot/worker.nix b/nixos/modules/services/continuous-integration/buildbot/worker.nix new file mode 100644 index 00000000000..430fd4e53f1 --- /dev/null +++ b/nixos/modules/services/continuous-integration/buildbot/worker.nix @@ -0,0 +1,128 @@ +# NixOS module for Buildbot Worker. + +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.buildbot-worker; + +in { + options = { + services.buildbot-worker = { + + enable = mkOption { + type = types.bool; + default = false; + description = "Whether to enable the Buildbot Worker."; + }; + + user = mkOption { + default = "bbworker"; + type = types.str; + description = "User the buildbot Worker should execute under."; + }; + + group = mkOption { + default = "bbworker"; + type = types.str; + description = "Primary group of buildbot Worker user."; + }; + + extraGroups = mkOption { + type = types.listOf types.str; + default = [ "nixbld" ]; + description = "List of extra groups that the Buildbot Worker user should be a part of."; + }; + + home = mkOption { + default = "/home/bbworker"; + type = types.path; + description = "Buildbot home directory."; + }; + + buildbotDir = mkOption { + default = "${cfg.home}/worker"; + type = types.path; + description = "Specifies the Buildbot directory."; + }; + + workerUser = mkOption { + default = "example-worker"; + type = types.str; + description = "Specifies the Buildbot Worker user."; + }; + + workerPass = mkOption { + default = "pass"; + type = types.str; + description = "Specifies the Buildbot Worker password."; + }; + + masterUrl = mkOption { + default = "localhost:9989"; + type = types.str; + description = "Specifies the Buildbot Worker connection string."; + }; + + package = mkOption { + type = types.package; + default = pkgs.buildbot-worker; + description = "Package to use for buildbot worker."; + example = pkgs.buildbot-worker; + }; + + packages = mkOption { + default = [ ]; + example = [ pkgs.git ]; + type = types.listOf types.package; + description = "Packages to add to PATH for the buildbot process."; + }; + + }; + }; + + config = mkIf cfg.enable { + users.extraGroups = optional (cfg.group == "bbworker") { + name = "bbworker"; + }; + + users.extraUsers = optional (cfg.user == "bbworker") { + name = "bbworker"; + description = "Buildbot Worker User."; + isNormalUser = true; + createHome = true; + home = cfg.home; + group = cfg.group; + extraGroups = cfg.extraGroups; + useDefaultShell = true; + }; + + systemd.services.buildbot-worker = { + description = "Buildbot Worker."; + after = [ "network.target" ]; + wantedBy = [ "multi-user.target" ]; + wants = [ "buildbot-master.service" ]; + path = cfg.packages; + + preStart = '' + # NOTE: ensure master has time to start in case running on localhost + ${pkgs.coreutils}/bin/sleep 4 + ${pkgs.coreutils}/bin/mkdir -vp ${cfg.buildbotDir} + ${cfg.package}/bin/buildbot-worker create-worker ${cfg.buildbotDir} ${cfg.masterUrl} ${cfg.workerUser} ${cfg.workerPass} + ''; + + serviceConfig = { + Type = "forking"; + User = cfg.user; + Group = cfg.group; + WorkingDirectory = cfg.home; + ExecStart = "${cfg.package}/bin/buildbot-worker start ${cfg.buildbotDir}"; + }; + + }; + }; + + meta.maintainers = with lib.maintainers; [ nand0p ]; + +} |