Skip to content

Commit 1452569

Browse files
rvlangerman
authored andcommitted
Import hackage package set from haskell.nix
1 parent 11186ed commit 1452569

File tree

2 files changed

+31
-36
lines changed

2 files changed

+31
-36
lines changed

default.nix

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
1-
{ pkgs ? import <nixpkgs> {} }:
21
let
3-
hsPkgs = import ./pkgs.nix { inherit pkgs; };
2+
overrideWith = override: default:
3+
let
4+
try = builtins.tryEval (builtins.findFile builtins.nixPath override);
5+
in if try.success then
6+
builtins.trace "using search host <${override}>" try.value
7+
else
8+
default;
49
in
5-
hsPkgs // {
6-
nix-tools-all-execs = pkgs.symlinkJoin
7-
{ name = "nix-tools";
8-
paths = builtins.attrValues hsPkgs.nix-tools.components.exes; };
9-
}
10+
11+
{ pkgs ? import <nixpkgs> {}
12+
13+
# a different haskell infrastructure
14+
, haskell ? import (overrideWith "haskell"
15+
(pkgs.fetchFromGitHub { owner = "input-output-hk";
16+
repo = "haskell.nix";
17+
rev = "ed1dbc01f98411894f6613c62818f14b02fb6679";
18+
sha256 = "0kbj4kb9rlvjb4afpcisz9zlk5z3h7frkwggfwri1q5683fapkgv";
19+
name = "haskell-lib-source"; }))
20+
{ inherit pkgs; }
21+
}:
22+
23+
let
24+
hsPkgs = import ./pkgs.nix { inherit (haskell) mkPkgSet; };
25+
in
26+
hsPkgs // {
27+
nix-tools-all-execs = pkgs.symlinkJoin
28+
{ name = "nix-tools";
29+
paths = builtins.attrValues hsPkgs.nix-tools.components.exes; };
30+
}

pkgs.nix

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,14 @@
1-
{ pkgs ? import <nixpkgs> {}
2-
}:
3-
let
4-
overrideWith = override: default:
5-
let
6-
try = builtins.tryEval (builtins.findFile builtins.nixPath override);
7-
in if try.success then
8-
builtins.trace "using search host <${override}>" try.value
9-
else
10-
default;
11-
in
1+
{ mkPkgSet }:
2+
123
let
13-
# all packages from hackage as nix expressions
14-
hackage = import (overrideWith "hackage"
15-
(pkgs.fetchFromGitHub { owner = "angerman";
16-
repo = "hackage.nix";
17-
rev = "15155a37d3a40173b57e93b09453984fac614523";
18-
sha256 = "016538bfnlb0dxdga4n5p0m75zq0zymbdh5vrvr0gwsa7pywi7zy";
19-
name = "hackage-exprs-source"; }))
20-
;
21-
# a different haskell infrastructure
22-
haskell = import (overrideWith "haskell"
23-
(pkgs.fetchFromGitHub { owner = "angerman";
24-
repo = "haskell.nix";
25-
rev = "ed1dbc01f98411894f6613c62818f14b02fb6679";
26-
sha256 = "0kbj4kb9rlvjb4afpcisz9zlk5z3h7frkwggfwri1q5683fapkgv";
27-
name = "haskell-lib-source"; }))
28-
hackage;
294

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

36-
pkgSet = haskell.mkNewPkgSet {
37-
inherit pkgs;
11+
pkgSet = mkPkgSet {
3812
pkg-def = plan;
3913
pkg-def-overlays = [
4014
{ nix-tools = ./nix-tools.nix;

0 commit comments

Comments
 (0)