From fd9c3f516d4d5125f8d00d35113cec54eef6197b Mon Sep 17 00:00:00 2001 From: Bruce Collie Date: Fri, 28 Jun 2024 11:43:37 +0100 Subject: [PATCH] Clean up nix code (#664) * Clean up nix code * Set Version: 0.1.72 * Set Version: 0.1.73 --------- Co-authored-by: devops --- flake.lock | 4 --- flake.nix | 78 ++++++++++++++++++++---------------------- package/version | 2 +- pykwasm/pyproject.toml | 2 +- 4 files changed, 39 insertions(+), 47 deletions(-) diff --git a/flake.lock b/flake.lock index 9585ee36c..714934d20 100644 --- a/flake.lock +++ b/flake.lock @@ -363,10 +363,6 @@ "k-framework", "nixpkgs" ], - "nixpkgs-pyk": [ - "pyk", - "nixpkgs" - ], "poetry2nix": [ "pyk", "poetry2nix" diff --git a/flake.nix b/flake.nix index 8288c3959..0cd76d46e 100644 --- a/flake.nix +++ b/flake.nix @@ -7,12 +7,11 @@ flake-utils.follows = "k-framework/flake-utils"; rv-utils.follows = "k-framework/rv-utils"; pyk.url = "github:runtimeverification/k/v7.1.38?dir=pyk"; - nixpkgs-pyk.follows = "pyk/nixpkgs"; poetry2nix.follows = "pyk/poetry2nix"; }; outputs = - { self, k-framework, nixpkgs, flake-utils, rv-utils, pyk, ... }@inputs: + { self, k-framework, nixpkgs, flake-utils, rv-utils, pyk, poetry2nix }: let overlay = (final: prev: let @@ -23,26 +22,15 @@ ] ./.); version = self.rev or "dirty"; - - nixpkgs-pyk = import inputs.nixpkgs-pyk { - system = prev.system; - overlays = [ pyk.overlay ]; - }; - - python310-pyk = nixpkgs-pyk.python310; - - poetry2nix = inputs.poetry2nix.lib.mkPoetry2Nix { pkgs = nixpkgs-pyk; }; in { - pyk = pyk.packages.${prev.system}.pyk; - kwasm = prev.stdenv.mkDerivation { pname = "kwasm"; inherit src version; - buildInputs = with final; [ + buildInputs = with prev; [ k-framework.packages.${system}.k final.kwasm-pyk - python310-pyk + python310 ]; nativeBuildInputs = [ prev.makeWrapper ]; @@ -69,29 +57,33 @@ ''; }; - kwasm-pyk = poetry2nix.mkPoetryApplication { - python = nixpkgs-pyk.python310; + kwasm-pyk = prev.poetry2nix.mkPoetryApplication { + python = prev.python310; projectDir = ./pykwasm; - overrides = poetry2nix.overrides.withDefaults - (finalPython: prevPython: { - pyk = nixpkgs-pyk.pyk-python310; - pygments = prevPython.pygments.overridePythonAttrs ( old: { - buildInputs = (old.buildInputs or [ ]) - ++ [ prevPython.hatchling ]; - }); - xdg-base-dirs = prevPython.xdg-base-dirs.overridePythonAttrs - (old: { - propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) - ++ [ finalPython.poetry ]; - }); - py-wasm = prevPython.py-wasm.overridePythonAttrs - ( - old: { - buildInputs = (old.buildInputs or [ ]) ++ [ prevPython.setuptools ]; - } - ); + + overrides = prev.poetry2nix.overrides.withDefaults + (finalPython: prevPython: { + pyk = prev.pyk-python310; + + pygments = prevPython.pygments.overridePythonAttrs + (old: { + buildInputs = (old.buildInputs or [ ]) + ++ [ prevPython.hatchling ]; + }); + + xdg-base-dirs = prevPython.xdg-base-dirs.overridePythonAttrs + (old: { + propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) + ++ [ finalPython.poetry ]; + }); + + py-wasm = prevPython.py-wasm.overridePythonAttrs + (old: { + buildInputs = (old.buildInputs or [ ]) + ++ [ prevPython.setuptools ]; + }); }); - groups = [ ]; + checkGroups = [ ]; }; @@ -108,11 +100,11 @@ git ]; - patchPhase = '' + patchPhase = with final; '' substituteInPlace Makefile \ - --replace-fail '$(TEST)' '${final.kwasm}/bin/kwasm' \ - --replace-fail '$(KDIST)' '${nixpkgs-pyk.pyk-python310}/bin/kdist' \ - --replace-fail '$(SOURCE_DIR)' '${final.kwasm}/wasm-semantics/source' + --replace-fail '$(TEST)' '${kwasm}/bin/kwasm' \ + --replace-fail '$(KDIST)' '${pyk-python310}/bin/kdist' \ + --replace-fail '$(SOURCE_DIR)' '${kwasm}/wasm-semantics/source' ''; buildPhase = '' @@ -137,7 +129,11 @@ let pkgs = import nixpkgs { inherit system; - overlays = [ overlay ]; + overlays = [ + poetry2nix.overlays.default + pyk.overlay + overlay + ]; }; in { packages = rec { diff --git a/package/version b/package/version index 8076b7dca..416eb55e2 100644 --- a/package/version +++ b/package/version @@ -1 +1 @@ -0.1.72 +0.1.73 diff --git a/pykwasm/pyproject.toml b/pykwasm/pyproject.toml index 2c90b5d0f..ab6a536fd 100644 --- a/pykwasm/pyproject.toml +++ b/pykwasm/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "pykwasm" -version = "0.1.72" +version = "0.1.73" description = "" authors = [ "Runtime Verification, Inc. ",