-
Notifications
You must be signed in to change notification settings - Fork 9
/
flake.nix
143 lines (133 loc) · 6.53 KB
/
flake.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
{
description = "Minimal devshell flake for haskell";
inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils, haskellNix }:
let overlays = {
crypto = final: prev: {
libsodium-vrf = final.callPackage ({ stdenv, lib, fetchFromGitHub, autoreconfHook }:
stdenv.mkDerivation {
name = "libsodium-1.0.18";
src = fetchFromGitHub {
owner = "input-output-hk";
repo = "libsodium";
rev = "11bb20dba02b013bf1d83e3c16c51eab2ff07efc";
sha256 = "1h9fcwra610vmh0inkdkqs3bfs83xl5dk146dqx440wwh9pn4n4w";
};
nativeBuildInputs = [ autoreconfHook ];
configureFlags = [ "--enable-static" ];
outputs = [ "out" "dev" ];
separateDebugInfo = stdenv.isLinux && stdenv.hostPlatform.libc != "musl";
enableParallelBuilding = true;
doCheck = true;
meta = with lib; {
description = "A modern and easy-to-use crypto library - VRF fork";
homepage = "http://doc.libsodium.org/";
license = licenses.isc;
maintainers = [ "tdammers" "nclarke" ];
platforms = platforms.all;
};
}) {};
};
# add static-$pkg for a few packages to be able to pull them im explicitly.
static-libs = (final: prev: {
static-libsodium-vrf = final.libsodium-vrf.overrideDerivation (old: {
configureFlags = old.configureFlags ++ [ "--disable-shared" ];
});
static-secp256k1 = final.secp256k1.overrideDerivation (old: {
configureFlags = old.configureFlags ++ ["--enable-static" "--disable-shared" ];
});
static-gmp = (final.gmp.override { withStatic = true; }).overrideDerivation (old: {
configureFlags = old.configureFlags ++ ["--enable-static" "--disable-shared" ];
});
static-openssl = (final.openssl.override { static = true; });
static-zlib = final.zlib.override { shared = false; };
static-pcre = final.pcre.override { shared = false; };
});
# the haskell inline-r package depends on internals of the R
# project that have been hidden in R 4.2+. See
# https://github.com/tweag/HaskellR/issues/374
oldR = (final: prev: {
R_4_1_3 = final.R.overrideDerivation (old: rec {
version = "4.1.3";
patches = []; # upstream patches will most likely break this build, as they are specific to a different version.
src = final.fetchurl {
url = "https://cran.r-project.org/src/base/R-${final.lib.versions.major version}/${old.pname}-${version}.tar.gz";
sha256 = "sha256-Ff9bMzxhCUBgsqUunB2OxVzELdAp45yiKr2qkJUm/tY="; };
});
});
cddl-tools = (final: prev: {
cbor-diag = final.callPackage ./pkgs/cbor-diag { };
cddl = final.callPackage ./pkgs/cddl { };
});
};
supportedSystems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
in flake-utils.lib.eachSystem supportedSystems (system:
let
pkgs = import nixpkgs {
overlays = [haskellNix.overlay] ++ builtins.attrValues overlays;
inherit system;
inherit (haskellNix) config;
};
in rec {
# These are for checking IOG projects build in an environment
# without haskell packages built by haskell.nix.
#
# Usage:
#
# nix develop github:input-output-hk/devx#ghc924 --no-write-lock-file -c cabal build
#
devShells =
let compilers = pkgs: builtins.removeAttrs pkgs.haskell-nix.compiler
# Exclude old versions of GHC to speed up `nix flake check`
[ "ghc844"
"ghc861" "ghc862" "ghc863" "ghc864" "ghc865"
"ghc881" "ghc882" "ghc883" "ghc884"
"ghc8101" "ghc8102" "ghc8103" "ghc8104" "ghc8105" "ghc8106" "ghc810420210212"
"ghc901"
"ghc921" "ghc922" "ghc923" "ghc924"];
static-pkgs = if pkgs.stdenv.hostPlatform.isLinux
then if pkgs.stdenv.hostPlatform.isAarch64
then pkgs.pkgsCross.aarch64-multiplatform-musl
else pkgs.pkgsCross.musl64
else pkgs;
in (builtins.mapAttrs (compiler-nix-name: compiler:
import ./dynamic.nix { inherit pkgs compiler compiler-nix-name; }
) (compilers pkgs)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-minimal" (
import ./dynamic.nix { inherit pkgs compiler compiler-nix-name; withHLS = false; withHlint = false; }
)) (compilers pkgs)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-static" (
import ./static.nix { pkgs = static-pkgs; inherit compiler compiler-nix-name; }
)) (compilers static-pkgs.buildPackages)
// pkgs.lib.mapAttrs' (compiler-nix-name: compiler:
pkgs.lib.nameValuePair "${compiler-nix-name}-static-minimal" (
import ./static.nix { pkgs = static-pkgs; inherit compiler compiler-nix-name; withHLS = false; withHlint = false; }
)) (compilers static-pkgs.buildPackages)
);
hydraJobs = devShells;
});
# --- Flake Local Nix Configuration ----------------------------
nixConfig = {
extra-substituters = [
"https://cache.iog.io"
# We only have zw3rk cache in here, because it provide aarch64-linux and aarch64-darwin.
"https://cache.zw3rk.com"
];
extra-trusted-public-keys = [
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
"loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk="
];
# post-build-hook = "./upload-to-cache.sh";
allow-import-from-derivation = "true";
};
# --------------------------------------------------------------
}