-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
90 lines (89 loc) · 3.09 KB
/
flake.nix
File metadata and controls
90 lines (89 loc) · 3.09 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
{
description = "IMP Semantics";
inputs = {
rv-nix-tools.url = "github:runtimeverification/rv-nix-tools/854d4f05ea78547d46e807b414faad64cea10ae4";
nixpkgs.follows = "rv-nix-tools/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
k-framework.url = "github:runtimeverification/k/v7.1.288";
k-framework.inputs.nixpkgs.follows = "nixpkgs";
uv2nix.url = "github:pyproject-nix/uv2nix/680e2f8e637bc79b84268949d2f2b2f5e5f1d81c";
# 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
uv2nix.inputs.nixpkgs.url = "github:runtimeverification/nixpkgs/libmatch";
# uv2nix.inputs.nixpkgs.follows = "nixpkgs";
pyproject-build-systems.url = "github:pyproject-nix/build-system-pkgs/7dba6dbc73120e15b558754c26024f6c93015dd7";
pyproject-build-systems = {
inputs.nixpkgs.follows = "nixpkgs";
inputs.uv2nix.follows = "uv2nix";
inputs.pyproject-nix.follows = "uv2nix/pyproject-nix";
};
pyproject-nix.follows = "uv2nix/pyproject-nix";
};
outputs = { self, rv-nix-tools, nixpkgs, flake-utils, pyproject-nix, pyproject-build-systems, uv2nix, k-framework }:
let
pythonVer = "310";
in flake-utils.lib.eachSystem [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
] (system:
let
# due to the nixpkgs that we use in this flake being outdated, uv is also heavily outdated
# we can instead use the binary release of uv provided by uv2nix for now
uvOverlay = final: prev: {
uv = uv2nix.packages.${final.system}.uv-bin;
};
# create custom overlay for k, because the overlay in k-framework currently also includes a lot of other stuff instead of only k
kOverlay = final: prev: {
k = k-framework.packages.${final.system}.k;
};
kimpOverlay = final: prev:
let
kimp-pyk = final.callPackage ./nix/kimp-pyk {
inherit pyproject-nix pyproject-build-systems uv2nix;
python = final."python${pythonVer}";
};
kimp = final.callPackage ./nix/kimp {
inherit kimp-pyk;
rev = self.rev or null;
};
in {
inherit kimp;
};
pkgs = import nixpkgs {
inherit system;
overlays = [
uvOverlay
kOverlay
kimpOverlay
];
};
python = pkgs."python${pythonVer}";
in {
devShells.default = pkgs.mkShell {
name = "uv develop shell";
buildInputs = [
python
pkgs.uv
];
env = {
# prevent uv from managing Python downloads and force use of specific
UV_PYTHON_DOWNLOADS = "never";
UV_PYTHON = python.interpreter;
};
shellHook = ''
unset PYTHONPATH
'';
};
packages = rec {
inherit (pkgs) kimp uv;
default = kimp;
};
}) // {
overlays.default = final: prev: {
inherit (self.packages.${final.system}) kimp;
};
};
}