-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathflake.nix
152 lines (151 loc) · 5.17 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
144
145
146
147
148
149
150
151
152
{
description = "Kontrol";
inputs = {
kevm.url = "github:runtimeverification/evm-semantics/v1.0.814";
nixpkgs.follows = "kevm/nixpkgs";
k-framework.follows = "kevm/k-framework";
flake-utils.follows = "kevm/flake-utils";
rv-utils.follows = "kevm/rv-utils";
foundry = {
url =
"github:shazow/foundry.nix?rev=221d7506a99f285ec6aee26245c55bbef8a407f1"; # Use the same version as CI
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
solc = {
url = "github:hellwolf/solc.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
pyproject-nix = {
url = "github:pyproject-nix/pyproject.nix";
inputs.nixpkgs.follows = "uv2nix/nixpkgs";
# inputs.uv2nix.follows = "nixpkgs";
};
pyproject-build-systems = {
url = "github:pyproject-nix/build-system-pkgs";
inputs.pyproject-nix.follows = "pyproject-nix";
inputs.uv2nix.follows = "uv2nix";
inputs.nixpkgs.follows = "uv2nix/nixpkgs";
# inputs.uv2nix.follows = "nixpkgs";
};
uv2nix = {
url = "github:pyproject-nix/uv2nix";
inputs.pyproject-nix.follows = "pyproject-nix";
# stale nixpkgs is missing the alias `lib.match` -> `builtins.match`
# therefore point uv2nix to a patched nixpkgs, which introduces this alias
# this is a temporary solution until nixpkgs us up-to-date again
inputs.nixpkgs.url = "github:runtimeverification/nixpkgs/libmatch";
# inputs.uv2nix.follows = "nixpkgs";
};
};
outputs = {
self,
k-framework,
nixpkgs,
flake-utils,
kevm,
rv-utils,
foundry,
solc,
pyproject-nix,
pyproject-build-systems,
uv2nix,
... }:
let
pythonVer = "310";
in flake-utils.lib.eachDefaultSystem (system:
let
# due to the nixpkgs that we use in this flake being outdated, uv is also heavily outdated
# we can just use the binary release of uv provided by uv2nix
uvOverlay = final: prev: {
uv = uv2nix.packages.${final.system}.uv-bin;
};
kontrolOverlay = final: prev:
let
kontrol-pyk = final.callPackage ./nix/kontrol-pyk {
inherit pyproject-nix pyproject-build-systems uv2nix;
python = final."python${pythonVer}";
};
kontrol = final.callPackage ./nix/kontrol {
inherit kontrol-pyk;
rev = self.rev or null;
};
in {
inherit kontrol;
};
solcMkDefaultOverlay = final: prev: {
solcMkDefault = solc.mkDefault;
};
pkgs = import nixpkgs {
inherit system;
overlays = [
(final: prev: { llvm-backend-release = false; })
k-framework.overlay
foundry.overlay
# Matching the version of Foundry with CI
(final: prev: {
foundry-bin = prev.foundry-bin.overrideAttrs (_: let
sources = {
"x86_64-linux" = {
url = "https://github.com/foundry-rs/foundry/releases/download/rc-1/foundry_rc-1_linux_amd64.tar.gz";
sha256 = "0kxfi64rl04r18jk60ji72fkvcaps0adrk3cjp9facyr7jcdx8gy";
};
"aarch64-linux" = {
url = "https://github.com/foundry-rs/foundry/releases/download/rc-1/foundry_rc-1_linux_arm64.tar.gz";
sha256 = "0dgbzmfzan8nfb2dfmb8960hdc6wi3x7jx3si5r9h94j6cn9sysk";
};
"x86_64-darwin" = {
url = "https://github.com/foundry-rs/foundry/releases/download/rc-1/foundry_rc-1_darwin_amd64.tar.gz";
sha256 = "0wx8fsghpdap5f16pkn8fsc3dbxfzxi03wjylp9bjw0knjs3f33g";
};
"aarch64-darwin" = {
url = "https://github.com/foundry-rs/foundry/releases/download/rc-1/foundry_rc-1_darwin_arm64.tar.gz";
sha256 = "1zq726d3vqnlp5bn5ijzia8xbw804g6kwxws02ddf390s5mr7946";
};
};
in {
src = final.fetchzip {
inherit (sources.${final.stdenv.hostPlatform.system}) url sha256;
stripRoot = false;
};
});
})
solc.overlay
solcMkDefaultOverlay
kevm.overlays.default
uvOverlay
kontrolOverlay
];
};
python = pkgs."python${pythonVer}";
in {
devShells.default =
let
kevmShell = kevm.devShell.${system};
in pkgs.mkShell {
buildInputs = (kevmShell.buildInputs or [ ]) ++ [
pkgs.foundry-bin
(solc.mkDefault pkgs pkgs.solc_0_8_13)
python
pkgs.uv
];
env = (kevmShell.env or { }) // {
# prevent uv from managing Python downloads and force use of specific
UV_PYTHON_DOWNLOADS = "never";
UV_PYTHON = python.interpreter;
};
shellHook = (kevmShell.shellHook or "") + ''
unset PYTHONPATH
'';
};
packages = rec {
kontrol = pkgs.kontrol;
default = kontrol;
};
}) // {
overlays.default = final: prev: {
inherit (self.packages.${final.system}) kontrol;
};
};
}