use nixos options instead of nixpkgs overlay
The overlay will break if buildbot in unstable will change it's python override in nixpkgs. This will happen in the next release when sqlalchemy will be update. Also I have at least three installations where I share nixpkgs instances across multiple nixos configuration for performance reasons, where I cannot use overlays defined in a NixOS module.
This commit is contained in:
parent
6efd536381
commit
e8a88f8f15
14
flake.nix
14
flake.nix
|
@ -20,8 +20,18 @@
|
|||
] ++ inputs.nixpkgs.lib.optional (inputs.treefmt-nix ? flakeModule) ./nix/treefmt/flake-module.nix;
|
||||
systems = [ "x86_64-linux" ];
|
||||
flake = {
|
||||
nixosModules.buildbot-master = import ./nix/master.nix inputs;
|
||||
nixosModules.buildbot-worker = import ./nix/worker.nix inputs;
|
||||
nixosModules.buildbot-master.imports = [
|
||||
./nix/master.nix
|
||||
({ pkgs, ... }: {
|
||||
services.buildbot-nix.master.buildbotNixpkgs = lib.mkDefault inputs.nixpkgs.legacyPackages.${pkgs.hostPlatform.system};
|
||||
})
|
||||
];
|
||||
nixosModules.buildbot-worker.imports = [
|
||||
./nix/worker.nix
|
||||
({ pkgs, ... }: {
|
||||
services.buildbot-nix.worker.package = lib.mkDefault inputs.nixpkgs.legacyPackages.${pkgs.hostPlatform.system}.buildbot-worker;
|
||||
})
|
||||
];
|
||||
|
||||
nixosConfigurations =
|
||||
let
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
{ nixpkgs, ... }:
|
||||
{ config
|
||||
, pkgs
|
||||
, lib
|
||||
|
@ -9,7 +8,6 @@ let
|
|||
inherit (lib) mkRemovedOptionModule mkRenamedOptionModule;
|
||||
in
|
||||
{
|
||||
_file = ./master.nix;
|
||||
imports = [
|
||||
(mkRenamedOptionModule
|
||||
[
|
||||
|
@ -59,17 +57,8 @@ in
|
|||
];
|
||||
|
||||
options = {
|
||||
services.buildbot-nix.vendorBuildbot = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to vendow `buildbot-master` from the `nixpkgs` input of the `buildbot-nix` flake.
|
||||
`buildbot-nix` requires `buildbot-master` to be at least of version `4`.
|
||||
'';
|
||||
};
|
||||
services.buildbot-nix.master = {
|
||||
enable = lib.mkEnableOption "buildbot-master";
|
||||
package = lib.mkPackageOption pkgs "buildbot" { };
|
||||
dbUrl = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "postgresql://@/buildbot";
|
||||
|
@ -266,6 +255,11 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
buildbotNixpkgs = lib.mkOption {
|
||||
type = lib.types.raw;
|
||||
description = "Nixpkgs to use for buildbot packages";
|
||||
};
|
||||
|
||||
outputsPath = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.path;
|
||||
description = "Path where we store the latest build store paths names for nix attributes as text files. This path will be exposed via nginx at \${domain}/nix-outputs";
|
||||
|
@ -275,14 +269,6 @@ in
|
|||
};
|
||||
};
|
||||
config = lib.mkMerge [
|
||||
(lib.mkIf config.services.buildbot-nix.vendorBuildbot {
|
||||
nixpkgs.overlays = [
|
||||
(final: prev:
|
||||
{
|
||||
buildbotPackages = prev.python3.pkgs.callPackage "${nixpkgs}/pkgs/development/tools/continuous-integration/buildbot" { };
|
||||
})
|
||||
];
|
||||
})
|
||||
(lib.mkIf cfg.enable {
|
||||
# By default buildbot uses a normal user, which is not a good default, because
|
||||
# we grant normal users potentially access to other resources. Also
|
||||
|
@ -296,8 +282,12 @@ in
|
|||
assertions = [
|
||||
{
|
||||
assertion =
|
||||
lib.versionAtLeast cfg.package.version "4.0.0";
|
||||
message = "`buildbot-nix` requires `buildbot` 4.0.0 or greater to function";
|
||||
lib.versionAtLeast cfg.buildbotNixpkgs.buildbot.version "4.0.0";
|
||||
message = ''
|
||||
`buildbot-nix` requires `buildbot` 4.0.0 or greater to function.
|
||||
Set services.buildbot-nix.master.buildbotNixpkgs to a nixpkgs with buildbot >= 4.0.0,
|
||||
i.e. nixpkgs-unstable.
|
||||
'';
|
||||
}
|
||||
{
|
||||
assertion =
|
||||
|
@ -409,21 +399,20 @@ in
|
|||
in
|
||||
"${if hasSSL then "https" else "http"}://${cfg.domain}/";
|
||||
dbUrl = config.services.buildbot-nix.master.dbUrl;
|
||||
package =
|
||||
cfg.package.overrideAttrs (old: {
|
||||
patches =
|
||||
old.patches ++ [
|
||||
./0001-Support-per-installation-tokens-in-GithubStatusPush-.patch #;
|
||||
];
|
||||
|
||||
package = cfg.buildbotNixpkgs.buildbot.overrideAttrs (old: {
|
||||
patches = old.patches ++ [ ./0001-Support-per-installation-tokens-in-GithubStatusPush-.patch ];
|
||||
});
|
||||
pythonPackages = ps: [
|
||||
ps.requests
|
||||
ps.treq
|
||||
ps.psycopg2
|
||||
(ps.toPythonModule pkgs.buildbot-worker)
|
||||
pkgs.buildbot-plugins.www-react
|
||||
(pkgs.python3.pkgs.callPackage ../default.nix { })
|
||||
(pkgs.python3.pkgs.callPackage ./buildbot-gitea.nix { buildbot = cfg.package; })
|
||||
(ps.toPythonModule cfg.buildbotNixpkgs.buildbot-worker)
|
||||
cfg.buildbotNixpkgs.buildbot-plugins.www-react
|
||||
(cfg.buildbotNixpkgs.python3.pkgs.callPackage ../default.nix { })
|
||||
(cfg.buildbotNixpkgs.python3.pkgs.callPackage ./buildbot-gitea.nix {
|
||||
inherit (cfg.buildbotNixpkgs) buildbot;
|
||||
})
|
||||
];
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
{ ... }:
|
||||
{ config
|
||||
, pkgs
|
||||
, lib
|
||||
|
@ -90,7 +89,10 @@ in
|
|||
ExecReload = "+${config.systemd.package}/bin/systemd-run --on-active=60 ${config.systemd.package}/bin/systemctl restart buildbot-worker";
|
||||
ExecStart = lib.traceIf
|
||||
(lib.versionOlder pkgs.buildbot-worker.version "4.0.0")
|
||||
"`buildbot-nix` recommends `buildbot-worker` to be at least of version `4.0.0`"
|
||||
''
|
||||
`buildbot-nix` recommends `buildbot-worker` to be at least of version `4.0.0`.
|
||||
Consider upgrading by setting `services.buildbot-nix.worker.package` i.e. from nixpkgs-unstable.
|
||||
''
|
||||
"${python.pkgs.twisted}/bin/twistd --nodaemon --pidfile= --logfile - --python ${../buildbot_nix}/worker.py";
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue