From fd2f4bf21683aebc3bd7de056766375e904e4f09 Mon Sep 17 00:00:00 2001 From: Astro Date: Fri, 13 Dec 2019 19:11:49 +0100 Subject: [PATCH] collectd-{,master}: init --- collectd-master.nix | 17 +++++++++++++++++ collectd.nix | 39 +++++++++++++++++++++++++++++++++++++++ jobsets.nix | 17 +++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 collectd-master.nix create mode 100644 collectd.nix diff --git a/collectd-master.nix b/collectd-master.nix new file mode 100644 index 0000000..4f8c1da --- /dev/null +++ b/collectd-master.nix @@ -0,0 +1,17 @@ +let + overlay = self: super: { + collectd = super.collectd.overrideAttrs (_: rec { + name = "collectd-${version}"; + src = ; + version = "unstable"; + patches = []; + }); + }; +in +import ./collectd.nix { + pkgs = ( + import { + overlays = [ overlay ]; + } + ); +} diff --git a/collectd.nix b/collectd.nix new file mode 100644 index 0000000..4f0ade6 --- /dev/null +++ b/collectd.nix @@ -0,0 +1,39 @@ +{ pkgs ? import {}, + ... +}: + +with pkgs; + +let + collectdMakefileAm = + stdenv.mkDerivation { + name = "collectd-Makefile.am-BUILD_PLUGINs"; + src = pkgs.collectd.src; + phases = [ "unpackPhase" "installPhase" ]; + installPhase = "grep BUILD_PLUGIN Makefile.am > $out"; + }; + plugins = + let + findPlugins = s: + let + m = builtins.match ".*BUILD_PLUGIN_([A-Z0-9_]+)([.$\n]*)" s; + plugin = lib.toLower (builtins.elemAt m 0); + rest = builtins.elemAt m 1; + in if m == null + then [] + else [plugin] ++ (findPlugins rest); + in + builtins.concatMap findPlugins ( + lib.splitString "\n" ( + builtins.readFile collectdMakefileAm + ) + ); +in +builtins.listToAttrs ( + map (plugin: { + name = "collectd-plugin-${plugin}"; + value = lib.hydraJob (pkgs.collectd.override { + enabledPlugins = [ plugin ]; + }); + }) plugins +) diff --git a/jobsets.nix b/jobsets.nix index 67b9822..0e9c0a6 100644 --- a/jobsets.nix +++ b/jobsets.nix @@ -148,6 +148,23 @@ let wikidata-query-rdf = "https://git.gra.one/graviola/wikidata/wikidata-query-rdf.git"; }; }; + + collectd = mkJobset { + description = "Test dependencies for each collectd plugin"; + nixexprpath = "collectd.nix"; + gitUrls = { + nixpkgs = "https://github.com/NixOS/nixpkgs.git nixos-unstable"; + }; + }; + + collectd-master = mkJobset { + description = "Test dependencies for each collectd plugin"; + nixexprpath = "collectd-master.nix"; + gitUrls = { + collectd = "https://git.octo.it/collectd.git"; + nixpkgs = "https://github.com/NixOS/nixpkgs.git nixos-unstable"; + }; + }; }; jobsetsJson = pkgs.writeText "jobsets.json" (builtins.toJSON jobsets );