From 2493056eed1ee5afcab24403c21e028971207531 Mon Sep 17 00:00:00 2001 From: Antoine Eiche Date: Sat, 18 Apr 2020 01:03:15 +0200 Subject: [PATCH] Setup an Hydra declarative project This commit adds configuration files ingested an Hydra instance to create a declarative project. Currently, this Hydra instance builds - the master branch - all pull requests We use the nix community provided Hydra instance https://hydra.nix-community.org/project/simple-nixos-mailserver. --- .hydra/declarative-jobsets.nix | 58 ++++++++++++++++++++++++++++++++++ .hydra/default.nix | 1 + .hydra/spec.json | 30 ++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 .hydra/declarative-jobsets.nix create mode 100644 .hydra/default.nix create mode 100644 .hydra/spec.json diff --git a/.hydra/declarative-jobsets.nix b/.hydra/declarative-jobsets.nix new file mode 100644 index 0000000..7ddb159 --- /dev/null +++ b/.hydra/declarative-jobsets.nix @@ -0,0 +1,58 @@ +{ nixpkgs, declInput, pulls }: + +let + pkgs = import nixpkgs {}; + + prs = builtins.fromJSON (builtins.readFile pulls); + prJobsets = pkgs.lib.mapAttrs (num: info: + { enabled = 1; + hidden = false; + description = "PR ${num}: ${info.title}"; + nixexprinput = "snm"; + nixexprpath = ".hydra/default.nix"; + checkinterval = 30; + schedulingshares = 20; + enableemail = false; + emailoverride = ""; + keepnr = 1; + type = 0; + inputs = { + cloudwatt = { + type = "git"; + value = "${info.target_repo_url} merge-requests/${info.iid}/head"; + emailresponsible = false; + }; + }; + } + ) prs; + + desc = prJobsets // { + master = { + description = "Build master branch of Simple NixOS MailServer"; + checkinterval = "60"; + enabled = "1"; + nixexprinput = "snm"; + nixexprpath = ".hydra/default.nix"; + schedulingshares = 100; + enableemail = false; + emailoverride = ""; + keepnr = 3; + hidden = false; + type = 0; + inputs = { + snm = { + value = "https://gitlab.com/simple-nixos-mailserver/nixos-mailserver master"; + type = "git"; + emailresponsible = false; + }; + }; + }; + }; + +in { + jobsets = pkgs.runCommand "spec-jobsets.json" {} '' + cat >$out <