Skip to content

Commit a293a10

Browse files
committed
done
1 parent a06f388 commit a293a10

File tree

7 files changed

+513
-11
lines changed

7 files changed

+513
-11
lines changed

nix-tools/flake.lock

+107
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nix-tools/flake.nix

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
{
2-
inputs.nixpkgs.follows = "haskellNix/nixpkgs";
3-
inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
2+
inputs = {
3+
nixpkgs.follows = "haskellNix/nixpkgs";
44

5-
outputs = { self, nixpkgs, haskellNix, ... }:
5+
haskellNix.url = "github:input-output-hk/haskell.nix";
6+
7+
iohkNix.url = "github:input-output-hk/iohk-nix";
8+
9+
CHaP = {
10+
url = "github:input-output-hk/cardano-haskell-packages?ref=repo";
11+
flake = false;
12+
};
13+
};
14+
15+
16+
outputs = inputs@{ self, nixpkgs, haskellNix, iohkNix, ... }:
617
let
718
systems = [
819
"x86_64-linux"
@@ -40,8 +51,12 @@
4051
mkdir -p $out/nix-support
4152
echo "file binary-dist $out/${tarball-filename}" >> $out/nix-support/hydra-build-products
4253
'';
54+
4355
in
4456
{
57+
58+
static-nix-tools-outputs = import ./static/outputs.nix inputs;
59+
4560
# this is not per-system!
4661
overlays.default = import ./overlay.nix;
4762

@@ -51,6 +66,7 @@
5166
nix-tools = system: (haskellNix.legacyPackages.${system}.extend self.overlays.default).nix-tools;
5267
haskell-nix = system: (haskellNix.legacyPackages.${system}.extend self.overlays.default).haskell-nix;
5368
};
69+
5470
project = forAllSystems (pkgs: pkgs.nix-tools.project);
5571

5672
packages = forAllSystems (pkgs:

nix-tools/nix-tools/tests/golden/test1.pkgs.nix

+8-8
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
hashable.revision = import ./cabal-files/hashable.nix;
111111
hashable.flags.random-initial-seed = false;
112112
hashable.flags.integer-gmp = true;
113-
};
113+
};
114114
compiler = {
115115
version = "9.4.5";
116116
nix-name = "ghc945";
@@ -133,14 +133,14 @@
133133
"deepseq" = "1.4.8.0";
134134
"binary" = "0.8.9.1";
135135
"containers" = "0.6.7";
136-
};
137136
};
138137
};
138+
};
139139
extras = _hackage:
140-
{ packages = {}; };
140+
{ packages = { }; };
141141
modules = [
142142
({ lib, ... }:
143-
{ packages = {}; })
143+
{ packages = { }; })
144144
({ lib, ... }:
145145
{
146146
packages = {
@@ -196,7 +196,7 @@
196196
"hashable".components.library.planned = lib.mkOverride 900 true;
197197
"semigroups".components.library.planned = lib.mkOverride 900 true;
198198
"void".components.library.planned = lib.mkOverride 900 true;
199-
};
200-
})
201-
];
202-
}
199+
};
200+
})
201+
];
202+
}

nix-tools/static/outputs.nix

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
inputs@{ nixpkgs, haskellNix, iohkNix, ... }:
2+
3+
let
4+
5+
inherit (nixpkgs) lib;
6+
7+
8+
supported-systems = [
9+
"x86_64-linux"
10+
"x86_64-darwin"
11+
"aarch64-linux"
12+
"aarch64-darwin"
13+
];
14+
15+
16+
static-libraries-overlay = final: prev: {
17+
static-libsodium-vrf = final.libsodium-vrf.overrideDerivation (old: {
18+
configureFlags = old.configureFlags ++ [ "--disable-shared" ];
19+
});
20+
static-secp256k1 = final.secp256k1.overrideDerivation (old: {
21+
configureFlags = old.configureFlags ++ [ "--enable-static" "--disable-shared" ];
22+
});
23+
dyn-static-secp256k1 = final.secp256k1.overrideDerivation (old: {
24+
configureFlags = old.configureFlags ++ [ "--enable-static" "--enable-shared" ];
25+
});
26+
static-gmp = (final.gmp.override { withStatic = true; }).overrideDerivation (old: {
27+
configureFlags = old.configureFlags ++ [ "--enable-static" "--disable-shared" ];
28+
});
29+
static-libblst = (final.libblst.override { enableShared = false; }).overrideDerivation (old: {
30+
postFixup = "";
31+
});
32+
static-openssl = (final.openssl.override { static = true; });
33+
static-zlib = final.zlib.override { shared = false; };
34+
static-pcre = final.pcre.override { shared = false; };
35+
};
36+
37+
38+
# This sets up the `pkgs`, by importing the nixpkgs flake and adding the
39+
# haskellNix overlay. We need the iohkNix overlays to get the necessary cryto
40+
# packages: secp256k1, blst, and libsodium.
41+
mkNixpkgsForSystem = system: import nixpkgs {
42+
43+
inherit system;
44+
45+
# Also ensure we are using haskellNix config. Otherwise we won't be
46+
# selecting the correct wine version for cross compilation.
47+
inherit (haskellNix) config;
48+
49+
overlays = with inputs; [
50+
iohkNix.overlays.crypto
51+
haskellNix.overlay
52+
iohkNix.overlays.haskell-nix-extra
53+
iohkNix.overlays.haskell-nix-crypto
54+
iohkNix.overlays.cardano-lib
55+
iohkNix.overlays.utils
56+
static-libraries-overlay
57+
(import ./packaging.nix)
58+
];
59+
};
60+
61+
62+
# Keep it simple (from https://ayats.org/blog/no-flake-utils/)
63+
forAllSystems = f:
64+
nixpkgs.lib.genAttrs supported-systems
65+
(system: f (mkNixpkgsForSystem system));
66+
67+
68+
outputs = {
69+
zipped = forAllSystems (import ./zipped.nix inputs);
70+
};
71+
72+
in
73+
74+
outputs

0 commit comments

Comments
 (0)