-
Notifications
You must be signed in to change notification settings - Fork 12
/
stage0.nix
31 lines (29 loc) · 997 Bytes
/
stage0.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
{ pkgs ? import ./pkgs {}
, callPackage ? pkgs.callPackage
, catalog ? ./catalog.rktd
}:
callPackage ({cacert, callPackageFull, nix, racket, runCommand}:
let
nix-command = nix;
bootstrap = name: extraArgs: let
nix = runCommand "${name}.nix" {
src = ./nix;
buildInputs = [ cacert nix-command racket ];
inherit extraArgs;
} ''
racket -N racket2nix $src/racket2nix.rkt $extraArgs --catalog ${catalog} $src > $out
'';
nixAttrs = callPackageFull nix {};
out = if nixAttrs ? overrideAttrs then nixAttrs.overrideAttrs (oldAttrs: {
name = "${name}";
postInstall = "$out/bin/racket2nix --test";
buildInputs = oldAttrs.buildInputs ++ [ nix-command ];
}) else {};
in
out // { inherit nix; };
in
(bootstrap "racket2nix-stage0" "") // {
flat = bootstrap "racket2nix-stage0.flat" "--flat";
thin = let inherit (bootstrap "racket2nix-stage0.thin" "--thin") nix; in
((callPackageFull ./racket-packages.nix {}).extend (import nix)).nix // { inherit nix; };
}) {}