Skip to content

Instantly share code, notes, and snippets.

@MichaelXavier
Last active February 12, 2019 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelXavier/bb404b3f2d4be10157ad481e36ae5c3b to your computer and use it in GitHub Desktop.
Save MichaelXavier/bb404b3f2d4be10157ad481e36ae5c3b to your computer and use it in GitHub Desktop.
troubleshooting disabling checks, benchmarks, etc in haskell + nix
let
nixpkgs = fetchTarball {
# a recent-ish release, could go to master
url = "https://github.com/NixOS/nixpkgs/archive/0879595c607b66a990693972a55a27fa54eccd79.tar.gz";
sha256 = "0f8nfccabsp7qm6cjpp9m0qiwckzrqjyjhb7vlcbzqz0657hn46j";
};
in
{ ghc ? "ghc863"
, pkgs ? import nixpkgs {
config = {
allowUnfree = true; # allow unfree internal packages
packageOverrides = pkgs:
{
haskell = pkgs.haskell // {
packages = pkgs.haskell.packages // {
# by default, disable sources of build slowdown: checking (tests), benchmarking (defaults to false currently), hoogle and haddock building, and profiling
#TODO: this isn't working? i still see .p_o files in the output
"${ghc}" = pkgs.haskell.packages.${ghc}.override {
overrides = self: super:
{
mkDerivation = args: super.mkDerivation (args // {
doCheck = false;
doBenchmark = false;
doHoogle = false;
doHaddock = false;
enableLibraryProfiling = false;
enableExecutableProfiling = false;
});
};
};
};
};
};
};
}
}:
let
inherit (pkgs) lib;
hlib = pkgs.haskell.lib;
hpkgs = pkgs.haskell.packages.${ghc}.extend (self: super:
{
my-package = self.callCabal2nix "my-package" (lib.sourceByRegex ./. [
"^\\exec.*$"
"^.*\\.cabal$"
"^LICENSE$"
]) {};
}
);
in {
inherit pkgs hpkgs;
}
with import ./default.nix {};
hpkgs.shellFor {
packages = p:
[ hpkgs.my-package
];
nativeBuildInputs =
[ hpkgs.cabal-install
];
# huh?
shellHook = ''
export NIX_PATH=nixpkgs=${toString pkgs.path}
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment