summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/5pkgs')
-rw-r--r--krebs/5pkgs/builders.nix51
-rw-r--r--krebs/5pkgs/default.nix14
2 files changed, 55 insertions, 10 deletions
diff --git a/krebs/5pkgs/builders.nix b/krebs/5pkgs/builders.nix
index 19169b186..39b91d144 100644
--- a/krebs/5pkgs/builders.nix
+++ b/krebs/5pkgs/builders.nix
@@ -66,7 +66,52 @@ rec {
mv "$textPath" $out
'';
- writeNixFromCabal = name: path: pkgs.runCommand name {} ''
- ${pkgs.cabal2nix}/bin/cabal2nix ${path} > $out
- '';
+ writeHaskellBin =
+ k:
+ let
+ k' = parseDrvName k;
+ name = k'.name;
+ version = if k'.version != "" then k'.version else "0";
+ in
+ { build-depends ? ["base"] ++ depends
+ , depends ? []
+ , ghc-options ? ["-Wall" "-O3" "-threaded" "-rtsopts"]
+ , haskellPackages ? pkgs.haskellPackages
+ , license ? "WTFPL"
+ }:
+ main-text:
+ let
+ cabal-file = pkgs.writeText "${name}-${version}.cabal" ''
+ build-type: Simple
+ cabal-version: >= 1.2
+ name: ${name}
+ version: ${version}
+
+ executable ${name}
+ build-depends: ${concatStringsSep "," build-depends}
+ ghc-options: ${toString ghc-options}
+ main-is: ${main-file.name}
+ '';
+ main-file = pkgs.writeText "${name}-${version}.hs" main-text;
+ in
+ haskellPackages.mkDerivation rec {
+ inherit license version;
+ executableHaskellDepends = attrVals build-depends haskellPackages;
+ isExecutable = true;
+ isLibrary = false;
+ pname = name;
+ src = pkgs.runCommand "${name}-${version}-src" {} ''
+ install -D ${cabal-file} $out/${cabal-file.name}
+ install -D ${main-file} $out/${main-file.name}
+ '';
+ };
+
+ writeNixFromCabal =
+ trace (toString [
+ "The function `writeNixFromCabal` has been deprecated in favour of"
+ "`writeHaskellBin'."
+ ])
+ (name: path: pkgs.runCommand name {} ''
+ ${pkgs.cabal2nix}/bin/cabal2nix ${path} > $out
+ '');
}
diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix
index c96e71538..53fc4de44 100644
--- a/krebs/5pkgs/default.nix
+++ b/krebs/5pkgs/default.nix
@@ -36,13 +36,13 @@ 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;
- });
- };
+ #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