-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
93 lines (91 loc) · 2.82 KB
/
flake.nix
File metadata and controls
93 lines (91 loc) · 2.82 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
{
description = "kup";
inputs = {
rv-nix-tools.url = "github:runtimeverification/rv-nix-tools/854d4f05ea78547d46e807b414faad64cea10ae4";
nixpkgs.follows = "rv-nix-tools/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
uv2nix.url = "github:pyproject-nix/uv2nix/c8cf711802cb00b2e05d5c54d3486fce7bfc8f7c";
# 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
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
uv2nix.inputs.nixpkgs.url = "github:runtimeverification/nixpkgs/libmatch";
# inputs.nixpkgs.follows = "nixpkgs";
pyproject-build-systems.url = "github:pyproject-nix/build-system-pkgs/795a980d25301e5133eca37adae37283ec3c8e66";
pyproject-build-systems = {
inputs.nixpkgs.follows = "uv2nix/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,
nixpkgs-unstable,
}:
let
pythonVer = "310";
in flake-utils.lib.eachSystem [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
] (system:
let
# for uv2nix, remove both `pkgs-unstable` and `staleNixpkgsOverlay` once we updated to a newer version of nixpkgs
pkgs-unstable = import nixpkgs-unstable {
inherit system;
};
staleNixpkgsOverlay = final: prev: {
inherit (pkgs-unstable) replaceVars;
};
uvOverlay = final: prev: {
uv = uv2nix.packages.${final.system}.uv-bin;
};
kupOverlay = final: prev: {
kup = final.callPackage ./nix/kup {
inherit pyproject-nix pyproject-build-systems uv2nix;
python = final."python${pythonVer}";
};
};
pkgs = import nixpkgs {
inherit system;
overlays = [
staleNixpkgsOverlay
uvOverlay
kupOverlay
];
};
python = pkgs."python${pythonVer}";
in rec {
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) kup;
default = kup;
};
}) // {
overlays.default = final: prev: {
inherit (self.packages.${final.system}) kup;
};
};
}