default.nix 1.39 KB
Newer Older
Valentin Reis's avatar
Valentin Reis committed
1
{
2
  hostPkgs ? import <nixpkgs> {},
Valentin Reis's avatar
Valentin Reis committed
3 4 5 6 7 8 9
  pkgs ? import (hostPkgs.nix-update-source.fetch ./argopkgs.json).src {},
}:
let
  filterHdevTools = builtins.filterSource (path: type: baseNameOf path != ".hdevtools.sock");

  hpkgs = pkgs.haskellPackages.override {
      overrides = self: super: rec {
10
        argotk = (self.callCabal2nix "argotk" (filterHdevTools ./.) {}).overrideAttrs
Valentin Reis's avatar
hwolc  
Valentin Reis committed
11
          (old:{buildInputs=old.buildInputs ++ [pkgs.hwloc];});
Valentin Reis's avatar
Valentin Reis committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
    };
  };

  devHPackages = with hpkgs; [
    cabal-install
    apply-refact
    hdevtools
    hindent
    hlint
    shake
    brittany
    ghcid
  ];
in rec
{
27 28 29
  argotk = hpkgs.argotk.overrideAttrs (old:{
        installPhase = old.installPhase + ''
          mkdir $out/share/
Valentin Reis's avatar
Valentin Reis committed
30 31
          ARGOTK_SHARE=share $out/bin/argotk --bash-completion-script argotk > $out/share/argotk.sh
          cp -r share/* $out/share/
Valentin Reis's avatar
Valentin Reis committed
32
          substituteInPlace $out/share/simple-H2O.xml --replace \
Valentin Reis's avatar
Valentin Reis committed
33
                H2O.HF.wfs.xml $out/H2O.HF.wfs.xml
34 35
        '';
      });
Valentin Reis's avatar
Valentin Reis committed
36 37 38 39

  hack = hpkgs.shellFor {
    packages = p: with p; [ argotk ];
    withHoogle = true;
Valentin Reis's avatar
Valentin Reis committed
40 41 42 43 44
    buildInputs = devHPackages;
  };

  preCommit = pkgs.mkShell {
    name = "shake";
Valentin Reis's avatar
Valentin Reis committed
45
    ARGOTK_SHARE = "${argotk}/share";
Valentin Reis's avatar
Valentin Reis committed
46 47 48
    buildInputs = [
      (pkgs.haskellPackages.ghcWithPackages (p: with p; [
          argotk
Valentin Reis's avatar
hwolc  
Valentin Reis committed
49
          pkgs.hwloc
Valentin Reis's avatar
Valentin Reis committed
50 51 52 53
          shake
          (pkgs.haskell.lib.doJailbreak panpipe)
        ]))
      ];
Valentin Reis's avatar
Valentin Reis committed
54 55
  };
}