Skip to content

Import hackage package set from haskell.nix #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,30 @@
{ pkgs ? import <nixpkgs> {} }:
let
hsPkgs = import ./pkgs.nix { inherit pkgs; };
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
hsPkgs // {
nix-tools-all-execs = pkgs.symlinkJoin
{ name = "nix-tools";
paths = builtins.attrValues hsPkgs.nix-tools.components.exes; };
}

{ pkgs ? import <nixpkgs> {}

# a different haskell infrastructure
, haskell ? import (overrideWith "haskell"
(pkgs.fetchFromGitHub { owner = "input-output-hk";
repo = "haskell.nix";
rev = "ed1dbc01f98411894f6613c62818f14b02fb6679";
sha256 = "0kbj4kb9rlvjb4afpcisz9zlk5z3h7frkwggfwri1q5683fapkgv";
name = "haskell-lib-source"; }))
{ inherit pkgs; }
}:

let
hsPkgs = import ./pkgs.nix { inherit (haskell) mkPkgSet; };
in
hsPkgs // {
nix-tools-all-execs = pkgs.symlinkJoin
{ name = "nix-tools";
paths = builtins.attrValues hsPkgs.nix-tools.components.exes; };
}
32 changes: 3 additions & 29 deletions pkgs.nix
Original file line number Diff line number Diff line change
@@ -1,40 +1,14 @@
{ 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
{ mkPkgSet }:

let
# all packages from hackage as nix expressions
hackage = import (overrideWith "hackage"
(pkgs.fetchFromGitHub { owner = "angerman";
repo = "hackage.nix";
rev = "15155a37d3a40173b57e93b09453984fac614523";
sha256 = "016538bfnlb0dxdga4n5p0m75zq0zymbdh5vrvr0gwsa7pywi7zy";
name = "hackage-exprs-source"; }))
;
# a different haskell infrastructure
haskell = import (overrideWith "haskell"
(pkgs.fetchFromGitHub { owner = "angerman";
repo = "haskell.nix";
rev = "ed1dbc01f98411894f6613c62818f14b02fb6679";
sha256 = "0kbj4kb9rlvjb4afpcisz9zlk5z3h7frkwggfwri1q5683fapkgv";
name = "haskell-lib-source"; }))
hackage;

# our packages
# this is generated with plan-to-nix
# $ cabal new-configure
# $ plan-to-nix ./dist-newstyle/cache/plan.json > plan.nix
plan = import ./plan.nix;

pkgSet = haskell.mkNewPkgSet {
inherit pkgs;
pkgSet = mkPkgSet {
pkg-def = plan;
pkg-def-overlays = [
{ nix-tools = ./nix-tools.nix;
Expand Down