Skip to content

Commit

Permalink
Clean up nix code (#664)
Browse files Browse the repository at this point in the history
* Clean up nix code

* Set Version: 0.1.72

* Set Version: 0.1.73

---------

Co-authored-by: devops <[email protected]>
  • Loading branch information
Baltoli and devops authored Jun 28, 2024
1 parent 2ef1bfc commit fd9c3f5
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 47 deletions.
4 changes: 0 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 37 additions & 41 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ];
Expand All @@ -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 = [ ];
};

Expand All @@ -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 = ''
Expand All @@ -137,7 +129,11 @@
let
pkgs = import nixpkgs {
inherit system;
overlays = [ overlay ];
overlays = [
poetry2nix.overlays.default
pyk.overlay
overlay
];
};
in {
packages = rec {
Expand Down
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.72
0.1.73
2 changes: 1 addition & 1 deletion pykwasm/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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. <[email protected]>",
Expand Down

0 comments on commit fd9c3f5

Please sign in to comment.