|
1 | 1 | {
|
2 | 2 | description = "kmir - ";
|
3 | 3 | inputs = {
|
4 |
| - k-framework.url = "github:runtimeverification/k/v7.1.280"; |
5 |
| - nixpkgs.follows = "k-framework/nixpkgs"; |
6 |
| - flake-utils.follows = "k-framework/flake-utils"; |
| 4 | + nixpkgs.url = "nixpkgs/nixos-25.05"; |
7 | 5 | rv-nix-tools.follows = "k-framework/rv-nix-tools";
|
8 |
| - # poetry2nix.follows = "k-framework/poetry2nix"; # FIXME: To stop crash with `nix flake update` |
| 6 | + |
| 7 | + flake-utils.url = "github:numtide/flake-utils"; |
| 8 | + k-framework.url = "github:runtimeverification/k/v7.1.280"; |
| 9 | + |
| 10 | + uv2nix.url = "github:pyproject-nix/uv2nix/680e2f8e637bc79b84268949d2f2b2f5e5f1d81c"; |
| 11 | + # stale nixpkgs is missing the alias `lib.match` -> `builtins.match` |
| 12 | + # therefore point uv2nix to a patched nixpkgs, which introduces this alias |
| 13 | + # this is a temporary solution until nixpkgs us up-to-date again |
| 14 | + uv2nix.inputs.nixpkgs.url = "github:runtimeverification/nixpkgs/libmatch"; |
| 15 | + # inputs.nixpkgs.follows = "nixpkgs"; |
| 16 | + pyproject-build-systems.url = "github:pyproject-nix/build-system-pkgs/7dba6dbc73120e15b558754c26024f6c93015dd7"; |
| 17 | + pyproject-build-systems = { |
| 18 | + inputs.nixpkgs.follows = "uv2nix/nixpkgs"; |
| 19 | + inputs.uv2nix.follows = "uv2nix"; |
| 20 | + inputs.pyproject-nix.follows = "uv2nix/pyproject-nix"; |
| 21 | + }; |
| 22 | + pyproject-nix.follows = "uv2nix/pyproject-nix"; |
9 | 23 | };
|
10 |
| - outputs = { self, nixpkgs, flake-utils, k-framework, ... }@inputs: |
11 |
| - let |
12 |
| - allOverlays = [ |
13 |
| - k-framework.overlays.pyk |
14 |
| - (final: prev: let |
15 |
| - poetry2nix = |
16 |
| - inputs.poetry2nix.lib.mkPoetry2Nix { pkgs = prev; }; |
17 |
| - in { |
18 |
| - kmir = poetry2nix.mkPoetryApplication { |
19 |
| - python = prev.python310; |
20 |
| - projectDir = ./kmir; |
21 |
| - overrides = poetry2nix.overrides.withDefaults |
22 |
| - (finalPython: prevPython: { |
23 |
| - kframework = prev.pyk-python310; |
24 |
| - }); |
25 |
| - groups = []; |
26 |
| - # We remove `dev` from `checkGroups`, so that poetry2nix does not try to resolve dev dependencies. |
27 |
| - checkGroups = []; |
28 |
| - }; |
29 |
| - }) |
30 |
| - ]; |
31 |
| - in flake-utils.lib.eachSystem [ |
| 24 | + outputs = { self, nixpkgs, rv-nix-tools, flake-utils, k-framework, pyproject-nix, pyproject-build-systems, uv2nix }: |
| 25 | + let |
| 26 | + pythonVer = "310"; |
| 27 | + in flake-utils.lib.eachSystem [ |
32 | 28 | "x86_64-linux"
|
33 | 29 | "x86_64-darwin"
|
34 | 30 | "aarch64-linux"
|
35 | 31 | "aarch64-darwin"
|
36 | 32 | ] (system:
|
37 |
| - let |
38 |
| - pkgs = import nixpkgs { |
39 |
| - inherit system; |
40 |
| - overlays = allOverlays; |
| 33 | + let |
| 34 | + # due to the nixpkgs that we use in this flake being outdated, uv is also heavily outdated |
| 35 | + # we can instead use the binary release of uv provided by uv2nix for now |
| 36 | + uvOverlay = final: prev: { |
| 37 | + uv = uv2nix.packages.${final.system}.uv-bin; |
| 38 | + }; |
| 39 | + mir-semanticsOverlay = final: prev: { |
| 40 | + mir-semantics = final.callPackage ./nix/mir-semantics { |
| 41 | + inherit pyproject-nix pyproject-build-systems uv2nix; |
| 42 | + python = final."python${pythonVer}"; |
41 | 43 | };
|
42 |
| - in { |
43 |
| - packages = rec { |
44 |
| - inherit (pkgs) kmir; |
45 |
| - default = kmir; |
| 44 | + }; |
| 45 | + pkgs = import nixpkgs { |
| 46 | + inherit system; |
| 47 | + overlays = [ |
| 48 | + uvOverlay |
| 49 | + mir-semanticsOverlay |
| 50 | + ]; |
| 51 | + }; |
| 52 | + python = pkgs."python${pythonVer}"; |
| 53 | + in { |
| 54 | + devShells.default = pkgs.mkShell { |
| 55 | + name = "uv develop shell"; |
| 56 | + buildInputs = [ |
| 57 | + python |
| 58 | + pkgs.uv |
| 59 | + ]; |
| 60 | + env = { |
| 61 | + # prevent uv from managing Python downloads and force use of specific |
| 62 | + UV_PYTHON_DOWNLOADS = "never"; |
| 63 | + UV_PYTHON = python.interpreter; |
46 | 64 | };
|
47 |
| - }) // { |
48 |
| - overlay = nixpkgs.lib.composeManyExtensions allOverlays; |
| 65 | + shellHook = '' |
| 66 | + unset PYTHONPATH |
| 67 | + ''; |
| 68 | + }; |
| 69 | + packages = rec { |
| 70 | + inherit (pkgs) mir-semantics; |
| 71 | + default = mir-semantics; |
| 72 | + }; |
| 73 | + }) // { |
| 74 | + overlays.default = final: prev: { |
| 75 | + inherit (self.packages.${final.system}) mir-semantics; |
49 | 76 | };
|
| 77 | + }; |
50 | 78 | }
|
0 commit comments