Skip to content

Instantly share code, notes, and snippets.

@bennofs
Created August 19, 2015 17:23
Show Gist options
  • Select an option

  • Save bennofs/a73b06fcd07ba94a817e to your computer and use it in GitHub Desktop.

Select an option

Save bennofs/a73b06fcd07ba94a817e to your computer and use it in GitHub Desktop.
Use this as a default.nix in the root servant folder to aggregate all dependencies
# This is a function: we take `haskellPackages` as an argument so that it can be overriden,
# but supply `nixpkgs.haskellPackages` as a default value if no value is explictly given.
{ haskellPackages ? (import <nixpkgs> {}).haskellPackages }:
let
# Build our own haskell package set with all the packages added that we want
myHaskellPackages = haskellPackages.override {
# super refers to the "previous" haskell package set (the one we extend)
# self refers to the final haskell package set, after our customizations have been
# applied.
#
# For example, if `myHaskellPackages` is extend again with some package
# `foo`, then that package would not be present in `super` but it would be present in
# `self`.
overrides = self: super: {
# Add all the packages
servant = self.callPackage ./servant {};
servant-client = self.callPackage ./servant-client {};
# ...
};
}
# Now, build a "meta" package that has all the packages we want:
aggregated = myHaskellPackages.mkDerivation {
pname = "servant-aggregated";
version = "0.0.1";
src = null;
license = null;
libraryHaskellDepends = with myHaskellPackages; [
servant servant-client ghc-mod
]; # ...
librarySystemDepends = [ ]; # add native stuff here
};
# and use it for our env
in aggregated.env
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment