-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathflake.nix
More file actions
156 lines (144 loc) · 5.36 KB
/
flake.nix
File metadata and controls
156 lines (144 loc) · 5.36 KB
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
153
154
155
156
{
description = "A Nix-based development environment for the lean-mlir project.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
};
installPackages = with pkgs; [
##########################################################
##
## Installed packages
##
##########################################################
#
# To add a new package to be installed in both the Dockerfile
# and local development environments, search for the name of the
# relevant nix package on https://search.nixos.org/packages,
# and add it at the end of the list below.
#
elan
curl # Needed for `lake exe cache ...`
unzip
black
llvmPackages_19.mlir
llvmPackages_19.bintools-unwrapped
ripgrep
#
# Packages with specific version overrides
#
# To update, replace `version` with the new commit hash or tag
# you wish to update to, replace hash with an empty string (`""`),
# and run `nix develop` (or attempt to build the Docker image).
# This will fail, with a hash mismatch error, for example;
# ```
# error: hash mismatch in fixed-output derivation '/nix/store/ni1ps8il94y5lbvzlxwvaqsxwrwqkxqd-source.drv':
# specified: sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=
# got: sha256-cEzN/nktAe5wbNDCn6P9orNuZS6KbnjuRpG4XgnzevA=
# ```
# Then, replace the now-empty hash with the hash you see in the `got`
# of the error you just got.
(bitwuzla.overrideAttrs (final: prev: rec {
version = "0dca38d0f62fa9002ad6278ca6374838a69ade19";
src = fetchFromGitHub {
inherit (prev.src) owner repo;
rev = version;
hash = "sha256-cEzN/nktAe5wbNDCn6P9orNuZS6KbnjuRpG4XgnzevA=";
};
}))
];
pythonPackages = ps: with ps; [
##########################################################
##
## Python dependencies
##
##########################################################
#
# To add a new python package to be installed in both the Dockerfile
# and local development environments, search for the name of the
# relevant nix package on https://search.nixos.org/packages,
# and add it at the end of the list below.
# For example, for matplotlib, the search will return
# `python313Packages.matplotlib` as the relevant nix package.
# To install this, omit the python313Packages prefix from the
# package name, and list only the bit after the dot below.
#
matplotlib
pandas
polars
num2words
psutil
contourpy
cycler
fonttools
importlib-metadata
kiwisolver
numpy
packaging
pillow
python-dateutil
pyparsing
pytz
six
tabulate
tzdata
zipp
# (ps.callPackage ./xdsl.nix {})
# ^^ FIXME: this is temporarily disabled, as the version of
# typing-extensions packaged by nixpkgs did not fit in the constraints
# set by xdsl, breaking the entire devshell. We do need xDSL, though!
];
pythonEnv = pkgs.python3.withPackages pythonPackages;
customShellHook = pkgs.writeShellScriptBin "lean-mlir-init-env" ''
# Ensure the right Lean toolchain gets installed
# And that dependencies are checked out to the right versions,
# although we do not check any cached build outputs
#
# NOTE: surprisingly, there seems to be no dedicated command which just
# fetches the depencies, without updating the manifest to newer version
# as `lake update` does, or fetching build outputs from cache. Thus,
# we use `lake env ...` which as a side-effect does ensure all dependency
# sources are available.
lake env echo
'';
shellPkgs = installPackages ++ [
pythonEnv
customShellHook
];
in
{
devShell = pkgs.mkShell {
buildInputs = shellPkgs;
shellHook = ''
lean-mlir-init-env
'';
};
packages.default = pkgs.buildEnv {
name = "LeanMLIR build environment";
paths = shellPkgs;
};
# nix run .#test-experiments
apps.test-experiments =
let
programDir = pkgs.writeShellApplication {
name = "run-experiments-script";
runtimeInputs = shellPkgs;
text = ''
set -euo pipefail
export PATH=${pkgs.lib.makeBinPath [ pythonEnv pkgs.coreutils ]}:$PATH
./artifacts/oopsla25-width-indep/test_experiments.sh
'';
};
program = "${programDir}/bin/run-experiments-script";
in
{
inherit program;
type = "app";
};
});
}