Merge remote-tracking branch 'cd/master'

This commit is contained in:
makefu 2015-10-17 11:18:55 +02:00
commit 2454867a52
9 changed files with 150 additions and 108 deletions

View File

@ -1,61 +1,49 @@
{ current-date { current-date ? abort "current-date not defined"
, current-host-name , current-host-name ? abort "current-host-name not defined"
, current-user-name , current-user-name ? builtins.getEnv "LOGNAME"
}: }:
assert current-user-name != "";
let let
lib = import <nixpkgs/lib>; lib = import <nixpkgs/lib>;
klib = import ./krebs/4lib { inherit lib; };
in with klib; let
krebs-modules-path = ./krebs/3modules; nspath = ns: p: ./. + "/${ns}/${p}";
krebs-pkgs-path = ./krebs/5pkgs; kpath = nspath "krebs";
user-modules-path = ./. + "/${current-user-name}/3modules"; upath = nspath current-user-name;
user-pkgs-path = ./. + "/${current-user-name}/5pkgs";
# XXX This is only used interactively, e.g. using get. stockholm = {
pkgs = imports = map (f: f "3modules") [ kpath upath ];
let
pkgs = import <nixpkgs> {}; nixpkgs.config.packageOverrides = pkgs:
args = { let
inherit pkgs; kpkgs = import (kpath "5pkgs") { inherit pkgs; };
lib = pkgs.lib; upkgs = import (upath "5pkgs") { pkgs = pkgs // kpkgs; };
}; in
in kpkgs // upkgs;
pkgs // };
import krebs-pkgs-path args //
import user-pkgs-path args;
out = out =
{ inherit pkgs; } // { inherit (eval {}) config options pkgs; } //
lib.mapAttrs (_: builtins.getAttr "main") lib.mapAttrs
(lib.filterAttrs (_: builtins.hasAttr "main") (name: _:
(lib.mapAttrs if builtins.pathExists (nspath name "default.nix")
(k: v: then import (nspath name "default.nix")
if lib.hasPrefix "." k || v != "directory" then else import-1systems (nspath name "1systems"))
{} (lib.filterAttrs
else if builtins.pathExists (./. + "/${k}/default.nix") then (n: t: !lib.hasPrefix "." n && t == "directory")
{ main = import (./. + "/${k}"); } (builtins.readDir ./.));
else if builtins.pathExists (./. + "/${k}/1systems") then
{ main = mk-namespace (./. + "/${k}"); }
else
{})
(builtins.readDir ./.)));
eval = path: import <nixpkgs/nixos/lib/eval-config.nix> { eval = path: import <nixpkgs/nixos/lib/eval-config.nix> {
system = builtins.currentSystem;
modules = [ modules = [
stockholm
path path
krebs-modules-path
user-modules-path
] ++ [
({ config, lib, pkgs, ... }@args: {
_module.args.pkgs =
(import krebs-pkgs-path args) //
(import user-pkgs-path args);
})
]; ];
}; };
mk-namespace = path: mapNixDir mk-system (path + "/1systems"); import-1systems = path: lib.mapAttrs (_: mk-system) (nixDir path);
mk-system = path: rec { mk-system = path: rec {
inherit (eval path) config options; inherit (eval path) config options;
@ -63,8 +51,6 @@ let
fetch = import ./krebs/0tools/fetch.nix { inherit config lib; }; fetch = import ./krebs/0tools/fetch.nix { inherit config lib; };
}; };
mapNixDir = f: path: lib.mapAttrs (_: f) (nixDir path);
nixDir = path: nixDir = path:
builtins.listToAttrs builtins.listToAttrs
(catMaybes (catMaybes
@ -83,12 +69,4 @@ let
}.${v} or Nothing) }.${v} or Nothing)
(builtins.readDir path))); (builtins.readDir path)));
# TODO move to lib
Just = x: { type = "maybe"; value = x; };
Nothing = { type = "maybe"; };
isMaybe = x: builtins.typeOf x == "set" && x.type or false == "maybe";
isJust = x: isMaybe x && builtins.hasAttr "value" x;
fromJust = x: assert isJust x; x.value;
catMaybes = xs: map fromJust (builtins.filter isJust xs);
in out in out

10
krebs/4lib/maybe.nix Normal file
View File

@ -0,0 +1,10 @@
{ ... }:
rec {
Just = x: { type = "maybe"; value = x; };
Nothing = { type = "maybe"; };
isMaybe = x: builtins.typeOf x == "set" && x.type or false == "maybe";
isJust = x: isMaybe x && builtins.hasAttr "value" x;
fromJust = x: assert isJust x; x.value;
catMaybes = xs: map fromJust (builtins.filter isJust xs);
}

View File

