summaryrefslogtreecommitdiff
path: root/Com/Simatime/buildGhc.nix
diff options
context:
space:
mode:
Diffstat (limited to 'Com/Simatime/buildGhc.nix')
-rw-r--r--Com/Simatime/buildGhc.nix67
1 files changed, 0 insertions, 67 deletions
diff --git a/Com/Simatime/buildGhc.nix b/Com/Simatime/buildGhc.nix
deleted file mode 100644
index 2b578b8..0000000
--- a/Com/Simatime/buildGhc.nix
+++ /dev/null
@@ -1,67 +0,0 @@
-nixpkgs: main:
-
-with nixpkgs;
-with nixpkgs.lib;
-
-let
- # provided by .envrc
- root = builtins.getEnv "BIZ_ROOT";
-
- # general functions to put in a lib
- lines = s: strings.splitString "\n" s;
- seq = ls: builtins.filter (x: x!= null) ls;
-
- # turn the file path into a Haskell module name
- relpath = builtins.replaceStrings ["${root}/"] [""] (builtins.toString main);
- module = builtins.replaceStrings ["/" ".hs"] ["." ""] relpath;
-
- # extract info from special comments
- content = builtins.readFile main;
- exe = builtins.head (lists.flatten (seq
- (map (builtins.match "^-- : exe ([[:alnum:]._-]*)$")
- (lines content))));
- deps = lists.flatten (seq
- (map (builtins.match "^-- : dep ([[:alnum:]._-]*)$")
- (lines content)));
-
- # do the build...
-
- depsToPackageSet = packageSet: deps:
- map (s: builtins.getAttr s packageSet) deps;
-
- claySrc = pkgs.fetchFromGitHub {
- owner = "sebastiaanvisser";
- repo = "clay";
- rev = "cc7729b1b42a79e261091ff7835f7fc2a7ae3cee";
- sha256 = "1vd67976lvi5l4qq18zy6j44apynkl44ps04p8vwfx4gzr895dyp";
- };
-
- ghc865_ = pkgs.haskell.packages.ghc865.override (oldAttrs: {
- overrides = with pkgs.haskell.lib; self: super: {
- clay = self.callCabal2nix "clay" claySrc {};
- wai-middleware-metrics = dontCheck super.wai-middleware-metrics;
- };
- });
-
- ghc = ghc865_.ghcWithPackages (hp: depsToPackageSet hp deps);
-
-in stdenv.mkDerivation {
- name = module;
- version = "0";
- src = ../../.; # this is the git root
- nativeBuildInputs = [ ghc ];
- strictDeps = true;
- buildPhase = ''
- #
- mkdir -p $out/{bin,static} ${baseNameOf relpath}
- #
- # compile with ghc
- #
- ${ghc}/bin/ghc -Werror -i. \
- --make ${main} \
- -main-is ${module} \
- -o $out/bin/${exe}
- '';
- # the install process was handled above
- installPhase = "exit 0";
-} // { env = ghc; }