-
Notifications
You must be signed in to change notification settings - Fork 10
/
flake.nix
58 lines (54 loc) · 1.66 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
{
description = "Providing assorted versions of solidity compilers (solc)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
solc-macos-amd64-list-json = {
# Go to https://github.com/ethereum/solc-bin/blob/gh-pages/macosx-amd64/list.json to obtain a revision
url = "file+https://github.com/ethereum/solc-bin/raw/67f45d8/macosx-amd64/list.json";
flake = false;
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
solc-macos-amd64-list-json,
}:
let
solc-macos-amd64-list = builtins.fromJSON (builtins.readFile solc-macos-amd64-list-json);
solc-pkgs-overlay = final: prev: import ./mk-solc-pkgs.nix prev { inherit solc-macos-amd64-list; };
in
flake-utils.lib.eachSystem
[
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
]
(
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ solc-pkgs-overlay ];
};
in
{
# default shell with the latest solc compiler
devShells.default = pkgs.mkShell { buildInputs = [ pkgs.solc_0_8_28 ]; };
# export all solc packages
packages = pkgs.solcPackages;
solcPackages = pkgs.solcPackages;
}
)
// {
# the overlay for nixpkgs
overlay = solc-pkgs-overlay;
# make a package with the symlink 'solc' to the selected solc
mkDefault =
pkgs: solc-selected:
pkgs.runCommand "solc-default" { }
"mkdir -p $out/bin && ln -s ${pkgs.lib.getExe solc-selected} $out/bin/solc";
};
}