From 19732ae8d1da6347ab48c1123758fde6ace7a734 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sat, 31 Aug 2019 00:42:02 -0700 Subject: pack: a common bild function --- lore/bild.nix | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 lore/bild.nix (limited to 'lore') diff --git a/lore/bild.nix b/lore/bild.nix new file mode 100644 index 0000000..8a6d510 --- /dev/null +++ b/lore/bild.nix @@ -0,0 +1,49 @@ +{ + # a common build function + # + # see example usage in pack/ibb.nix. this is not set in stone, obviously. we + # should figure out how to use overlays, for one. + # + bild = file: { nixpkgs }: + with nixpkgs; + let + pack = import file; + + depsToPackageSet = packageSet: deps: + map (s: builtins.getAttr s packageSet) deps; + + ghc = pkgs.haskell.packages.ghc844.ghcWithPackages (hp: + depsToPackageSet hp + ([ "hinotify" ] ++ pack.deps.both ++ pack.deps.apex)); + + ghcjs_ = pkgs.haskell.packages.ghcjs.override (oldAttrs: { + overrides = with pkgs.haskell.lib; self: super: { + http-types = dontCheck super.http-types; + tasty-quickcheck = dontCheck super.tasty-quickcheck; + scientific = dontCheck super.scientific; # takes forever + servant = dontCheck super.servant; + comonad = dontCheck super.comonad; + QuickCheck = dontCheck super.QuickCheck; + }; + }); + + ghcjs = ghcjs_.ghcWithPackages (hp: + depsToPackageSet hp (pack.deps.both ++ pack.deps.aero)); + + make = ../chip/make; + in + stdenv.mkDerivation { + name = pack.name; + version = "0"; + src = ../.; + nativeBuildInputs = [ + ghc ghcjs + ]; + strictDeps = true; + buildPhase = "${ghc}/bin/runhaskell ${make} ${pack.name}"; + installPhase = '' + mkdir -p $out/bin + cp bild/${pack.name} $out/bin/${pack.name} + ''; + }; +} -- cgit v1.2.3