From 5013b592f1999c43ea91bd75469d0a64848983a0 Mon Sep 17 00:00:00 2001 From: Greg Hale Date: Fri, 29 Mar 2019 19:35:24 -0400 Subject: [PATCH] Add hydra.json and jobsets.nix for hydra --- default.nix | 3 ++- hydra.json | 29 +++++++++++++++++++++++ jobsets.nix | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 hydra.json create mode 100644 jobsets.nix diff --git a/default.nix b/default.nix index 4cbb016..3ef9e94 100644 --- a/default.nix +++ b/default.nix @@ -36,9 +36,10 @@ let then pkgs.lib.composeExtensions orig.overrides overlay else overlay; }; - + in { haskellPackages = pkgs.haskell.packages.${compiler}.override overrideHaskellPackages; inherit pkgs; + nixpkgs = pkgs; } diff --git a/hydra.json b/hydra.json new file mode 100644 index 0000000..e778b15 --- /dev/null +++ b/hydra.json @@ -0,0 +1,29 @@ +{ + "enabled": 1, + "hidden": true, + "description": "Jobsets", + "nixexprinput": "src", + "nixexprpath": "jobsets.nix", + "checkinterval": 300, + "schedulingshares": 100, + "enableemail": false, + "emailoverride": "", + "keepnr": 10, + "inputs": { + "src": { + "type": "git", + "value": "https://github.com/haskell-nix/hnix-store.git master 1", + "emailresponsible": false + }, + "nixpkgs": { + "type": "git", + "value": "https://github.com/NixOS/nixpkgs-channels nixos-unstable", + "emailresponsible": false + }, + "prs": { + "type": "githubpulls", + "value": "haskell-nix hnix-store", + "emailresponsible": false + } + } +} diff --git a/jobsets.nix b/jobsets.nix new file mode 100644 index 0000000..6cea5ed --- /dev/null +++ b/jobsets.nix @@ -0,0 +1,66 @@ +{ prs }: + +let + self = import ./. {}; + pkgs = self.nixpkgs; + mkFetchGithub = value: { + inherit value; + type = "git"; + emailresponsible = false; + }; +in +with pkgs.lib; +let + defaults = jobs: { + inherit (jobs) description; + enabled = 1; + hidden = false; + keepnr = 10; + schedulingshares = 100; + checkinterval = 120; + enableemail = false; + emailoverride = ""; + nixexprinput = "hnix-store"; + nixexprpath = "release.nix"; + inputs = jobs.inputs // { + nixpkgs = { + type = "git"; + value = "https://github.com/NixOS/nixpkgs-channels nixos-unstable"; + emailresponsible = false; + }; + }; + }; + branchJobset = branch: defaults { + description = "hnix-store-${branch}"; + inputs = { + hnix-store = { + value = "https://github.com/haskell-nix/hnix-store ${branch}"; + type = "git"; + emailresponsible = false; + }; + }; + }; + makePr = num: info: { + name = "hnix-store-pr-${num}"; + value = defaults { + description = "#${num}: ${info.title}"; + inputs = { + hnix-store = { + #NOTE: This should really use "pull/${num}/merge"; however, GitHub's + #status checks only operate on PR heads. This creates a race + #condition, which can currently only be solved by requiring PRs to be + #up to date before they're merged. See + #https://github.com/isaacs/github/issues/1002 + value = "https://github.com/haskell-nix/hnix-store pull/${num}/head 1"; + type = "git"; + emailresponsible = false; + }; + }; + }; + }; + processedPrs = mapAttrs' makePr (builtins.fromJSON (builtins.readFile prs)); + jobsetsAttrs = processedPrs // + genAttrs ["master" "pending"] branchJobset; +in { + jobsets = pkgs.writeText "spec.json" (builtins.toJSON jobsetsAttrs); +}