default.nix 1.27 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/
32
33
        '';
      });
Valentin Reis's avatar
Valentin Reis committed
34
35
36
37

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

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