@ -1,6 +1,6 @@
{ lib, pkgs, ... }: { pkgs, ... }:
with import ../4lib { inherit lib; }; with import ../4lib { inherit (pkgs) lib; };
let let
subdirs = mapAttrs (_: flip pkgs.callPackage {}) (subdirsOf ./.); subdirs = mapAttrs (_: flip pkgs.callPackage {}) (subdirsOf ./.);
@ -9,6 +9,20 @@ in
subdirs // rec { subdirs // rec {
haskellPackages = pkgs.haskellPackages.override {
overrides = self: super:
mapAttrs (name: path: self.callPackage path {})
(mapAttrs'
(name: type:
if hasSuffix ".nix" name
then {
name = removeSuffix ".nix" name;
value = ./haskell-overrides + "/${name}";
}
else null)
(builtins.readDir ./haskell-overrides));
};
push = pkgs'.callPackage ./push { push = pkgs'.callPackage ./push {
inherit (subdirs) get jq; inherit (subdirs) get jq;
}; };
@ -30,7 +44,7 @@ subdirs // rec {
execveBin = name: cfg: execve name (cfg // { destination = "/bin/${name}"; }); execveBin = name: cfg: execve name (cfg // { destination = "/bin/${name}"; });
writeC = name: { destination ? "" }: src: pkgs.runCommand name {} '' writeC = name: { destination ? "" }: src: pkgs.runCommand name {} ''
PATH=${lib.makeSearchPath "bin" (with pkgs; [ PATH=${makeSearchPath "bin" (with pkgs; [
binutils binutils
coreutils coreutils
gcc gcc

View File

@ -0,0 +1,14 @@
{ mkDerivation, base, fetchgit, stdenv }:
mkDerivation {
pname = "blessings";
version = "1.0.0";
src = fetchgit {
url = http://cgit.cd.retiolum/blessings;
rev = "25a510dcb38ea9158e9969d56eb66cb1b860ab5f";
sha256 = "b962153e80e51519b52220199d8350b54154833e4bc25a792ecc58898fef3fb2";
};
libraryHaskellDepends = [ base ];
doHaddock = false;
# WTFPL is the true license, which is unknown to cabal.
license = stdenv.lib.licenses.wtfpl;
}

View File

@ -0,0 +1,25 @@
{ mkDerivation, attoparsec, base, base64-bytestring, bytestring
, case-insensitive, containers, exceptions, fetchgit, QuickCheck
, stdenv, tasty, tasty-quickcheck, text, text-icu, time
}:
mkDerivation {
pname = "email-header";
version = "0.3.0";
src = fetchgit {
url = "https://github.com/4z3/email-header";
sha256 = "f33fba567a39b1f2448869b269c26c40d8007599c23ab83bde5b4dfd9fd76ebc";
rev = "7b179bd31192ead8afe7a0b6e34bcad4039deaa8";
};
buildDepends = [
attoparsec base base64-bytestring bytestring case-insensitive
containers exceptions text text-icu time
];
testDepends = [
base bytestring case-insensitive containers QuickCheck tasty
tasty-quickcheck text time
];
jailbreak = true;
homepage = "http://github.com/knrafto/email-header";
description = "Parsing and rendering of email and MIME headers";
license = stdenv.lib.licenses.bsd3;
}

View File

@ -0,0 +1,20 @@
{ mkDerivation, base, bytestring, fetchzip, HUnit, mtl, QuickCheck
, stdenv, test-framework, test-framework-hunit
, test-framework-quickcheck2, text, transformers
}:
mkDerivation {
pname = "megaparsec";
version = "4.1.0";
src = fetchzip {
url = "https://hackage.haskell.org/package/megaparsec-4.1.0/megaparsec-4.1.0.tar.gz";
sha256 = "1a1ka53a3r91lwnlvzaa8nyk1dxvfd1ij1i5x5vp83q2r9z9dcmi";
};
libraryHaskellDepends = [ base bytestring mtl text transformers ];
testHaskellDepends = [
base HUnit mtl QuickCheck test-framework test-framework-hunit
test-framework-quickcheck2 transformers
];
homepage = "https://github.com/mrkkrp/megaparsec";
description = "Monadic parser combinators";
license = stdenv.lib.licenses.bsd3;
}

View File

@ -0,0 +1,12 @@
{ mkDerivation, base, fetchgit, stdenv }:
mkDerivation {
pname = "scanner";
version = "1.0.0";
src = fetchgit {
url = http://cgit.cd.retiolum/scanner;
rev = "7f091a3bc152ad3974a1873b460fa1759bf8dcad";
sha256 = "7d123c227777932039d26fc832b8d32a90f04c0bd6b7e8bcff0a6f49a54e0054";
};
libraryHaskellDepends = [ base ];
license = stdenv.lib.licenses.wtfpl;
}

View File

@ -1,63 +1,29 @@
{ pkgs, ... }: { pkgs, ... }:
let pkgs.haskellngPackages.callPackage (
hspkgs = pkgs.haskellngPackages.override {
overrides = self: super: {
email-header = self.callPackage (
{ mkDerivation, attoparsec, base, base64-bytestring, bytestring
, case-insensitive, containers, exceptions, fetchgit, QuickCheck
, stdenv, tasty, tasty-quickcheck, text, text-icu, time
}:
mkDerivation {
pname = "email-header";
version = "0.3.0";
src = fetchgit {
url = "https://github.com/4z3/email-header";
sha256 = "f33fba567a39b1f2448869b269c26c40d8007599c23ab83bde5b4dfd9fd76ebc";
rev = "7b179bd31192ead8afe7a0b6e34bcad4039deaa8";
};
buildDepends = [
attoparsec base base64-bytestring bytestring case-insensitive
containers exceptions text text-icu time
];
testDepends = [
base bytestring case-insensitive containers QuickCheck tasty
tasty-quickcheck text time
];
jailbreak = true;
homepage = "http://github.com/knrafto/email-header";
description = "Parsing and rendering of email and MIME headers";
license = stdenv.lib.licenses.bsd3;
}
) {};
};
};
in
hspkgs.callPackage (
{ mkDerivation, aeson, attoparsec, base, base64-bytestring { mkDerivation, aeson, attoparsec, base, base64-bytestring
, blaze-builder, bytestring, case-insensitive, containers, deepseq , blaze-builder, blessings, bytestring, case-insensitive, containers, deepseq
, directory, docopt, email-header, fetchgit, filepath , directory, docopt, email-header, fetchgit, filepath
, friendly-time, hyphenation, linebreak, old-locale, process , friendly-time, hyphenation, linebreak, old-locale, process
, random, rosezipper, safe, split, stdenv, terminal-size, text , random, rosezipper, safe, scanner, split, stdenv, terminal-size, text
, time, transformers, transformers-compat, unix, vector , time, transformers, transformers-compat, unix, vector
}: }:
mkDerivation { mkDerivation {
pname = "much"; pname = "much";
version = "0.0.0.0"; version = "1.0.0";
src = fetchgit { src = fetchgit {
url = "http://cgit.nomic/much"; url = "http://cgit.cd.retiolum/much";
sha256 = "f0bcc34456cb876d3439694d1e16db414a540e13f476fa3ff1ad70d1d3caccb2"; rev = "045dc986b4de225a927175f81c8ccfdab450202c";
rev = "bfd854e05207a073eaa983c49f27c37555ccfce5"; sha256 = "cec175e3dc32ef93029ee5285f6c4042ce11d637945bc8cec02cb6699d06cc13";
}; };
isLibrary = false; isLibrary = false;
isExecutable = true; isExecutable = true;
buildDepends = [ buildDepends = [
aeson attoparsec base base64-bytestring blaze-builder bytestring aeson attoparsec base base64-bytestring blaze-builder blessings bytestring
case-insensitive containers deepseq directory docopt email-header case-insensitive containers deepseq directory docopt email-header filepath
filepath friendly-time hyphenation linebreak old-locale process friendly-time hyphenation linebreak old-locale process random rosezipper
random rosezipper safe split terminal-size text time transformers safe scanner split terminal-size text time transformers transformers-compat
transformers-compat unix vector unix vector
]; ];
license = stdenv.lib.licenses.mit; license = stdenv.lib.licenses.mit;
} }

View File

@ -19,7 +19,7 @@ let
rules = concatMap make-rules (attrValues repos); rules = concatMap make-rules (attrValues repos);
public-repos = mapAttrs make-public-repo { public-repos = mapAttrs make-public-repo ({
cac = { cac = {
desc = "CloudAtCost command line interface"; desc = "CloudAtCost command line interface";
}; };
@ -30,21 +30,24 @@ let
hack = {}; hack = {};
load-env = {}; load-env = {};
make-snapshot = {}; make-snapshot = {};
mime = {};
much = {}; much = {};
nixos-infest = {}; nixos-infest = {};
nixpkgs = {}; nixpkgs = {};
painload = {}; painload = {};
push = {}; push = {};
quipper = {};
regfish = {}; regfish = {};
stockholm = { stockholm = {
desc = "take all the computers hostage, they'll love you!"; desc = "take all the computers hostage, they'll love you!";
}; };
} // mapAttrs (_: repo: repo // { section = "Haskell libraries"; }) {
blessings = {};
mime = {};
quipper = {};
scanner = {};
wai-middleware-time = {}; wai-middleware-time = {};
web-routes-wai-custom = {}; web-routes-wai-custom = {};
xintmap = {}; xintmap = {};
}; });
restricted-repos = mapAttrs make-restricted-repo ( restricted-repos = mapAttrs make-restricted-repo (
{ {
@ -56,8 +59,8 @@ let
import <secrets/repos.nix> { inherit config lib pkgs; } import <secrets/repos.nix> { inherit config lib pkgs; }
); );
make-public-repo = name: { desc ? null, ... }: { make-public-repo = name: { desc ? null, section ? null, ... }: {
inherit name desc; inherit name desc section;
public = true; public = true;
hooks = { hooks = {
post-receive = git.irc-announce { post-receive = git.irc-announce {