diff options
Diffstat (limited to 'krebs/5pkgs')
-rw-r--r-- | krebs/5pkgs/Reaktor/default.nix | 3 | ||||
-rw-r--r-- | krebs/5pkgs/builders.nix | 77 | ||||
-rw-r--r-- | krebs/5pkgs/default.nix | 8 | ||||
-rw-r--r-- | krebs/5pkgs/get/default.nix | 6 | ||||
-rw-r--r-- | krebs/5pkgs/git-hooks/default.nix | 9 | ||||
-rw-r--r-- | krebs/5pkgs/go/default.nix | 2 |
6 files changed, 73 insertions, 32 deletions
diff --git a/krebs/5pkgs/Reaktor/default.nix b/krebs/5pkgs/Reaktor/default.nix index c4a362757..fc3710820 100644 --- a/krebs/5pkgs/Reaktor/default.nix +++ b/krebs/5pkgs/Reaktor/default.nix @@ -3,6 +3,9 @@ python3Packages.buildPythonPackage rec { name = "Reaktor-${version}"; version = "0.5.1"; + + doCheck = false; + propagatedBuildInputs = with pkgs;[ python3Packages.docopt python3Packages.requests2 diff --git a/krebs/5pkgs/builders.nix b/krebs/5pkgs/builders.nix index 924e0c086..da7052f38 100644 --- a/krebs/5pkgs/builders.nix +++ b/krebs/5pkgs/builders.nix @@ -74,33 +74,59 @@ rec { writeOut = name: specs0: let - specs = mapAttrsToList (path0: spec0: rec { - path = guard { - type = types.pathname; - value = path0; - }; - var = "file_${hashString "sha1" path}"; - text = spec0.text; - executable = guard { - type = types.bool; - value = spec0.executable or false; + writers.link = + { path + , link + }: + assert path == "" || types.absolute-pathname.check path; + assert types.package.check link; + { + install = /* sh */ '' + ${optionalString (dirOf path != "/") /* sh */ '' + ${pkgs.coreutils}/bin/mkdir -p $out${dirOf path} + ''} + ${pkgs.coreutils}/bin/ln -s ${link} $out${path} + ''; }; - mode = guard { - type = types.file-mode; - value = spec0.mode or (if executable then "0755" else "0644"); + + writers.text = + { path + , executable ? false + , mode ? if executable then "0755" else "0644" + , text + }: + assert path == "" || types.absolute-pathname.check path; + assert types.bool.check executable; + assert types.file-mode.check mode; + rec { + var = "file_${hashString "sha1" path}"; + val = text; + install = /* sh */ '' + ${pkgs.coreutils}/bin/install -m ${mode} -D ''$${var}Path $out${path} + ''; }; - }) specs0; - filevars = genAttrs' specs (spec: nameValuePair spec.var spec.text); + write = spec: writers.${spec.type} (removeAttrs spec ["type"]); + + specs = + mapAttrsToList + (path: spec: let + known-types = [ "link" "text" ]; + found-types = attrNames (getAttrs known-types spec); + type = assert length found-types == 1; head found-types; + in spec // { inherit path type; }) + specs0; + + files = map write specs; + + filevars = genAttrs' (filter (hasAttr "var") files) + (spec: nameValuePair spec.var spec.val); env = filevars // { passAsFile = attrNames filevars; }; in pkgs.runCommand name env /* sh */ '' set -efu - PATH=${makeBinPath [pkgs.coreutils]} - ${concatMapStrings (spec: /* sh */ '' - install -m ${spec.mode} -D ''$${spec.var}Path $out${spec.path} - '') specs} + ${concatMapStringsSep "\n" (getAttr "install") files} ''; writeHaskell = @@ -205,6 +231,17 @@ rec { ''; }; + writeJq = name: src: pkgs.runCommand name {} /* sh */ '' + name=${assert types.filename.check name; name} + src=${shell.escape src} + + # syntax check + printf '%s' "$src" > src.jq + ${pkgs.jq}/bin/jq -f src.jq < /dev/null + + cp src.jq "$out" + ''; + writeNixFromCabal = trace (toString [ "The function `writeNixFromCabal` has been deprecated in favour of" @@ -213,4 +250,6 @@ rec { (name: path: pkgs.runCommand name {} /* sh */ '' ${pkgs.cabal2nix}/bin/cabal2nix ${path} > $out ''); + + writeSed = makeScriptWriter "${pkgs.gnused}/bin/sed -f"; } diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix index f2bbaf7f4..cdab64212 100644 --- a/krebs/5pkgs/default.nix +++ b/krebs/5pkgs/default.nix @@ -38,14 +38,6 @@ with config.krebs.lib; ReaktorPlugins = callPackage ./Reaktor/plugins.nix {}; - #buildbot = callPackage <nixpkgs/pkgs/development/tools/build-managers/buildbot> { - # inherit (pkgs.pythonPackages) twisted jinja2; - # dateutil = pkgs.pythonPackages.dateutil_1_5; - # sqlalchemy_migrate_0_7 = pkgs.pythonPackages.sqlalchemy_migrate_func (pkgs.pythonPackages.sqlalchemy7.override { - # doCheck = false; - # }); - #}; - # XXX symlinkJoin changed arguments somewhere around nixpkgs d541e0d symlinkJoin = { name, paths, ... }@args: let x = pkgs.symlinkJoin args; diff --git a/krebs/5pkgs/get/default.nix b/krebs/5pkgs/get/default.nix index f82c7e8b7..7dda86601 100644 --- a/krebs/5pkgs/get/default.nix +++ b/krebs/5pkgs/get/default.nix @@ -1,12 +1,12 @@ { coreutils, gnugrep, gnused, fetchgit, jq, nix, stdenv, ... }: stdenv.mkDerivation { - name = "get-1.4.0"; + name = "get-1.4.1"; src = fetchgit { url = http://cgit.cd.krebsco.de/get; - rev = "08757d47c480c130d69270855c6c0371f6b7d385"; - sha256 = "7c609e2cde7a071bbf62241a7bea60313fdbf076b9f7b3d97226417e13e5ba9d"; + rev = "41c0c35805ec1708729f73d14650d8ebc94a405b"; + sha256 = "0rx1qsbb4py14795yhhqwlvaibj2569fqm7x2671l868xi59h9f9"; }; phases = [ diff --git a/krebs/5pkgs/git-hooks/default.nix b/krebs/5pkgs/git-hooks/default.nix index c8e8c8f53..6f2cb8b6a 100644 --- a/krebs/5pkgs/git-hooks/default.nix +++ b/krebs/5pkgs/git-hooks/default.nix @@ -8,13 +8,14 @@ let }; # TODO irc-announce should return a derivation - irc-announce = { nick, channel, server, port ? 6667, verbose ? false }: '' + irc-announce = { nick, channel, server, port ? 6667, verbose ? false, branches ? [] }: '' #! /bin/sh set -euf export PATH=${makeBinPath (with pkgs; [ coreutils git + gnugrep gnused ])} @@ -54,6 +55,12 @@ let h=$(echo $ref | sed 's:^refs/heads/::') + ${optionalString (branches != []) '' + if ! (echo "$h" | grep -qE "${concatStringsSep "|" branches}"); then + echo "we are not serving this branch: $h" + exit 0 + fi + ''} # empty_tree=$(git hash-object -t tree /dev/null) empty_tree=4b825dc6 diff --git a/krebs/5pkgs/go/default.nix b/krebs/5pkgs/go/default.nix index 9dd166adc..fb8b65ea1 100644 --- a/krebs/5pkgs/go/default.nix +++ b/krebs/5pkgs/go/default.nix @@ -22,7 +22,7 @@ in nodePackages.buildNodePackage { name = "go"; src = fetchgit { - url = "http://cgit.echelon/go/"; + url = "http://cgit.lassul.us/go/"; rev = "05d02740e0adbb36cc461323647f0c1e7f493156"; sha256 = "6015c9a93317375ae8099c7ab982df0aa93a59ec2b48972e253887bb6ca0004f"; }; |