Skip to content

Instantly share code, notes, and snippets.

@angerman
Created November 16, 2018 07:42
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 angerman/5904483d65f7ff99e54f1a5608fd34a0 to your computer and use it in GitHub Desktop.
Save angerman/5904483d65f7ff99e54f1a5608fd34a0 to your computer and use it in GitHub Desktop.
{ pkgs ? import <nixpkgs> {}
}:
let
overrideWith = override: default:
let
try = builtins.tryEval (builtins.findFile builtins.nixPath override);
in if try.success then
builtins.trace "using search host <${override}>" try.value
else
default;
in
let
# all packages from hackage as nix expressions
hackage = import (overrideWith "hackage"
(pkgs.fetchFromGitHub { owner = "angerman";
repo = "hackage.nix";
rev = "cd21bbd8d8c961793a562d557f9244bd90236961";
sha256 = "03v2fw63xi3l2a7cvz1n9rl0nq9hk65g1k20w8i0gkky7a6cq9yd";
name = "hackage-exprs-source"; }))
;
# a different haskell infrastructure
haskell = import (overrideWith "haskell"
(pkgs.fetchFromGitHub { owner = "angerman";
repo = "haskell.nix";
rev = "28a9c6f3528daa57d506d134e137fb617a947985";
sha256 = "0qv0vb5q96sdfi8pwwrswfhcw3ay0qh91a8l2g6bz46q7zmgp75m";
name = "haskell-lib-source"; }))
hackage;
# the set of all stackage snapshots
stackage = import (overrideWith "stackage"
(pkgs.fetchFromGitHub { owner = "angerman";
repo = "stackage.nix";
rev = "014445d63dcf374f30435e5859e463d2c29b5c4e";
sha256 = "1hma4clx8lslah8l4xpglshbbd42v1vraafhb03ci92dyjscnkdq";
name = "stackage-snapshot-source"; }))
;
# our packages
stack-pkgs = import ./.stack-pkgs.nix;
# Build the packageset with module support.
# We can essentially override anything in the modules
# section.
#
# packages.cbors.patches = [ ./one.patch ];
# packages.cbors.flags.optimize-gmp = false;
#
pkgSet = haskell.mkNewPkgSet {
inherit pkgs;
pkg-def = stackage.${stack-pkgs.resolver};
modules = [
stack-pkgs.module
({ config, lib, ... }: {
packages = { hsc2hs = config.hackage.configs.hsc2hs."0.68.3".revisions.default; };
})
];
};
packages = pkgSet.config.hsPkgs // { _config = pkgSet.config; };
in packages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment