From 9dbece385ecd553232d454e1089579643ba60ed4 Mon Sep 17 00:00:00 2001 From: Bruce Collie Date: Thu, 6 Jun 2024 18:02:39 +0100 Subject: [PATCH] Package Nix flake (#255) * Implement Nix flake build * Run Nix build matrix * Set Version: 0.1.73 * Add missing dependencies * Set Version: 0.1.74 * Set Version: 0.1.74 --------- Co-authored-by: devops --- .github/workflows/test-pr.yml | 19 + .github/workflows/update-version.yml | 9 + .gitignore | 1 + flake.lock | 1230 +++++++++++++++++++ flake.nix | 154 +++ kmultiversx/poetry.lock | 2 +- kmultiversx/pyproject.toml | 2 +- kmultiversx/src/kmultiversx/kdist/plugin.py | 2 +- package/version | 2 +- 9 files changed, 1417 insertions(+), 4 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml index e18661f4..60e755d2 100644 --- a/.github/workflows/test-pr.yml +++ b/.github/workflows/test-pr.yml @@ -115,3 +115,22 @@ jobs: if: always() run: | docker stop --time=0 elrond-semantics-ci-${GITHUB_SHA} + + nix: + name: 'Build using Nix' + strategy: + fail-fast: false + matrix: + include: + - runner: normal + - runner: ARM64 + runs-on: ${{ matrix.runner }} + timeout-minutes: 60 + steps: + - name: 'Check out code' + uses: actions/checkout@v3 + with: + # Check out pull request HEAD instead of merge commit. + ref: ${{ github.event.pull_request.head.sha }} + - name: 'Build KMultiversX' + run: GC_DONT_GC=1 nix build .#kmultiversx --extra-experimental-features 'nix-command flakes' --print-build-logs diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index e1859198..d40f938c 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -35,5 +35,14 @@ jobs: K_VERSION=$(poetry -C kmultiversx run python3 -c 'import pyk; print(pyk.__version__)') echo ${K_VERSION} > deps/k_release git add deps/k_release && git commit -m "deps/k_release: sync release file version ${K_VERSION}" || true + - name: 'Update Nix flake inputs' + run: | + K_VERSION="$(cat deps/k_release)" + PYKWASM_VERSION="$(cat deps/kwasm_release)" + sed -i 's! k-framework.url = "github:runtimeverification/k/v[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+"! k-framework.url = "github:runtimeverification/k/'"v${K_VERSION}"'"!' flake.nix + sed -i 's! pyk.url = "github:runtimeverification/k/v[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+?dir=pyk"! pyk.url = "github:runtimeverification/k/'"v${K_VERSION}"'?dir=pyk"!' flake.nix + sed -i 's! wasm-semantics.url = "github:runtimeverification/wasm-semantics/v[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+"! wasm-semantics.url = "github:runtimeverification/wasm-semantics/'"v${PYKWASM_VERSION}"'"!' flake.nix + nix flake update + git add flake.nix flake.lock && git commit -m 'flake.{nix,lock}: update Nix derivations' || true - name: 'Push updates' run: git push diff --git a/.gitignore b/.gitignore index 1cce33d9..fb5a47e2 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ tmp *.pyc venv .hypothesis +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..fac34dde --- /dev/null +++ b/flake.lock @@ -0,0 +1,1230 @@ +{ + "nodes": { + "ate-pairing": { + "flake": false, + "locked": { + "lastModified": 1499347915, + "narHash": "sha256-IMfWgKkkX7UcUaOPtGRcYD8MdVEP5Z9JOOSJ4+P07G8=", + "owner": "herumi", + "repo": "ate-pairing", + "rev": "e69890125746cdaf25b5b51227d96678f76479fe", + "type": "github" + }, + "original": { + "owner": "herumi", + "repo": "ate-pairing", + "rev": "e69890125746cdaf25b5b51227d96678f76479fe", + "type": "github" + } + }, + "blockchain-k-plugin": { + "inputs": { + "ate-pairing": "ate-pairing", + "cpp-httplib": "cpp-httplib", + "cryptopp": "cryptopp", + "flake-utils": [ + "k-framework", + "flake-utils" + ], + "libff": "libff", + "nixpkgs": [ + "k-framework", + "nixpkgs" + ], + "xbyak": "xbyak" + }, + "locked": { + "lastModified": 1713805275, + "narHash": "sha256-5aEVo9l9Q+W9FsjjSCbhlPw6pITIYJjUGJ5zFkatxVo=", + "owner": "runtimeverification", + "repo": "blockchain-k-plugin", + "rev": "3054e0fca2b5b621945e643c361a4777db4b3f52", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "repo": "blockchain-k-plugin", + "rev": "3054e0fca2b5b621945e643c361a4777db4b3f52", + "type": "github" + } + }, + "cpp-httplib": { + "flake": false, + "locked": { + "lastModified": 1595279716, + "narHash": "sha256-cZW/iEwlaB4UQ0OQLNqboY9addncIM/OsxxPzqmATmE=", + "owner": "yhirose", + "repo": "cpp-httplib", + "rev": "72ce293fed9f9335e92c95ab7d085feed18c0ee8", + "type": "github" + }, + "original": { + "owner": "yhirose", + "repo": "cpp-httplib", + "rev": "72ce293fed9f9335e92c95ab7d085feed18c0ee8", + "type": "github" + } + }, + "cryptopp": { + "flake": false, + "locked": { + "lastModified": 1632484127, + "narHash": "sha256-a3TYaK34WvKEXN7LKAfGwQ3ZL6a3k/zMZyyVfnkQqO4=", + "owner": "weidai11", + "repo": "cryptopp", + "rev": "69bf6b53052b59ccb57ce068ce741988ae087317", + "type": "github" + }, + "original": { + "owner": "weidai11", + "repo": "cryptopp", + "rev": "69bf6b53052b59ccb57ce068ce741988ae087317", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_4" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "inputs": { + "systems": "systems_5" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "fmt-src": { + "flake": false, + "locked": { + "lastModified": 1661615830, + "narHash": "sha256-rP6ymyRc7LnKxUXwPpzhHOQvpJkpnRFOt2ctvUNlYI0=", + "owner": "fmtlib", + "repo": "fmt", + "rev": "a33701196adfad74917046096bf5a2aa0ab0bb50", + "type": "github" + }, + "original": { + "owner": "fmtlib", + "ref": "9.1.0", + "repo": "fmt", + "type": "github" + } + }, + "fmt-src_2": { + "flake": false, + "locked": { + "lastModified": 1661615830, + "narHash": "sha256-rP6ymyRc7LnKxUXwPpzhHOQvpJkpnRFOt2ctvUNlYI0=", + "owner": "fmtlib", + "repo": "fmt", + "rev": "a33701196adfad74917046096bf5a2aa0ab0bb50", + "type": "github" + }, + "original": { + "owner": "fmtlib", + "ref": "9.1.0", + "repo": "fmt", + "type": "github" + } + }, + "haskell-backend": { + "inputs": { + "nixpkgs": [ + "k-framework", + "haskell-backend", + "rv-utils", + "nixpkgs" + ], + "rv-utils": "rv-utils", + "stacklock2nix": "stacklock2nix", + "z3": "z3" + }, + "locked": { + "lastModified": 1717504162, + "narHash": "sha256-muZL1MfImaMimk+f/SwPj4xrlRvDnSpovDhAx/WqdCw=", + "owner": "runtimeverification", + "repo": "haskell-backend", + "rev": "abceb59fcbc47d1bc537ff797f806c8bb8649626", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "repo": "haskell-backend", + "rev": "abceb59fcbc47d1bc537ff797f806c8bb8649626", + "type": "github" + } + }, + "haskell-backend_2": { + "inputs": { + "nixpkgs": [ + "wasm-semantics", + "k-framework", + "haskell-backend", + "rv-utils", + "nixpkgs" + ], + "rv-utils": "rv-utils_5", + "stacklock2nix": "stacklock2nix_2", + "z3": "z3_2" + }, + "locked": { + "lastModified": 1717504162, + "narHash": "sha256-muZL1MfImaMimk+f/SwPj4xrlRvDnSpovDhAx/WqdCw=", + "owner": "runtimeverification", + "repo": "haskell-backend", + "rev": "abceb59fcbc47d1bc537ff797f806c8bb8649626", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "repo": "haskell-backend", + "rev": "abceb59fcbc47d1bc537ff797f806c8bb8649626", + "type": "github" + } + }, + "immer-src": { + "flake": false, + "locked": { + "lastModified": 1708038459, + "narHash": "sha256-aV/mQFuPzioy1PxROc85ypeP7/d0nn+xcBPzy9taw2s=", + "owner": "runtimeverification", + "repo": "immer", + "rev": "4b0914f0b2acb33befe0ba4cd3a7954f2687e9bb", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "repo": "immer", + "rev": "4b0914f0b2acb33befe0ba4cd3a7954f2687e9bb", + "type": "github" + } + }, + "immer-src_2": { + "flake": false, + "locked": { + "lastModified": 1708038459, + "narHash": "sha256-aV/mQFuPzioy1PxROc85ypeP7/d0nn+xcBPzy9taw2s=", + "owner": "runtimeverification", + "repo": "immer", + "rev": "4b0914f0b2acb33befe0ba4cd3a7954f2687e9bb", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "repo": "immer", + "rev": "4b0914f0b2acb33befe0ba4cd3a7954f2687e9bb", + "type": "github" + } + }, + "k-framework": { + "inputs": { + "flake-utils": "flake-utils", + "haskell-backend": "haskell-backend", + "llvm-backend": "llvm-backend", + "nixpkgs": [ + "k-framework", + "llvm-backend", + "nixpkgs" + ], + "rv-utils": "rv-utils_3" + }, + "locked": { + "lastModified": 1717580671, + "narHash": "sha256-ucSdll3uu4lu3FIYQ1hyLnm2BGiIydHx40orLN9VM8s=", + "owner": "runtimeverification", + "repo": "k", + "rev": "e12cbe44f5e39c7daf84b62e538d59b8fa31bc28", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "ref": "v7.0.112", + "repo": "k", + "type": "github" + } + }, + "k-framework_2": { + "inputs": { + "flake-utils": "flake-utils_3", + "haskell-backend": "haskell-backend_2", + "llvm-backend": "llvm-backend_2", + "nixpkgs": [ + "wasm-semantics", + "k-framework", + "llvm-backend", + "nixpkgs" + ], + "rv-utils": "rv-utils_7" + }, + "locked": { + "lastModified": 1717580671, + "narHash": "sha256-ucSdll3uu4lu3FIYQ1hyLnm2BGiIydHx40orLN9VM8s=", + "owner": "runtimeverification", + "repo": "k", + "rev": "e12cbe44f5e39c7daf84b62e538d59b8fa31bc28", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "ref": "v7.0.112", + "repo": "k", + "type": "github" + } + }, + "libff": { + "flake": false, + "locked": { + "lastModified": 1588032522, + "narHash": "sha256-I0kH2XLvHDSrdL/o4i6XozWQJV0UDv9zH6+sWS0UQHg=", + "owner": "scipr-lab", + "repo": "libff", + "rev": "5835b8c59d4029249645cf551f417608c48f2770", + "type": "github" + }, + "original": { + "owner": "scipr-lab", + "repo": "libff", + "rev": "5835b8c59d4029249645cf551f417608c48f2770", + "type": "github" + } + }, + "llvm-backend": { + "inputs": { + "flake-compat": "flake-compat", + "fmt-src": "fmt-src", + "immer-src": "immer-src", + "nixpkgs": [ + "k-framework", + "llvm-backend", + "rv-utils", + "nixpkgs" + ], + "pybind11-src": "pybind11-src", + "rapidjson-src": "rapidjson-src", + "rv-utils": "rv-utils_2", + "utils": [ + "k-framework", + "flake-utils" + ] + }, + "locked": { + "lastModified": 1717532732, + "narHash": "sha256-0VTqGrolstZlxtd6DRmoWnJsYO+BB8i+PniGKenB34I=", + "owner": "runtimeverification", + "repo": "llvm-backend", + "rev": "caca83fbec616482760697fbf7620c45e9b560b7", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "ref": "v0.1.42", + "repo": "llvm-backend", + "type": "github" + } + }, + "llvm-backend_2": { + "inputs": { + "flake-compat": "flake-compat_2", + "fmt-src": "fmt-src_2", + "immer-src": "immer-src_2", + "nixpkgs": [ + "wasm-semantics", + "k-framework", + "llvm-backend", + "rv-utils", + "nixpkgs" + ], + "pybind11-src": "pybind11-src_2", + "rapidjson-src": "rapidjson-src_2", + "rv-utils": "rv-utils_6", + "utils": [ + "wasm-semantics", + "k-framework", + "flake-utils" + ] + }, + "locked": { + "lastModified": 1717532732, + "narHash": "sha256-0VTqGrolstZlxtd6DRmoWnJsYO+BB8i+PniGKenB34I=", + "owner": "runtimeverification", + "repo": "llvm-backend", + "rev": "caca83fbec616482760697fbf7620c45e9b560b7", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "ref": "v0.1.42", + "repo": "llvm-backend", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "pyk", + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1693660503, + "narHash": "sha256-B/g2V4v6gjirFmy+I5mwB2bCYc0l3j5scVfwgl6WOl8=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "bd5bdbb52350e145c526108f4ef192eb8e554fa0", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nix-github-actions_2": { + "inputs": { + "nixpkgs": [ + "wasm-semantics", + "pyk", + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1693660503, + "narHash": "sha256-B/g2V4v6gjirFmy+I5mwB2bCYc0l3j5scVfwgl6WOl8=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "bd5bdbb52350e145c526108f4ef192eb8e554fa0", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1716457947, + "narHash": "sha256-Y+exebcqeprnhEpoPJrEUZmNeO60qeOxkVHhqG/OEwQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "69493a13eaea0dc4682fd07e8a084f17813dbeeb", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "69493a13eaea0dc4682fd07e8a084f17813dbeeb", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1716457947, + "narHash": "sha256-Y+exebcqeprnhEpoPJrEUZmNeO60qeOxkVHhqG/OEwQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "69493a13eaea0dc4682fd07e8a084f17813dbeeb", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "69493a13eaea0dc4682fd07e8a084f17813dbeeb", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1716457947, + "narHash": "sha256-Y+exebcqeprnhEpoPJrEUZmNeO60qeOxkVHhqG/OEwQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "69493a13eaea0dc4682fd07e8a084f17813dbeeb", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "69493a13eaea0dc4682fd07e8a084f17813dbeeb", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1698675399, + "narHash": "sha256-nj+LNEeVXGP31vxoL3x7HW7+oEiyoLVDqwMg30yFBMA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7378978469efa3b2b2f97d645a2a0b0e2447da2b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1716457947, + "narHash": "sha256-Y+exebcqeprnhEpoPJrEUZmNeO60qeOxkVHhqG/OEwQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "69493a13eaea0dc4682fd07e8a084f17813dbeeb", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "69493a13eaea0dc4682fd07e8a084f17813dbeeb", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { + "lastModified": 1716457947, + "narHash": "sha256-Y+exebcqeprnhEpoPJrEUZmNeO60qeOxkVHhqG/OEwQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "69493a13eaea0dc4682fd07e8a084f17813dbeeb", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "69493a13eaea0dc4682fd07e8a084f17813dbeeb", + "type": "github" + } + }, + "nixpkgs_7": { + "locked": { + "lastModified": 1716457947, + "narHash": "sha256-Y+exebcqeprnhEpoPJrEUZmNeO60qeOxkVHhqG/OEwQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "69493a13eaea0dc4682fd07e8a084f17813dbeeb", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "69493a13eaea0dc4682fd07e8a084f17813dbeeb", + "type": "github" + } + }, + "nixpkgs_8": { + "locked": { + "lastModified": 1716457947, + "narHash": "sha256-Y+exebcqeprnhEpoPJrEUZmNeO60qeOxkVHhqG/OEwQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "69493a13eaea0dc4682fd07e8a084f17813dbeeb", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "rev": "69493a13eaea0dc4682fd07e8a084f17813dbeeb", + "type": "github" + } + }, + "nixpkgs_9": { + "locked": { + "lastModified": 1698675399, + "narHash": "sha256-nj+LNEeVXGP31vxoL3x7HW7+oEiyoLVDqwMg30yFBMA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7378978469efa3b2b2f97d645a2a0b0e2447da2b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils_2", + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "pyk", + "nixpkgs" + ], + "systems": "systems_3", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1698640399, + "narHash": "sha256-mXzyx79/iFLZ0UDuSkqgFfejYRcSJfsCnJ9WlMusaI0=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "626111646fe236cb1ddc8191a48c75e072a82b7c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "626111646fe236cb1ddc8191a48c75e072a82b7c", + "type": "github" + } + }, + "poetry2nix_2": { + "inputs": { + "flake-utils": "flake-utils_4", + "nix-github-actions": "nix-github-actions_2", + "nixpkgs": [ + "wasm-semantics", + "pyk", + "nixpkgs" + ], + "systems": "systems_6", + "treefmt-nix": "treefmt-nix_2" + }, + "locked": { + "lastModified": 1698640399, + "narHash": "sha256-mXzyx79/iFLZ0UDuSkqgFfejYRcSJfsCnJ9WlMusaI0=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "626111646fe236cb1ddc8191a48c75e072a82b7c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "626111646fe236cb1ddc8191a48c75e072a82b7c", + "type": "github" + } + }, + "pybind11-src": { + "flake": false, + "locked": { + "lastModified": 1657936673, + "narHash": "sha256-/X8DZPFsNrKGbhjZ1GFOj17/NU6p4R+saCW3pLKVNeA=", + "owner": "pybind", + "repo": "pybind11", + "rev": "0ba639d6177659c5dc2955ac06ad7b5b0d22e05c", + "type": "github" + }, + "original": { + "owner": "pybind", + "repo": "pybind11", + "rev": "0ba639d6177659c5dc2955ac06ad7b5b0d22e05c", + "type": "github" + } + }, + "pybind11-src_2": { + "flake": false, + "locked": { + "lastModified": 1657936673, + "narHash": "sha256-/X8DZPFsNrKGbhjZ1GFOj17/NU6p4R+saCW3pLKVNeA=", + "owner": "pybind", + "repo": "pybind11", + "rev": "0ba639d6177659c5dc2955ac06ad7b5b0d22e05c", + "type": "github" + }, + "original": { + "owner": "pybind", + "repo": "pybind11", + "rev": "0ba639d6177659c5dc2955ac06ad7b5b0d22e05c", + "type": "github" + } + }, + "pyk": { + "inputs": { + "flake-utils": [ + "pyk", + "poetry2nix", + "flake-utils" + ], + "nixpkgs": "nixpkgs_4", + "poetry2nix": "poetry2nix" + }, + "locked": { + "dir": "pyk", + "lastModified": 1717580671, + "narHash": "sha256-ucSdll3uu4lu3FIYQ1hyLnm2BGiIydHx40orLN9VM8s=", + "owner": "runtimeverification", + "repo": "k", + "rev": "e12cbe44f5e39c7daf84b62e538d59b8fa31bc28", + "type": "github" + }, + "original": { + "dir": "pyk", + "owner": "runtimeverification", + "ref": "v7.0.112", + "repo": "k", + "type": "github" + } + }, + "pyk_2": { + "inputs": { + "flake-utils": [ + "wasm-semantics", + "pyk", + "poetry2nix", + "flake-utils" + ], + "nixpkgs": "nixpkgs_9", + "poetry2nix": "poetry2nix_2" + }, + "locked": { + "dir": "pyk", + "lastModified": 1717580671, + "narHash": "sha256-ucSdll3uu4lu3FIYQ1hyLnm2BGiIydHx40orLN9VM8s=", + "owner": "runtimeverification", + "repo": "k", + "rev": "e12cbe44f5e39c7daf84b62e538d59b8fa31bc28", + "type": "github" + }, + "original": { + "dir": "pyk", + "owner": "runtimeverification", + "ref": "v7.0.112", + "repo": "k", + "type": "github" + } + }, + "rapidjson-src": { + "flake": false, + "locked": { + "lastModified": 1472111945, + "narHash": "sha256-SxUXSOQDZ0/3zlFI4R84J56/1fkw2jhge4mexNF6Pco=", + "owner": "Tencent", + "repo": "rapidjson", + "rev": "f54b0e47a08782a6131cc3d60f94d038fa6e0a51", + "type": "github" + }, + "original": { + "owner": "Tencent", + "repo": "rapidjson", + "rev": "f54b0e47a08782a6131cc3d60f94d038fa6e0a51", + "type": "github" + } + }, + "rapidjson-src_2": { + "flake": false, + "locked": { + "lastModified": 1472111945, + "narHash": "sha256-SxUXSOQDZ0/3zlFI4R84J56/1fkw2jhge4mexNF6Pco=", + "owner": "Tencent", + "repo": "rapidjson", + "rev": "f54b0e47a08782a6131cc3d60f94d038fa6e0a51", + "type": "github" + }, + "original": { + "owner": "Tencent", + "repo": "rapidjson", + "rev": "f54b0e47a08782a6131cc3d60f94d038fa6e0a51", + "type": "github" + } + }, + "root": { + "inputs": { + "blockchain-k-plugin": "blockchain-k-plugin", + "flake-utils": [ + "k-framework", + "flake-utils" + ], + "k-framework": "k-framework", + "nixpkgs": [ + "k-framework", + "nixpkgs" + ], + "nixpkgs-pyk": [ + "pyk", + "nixpkgs" + ], + "poetry2nix": [ + "pyk", + "poetry2nix" + ], + "pyk": "pyk", + "rv-utils": "rv-utils_4", + "wasm-semantics": "wasm-semantics" + } + }, + "rv-utils": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1716459074, + "narHash": "sha256-IpahO+EkWdGl9QP7B2YXfJWpSfghjxgpz4ab47nRJY4=", + "owner": "runtimeverification", + "repo": "rv-nix-tools", + "rev": "a65058865cda201de504f5546271b8e997a0be9c", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "repo": "rv-nix-tools", + "type": "github" + } + }, + "rv-utils_2": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1716459074, + "narHash": "sha256-IpahO+EkWdGl9QP7B2YXfJWpSfghjxgpz4ab47nRJY4=", + "owner": "runtimeverification", + "repo": "rv-nix-tools", + "rev": "a65058865cda201de504f5546271b8e997a0be9c", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "repo": "rv-nix-tools", + "type": "github" + } + }, + "rv-utils_3": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1716459074, + "narHash": "sha256-IpahO+EkWdGl9QP7B2YXfJWpSfghjxgpz4ab47nRJY4=", + "owner": "runtimeverification", + "repo": "rv-nix-tools", + "rev": "a65058865cda201de504f5546271b8e997a0be9c", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "repo": "rv-nix-tools", + "type": "github" + } + }, + "rv-utils_4": { + "inputs": { + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1716459074, + "narHash": "sha256-IpahO+EkWdGl9QP7B2YXfJWpSfghjxgpz4ab47nRJY4=", + "owner": "runtimeverification", + "repo": "rv-nix-tools", + "rev": "a65058865cda201de504f5546271b8e997a0be9c", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "repo": "rv-nix-tools", + "type": "github" + } + }, + "rv-utils_5": { + "inputs": { + "nixpkgs": "nixpkgs_6" + }, + "locked": { + "lastModified": 1716459074, + "narHash": "sha256-IpahO+EkWdGl9QP7B2YXfJWpSfghjxgpz4ab47nRJY4=", + "owner": "runtimeverification", + "repo": "rv-nix-tools", + "rev": "a65058865cda201de504f5546271b8e997a0be9c", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "repo": "rv-nix-tools", + "type": "github" + } + }, + "rv-utils_6": { + "inputs": { + "nixpkgs": "nixpkgs_7" + }, + "locked": { + "lastModified": 1716459074, + "narHash": "sha256-IpahO+EkWdGl9QP7B2YXfJWpSfghjxgpz4ab47nRJY4=", + "owner": "runtimeverification", + "repo": "rv-nix-tools", + "rev": "a65058865cda201de504f5546271b8e997a0be9c", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "repo": "rv-nix-tools", + "type": "github" + } + }, + "rv-utils_7": { + "inputs": { + "nixpkgs": "nixpkgs_8" + }, + "locked": { + "lastModified": 1716459074, + "narHash": "sha256-IpahO+EkWdGl9QP7B2YXfJWpSfghjxgpz4ab47nRJY4=", + "owner": "runtimeverification", + "repo": "rv-nix-tools", + "rev": "a65058865cda201de504f5546271b8e997a0be9c", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "repo": "rv-nix-tools", + "type": "github" + } + }, + "stacklock2nix": { + "locked": { + "lastModified": 1705051190, + "narHash": "sha256-xgH0gaD3dNtOzZzX3A40hZTiHJP5cIGmifbmfcS2OGI=", + "owner": "cdepillabout", + "repo": "stacklock2nix", + "rev": "22676dfc45fa1c33899ba1da1a23665172a18ba7", + "type": "github" + }, + "original": { + "owner": "cdepillabout", + "repo": "stacklock2nix", + "type": "github" + } + }, + "stacklock2nix_2": { + "locked": { + "lastModified": 1705051190, + "narHash": "sha256-xgH0gaD3dNtOzZzX3A40hZTiHJP5cIGmifbmfcS2OGI=", + "owner": "cdepillabout", + "repo": "stacklock2nix", + "rev": "22676dfc45fa1c33899ba1da1a23665172a18ba7", + "type": "github" + }, + "original": { + "owner": "cdepillabout", + "repo": "stacklock2nix", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "id": "systems", + "type": "indirect" + } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_6": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "id": "systems", + "type": "indirect" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "pyk", + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1697388351, + "narHash": "sha256-63N2eBpKaziIy4R44vjpUu8Nz5fCJY7okKrkixvDQmY=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "aae39f64f5ecbe89792d05eacea5cb241891292a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_2": { + "inputs": { + "nixpkgs": [ + "wasm-semantics", + "pyk", + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1697388351, + "narHash": "sha256-63N2eBpKaziIy4R44vjpUu8Nz5fCJY7okKrkixvDQmY=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "aae39f64f5ecbe89792d05eacea5cb241891292a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "wasm-semantics": { + "inputs": { + "flake-utils": [ + "wasm-semantics", + "k-framework", + "flake-utils" + ], + "k-framework": "k-framework_2", + "nixpkgs": [ + "wasm-semantics", + "k-framework", + "nixpkgs" + ], + "nixpkgs-pyk": [ + "wasm-semantics", + "pyk", + "nixpkgs" + ], + "poetry2nix": [ + "wasm-semantics", + "pyk", + "poetry2nix" + ], + "pyk": "pyk_2", + "rv-utils": [ + "wasm-semantics", + "k-framework", + "rv-utils" + ] + }, + "locked": { + "lastModified": 1717594015, + "narHash": "sha256-5v6ToIgOMZePIKturVNdI6P6BY/4IycwQf6GsyA2ovU=", + "owner": "runtimeverification", + "repo": "wasm-semantics", + "rev": "300550f22fbb1f7b8eddf9c5df4cd334eaf73fbd", + "type": "github" + }, + "original": { + "owner": "runtimeverification", + "ref": "v0.1.59", + "repo": "wasm-semantics", + "type": "github" + } + }, + "xbyak": { + "flake": false, + "locked": { + "lastModified": 1518572786, + "narHash": "sha256-jqDSNDcqK7010ig941hrJFkv1X7MbgXmhPOOE9wHmho=", + "owner": "herumi", + "repo": "xbyak", + "rev": "f0a8f7faa27121f28186c2a7f4222a9fc66c283d", + "type": "github" + }, + "original": { + "owner": "herumi", + "repo": "xbyak", + "rev": "f0a8f7faa27121f28186c2a7f4222a9fc66c283d", + "type": "github" + } + }, + "z3": { + "flake": false, + "locked": { + "lastModified": 1674011426, + "narHash": "sha256-7cuUf29TMpX62PwO1ab3ZuzmzlcrRjTKB1CyXnYgYus=", + "owner": "Z3Prover", + "repo": "z3", + "rev": "3012293c35eadbfd73e5b94adbe50b0cc44ffb83", + "type": "github" + }, + "original": { + "owner": "Z3Prover", + "ref": "z3-4.12.1", + "repo": "z3", + "type": "github" + } + }, + "z3_2": { + "flake": false, + "locked": { + "lastModified": 1674011426, + "narHash": "sha256-7cuUf29TMpX62PwO1ab3ZuzmzlcrRjTKB1CyXnYgYus=", + "owner": "Z3Prover", + "repo": "z3", + "rev": "3012293c35eadbfd73e5b94adbe50b0cc44ffb83", + "type": "github" + }, + "original": { + "owner": "Z3Prover", + "ref": "z3-4.12.1", + "repo": "z3", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..b734b393 --- /dev/null +++ b/flake.nix @@ -0,0 +1,154 @@ +{ + description = "K Semantics of MultiversX"; + + inputs = { + wasm-semantics.url = "github:runtimeverification/wasm-semantics/v0.1.59"; + k-framework.url = "github:runtimeverification/k/v7.0.112"; + pyk.url = "github:runtimeverification/k/v7.0.112?dir=pyk"; + nixpkgs.follows = "k-framework/nixpkgs"; + flake-utils.follows = "k-framework/flake-utils"; + rv-utils.url = "github:runtimeverification/rv-nix-tools"; + nixpkgs-pyk.follows = "pyk/nixpkgs"; + poetry2nix.follows = "pyk/poetry2nix"; + blockchain-k-plugin = { + url = + "github:runtimeverification/blockchain-k-plugin/3054e0fca2b5b621945e643c361a4777db4b3f52"; + inputs.flake-utils.follows = "k-framework/flake-utils"; + inputs.nixpkgs.follows = "k-framework/nixpkgs"; + }; + }; + + outputs = + { self, k-framework, nixpkgs, flake-utils, rv-utils, pyk, nixpkgs-pyk, poetry2nix, wasm-semantics, blockchain-k-plugin }@inputs: + let + overlay = (final: prev: + let + src = prev.lib.cleanSource (prev.nix-gitignore.gitignoreSourcePure [ + "/.github" + "flake.lock" + ./.gitignore + ] ./.); + + 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 { + kmultiversx-src = prev.stdenv.mkDerivation { + name = "kmultiversx-${self.rev or "dirty"}-src"; + src = prev.lib.cleanSource + (prev.nix-gitignore.gitignoreSourcePure [ + ./.gitignore + ".github/" + "result*" + "*.nix" + "deps/" + ] ./.); + dontBuild = true; + + installPhase = '' + mkdir $out + cp -r $src/* $out + chmod -R u+w $out + mkdir -p $out/kmultiversx/src/kmultiversx/kdist/plugin/ + cp -r ${prev.blockchain-k-plugin-src}/* $out/kmultiversx/src/kmultiversx/kdist/plugin/ + ''; + }; + + kmultiversx = prev.stdenv.mkDerivation { + pname = "kmultiversx"; + src = final.kmultiversx-src; + inherit version; + + buildInputs = with final; [ + secp256k1 + nixpkgs-pyk.pyk-python310 + k-framework.packages.${system}.k + kmultiversx-pyk + cmake + openssl.dev + clang + mpfr + pkg-config + procps + llvmPackages.llvm + ]; + + dontUseCmakeConfigure = true; + + nativeBuildInputs = [ prev.makeWrapper ]; + + enableParallelBuilding = true; + + buildPhase = '' + export XDG_CACHE_HOME=$(pwd) + ${ + prev.lib.optionalString + (prev.stdenv.isAarch64 && prev.stdenv.isDarwin) + "APPLE_SILICON=true" + } K_OPTS="-Xmx8G -Xss512m" kdist -v build mx-semantics.* -j$NIX_BUILD_CORES + ''; + + installPhase = '' + mkdir -p $out + cp -r ./kdist-*/* $out/ + ''; + }; + + kmultiversx-pyk = poetry2nix.mkPoetryApplication { + python = nixpkgs-pyk.python310; + projectDir = ./kmultiversx; + src = rv-utils.lib.mkSubdirectoryAppSrc { + pkgs = import nixpkgs { system = prev.system; }; + src = ./kmultiversx; + subdirectories = [ "pykwasm" ]; + cleaner = poetry2nix.cleanPythonSources; + }; + overrides = poetry2nix.overrides.withDefaults + (finalPython: prevPython: { + pyk = nixpkgs-pyk.pyk-python310; + pykwasm = wasm-semantics.packages.${prev.system}.kwasm-pyk; + hypothesis = prevPython.hypothesis.overridePythonAttrs (old: { + propagatedBuildInputs = prev.lib.filter + (x: !(prev.lib.strings.hasInfix "attrs" x.name)) + old.propagatedBuildInputs; + buildInputs = (old.buildInputs or []) ++ [ finalPython.attrs ]; + }); + }); + groups = [ ]; + checkGroups = [ ]; + postInstall = '' + mkdir -p $out/${nixpkgs-pyk.python310.sitePackages}/kmultiversx/kdist/plugin + cp -r ${prev.blockchain-k-plugin-src}/* $out/${nixpkgs-pyk.python310.sitePackages}/kmultiversx/kdist/plugin/ + ''; + }; + }); + in flake-utils.lib.eachSystem [ + "x86_64-linux" + "x86_64-darwin" + "aarch64-linux" + "aarch64-darwin" + ] (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ + blockchain-k-plugin.overlay + overlay + ]; + }; + in { + packages = rec { + inherit (pkgs) kmultiversx kmultiversx-pyk; + default = pkgs.kmultiversx; + }; + }) // { + overlays.default = overlay; + }; +} diff --git a/kmultiversx/poetry.lock b/kmultiversx/poetry.lock index 582ff742..c586b403 100644 --- a/kmultiversx/poetry.lock +++ b/kmultiversx/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "attrs" diff --git a/kmultiversx/pyproject.toml b/kmultiversx/pyproject.toml index 3197a6c9..1e7a149f 100644 --- a/kmultiversx/pyproject.toml +++ b/kmultiversx/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "kmultiversx" -version = "0.1.73" +version = "0.1.74" description = "Python tools for Elrond semantics" authors = [ "Runtime Verification, Inc. ", diff --git a/kmultiversx/src/kmultiversx/kdist/plugin.py b/kmultiversx/src/kmultiversx/kdist/plugin.py index 5edea14e..c7894f88 100644 --- a/kmultiversx/src/kmultiversx/kdist/plugin.py +++ b/kmultiversx/src/kmultiversx/kdist/plugin.py @@ -94,7 +94,7 @@ def ccopts(plugin_dir: Path) -> list[str]: f"-I{plugin_dir / 'libff/include'}", str(plugin_dir / 'plugin-c/crypto.cpp'), str(plugin_dir / 'plugin-c/plugin_util.cpp'), - ] + ['-lprocps'] if sys.platform == 'linux' else [] + ] + (['-lprocps'] if sys.platform == 'linux' else []) return KompileTarget( diff --git a/package/version b/package/version index 416eb55e..21f074df 100644 --- a/package/version +++ b/package/version @@ -1 +1 @@ -0.1.73 +0.1.74