diff --git a/.editorconfig b/.editorconfig index 81c47d69..40607fd1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,11 +8,24 @@ insert_final_newline = true trim_trailing_whitespace = true indent_style = space indent_size = 2 -max_line_length = 80 [*.{d,h,hpp,c,cpp,cxx,cs,hs,java,kt,py,rs,sol}] indent_size = 4 -[{Makefile,go.mod,go.sum,*.go,.gitmodules}] +[{Makefile,go.mod,go.sum,*.go,.gitmodules,dub.selections.json}] indent_style = tab indent_size = 4 +[*.md] +indent_style = space +# Prettier handles formatting for markdown files +# and `indent_size` is not enforcable because ordered and unordered lists use +# different indentation: +indent_size = unset +[**/Cargo.lock] +indent_style = space +indent_size = unset +[*.wit] +indent_style = space +indent_size = 2 +[*.rs] +indent_size = unset diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1f97b0bc..f74fe4e1 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,13 +1,12 @@ version: 2 updates: - -- package-ecosystem: github-actions - directory: "/" - schedule: - interval: daily - time: '00:00' - timezone: UTC - open-pull-requests-limit: 10 - commit-message: - prefix: "chore" - include: "scope" + - package-ecosystem: github-actions + directory: '/' + schedule: + interval: daily + time: '00:00' + timezone: UTC + open-pull-requests-limit: 10 + commit-message: + prefix: 'chore' + include: 'scope' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3914e770..a45d4304 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,11 @@ on: - main jobs: + lint: + uses: metacraft-labs/nixos-modules/.github/workflows/reusable-lint.yml@main + secrets: + NIX_GITHUB_TOKEN: ${{ secrets.NIX_GITHUB_TOKEN }} + CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} ci: uses: metacraft-labs/nixos-modules/.github/workflows/reusable-flake-checks-ci-matrix.yml@main secrets: diff --git a/.github/workflows/update-flake-lock.yml b/.github/workflows/update-flake-lock.yml index 8f0e2bd9..619818f4 100644 --- a/.github/workflows/update-flake-lock.yml +++ b/.github/workflows/update-flake-lock.yml @@ -8,7 +8,6 @@ on: schedule: - cron: 0 0 * * 0 - jobs: update-flake-lock: uses: metacraft-labs/nixos-modules/.github/workflows/reusable-update-flake-lock.yml@main diff --git a/.github/workflows/update-flake-packages.yml b/.github/workflows/update-flake-packages.yml index 4dba3f0a..24a998b3 100644 --- a/.github/workflows/update-flake-packages.yml +++ b/.github/workflows/update-flake-packages.yml @@ -1,8 +1,8 @@ -name: "Update Flake Packages ❄️" +name: 'Update Flake Packages ❄️' on: workflow_dispatch: schedule: - - cron: "0 0 * * *" # https://crontab.guru/#0_0_*_*_* + - cron: '0 0 * * *' # https://crontab.guru/#0_0_*_*_* jobs: update-flake-packages: diff --git a/.gitignore b/.gitignore index 7d7ab334..1cc5f0db 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ matrix.json matrix-pre.json matrix-post.json comment.md + +# Pre Commit +.pre-commit-config.yaml diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..60150f76 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,8 @@ +.direnv +node_modules +.yarn +.pnp.cjs +.pnp.loader.mjs +*.json +flake.lock +*.mdx diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 00000000..f0b537ed --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,8 @@ +{ + "tabWidth": 2, + "useTabs": false, + "singleQuote": true, + "semi": true, + "arrowParens": "avoid", + "trailingComma": "all" +} diff --git a/README.md b/README.md index ad68530f..2e05eae8 100644 --- a/README.md +++ b/README.md @@ -7,16 +7,15 @@ A Nix flake offering blockchain development tools This repo is provided as a Nix Flake. The packages defined here can be consumed via one of the flake output categories: -* `overlays.default` (which you can e.g. apply on top of Nixpkgs) - * All packages are placed inside the `metacraft-labs` namespace - * For example: `metacraft-labs.solana` -* `packages.${arch}.${pkg}` - suitable for use with `nix shell` - +- `overlays.default` (which you can e.g. apply on top of Nixpkgs) + - All packages are placed inside the `metacraft-labs` namespace + - For example: `metacraft-labs.solana` +- `packages.${arch}.${pkg}` - suitable for use with `nix shell` 1. Blockchain Node Software - + | package name | description | supported platforms | - |------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|---------------------------------------------| + | ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- | | [avalanche-cli]([avalanche-url]) | Helps developers develop and test subnets | x86_64-linux, x86_64-darwin, aarch64-darwin | | [bnb-beacon-node]([bnb-beacon-node-url]) | Blockchain with a flexible set of native assets and pluggable modules | x86_64-linux, x86_64-darwin, aarch64-darwin | | [cardano]([cardano-url]) | HTTP server & command-line for managing UTxOs and HD wallets in Cardano | x86_64-linux, x86_64-darwin | @@ -34,7 +33,7 @@ via one of the flake output categories: 2. ZK Circuit-related Software | package name | description | supported platforms | - |----------------------------------------|----------------------------------------------------------------------------|---------------------------------------------| + | -------------------------------------- | -------------------------------------------------------------------------- | ------------------------------------------- | | [circom]([circom-url]) | zkSnark circuit compiler | x86_64-linux, x86_64-darwin, aarch64-darwin | | [circom_runtime]([circom_runtime-url]) | The code needed to calculate the witness by a circuit compiled with circom | x86_64-linux, x86_64-darwin, aarch64-darwin | | [ffiasm]([ffiasm-url]) | A script that generates a Finite field Library in Intel64 and ARM Assembly | x86_64-linux, x86_64-darwin | @@ -46,22 +45,23 @@ via one of the flake output categories: 3. General Dev Tools | package name | description | supported platforms | - |------------------------------|---------------------------------------------------------------------------------------------------------------------------|---------------------------------------------| + | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- | | [emscripten][emscripten-url] | An LLVM-to-WebAssembly Compiler | x86_64-linux, x86_64-darwin, aarch64-darwin | | [kurtosis]([kurtosis-url]) | A platform for packaging and launching ephemeral backend stacks with a focus on approachability for the average developer | x86_64-linux | 4. Libraries - * Cryptography-related - | package name | description | supported platforms | - |----------------------------|--------------------------------------------------------------------------------|---------------------------------------------| - | [blst]([blst-url]) | Multilingual BLS12-381 signature library | x86_64-linux, x86_64-darwin, aarch64-darwin | - | [py-ecc]([py-ecc-url]) | Python implementation of ECC pairing and bn_128 and bls12_381 curve operations | x86_64-linux | + - Cryptography-related + + | package name | description | supported platforms | + | ---------------------- | ------------------------------------------------------------------------------ | ------------------------------------------- | + | [blst]([blst-url]) | Multilingual BLS12-381 signature library | x86_64-linux, x86_64-darwin, aarch64-darwin | + | [py-ecc]([py-ecc-url]) | Python implementation of ECC pairing and bn_128 and bls12_381 curve operations | x86_64-linux | - * General-purpose + - General-purpose | package name | description | supported platforms | - |----------------------------|------------------------------------------------|---------------------| + | -------------------------- | ---------------------------------------------- | ------------------- | | [pistache]([pistache-url]) | A high-performance REST toolkit written in C++ | x86_64-linux | [cosmos-url]: https://github.com/hyphacoop/testnets/blob/master/local/previous-local-testnets/v7-theta/priv_validator_key.json @@ -98,7 +98,7 @@ nix shell github:metacraft-labs/nix-blockchain-development#solana ### Declarative with Nix Flakes dev shell -* `flake.nix`: +- `flake.nix`: ```nix { @@ -144,7 +144,7 @@ nix shell github:metacraft-labs/nix-blockchain-development#solana } ``` -* `shell.nix`: +- `shell.nix`: ```nix {pkgs}: diff --git a/flake.lock b/flake.lock index 0673ea71..14072925 100644 --- a/flake.lock +++ b/flake.lock @@ -948,11 +948,11 @@ "vscode-server": "vscode-server" }, "locked": { - "lastModified": 1735319031, - "narHash": "sha256-vNj7Su3aCFwXIneaApag28c1kXXvws2R2Cnh/EDQJGM=", + "lastModified": 1736252821, + "narHash": "sha256-dWqGeDmasADnbjpGaEzu0pdXqECsmJeDX2eT3f9Cxcw=", "owner": "metacraft-labs", "repo": "nixos-modules", - "rev": "9c7963a35c4592be3455a5ed9f3bcfc2a798e994", + "rev": "f8d59d90b9ce8dfb7fba4e215ef85a8dbb004766", "type": "github" }, "original": { @@ -1143,11 +1143,11 @@ ] }, "locked": { - "lastModified": 1735266518, - "narHash": "sha256-2XkWYGgT+911gOLjgBj+8W8ZJk6P0qHJNz8RfKgT/5o=", + "lastModified": 1736390353, + "narHash": "sha256-e2SP1zV9CISHlYZwEhwT53N9CW7yPh0tKTR0vuQqiWc=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "e0b3654b716098b47f3643c65fbb75ef49c033e1", + "rev": "1033caad3e26a56050de55ba0384df5ff0fa5ebd", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 1a4abdb4..c2ece690 100644 --- a/flake.nix +++ b/flake.nix @@ -35,20 +35,35 @@ }; }; - outputs = inputs @ {flake-parts, ...}: - flake-parts.lib.mkFlake {inherit inputs;} { - systems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; - imports = [./packages]; - perSystem = { - final, - self', - ... - }: { - devShells.default = import ./shells/all.nix { - pkgs = final; - inherit self'; + outputs = + inputs@{ flake-parts, nixos-modules, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + imports = [ + nixos-modules.modules.flake.git-hooks + ./packages + ]; + perSystem = + { + final, + self', + config, + ... + }: + { + devShells.default = import ./shells/all.nix { + pkgs = final; + inherit self'; + }; + devShells.ci = import ./shells/ci.nix { + pkgs = final; + inherit config; + }; }; - devShells.ci = import ./shells/ci.nix {pkgs = final;}; - }; }; } diff --git a/packages/all-packages.nix b/packages/all-packages.nix index 0aed0d22..d39b87e4 100644 --- a/packages/all-packages.nix +++ b/packages/all-packages.nix @@ -1,179 +1,213 @@ -{...}: { - perSystem = { - pkgs, - self', - ... - }: let - inherit (pkgs) lib darwin hostPlatform symlinkJoin fetchFromGitHub; - inherit (pkgs.lib) optionalAttrs callPackageWith; - inherit - (self'.legacyPackages) - rustPlatformStable - craneLib-stable - cardano-node - cardano-cli - ; - python3Packages = pkgs.python3Packages; - - callPackage = callPackageWith (pkgs // {rustPlatform = rustPlatformStable;}); - darwinPkgs = { - inherit - (darwin.apple_sdk.frameworks) - CoreFoundation - Foundation - Security - SystemConfiguration +{ ... }: +{ + perSystem = + { + pkgs, + self', + ... + }: + let + inherit (pkgs) + lib + darwin + hostPlatform + symlinkJoin + fetchFromGitHub ; - }; + inherit (pkgs.lib) optionalAttrs callPackageWith; + inherit (self'.legacyPackages) + rustPlatformStable + craneLib-stable + cardano-node + cardano-cli + ; + python3Packages = pkgs.python3Packages; + + callPackage = callPackageWith (pkgs // { rustPlatform = rustPlatformStable; }); + darwinPkgs = { + inherit (darwin.apple_sdk.frameworks) + CoreFoundation + Foundation + Security + SystemConfiguration + ; + }; - # RapidSnark - ffiasm-src = callPackage ./ffiasm-src/default.nix {}; - zqfield = callPackage ./ffiasm/zqfield.nix { - inherit ffiasm-src; - }; - # Pairing Groups on BN-254, aka alt_bn128 - # Source: - # https://zips.z.cash/protocol/protocol.pdf (section 5.4.9.1) - # See also: - # https://eips.ethereum.org/EIPS/eip-196 - # https://eips.ethereum.org/EIPS/eip-197 - # https://hackmd.io/@aztec-network/ByzgNxBfd - # https://hackmd.io/@jpw/bn254 - zqfield-bn254 = symlinkJoin { - name = "zqfield-bn254"; - paths = [ - (zqfield { - primeNumber = "21888242871839275222246405745257275088696311157297823662689037894645226208583"; - name = "Fq"; - }) - (zqfield - { + # RapidSnark + ffiasm-src = callPackage ./ffiasm-src/default.nix { }; + zqfield = callPackage ./ffiasm/zqfield.nix { + inherit ffiasm-src; + }; + # Pairing Groups on BN-254, aka alt_bn128 + # Source: + # https://zips.z.cash/protocol/protocol.pdf (section 5.4.9.1) + # See also: + # https://eips.ethereum.org/EIPS/eip-196 + # https://eips.ethereum.org/EIPS/eip-197 + # https://hackmd.io/@aztec-network/ByzgNxBfd + # https://hackmd.io/@jpw/bn254 + zqfield-bn254 = symlinkJoin { + name = "zqfield-bn254"; + paths = [ + (zqfield { + primeNumber = "21888242871839275222246405745257275088696311157297823662689037894645226208583"; + name = "Fq"; + }) + (zqfield { primeNumber = "21888242871839275222246405745257275088548364400416034343698204186575808495617"; name = "Fr"; }) - ]; - }; - ffiasm = callPackage ./ffiasm/default.nix { - inherit ffiasm-src zqfield-bn254; - }; - rapidsnark = callPackage ./rapidsnark/default.nix { - inherit ffiasm zqfield-bn254; - }; - - # Elrond / MultiversX - # copied from https://github.com/NixOS/nixpkgs/blob/8df7949791250b580220eb266e72e77211bedad9/pkgs/development/python-modules/cryptography/default.nix - cattrs22-2 = pkgs.python3Packages.cattrs.overrideAttrs (finalAttrs: previousAttrs: { - version = "22.2.0"; - - src = fetchFromGitHub { - owner = "python-attrs"; - repo = "cattrs"; - rev = "v22.2.0"; - hash = "sha256-Qnrq/mIA/t0mur6IAen4vTmMIhILWS6v5nuf+Via2hA="; + ]; + }; + ffiasm = callPackage ./ffiasm/default.nix { + inherit ffiasm-src zqfield-bn254; + }; + rapidsnark = callPackage ./rapidsnark/default.nix { + inherit ffiasm zqfield-bn254; }; - patches = []; - }); - cryptography36 = callPackage ./python-modules/cryptography36/default.nix {}; - - py-ecc = callPackage ./python-modules/py-ecc/default.nix { - inherit (python3Packages) buildPythonPackage cached-property eth-typing eth-utils mypy-extensions pytestCheckHook pythonOlder; - }; - - ledgercomm = callPackage ./python-modules/ledgercomm/default.nix {}; - requests-cache = callPackage ./python-modules/requests-cache/default.nix {inherit cattrs22-2;}; - - corepack-shims = callPackage ./corepack-shims/default.nix {}; + # Elrond / MultiversX + # copied from https://github.com/NixOS/nixpkgs/blob/8df7949791250b580220eb266e72e77211bedad9/pkgs/development/python-modules/cryptography/default.nix + cattrs22-2 = pkgs.python3Packages.cattrs.overrideAttrs ( + finalAttrs: previousAttrs: { + version = "22.2.0"; + + src = fetchFromGitHub { + owner = "python-attrs"; + repo = "cattrs"; + rev = "v22.2.0"; + hash = "sha256-Qnrq/mIA/t0mur6IAen4vTmMIhILWS6v5nuf+Via2hA="; + }; + + patches = [ ]; + } + ); + cryptography36 = callPackage ./python-modules/cryptography36/default.nix { }; + + py-ecc = callPackage ./python-modules/py-ecc/default.nix { + inherit (python3Packages) + buildPythonPackage + cached-property + eth-typing + eth-utils + mypy-extensions + pytestCheckHook + pythonOlder + ; + }; - erdpy = callPackage ./erdpy/default.nix {inherit cryptography36 elrond-go elrond-proxy-go ledgercomm requests-cache;}; - elrond-go = callPackage ./elrond-go/default.nix {}; - elrond-proxy-go = callPackage ./elrond-proxy-go/default.nix {}; + ledgercomm = callPackage ./python-modules/ledgercomm/default.nix { }; + requests-cache = callPackage ./python-modules/requests-cache/default.nix { inherit cattrs22-2; }; - graphql = callPackage ./graphql/default.nix {inherit cardano-cli cardano-node;}; - cardano = callPackage ./cardano/default.nix {inherit cardano-cli cardano-node graphql;}; + corepack-shims = callPackage ./corepack-shims/default.nix { }; - polkadot-generic = callPackage ./polkadot/default.nix { - craneLib = craneLib-stable; - inherit (darwin) libiconv; - inherit - (darwinPkgs) - CoreFoundation - Security - SystemConfiguration - ; - }; - polkadot = polkadot-generic {}; - polkadot-fast = polkadot-generic {enableFastRuntime = true;}; - in { - legacyPackages.metacraft-labs = - rec { - gaiad = callPackage ./gaiad {}; - cosmos-theta-testnet = callPackage ./cosmos-theta-testnet {inherit gaiad;}; - blst = callPackage ./blst {}; - bnb-beacon-node = callPackage ./bnb-beacon-node {}; - - circom = callPackage ./circom/default.nix {craneLib = craneLib-stable;}; - circ = callPackage ./circ/default.nix {craneLib = craneLib-stable;}; - - emscripten = pkgs.emscripten.overrideAttrs (_old: { - postInstall = '' - pushd $TMPDIR - echo 'int __main_argc_argv( int a, int b ) { return 42; }' >test.c - for MEM in "-s ALLOW_MEMORY_GROWTH" ""; do - for LTO in -flto ""; do - # FIXME: change to the following, once binaryen is updated to - # >= v119 in Nixpkgs: - # for OPT in "-O2" "-O3" "-Oz" "-Os"; do - for OPT in "-O2"; do - $out/bin/emcc $MEM $LTO $OPT -s WASM=1 -s STANDALONE_WASM test.c + erdpy = callPackage ./erdpy/default.nix { + inherit + cryptography36 + elrond-go + elrond-proxy-go + ledgercomm + requests-cache + ; + }; + elrond-go = callPackage ./elrond-go/default.nix { }; + elrond-proxy-go = callPackage ./elrond-proxy-go/default.nix { }; + + graphql = callPackage ./graphql/default.nix { inherit cardano-cli cardano-node; }; + cardano = callPackage ./cardano/default.nix { inherit cardano-cli cardano-node graphql; }; + + polkadot-generic = callPackage ./polkadot/default.nix { + craneLib = craneLib-stable; + inherit (darwin) libiconv; + inherit (darwinPkgs) + CoreFoundation + Security + SystemConfiguration + ; + }; + polkadot = polkadot-generic { }; + polkadot-fast = polkadot-generic { enableFastRuntime = true; }; + in + { + legacyPackages.metacraft-labs = + rec { + gaiad = callPackage ./gaiad { }; + cosmos-theta-testnet = callPackage ./cosmos-theta-testnet { inherit gaiad; }; + blst = callPackage ./blst { }; + bnb-beacon-node = callPackage ./bnb-beacon-node { }; + + circom = callPackage ./circom/default.nix { craneLib = craneLib-stable; }; + circ = callPackage ./circ/default.nix { craneLib = craneLib-stable; }; + + emscripten = pkgs.emscripten.overrideAttrs (_old: { + postInstall = '' + pushd $TMPDIR + echo 'int __main_argc_argv( int a, int b ) { return 42; }' >test.c + for MEM in "-s ALLOW_MEMORY_GROWTH" ""; do + for LTO in -flto ""; do + # FIXME: change to the following, once binaryen is updated to + # >= v119 in Nixpkgs: + # for OPT in "-O2" "-O3" "-Oz" "-Os"; do + for OPT in "-O2"; do + $out/bin/emcc $MEM $LTO $OPT -s WASM=1 -s STANDALONE_WASM test.c + done done done - done - ''; - }); - - go-opera = callPackage ./go-opera/default.nix {}; - - circom_runtime = callPackage ./circom_runtime/default.nix {}; - - # Polkadot - inherit polkadot polkadot-fast; - - avalanche-cli = callPackage ./avalanche-cli/default.nix { - inherit blst; - }; - - inherit corepack-shims; - } - // lib.optionalAttrs hostPlatform.isLinux rec { - kurtosis = callPackage ./kurtosis/default.nix {}; - - wasmd = callPackage ./wasmd/default.nix {}; - - # Solana - # solana-validator = callPackage ./solana-validator {}; - - # inherit cryptography36; - - inherit py-ecc; - # inherit erdpy elrond-go elrond-proxy-go; - - # EOS / Antelope - leap = callPackage ./leap/default.nix {}; - eos-vm = callPackage ./eos-vm/default.nix {}; - cdt = callPackage ./cdt/default.nix {}; - } - // lib.optionalAttrs hostPlatform.isx86 rec { - inherit zqfield-bn254 ffiasm ffiasm-src rapidsnark; - - inherit cardano graphql; - } - // lib.optionalAttrs (hostPlatform.isx86 && hostPlatform.isLinux) rec { - pistache = callPackage ./pistache/default.nix {}; - inherit zqfield-bn254; - rapidsnark-server = callPackage ./rapidsnark-server/default.nix { - inherit ffiasm zqfield-bn254 rapidsnark pistache; + ''; + }); + + go-opera = callPackage ./go-opera/default.nix { }; + + circom_runtime = callPackage ./circom_runtime/default.nix { }; + + # Polkadot + inherit polkadot polkadot-fast; + + avalanche-cli = callPackage ./avalanche-cli/default.nix { + inherit blst; + }; + + inherit corepack-shims; + } + // lib.optionalAttrs hostPlatform.isLinux rec { + kurtosis = callPackage ./kurtosis/default.nix { }; + + wasmd = callPackage ./wasmd/default.nix { }; + + # Solana + # solana-validator = callPackage ./solana-validator {}; + + # inherit cryptography36; + + inherit py-ecc; + # inherit erdpy elrond-go elrond-proxy-go; + + # EOS / Antelope + leap = callPackage ./leap/default.nix { }; + eos-vm = callPackage ./eos-vm/default.nix { }; + cdt = callPackage ./cdt/default.nix { }; + } + // lib.optionalAttrs hostPlatform.isx86 rec { + inherit + zqfield-bn254 + ffiasm + ffiasm-src + rapidsnark + ; + + inherit cardano graphql; + } + // lib.optionalAttrs (hostPlatform.isx86 && hostPlatform.isLinux) rec { + pistache = callPackage ./pistache/default.nix { }; + inherit zqfield-bn254; + rapidsnark-server = callPackage ./rapidsnark-server/default.nix { + inherit + ffiasm + zqfield-bn254 + rapidsnark + pistache + ; + }; }; - }; - }; + }; } diff --git a/packages/avalanche-cli/default.nix b/packages/avalanche-cli/default.nix index 772469fe..de95bb33 100644 --- a/packages/avalanche-cli/default.nix +++ b/packages/avalanche-cli/default.nix @@ -25,13 +25,16 @@ buildGoModule rec { "-X=github.com/ava-labs/avalanche-cli/cmd.Version=${version}" ]; - buildInputs = [blst libusb1]; + buildInputs = [ + blst + libusb1 + ]; meta = { description = ""; homepage = "https://github.com/ava-labs/avalanche-cli"; # FIXME: nix-init did not find a license - maintainers = with lib.maintainers; []; + maintainers = with lib.maintainers; [ ]; mainProgram = "avalanche-cli"; }; } diff --git a/packages/blst/default.nix b/packages/blst/default.nix index fc75629a..3cc8655b 100644 --- a/packages/blst/default.nix +++ b/packages/blst/default.nix @@ -18,6 +18,11 @@ stdenv.mkDerivation rec { meta = { description = "Multilingual BLS12-381 signature library"; homepage = "https://github.com/supranational/blst"; - platforms = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]; + platforms = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; }; } diff --git a/packages/bnb-beacon-node/config/gentxs/node0.json b/packages/bnb-beacon-node/config/gentxs/node0.json index 94b15202..61122f55 100644 --- a/packages/bnb-beacon-node/config/gentxs/node0.json +++ b/packages/bnb-beacon-node/config/gentxs/node0.json @@ -47,4 +47,4 @@ "source": "0", "data": null } -} \ No newline at end of file +} diff --git a/packages/bnb-beacon-node/config/node0/gaiacli/key_seed.json b/packages/bnb-beacon-node/config/node0/gaiacli/key_seed.json index d36893cd..65d5d64c 100644 --- a/packages/bnb-beacon-node/config/node0/gaiacli/key_seed.json +++ b/packages/bnb-beacon-node/config/node0/gaiacli/key_seed.json @@ -1 +1 @@ -{"secret":"paddle bullet neck stage bottom link require hawk rough consider fold zebra tissue wreck cake produce subway double cram cereal open ice element salt"} \ No newline at end of file +{"secret":"paddle bullet neck stage bottom link require hawk rough consider fold zebra tissue wreck cake produce subway double cram cereal open ice element salt"} diff --git a/packages/bnb-beacon-node/config/node0/gaiad/config/genesis.json b/packages/bnb-beacon-node/config/node0/gaiad/config/genesis.json index 555dc542..3f9905eb 100644 --- a/packages/bnb-beacon-node/config/node0/gaiad/config/genesis.json +++ b/packages/bnb-beacon-node/config/node0/gaiad/config/genesis.json @@ -275,4 +275,4 @@ } ] } -} \ No newline at end of file +} diff --git a/packages/bnb-beacon-node/config/node0/gaiad/config/node_key.json b/packages/bnb-beacon-node/config/node0/gaiad/config/node_key.json index 133010ee..794060ee 100644 --- a/packages/bnb-beacon-node/config/node0/gaiad/config/node_key.json +++ b/packages/bnb-beacon-node/config/node0/gaiad/config/node_key.json @@ -1 +1 @@ -{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"n37n154ohDEZb9bQoCHvZ3TWdDjMgu149V3vPhG4k/GG29WbI01SFqwhWUO9q1FOWQ2iPQNTBNnsJ4xKReGCdA=="}} \ No newline at end of file +{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"n37n154ohDEZb9bQoCHvZ3TWdDjMgu149V3vPhG4k/GG29WbI01SFqwhWUO9q1FOWQ2iPQNTBNnsJ4xKReGCdA=="}} diff --git a/packages/bnb-beacon-node/config/node0/gaiad/config/priv_validator_key.json b/packages/bnb-beacon-node/config/node0/gaiad/config/priv_validator_key.json index 54d6213c..be541770 100644 --- a/packages/bnb-beacon-node/config/node0/gaiad/config/priv_validator_key.json +++ b/packages/bnb-beacon-node/config/node0/gaiad/config/priv_validator_key.json @@ -8,4 +8,4 @@ "type": "tendermint/PrivKeyEd25519", "value": "tol2TFACZYJNM+UxlbJ2Y+/xlxj7j8uaQFff91TxLyBRpIIYcj5mART4c+k+O2hbOuj2TTmDRQh0jwb9Cs8UOw==" } -} \ No newline at end of file +} diff --git a/packages/bnb-beacon-node/config/node0/gaiad/data/priv_validator_state.json b/packages/bnb-beacon-node/config/node0/gaiad/data/priv_validator_state.json index ca3ad2f7..7dc5ebc6 100644 --- a/packages/bnb-beacon-node/config/node0/gaiad/data/priv_validator_state.json +++ b/packages/bnb-beacon-node/config/node0/gaiad/data/priv_validator_state.json @@ -2,4 +2,4 @@ "height": "0", "round": "0", "step": 0 -} \ No newline at end of file +} diff --git a/packages/bnb-beacon-node/default.nix b/packages/bnb-beacon-node/default.nix index 00208df4..9f9d6b57 100644 --- a/packages/bnb-beacon-node/default.nix +++ b/packages/bnb-beacon-node/default.nix @@ -28,14 +28,17 @@ buildGoModule rec { libpcap ]; - ldflags = ["-s" "-w"]; + ldflags = [ + "-s" + "-w" + ]; meta = with lib; { description = ""; homepage = "https://github.com/bnb-chain/node"; changelog = "https://github.com/bnb-chain/node/blob/${src.rev}/CHANGELOG.md"; license = licenses.mpl20; - maintainers = with maintainers; []; + maintainers = with maintainers; [ ]; mainProgram = "bnb-beacon-node"; }; diff --git a/packages/cardano/default.nix b/packages/cardano/default.nix index 0710c556..886c5ef7 100644 --- a/packages/cardano/default.nix +++ b/packages/cardano/default.nix @@ -4,32 +4,41 @@ cardano-cli, graphql, symlinkJoin, -}: let +}: +let in - symlinkJoin rec { - name = "cardano-automation-${version}"; - version = "0-unstable-2023-04-25"; - paths = [graphql automate cardano-node cardano-cli]; - src = pkgs.fetchFromGitHub { - owner = "metacraft-labs"; - repo = "cardano-private-testnet-setup"; - rev = "7ad1b05b28817a1d6f9e8cd784d1654e92a62f5f"; - hash = "sha256-pzI+Hhs85rdonWRxKiZN7OSgh5fx/u1ip2zHWGpbWMA="; - }; +symlinkJoin rec { + name = "cardano-automation-${version}"; + version = "0-unstable-2023-04-25"; + paths = [ + graphql + automate + cardano-node + cardano-cli + ]; + src = pkgs.fetchFromGitHub { + owner = "metacraft-labs"; + repo = "cardano-private-testnet-setup"; + rev = "7ad1b05b28817a1d6f9e8cd784d1654e92a62f5f"; + hash = "sha256-pzI+Hhs85rdonWRxKiZN7OSgh5fx/u1ip2zHWGpbWMA="; + }; - automate = pkgs.writeShellApplication { - name = "run-cardano-local-testnet"; + automate = pkgs.writeShellApplication { + name = "run-cardano-local-testnet"; - runtimeInputs = [cardano-node cardano-cli]; - text = '' - cd ${src} - if [ -z "$CARDANO_TESTNET_DIR" ]; then - echo "Error: CARDANO_TESTNET_DIR is not set." - echo "Please set the environment variable and try again." - exit 1 - fi - export CARDANO_TESTNET_DIR="$CARDANO_TESTNET_DIR" - ${src}/scripts/automate.sh - ''; - }; - } + runtimeInputs = [ + cardano-node + cardano-cli + ]; + text = '' + cd ${src} + if [ -z "$CARDANO_TESTNET_DIR" ]; then + echo "Error: CARDANO_TESTNET_DIR is not set." + echo "Please set the environment variable and try again." + exit 1 + fi + export CARDANO_TESTNET_DIR="$CARDANO_TESTNET_DIR" + ${src}/scripts/automate.sh + ''; + }; +} diff --git a/packages/cargo-build-bpf/patches/Cargo.lock.diff b/packages/cargo-build-bpf/patches/Cargo.lock.diff index 1db89ae9..22d9b7d5 100644 --- a/packages/cargo-build-bpf/patches/Cargo.lock.diff +++ b/packages/cargo-build-bpf/patches/Cargo.lock.diff @@ -9,4 +9,4 @@ index 898e916f8a..c22aaae0d4 100644 - "solana-download-utils", "solana-sdk 1.10.11", "tar", - ] +] diff --git a/packages/cargo-build-bpf/patches/Cargo.toml.diff b/packages/cargo-build-bpf/patches/Cargo.toml.diff index b6a863b2..67853d54 100644 --- a/packages/cargo-build-bpf/patches/Cargo.toml.diff +++ b/packages/cargo-build-bpf/patches/Cargo.toml.diff @@ -3,10 +3,9 @@ index 888b59a101..86968aef4f 100644 --- a/sdk/cargo-build-bpf/Cargo.toml +++ b/sdk/cargo-build-bpf/Cargo.toml @@ -14,7 +14,6 @@ bzip2 = "0.4.3" - cargo_metadata = "0.14.2" - clap = { version = "3.1.5", features = ["cargo", "env"] } - regex = "1.5.4" + cargo_metadata = "0.14.2" + clap = { version = "3.1.5", features = ["cargo", "env"] } + regex = "1.5.4" -solana-download-utils = { path = "../../download-utils", version = "=1.10.11" } - solana-sdk = { path = "..", version = "=1.10.11" } - tar = "0.4.38" - + solana-sdk = { path = "..", version = "=1.10.11" } + tar = "0.4.38" diff --git a/packages/cargo-build-bpf/patches/main.rs.diff b/packages/cargo-build-bpf/patches/main.rs.diff index 8cfe4351..81828a47 100644 --- a/packages/cargo-build-bpf/patches/main.rs.diff +++ b/packages/cargo-build-bpf/patches/main.rs.diff @@ -3,17 +3,17 @@ index a602f6715f..a2451f3ce1 100644 --- a/sdk/cargo-build-bpf/src/main.rs +++ b/sdk/cargo-build-bpf/src/main.rs @@ -2,7 +2,6 @@ use { - bzip2::bufread::BzDecoder, - clap::{crate_description, crate_name, crate_version, Arg}, - regex::Regex, + bzip2::bufread::BzDecoder, + clap::{crate_description, crate_name, crate_version, Arg}, + regex::Regex, - solana_download_utils::download_file, - solana_sdk::signature::{write_keypair_file, Keypair}, - std::{ - collections::{HashMap, HashSet}, + solana_sdk::signature::{write_keypair_file, Keypair}, + std::{ + collections::{HashMap, HashSet}, @@ -113,81 +112,12 @@ where - - // Check whether a package is installed and install it if missing. - fn install_if_missing( + +// Check whether a package is installed and install it if missing. +fn install_if_missing( - config: &Config, - package: &str, - url: &str, @@ -24,7 +24,7 @@ index a602f6715f..a2451f3ce1 100644 + _url: &str, + _download_file_name: &str, + _target_path: &Path, - ) -> Result<(), String> { +) -> Result<(), String> { - // Check whether the target path is an empty directory. This can - // happen if package download failed on previous run of - // cargo-build-bpf. Remove the target_path directory in this @@ -94,6 +94,5 @@ index a602f6715f..a2451f3ce1 100644 - std::os::windows::fs::symlink_dir(target_path, source_path) - .map_err(|err| err.to_string())?; - } - Ok(()) - } - + Ok(()) +} diff --git a/packages/cdt/default.nix b/packages/cdt/default.nix index 933507a6..e031417e 100644 --- a/packages/cdt/default.nix +++ b/packages/cdt/default.nix @@ -15,13 +15,18 @@ clangStdenv.mkDerivation rec { openssl.dev libusb1.dev bzip2.dev - (boost.override - { - enableShared = false; - enabledStatic = true; - }) + (boost.override { + enableShared = false; + enabledStatic = true; + }) + ]; + nativeBuildInputs = with pkgs; [ + pkg-config + cmake + clang + git + python3 ]; - nativeBuildInputs = with pkgs; [pkg-config cmake clang git python3]; src = fetchgit { url = "https://github.com/AntelopeIO/cdt"; diff --git a/packages/circ/default.nix b/packages/circ/default.nix index 854db32e..cb859f67 100644 --- a/packages/circ/default.nix +++ b/packages/circ/default.nix @@ -11,7 +11,8 @@ cbc, binutils, gnum4, -}: let +}: +let commonArgs = rec { pname = "circ"; version = "unstable-2024-04-17"; @@ -29,7 +30,15 @@ gcc openssl cvc4 - (cbc.overrideAttrs (finalAttrs: previousAttrs: {configureFlags = ["-C" "--enable-static" "CXXFLAGS=-std=c++14"];})) + (cbc.overrideAttrs ( + finalAttrs: previousAttrs: { + configureFlags = [ + "-C" + "--enable-static" + "CXXFLAGS=-std=c++14" + ]; + } + )) binutils gnum4 ]; @@ -37,40 +46,45 @@ cargoArtifacts = craneLib.buildDepsOnly commonArgs; in - craneLib.buildPackage (commonArgs - // rec { - inherit cargoArtifacts; +craneLib.buildPackage ( + commonArgs + // rec { + inherit cargoArtifacts; - installPhase = '' - runHook preInstall + installPhase = '' + runHook preInstall - mkdir -p $out/bin - mv target/release/examples/circ $out/bin + mkdir -p $out/bin + mv target/release/examples/circ $out/bin - runHook postInstall - ''; + runHook postInstall + ''; - buildNoDefaultFeatures = true; - buildFeatures = [ - "c" - "zok" - "datalog" - "smt" - "lp" - "aby" - "kahip" - "kahypar" - "r1cs" - "poly" - "spartan" - "bellman" - ]; + buildNoDefaultFeatures = true; + buildFeatures = [ + "c" + "zok" + "datalog" + "smt" + "lp" + "aby" + "kahip" + "kahypar" + "r1cs" + "poly" + "spartan" + "bellman" + ]; - meta = with lib; { - description = "Cir)cuit (C)ompiler. Compiling high-level languages to circuits for SMT, zero-knowledge proofs, and more"; - homepage = "https://github.com/circify/circ"; - license = with licenses; [asl20 mit]; - maintainers = with maintainers; []; - platforms = with platforms; linux ++ darwin; - }; - }) + meta = with lib; { + description = "Cir)cuit (C)ompiler. Compiling high-level languages to circuits for SMT, zero-knowledge proofs, and more"; + homepage = "https://github.com/circify/circ"; + license = with licenses; [ + asl20 + mit + ]; + maintainers = with maintainers; [ ]; + platforms = with platforms; linux ++ darwin; + }; + } +) diff --git a/packages/circom/default.nix b/packages/circom/default.nix index f6426deb..36782a31 100644 --- a/packages/circom/default.nix +++ b/packages/circom/default.nix @@ -5,16 +5,13 @@ rustPlatform, craneLib, fetchFromGitHub, -}: let +}: +let commonArgs = rec { pname = "circom"; version = "2.1.5"; - buildInputs = - [] - ++ ( - lib.optionals stdenv.isDarwin [darwin.apple_sdk.frameworks.Security] - ); + buildInputs = [ ] ++ (lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ]); nativeBuildInputs = [ rustPlatform.bindgenHook ]; @@ -29,9 +26,11 @@ cargoArtifacts = craneLib.buildDepsOnly commonArgs; in - craneLib.buildPackage (commonArgs - // rec { - inherit cargoArtifacts; +craneLib.buildPackage ( + commonArgs + // rec { + inherit cargoArtifacts; - doCheck = false; - }) + doCheck = false; + } +) diff --git a/packages/circom_runtime/default.nix b/packages/circom_runtime/default.nix index 665c6066..2882c827 100644 --- a/packages/circom_runtime/default.nix +++ b/packages/circom_runtime/default.nix @@ -1,23 +1,26 @@ -{pkgs}: +{ pkgs }: with pkgs; - buildNpmPackage rec { - pname = "circom_runtime"; - version = "0.1.24"; - src = fetchFromGitHub { - owner = "iden3"; - repo = "circom_runtime"; - rev = "v${version}"; - hash = "sha256-iC6kqVn1ixJlcuf+t2wbC+0/sCcXGvSRfuheLiW0Egs="; - }; +buildNpmPackage rec { + pname = "circom_runtime"; + version = "0.1.24"; + src = fetchFromGitHub { + owner = "iden3"; + repo = "circom_runtime"; + rev = "v${version}"; + hash = "sha256-iC6kqVn1ixJlcuf+t2wbC+0/sCcXGvSRfuheLiW0Egs="; + }; - npmDepsHash = "sha256-LvgKNazeoS7FcsjFDHnA9ZLePOesFu6eeEWDRGQRPLE="; + npmDepsHash = "sha256-LvgKNazeoS7FcsjFDHnA9ZLePOesFu6eeEWDRGQRPLE="; - nativeBuildInputs = with pkgs; [gtest nodejs]; + nativeBuildInputs = with pkgs; [ + gtest + nodejs + ]; - buildInputs = with pkgs; []; + buildInputs = with pkgs; [ ]; - meta = with lib; { - homepage = "https://github.com/iden3/circom_runtime"; - platforms = with platforms; linux ++ darwin; - }; - } + meta = with lib; { + homepage = "https://github.com/iden3/circom_runtime"; + platforms = with platforms; linux ++ darwin; + }; +} diff --git a/packages/corepack-shims/default.nix b/packages/corepack-shims/default.nix index a480ddd6..9157de2a 100644 --- a/packages/corepack-shims/default.nix +++ b/packages/corepack-shims/default.nix @@ -4,8 +4,8 @@ }: stdenv.mkDerivation { name = "corepack-shims"; - buildInputs = [nodejs]; - phases = ["installPhase"]; + buildInputs = [ nodejs ]; + phases = [ "installPhase" ]; installPhase = '' mkdir -p $out/bin corepack enable --install-directory=$out/bin diff --git a/packages/cosmos-theta-testnet/default.nix b/packages/cosmos-theta-testnet/default.nix index 1b309558..54bca1a3 100644 --- a/packages/cosmos-theta-testnet/default.nix +++ b/packages/cosmos-theta-testnet/default.nix @@ -4,27 +4,26 @@ runCommand, symlinkJoin, gaiad, -}: let +}: +let dir = "local/previous-local-testnets/v7-theta"; v7-local-testnet-files = fetchFromGitHub { owner = "hyphacoop"; repo = "testnets"; rev = "16f13e4ec649445387d4be0edf92eaaae7619c88"; - sparseCheckout = [dir]; + sparseCheckout = [ dir ]; hash = "sha256-TFN0CtaSsfEHBxYhoFl8m5pu0iVLoW4aK2ArkyQOymk="; }; in - symlinkJoin { - name = "cosmos-theta-testnet"; - paths = [ - gaiad - ( - runCommand "create-data-dir" {} '' - mkdir -p $out/data - cp ${v7-local-testnet-files}/${dir}/priv_validator_key.json $out/data - gunzip -c ${v7-local-testnet-files}/${dir}/genesis.json.gz > $out/data/genesis.json - '' - ) - ]; - meta = gaiad.meta; - } +symlinkJoin { + name = "cosmos-theta-testnet"; + paths = [ + gaiad + (runCommand "create-data-dir" { } '' + mkdir -p $out/data + cp ${v7-local-testnet-files}/${dir}/priv_validator_key.json $out/data + gunzip -c ${v7-local-testnet-files}/${dir}/genesis.json.gz > $out/data/genesis.json + '') + ]; + meta = gaiad.meta; +} diff --git a/packages/default.nix b/packages/default.nix index 5832c83e..1e70c1e4 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -2,84 +2,104 @@ inputs, lib, ... -}: { - imports = [inputs.flake-parts.flakeModules.easyOverlay ./all-packages.nix]; - perSystem = { - self', - inputs', - pkgs, - system, - ... - }: let - pkgs-with-rust-overlay = let - rust-overlay = inputs.rust-overlay.overlays.default; - in - pkgs.extend rust-overlay; +}: +{ + imports = [ + inputs.flake-parts.flakeModules.easyOverlay + ./all-packages.nix + ]; + perSystem = + { + self', + inputs', + pkgs, + system, + ... + }: + let + pkgs-with-rust-overlay = + let + rust-overlay = inputs.rust-overlay.overlays.default; + in + pkgs.extend rust-overlay; - rust-stable = pkgs-with-rust-overlay.rust-bin.stable.latest.default.override { - extensions = ["rust-src"]; - targets = ["wasm32-wasi" "wasm32-unknown-unknown"]; - }; - rust-nightly = pkgs-with-rust-overlay.rust-bin.nightly.latest.default.override { - extensions = ["rust-src"]; - targets = ["wasm32-wasi" "wasm32-unknown-unknown"]; - }; + rust-stable = pkgs-with-rust-overlay.rust-bin.stable.latest.default.override { + extensions = [ "rust-src" ]; + targets = [ + "wasm32-wasi" + "wasm32-unknown-unknown" + ]; + }; + rust-nightly = pkgs-with-rust-overlay.rust-bin.nightly.latest.default.override { + extensions = [ "rust-src" ]; + targets = [ + "wasm32-wasi" + "wasm32-unknown-unknown" + ]; + }; - craneLib-stable = (inputs.crane.mkLib pkgs).overrideToolchain rust-stable; - craneLib-nightly = (inputs.crane.mkLib pkgs).overrideToolchain rust-nightly; + craneLib-stable = (inputs.crane.mkLib pkgs).overrideToolchain rust-stable; + craneLib-nightly = (inputs.crane.mkLib pkgs).overrideToolchain rust-nightly; - cardano-node = builtins.getFlake "github:input-output-hk/cardano-node/f0b4ac897dcbefba9fa0d247b204a24543cf55f6"; + cardano-node = builtins.getFlake "github:input-output-hk/cardano-node/f0b4ac897dcbefba9fa0d247b204a24543cf55f6"; - reexportedPackages = { - ethereum_nix = - { - # geth = inputs'.ethereum_nix.packages.geth; # TODO: re-enable when flake show/check passes - } - // lib.optionalAttrs (pkgs.hostPlatform.isx86 && pkgs.hostPlatform.isLinux) { - # nimbus = inputs'.ethereum_nix.packages.nimbus-eth2; # TODO: re-enable when flake show/check passes - }; - # noir = { - # nargo = inputs'.noir.packages.nargo; - # noirc_abi_wasm = inputs'.noir.packages.noirc_abi_wasm; - # acvm_js = inputs'.noir.packages.acvm_js; - # }; - }; + reexportedPackages = { + ethereum_nix = + { + # geth = inputs'.ethereum_nix.packages.geth; # TODO: re-enable when flake show/check passes + } + // lib.optionalAttrs (pkgs.hostPlatform.isx86 && pkgs.hostPlatform.isLinux) { + # nimbus = inputs'.ethereum_nix.packages.nimbus-eth2; # TODO: re-enable when flake show/check passes + }; + # noir = { + # nargo = inputs'.noir.packages.nargo; + # noirc_abi_wasm = inputs'.noir.packages.noirc_abi_wasm; + # acvm_js = inputs'.noir.packages.acvm_js; + # }; + }; - disabledPackages = [ - "circ" - "leap" - "go-opera" - ]; - in rec { - packages = self'.legacyPackages.metacraft-labs; + disabledPackages = [ + "circ" + "leap" + "go-opera" + ]; + in + rec { + packages = self'.legacyPackages.metacraft-labs; - checks = - (builtins.removeAttrs self'.legacyPackages.metacraft-labs disabledPackages) - // reexportedPackages.ethereum_nix; - # // reexportedPackages.noir; + checks = + (builtins.removeAttrs self'.legacyPackages.metacraft-labs disabledPackages) + // reexportedPackages.ethereum_nix; + # // reexportedPackages.noir; - overlayAttrs = { - inherit (self'.legacyPackages) metacraft-labs nix2container noir; - }; + overlayAttrs = { + inherit (self'.legacyPackages) metacraft-labs nix2container noir; + }; - legacyPackages = { - inherit (inputs'.nix2container.packages) nix2container; + legacyPackages = { + inherit (inputs'.nix2container.packages) nix2container; - inherit (cardano-node.outputs.packages.${system}) cardano-node cardano-cli; + inherit (cardano-node.outputs.packages.${system}) cardano-node cardano-cli; - noir = inputs'.noir.packages; - ethereum_nix = inputs'.ethereum_nix.packages; + noir = inputs'.noir.packages; + ethereum_nix = inputs'.ethereum_nix.packages; - inherit rust-stable rust-nightly craneLib-stable craneLib-nightly pkgs-with-rust-overlay; + inherit + rust-stable + rust-nightly + craneLib-stable + craneLib-nightly + pkgs-with-rust-overlay + ; - rustPlatformStable = pkgs.makeRustPlatform { - rustc = rust-stable; - cargo = rust-stable; - }; - rustPlatformNightly = pkgs.makeRustPlatform { - rustc = rust-nightly; - cargo = rust-nightly; + rustPlatformStable = pkgs.makeRustPlatform { + rustc = rust-stable; + cargo = rust-stable; + }; + rustPlatformNightly = pkgs.makeRustPlatform { + rustc = rust-nightly; + cargo = rust-nightly; + }; }; }; - }; } diff --git a/packages/elrond-go/default.nix b/packages/elrond-go/default.nix index 1a424807..923476a3 100644 --- a/packages/elrond-go/default.nix +++ b/packages/elrond-go/default.nix @@ -1,69 +1,74 @@ -{pkgs}: +{ pkgs }: with pkgs; - buildGo117Module rec { - pname = "elrond-go"; - version = "1.3.44"; +buildGo117Module rec { + pname = "elrond-go"; + version = "1.3.44"; - src = fetchgit { - url = "https://github.com/ElrondNetwork/elrond-go"; - rev = "v${version}"; - sha256 = "sha256-GbYhgFaaytIwd0X58/XcuP69hewO6nH7UgHEj3h7ToU="; - }; + src = fetchgit { + url = "https://github.com/ElrondNetwork/elrond-go"; + rev = "v${version}"; + sha256 = "sha256-GbYhgFaaytIwd0X58/XcuP69hewO6nH7UgHEj3h7ToU="; + }; - bls-go-binary-headers = fetchgit { - url = "https://github.com/herumi/bls-go-binary"; - rev = "v1.0.0"; - sha256 = "sha256-JokD6mAmLVKfM4i1lZfj1vcNClHHu/7/v3n7PKH2P4U="; - }; + bls-go-binary-headers = fetchgit { + url = "https://github.com/herumi/bls-go-binary"; + rev = "v1.0.0"; + sha256 = "sha256-JokD6mAmLVKfM4i1lZfj1vcNClHHu/7/v3n7PKH2P4U="; + }; - vendorHash = "sha256-+rHSabNwfiDUBdlNNm494EpGTSy9+R/vrf0VovMEywk="; - modSha256 = lib.fakeSha256; + vendorHash = "sha256-+rHSabNwfiDUBdlNNm494EpGTSy9+R/vrf0VovMEywk="; + modSha256 = lib.fakeSha256; - buildInputs = [gcc-unwrapped] ++ lib.optionals stdenv.isLinux [autoPatchelfHook]; + buildInputs = [ gcc-unwrapped ] ++ lib.optionals stdenv.isLinux [ autoPatchelfHook ]; - libwasmer = - if system == "x86_64-linux" - then "libwasmer_linux_amd64.so" - else if system == "aarch64-linux" - then "libwasmer_linux_arm64.so" - else ""; + libwasmer = + if system == "x86_64-linux" then + "libwasmer_linux_amd64.so" + else if system == "aarch64-linux" then + "libwasmer_linux_arm64.so" + else + ""; - postBuild = lib.optionals stdenv.isLinux '' - mkdir -p "$out/lib" - cp "/build/${pname}/vendor/github.com/ElrondNetwork/arwen-wasm-vm/v1_2/wasmer/${libwasmer}" "$out/lib" - ''; + postBuild = lib.optionals stdenv.isLinux '' + mkdir -p "$out/lib" + cp "/build/${pname}/vendor/github.com/ElrondNetwork/arwen-wasm-vm/v1_2/wasmer/${libwasmer}" "$out/lib" + ''; - postInstall = lib.optionals stdenv.isLinux '' - addAutoPatchelfSearchPath "$out/lib" - addAutoPatchelfSearchPath "${gcc-unwrapped}/lib" - # TODO: autoPatchElf is Linux-specific. We need a cross-platform solution - autoPatchelf -- "$out/bin" - ''; + postInstall = lib.optionals stdenv.isLinux '' + addAutoPatchelfSearchPath "$out/lib" + addAutoPatchelfSearchPath "${gcc-unwrapped}/lib" + # TODO: autoPatchElf is Linux-specific. We need a cross-platform solution + autoPatchelf -- "$out/bin" + ''; - subPackages = ["cmd/node" "cmd/seednode"]; + subPackages = [ + "cmd/node" + "cmd/seednode" + ]; - # Patch is needed to update go.mod to use go 1.18, as otherwise it fails to build - patches = [./go.mod.patch]; + # Patch is needed to update go.mod to use go 1.18, as otherwise it fails to build + patches = [ ./go.mod.patch ]; - libos = - if system == "x86_64-linux" - then "linux/amd64" - else if system == "aarch64-linux" - then "linux/arm64" - else if system == "x86_64-darwin" - then "darwin/amd64" - else if system == "aarch64-darwin" - then "darwin/arm64" - else if system == "x86_64-windows" - then "windows/amd64" - else ""; + libos = + if system == "x86_64-linux" then + "linux/amd64" + else if system == "aarch64-linux" then + "linux/arm64" + else if system == "x86_64-darwin" then + "darwin/amd64" + else if system == "aarch64-darwin" then + "darwin/arm64" + else if system == "x86_64-windows" then + "windows/amd64" + else + ""; - CGO_CFLAGS = "-I${bls-go-binary-headers}/bls/include "; - CGO_LDFLAGS = "-L${bls-go-binary-headers}/bls/lib/${libos}"; + CGO_CFLAGS = "-I${bls-go-binary-headers}/bls/include "; + CGO_LDFLAGS = "-L${bls-go-binary-headers}/bls/lib/${libos}"; - meta = with lib; { - description = "Elrond-GO: The official implementation of the Elrond protocol, written in golang. "; - homepage = "https://github.com/ElrondNetwork/elrond-go"; - license = licenses.gpl3; - }; - } + meta = with lib; { + description = "Elrond-GO: The official implementation of the Elrond protocol, written in golang. "; + homepage = "https://github.com/ElrondNetwork/elrond-go"; + license = licenses.gpl3; + }; +} diff --git a/packages/elrond-proxy-go/default.nix b/packages/elrond-proxy-go/default.nix index 54e282d4..0bbf84ef 100644 --- a/packages/elrond-proxy-go/default.nix +++ b/packages/elrond-proxy-go/default.nix @@ -1,21 +1,21 @@ -{pkgs}: +{ pkgs }: with pkgs; - buildGoModule rec { - pname = "elrond-proxy-go"; - version = "1.1.25"; +buildGoModule rec { + pname = "elrond-proxy-go"; + version = "1.1.25"; - src = fetchgit { - url = "https://github.com/ElrondNetwork/elrond-proxy-go"; - rev = "v${version}"; - sha256 = "sha256-Rlx1DQS0JQ9MwFeYAaH5AQw5uJN7eHR1RoewPeehwYw="; - }; + src = fetchgit { + url = "https://github.com/ElrondNetwork/elrond-proxy-go"; + rev = "v${version}"; + sha256 = "sha256-Rlx1DQS0JQ9MwFeYAaH5AQw5uJN7eHR1RoewPeehwYw="; + }; - vendorHash = "sha256-Nuq8mhZ5aNOHAZlOhtKSqoKrex6kmfuaTxNFxV/TwEw="; - modSha256 = lib.fakeSha256; + vendorHash = "sha256-Nuq8mhZ5aNOHAZlOhtKSqoKrex6kmfuaTxNFxV/TwEw="; + modSha256 = lib.fakeSha256; - meta = with lib; { - description = " 🐙 Elrond Proxy: The official implementation of the web proxy for the Elrond Network. An intermediary that abstracts away the complexity of Elrond sharding, through a friendly HTTP API. "; - homepage = "https://github.com/ElrondNetwork/elrond-proxy-go"; - license = licenses.gpl3; - }; - } + meta = with lib; { + description = " 🐙 Elrond Proxy: The official implementation of the web proxy for the Elrond Network. An intermediary that abstracts away the complexity of Elrond sharding, through a friendly HTTP API. "; + homepage = "https://github.com/ElrondNetwork/elrond-proxy-go"; + license = licenses.gpl3; + }; +} diff --git a/packages/eos-vm/default.nix b/packages/eos-vm/default.nix index 5db9f79d..6099f89f 100644 --- a/packages/eos-vm/default.nix +++ b/packages/eos-vm/default.nix @@ -15,13 +15,18 @@ clangStdenv.mkDerivation rec { openssl.dev libusb1.dev bzip2.dev - (boost.override - { - enableShared = false; - enabledStatic = true; - }) + (boost.override { + enableShared = false; + enabledStatic = true; + }) + ]; + nativeBuildInputs = with pkgs; [ + pkg-config + cmake + clang + git + python3 ]; - nativeBuildInputs = with pkgs; [pkg-config cmake clang git python3]; src = fetchgit { url = "https://github.com/AntelopeIO/eos-vm"; diff --git a/packages/erdpy/default.nix b/packages/erdpy/default.nix index 1be016dd..dc9634a5 100644 --- a/packages/erdpy/default.nix +++ b/packages/erdpy/default.nix @@ -7,78 +7,84 @@ elrond-proxy-go, }: with pkgs; - python3Packages.buildPythonApplication rec { - pname = "erdpy"; - version = "2.0.3"; - - format = "wheel"; - dist = "py3"; - python = "py3"; - - src = python3Packages.fetchPypi { - inherit pname version format dist python; - - sha256 = "215edfb6f9f8c8214cc42e67e8d5328859486007ac4e3438cb9aabd21de67414"; - }; - - postPatch = '' - - chmod u+rwx -R ./dist - pushd dist - wheel unpack --dest unpacked ./*.whl - pushd unpacked/erdpy-${version}/erdpy-2.0.3.dist-info - - # ledgercomm[hid] isn't a supported syntax by nix, so we split them into seperate requirements - sed -iE 's/Requires-Dist: ledgercomm.*/Requires-Dist: ledgercomm\nRequires-Dist: hid/' METADATA - popd - pushd unpacked/erdpy-${version} - - sed -iE 's#./node#${elrond-go}/bin/node#' erdpy/testnet/core.py - sed -iE 's#./seednode#${elrond-go}/bin/seednode#' erdpy/testnet/core.py - sed -iE 's#./proxy#${elrond-proxy-go}/bin/proxy#' erdpy/testnet/core.py - - # Attempting to preveent erdpy from downloading elrond-go and elrond-proxy-go doeesn't work out, due to the way dependeency resolution works in erdpy - # sed -iE 's/StandaloneModule(key="elrond_go", repo_name="elrond-go", organisation="ElrondNetwork"),//' erdpy/dependencies/install.py - # sed -iE 's/StandaloneModule(key="elrond_proxy_go", repo_name="elrond-proxy-go", organisation="ElrondNetwork"),//' erdpy/dependencies/install.py - # sed -iE 's/GolangModule(key="golang"),//' erdpy/dependencies/install.py - - sed -iE 's/myprocess.run_process(['go', 'build'], cwd=seednode_folder, env=golang_env)//' erdpy/testnet/setup.py - sed -iE 's/myprocess.run_process(['go', 'build'], cwd=node_folder, env=golang_env)//' erdpy/testnet/setup.py - sed -iE 's/myprocess.run_process(['go', 'build'], cwd=proxy_foldeer, env=golang_env)//' erdpy/testnet/setup.py - - - - - sed -iE 's#DEPENDENCY_KEYS = ["elrond_go", "elrond_proxy_go", "testwallets"]#$DEPENDENCY_KEYS = ["testwallets"]#' erdpy/testnet/setup.py - - # sed -iE 's#{ELRONDSDK}/elrond_go/{TAG}/elrond-go-{NOvTAG}#${elrond-go}#' erdpy/testnet/setup.py - # sed -iE 's#{ELRONDSDK}/elrond_proxy_go/{TAG}/elrond-proxy-go-{NOvTAG}#${elrond-proxy-go}#' erdpy/testnet/setup.py - - popd - wheel pack ./unpacked/erdpy-${version} - popd - ''; - - propagatedBuildInputs = with python3Packages; [ - hid - cryptography36 - ledgercomm - requests-cache - ]; - - erdpy_script = writeScriptBin "erdpy" '' - #!/usr/bin/env python3 - # -*- coding: utf-8 -*- - import re - import sys - from erdpy.cli import main - if __name__ == '__main__': - sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$\', \'\', sys.argv[0]) - sys.exit(main()) - ''; - - meta = with lib; { - homepage = "https://github.com/ElrondNetwork/elrond-sdk-erdpy"; - platforms = with platforms; linux ++ darwin; - }; - } +python3Packages.buildPythonApplication rec { + pname = "erdpy"; + version = "2.0.3"; + + format = "wheel"; + dist = "py3"; + python = "py3"; + + src = python3Packages.fetchPypi { + inherit + pname + version + format + dist + python + ; + + sha256 = "215edfb6f9f8c8214cc42e67e8d5328859486007ac4e3438cb9aabd21de67414"; + }; + + postPatch = '' + + chmod u+rwx -R ./dist + pushd dist + wheel unpack --dest unpacked ./*.whl + pushd unpacked/erdpy-${version}/erdpy-2.0.3.dist-info + + # ledgercomm[hid] isn't a supported syntax by nix, so we split them into seperate requirements + sed -iE 's/Requires-Dist: ledgercomm.*/Requires-Dist: ledgercomm\nRequires-Dist: hid/' METADATA + popd + pushd unpacked/erdpy-${version} + + sed -iE 's#./node#${elrond-go}/bin/node#' erdpy/testnet/core.py + sed -iE 's#./seednode#${elrond-go}/bin/seednode#' erdpy/testnet/core.py + sed -iE 's#./proxy#${elrond-proxy-go}/bin/proxy#' erdpy/testnet/core.py + + # Attempting to preveent erdpy from downloading elrond-go and elrond-proxy-go doeesn't work out, due to the way dependeency resolution works in erdpy + # sed -iE 's/StandaloneModule(key="elrond_go", repo_name="elrond-go", organisation="ElrondNetwork"),//' erdpy/dependencies/install.py + # sed -iE 's/StandaloneModule(key="elrond_proxy_go", repo_name="elrond-proxy-go", organisation="ElrondNetwork"),//' erdpy/dependencies/install.py + # sed -iE 's/GolangModule(key="golang"),//' erdpy/dependencies/install.py + + sed -iE 's/myprocess.run_process(['go', 'build'], cwd=seednode_folder, env=golang_env)//' erdpy/testnet/setup.py + sed -iE 's/myprocess.run_process(['go', 'build'], cwd=node_folder, env=golang_env)//' erdpy/testnet/setup.py + sed -iE 's/myprocess.run_process(['go', 'build'], cwd=proxy_foldeer, env=golang_env)//' erdpy/testnet/setup.py + + + + + sed -iE 's#DEPENDENCY_KEYS = ["elrond_go", "elrond_proxy_go", "testwallets"]#$DEPENDENCY_KEYS = ["testwallets"]#' erdpy/testnet/setup.py + + # sed -iE 's#{ELRONDSDK}/elrond_go/{TAG}/elrond-go-{NOvTAG}#${elrond-go}#' erdpy/testnet/setup.py + # sed -iE 's#{ELRONDSDK}/elrond_proxy_go/{TAG}/elrond-proxy-go-{NOvTAG}#${elrond-proxy-go}#' erdpy/testnet/setup.py + + popd + wheel pack ./unpacked/erdpy-${version} + popd + ''; + + propagatedBuildInputs = with python3Packages; [ + hid + cryptography36 + ledgercomm + requests-cache + ]; + + erdpy_script = writeScriptBin "erdpy" '' + #!/usr/bin/env python3 + # -*- coding: utf-8 -*- + import re + import sys + from erdpy.cli import main + if __name__ == '__main__': + sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$\', \'\', sys.argv[0]) + sys.exit(main()) + ''; + + meta = with lib; { + homepage = "https://github.com/ElrondNetwork/elrond-sdk-erdpy"; + platforms = with platforms; linux ++ darwin; + }; +} diff --git a/packages/ffiasm-src/default.nix b/packages/ffiasm-src/default.nix index d89ea999..543e0bc0 100644 --- a/packages/ffiasm-src/default.nix +++ b/packages/ffiasm-src/default.nix @@ -19,7 +19,7 @@ buildNpmPackage rec { npmDepsHash = "sha256-Tn27JihH8+15h4LAJc3NpoUs9Gnhe2rfLM5HspmxTUk="; - npmPackFlags = ["--ignore-scripts"]; + npmPackFlags = [ "--ignore-scripts" ]; dontNpmBuild = true; @@ -28,8 +28,12 @@ buildNpmPackage rec { # TODO: Re-enable them when we figure out if we can speed them up (e.g. reduce # number of iterations, or run a smaller subset). doCheck = false; - nativeCheckInputs = [nasm nodePackages.mocha gccStdenv.cc]; - checkInputs = [gmp]; + nativeCheckInputs = [ + nasm + nodePackages.mocha + gccStdenv.cc + ]; + checkInputs = [ gmp ]; checkPhase = "mocha --bail"; meta = { diff --git a/packages/ffiasm/default.nix b/packages/ffiasm/default.nix index 8b20ebe6..5870f788 100644 --- a/packages/ffiasm/default.nix +++ b/packages/ffiasm/default.nix @@ -6,71 +6,76 @@ stdenv, ffiasm-src, llvmPackages, -}: let +}: +let ffiasm = "${ffiasm-src}/lib/node_modules/ffiasm"; noexecstack = lib.optionalString stdenv.cc.bintools.isGNU "-Wl,-z,noexecstack"; - openmp = - lib.optional - stdenv.cc.isClang - ( - assert stdenv.cc == llvmPackages.clang; - llvmPackages.openmp - ); + openmp = lib.optional stdenv.cc.isClang ( + assert stdenv.cc == llvmPackages.clang; + llvmPackages.openmp + ); in - stdenv.mkDerivation rec { - pname = "ffiasm"; - inherit (ffiasm-src) version meta; +stdenv.mkDerivation rec { + pname = "ffiasm"; + inherit (ffiasm-src) version meta; - phases = ["checkPhase" "installPhase"]; + phases = [ + "checkPhase" + "installPhase" + ]; - installPhase = '' - mkdir -p $out - cp -r ${ffiasm-src}/* $out - ''; + installPhase = '' + mkdir -p $out + cp -r ${ffiasm-src}/* $out + ''; - passthru = { - inherit openmp; - }; + passthru = { + inherit openmp; + }; - doCheck = with stdenv.buildPlatform; !(isDarwin && isx86); - checkInputs = [gtest gmp zqfield-bn254] ++ openmp; - checkPhase = '' - function run_test { - echo -e "┌─── \033[1mstart \033[34m$1\033[0m ────╌╌╌" - { - c++ \ - -I${ffiasm}/c \ - ''${sources[*]} \ - -L${gtest}/lib -lgtest \ - ''${extra_cppflags[*]} \ - -pthread -std=c++14 ${noexecstack} \ - -o ./$1 + doCheck = with stdenv.buildPlatform; !(isDarwin && isx86); + checkInputs = [ + gtest + gmp + zqfield-bn254 + ] ++ openmp; + checkPhase = '' + function run_test { + echo -e "┌─── \033[1mstart \033[34m$1\033[0m ────╌╌╌" + { + c++ \ + -I${ffiasm}/c \ + ''${sources[*]} \ + -L${gtest}/lib -lgtest \ + ''${extra_cppflags[*]} \ + -pthread -std=c++14 ${noexecstack} \ + -o ./$1 - ./$1 ''${test_args[@]} + ./$1 ''${test_args[@]} - } 2>&1 | sed 's/^/│ /' - echo -e "└────╼ \033[1mend \033[34m$1\033[0m ────╌╌╌" - } + } 2>&1 | sed 's/^/│ /' + echo -e "└────╼ \033[1mend \033[34m$1\033[0m ────╌╌╌" + } - sources=(${ffiasm}/c/splitparstr{,_test}.cpp) - extra_cppflags=() - test_args=() - run_test splitparsestr_test + sources=(${ffiasm}/c/splitparstr{,_test}.cpp) + extra_cppflags=() + test_args=() + run_test splitparsestr_test - zq_files=(${zqfield-bn254}/lib/{fq,fr}.{cpp,o}) - default_sources=(${ffiasm}/c/{naf,splitparstr,alt_bn128,misc}.cpp ''${zq_files[*]}) - default_extra_cppflags=(-L${gmp}/lib -lgmp -fopenmp -I${zqfield-bn254}/lib) + zq_files=(${zqfield-bn254}/lib/{fq,fr}.{cpp,o}) + default_sources=(${ffiasm}/c/{naf,splitparstr,alt_bn128,misc}.cpp ''${zq_files[*]}) + default_extra_cppflags=(-L${gmp}/lib -lgmp -fopenmp -I${zqfield-bn254}/lib) - sources=(${ffiasm}/c/alt_bn128_test.cpp ''${default_sources[*]}) - extra_cppflags=(''${default_extra_cppflags[*]}) - run_test altbn128_test + sources=(${ffiasm}/c/alt_bn128_test.cpp ''${default_sources[*]}) + extra_cppflags=(''${default_extra_cppflags[*]}) + run_test altbn128_test - sources=(${ffiasm}/benchmark/multiexp_g1.cpp ''${default_sources[*]}) - extra_cppflags=(-DCOUNT_OPS ''${default_extra_cppflags[*]}) - test_args=(100) - run_test multiexp_g1_benchmark + sources=(${ffiasm}/benchmark/multiexp_g1.cpp ''${default_sources[*]}) + extra_cppflags=(-DCOUNT_OPS ''${default_extra_cppflags[*]}) + test_args=(100) + run_test multiexp_g1_benchmark - sources=(${ffiasm}/benchmark/multiexp_g2.cpp ''${default_sources[*]}) - run_test multiexp_g2_benchmark - ''; - } + sources=(${ffiasm}/benchmark/multiexp_g2.cpp ''${default_sources[*]}) + run_test multiexp_g2_benchmark + ''; +} diff --git a/packages/ffiasm/zqfield.nix b/packages/ffiasm/zqfield.nix index 9eb0ebac..a0029157 100644 --- a/packages/ffiasm/zqfield.nix +++ b/packages/ffiasm/zqfield.nix @@ -4,19 +4,18 @@ ffiasm-src, runCommand, hostPlatform, -}: { +}: +{ primeNumber, name, -}: let +}: +let filename = lib.toLower name; - nasmArgs = - if hostPlatform.isDarwin - then "-fmacho64 --prefix _" - else "-felf64"; + nasmArgs = if hostPlatform.isDarwin then "-fmacho64 --prefix _" else "-felf64"; in - runCommand "zqfield-${filename}-${primeNumber}" {} '' - ${lib.getExe ffiasm-src} -q ${primeNumber} -n ${name} - ${nasm}/bin/nasm ${nasmArgs} ${filename}.asm - mkdir -p $out/lib - cp ${filename}.{asm,cpp,hpp,o} $out/lib/ - '' +runCommand "zqfield-${filename}-${primeNumber}" { } '' + ${lib.getExe ffiasm-src} -q ${primeNumber} -n ${name} + ${nasm}/bin/nasm ${nasmArgs} ${filename}.asm + mkdir -p $out/lib + cp ${filename}.{asm,cpp,hpp,o} $out/lib/ +'' diff --git a/packages/gaiad/default.nix b/packages/gaiad/default.nix index 27f6f96e..b8dc82dd 100644 --- a/packages/gaiad/default.nix +++ b/packages/gaiad/default.nix @@ -21,7 +21,7 @@ buildGoModule rec { meta = with lib; { homepage = "https://github.com/cosmos/gaia"; license = licenses.mit; - maintainers = with maintainers; []; + maintainers = with maintainers; [ ]; description = '' The Cosmos Hub is built using the Cosmos SDK and compiled to a binary called gaiad (Gaia Daemon). The Cosmos Hub and other fully sovereign diff --git a/packages/go-opera/default.nix b/packages/go-opera/default.nix index 8b37991a..bfcde744 100644 --- a/packages/go-opera/default.nix +++ b/packages/go-opera/default.nix @@ -1,33 +1,33 @@ -{pkgs}: +{ pkgs }: with pkgs; - buildGoModule rec { - pname = "go-opera"; - version = "1.1.3-rc.5"; +buildGoModule rec { + pname = "go-opera"; + version = "1.1.3-rc.5"; - src = fetchgit { - url = "https://github.com/Fantom-foundation/go-opera"; - rev = "v${version}"; - sha256 = "sha256-j2FSsMpWCrMo9PfkpGoCML4kPVlR3OlK+sSWER/dMVw="; - }; + src = fetchgit { + url = "https://github.com/Fantom-foundation/go-opera"; + rev = "v${version}"; + sha256 = "sha256-j2FSsMpWCrMo9PfkpGoCML4kPVlR3OlK+sSWER/dMVw="; + }; - karalabe-usb = fetchgit { - url = "https://github.com/karalabe/usb"; - rev = "v0.0.2"; - sha256 = "sha256-liXTgMnA0W5CwfOkqaVLdWmDdBK+7DSWLQZuSLVOt6w="; - }; - doCheck = false; - buildInputs = [gcc-unwrapped]; - CGO_CFLAGS = "-I${karalabe-usb} -I${karalabe-usb}/hidapi/hidapi -I${karalabe-usb}/libusb/libusb"; + karalabe-usb = fetchgit { + url = "https://github.com/karalabe/usb"; + rev = "v0.0.2"; + sha256 = "sha256-liXTgMnA0W5CwfOkqaVLdWmDdBK+7DSWLQZuSLVOt6w="; + }; + doCheck = false; + buildInputs = [ gcc-unwrapped ]; + CGO_CFLAGS = "-I${karalabe-usb} -I${karalabe-usb}/hidapi/hidapi -I${karalabe-usb}/libusb/libusb"; - # GIT_COMMIT = "e529a4e7317e2f02e284c194677b301bb640cd73"; - # GIT_DATE = "1669028682"; - # ldflags = "-s -w -X github.com/Fantom-foundation/go-opera/cmd/opera/launcher.gitCommit=$${GIT_COMMIT} -X github.com/Fantom-foundation/go-opera/cmd/opera/launcher.gitDate=$${GIT_DATE}"; + # GIT_COMMIT = "e529a4e7317e2f02e284c194677b301bb640cd73"; + # GIT_DATE = "1669028682"; + # ldflags = "-s -w -X github.com/Fantom-foundation/go-opera/cmd/opera/launcher.gitCommit=$${GIT_COMMIT} -X github.com/Fantom-foundation/go-opera/cmd/opera/launcher.gitDate=$${GIT_DATE}"; - vendorHash = "sha256-FYOY7RwpLGm/0FldrXTKg2d68HzOmUQBt6EolQ2f3hA="; + vendorHash = "sha256-FYOY7RwpLGm/0FldrXTKg2d68HzOmUQBt6EolQ2f3hA="; - meta = with lib; { - description = "Opera blockchain protocol secured by the Lachesis consensus algorithm "; - homepage = "https://github.com/Fantom-foundation/go-opera"; - license = licenses.lgpl3; - }; - } + meta = with lib; { + description = "Opera blockchain protocol secured by the Lachesis consensus algorithm "; + homepage = "https://github.com/Fantom-foundation/go-opera"; + license = licenses.lgpl3; + }; +} diff --git a/packages/graphql/default.nix b/packages/graphql/default.nix index cdb3a962..35042d7e 100644 --- a/packages/graphql/default.nix +++ b/packages/graphql/default.nix @@ -3,40 +3,51 @@ cardano-node, cardano-cli, symlinkJoin, -}: let +}: +let in - symlinkJoin rec { - name = "graphql-${version}"; - version = "0-unstable-2023-05-09"; - src = pkgs.fetchFromGitHub { - owner = "metacraft-labs"; - repo = "cardano-graphql"; - rev = "5ab2b10349dadb23799ba906d080773ff6c25270"; - hash = "sha256-DHFF/JQNxQJj1WfGaAfIgwLqvudL02o0VCk/VQA8img="; - fetchSubmodules = true; - }; +symlinkJoin rec { + name = "graphql-${version}"; + version = "0-unstable-2023-05-09"; + src = pkgs.fetchFromGitHub { + owner = "metacraft-labs"; + repo = "cardano-graphql"; + rev = "5ab2b10349dadb23799ba906d080773ff6c25270"; + hash = "sha256-DHFF/JQNxQJj1WfGaAfIgwLqvudL02o0VCk/VQA8img="; + fetchSubmodules = true; + }; - paths = [automate-graphql graphql-down]; + paths = [ + automate-graphql + graphql-down + ]; - automate-graphql = pkgs.writeShellApplication { - name = "run-cardano-local-graphql"; - runtimeInputs = [cardano-node cardano-cli pkgs.jq]; - text = '' - export CARDANO_GRAPHQL_SRC="${src}" - bash ${./automate-graphql.bash} - ''; - }; + automate-graphql = pkgs.writeShellApplication { + name = "run-cardano-local-graphql"; + runtimeInputs = [ + cardano-node + cardano-cli + pkgs.jq + ]; + text = '' + export CARDANO_GRAPHQL_SRC="${src}" + bash ${./automate-graphql.bash} + ''; + }; - graphql-down = pkgs.writeShellApplication { - name = "stop-cardano-local-graphql"; - runtimeInputs = [cardano-node cardano-cli]; - text = '' - cd ${src} - docker compose -p testnet down - docker volume rm -f testnet_db-sync-data - docker volume rm -f testnet_node-db - docker volume rm -f testnet_node-ipc - docker volume rm -f testnet_postgres-data - ''; - }; - } + graphql-down = pkgs.writeShellApplication { + name = "stop-cardano-local-graphql"; + runtimeInputs = [ + cardano-node + cardano-cli + ]; + text = '' + cd ${src} + docker compose -p testnet down + docker volume rm -f testnet_db-sync-data + docker volume rm -f testnet_node-db + docker volume rm -f testnet_node-ipc + docker volume rm -f testnet_postgres-data + ''; + }; +} diff --git a/packages/kurtosis/default.nix b/packages/kurtosis/default.nix index b1a20e31..5bbe09f4 100644 --- a/packages/kurtosis/default.nix +++ b/packages/kurtosis/default.nix @@ -21,7 +21,7 @@ buildGoModule rec { ./scripts/generate-kurtosis-version.sh "${version}" ''; - subPackages = ["cli/cli"]; + subPackages = [ "cli/cli" ]; proxyVendor = true; vendorHash = "sha256-GaEIitoRiuYxtS7cDKobFyIlraDNQjcvbRvzG3nUKFU="; @@ -35,7 +35,7 @@ buildGoModule rec { homepage = "https://github.com/kurtosis-tech/kurtosis"; changelog = "https://github.com/kurtosis-tech/kurtosis/blob/${src.rev}/CHANGELOG.md"; license = licenses.asl20; - maintainers = with maintainers; []; + maintainers = with maintainers; [ ]; mainProgram = "kurtosis"; platforms = platforms.all; }; diff --git a/packages/leap/default.nix b/packages/leap/default.nix index f04cd67d..bb10677f 100644 --- a/packages/leap/default.nix +++ b/packages/leap/default.nix @@ -22,7 +22,13 @@ clang11Stdenv.mkDerivation rec { find . -type f -name '*.py' -print0 | xargs -0 -I{} sed -i -E 's#/usr/bin/env python3?#${pkgs.python3}/bin/python3#' {} ''; - nativeBuildInputs = with pkgs; [pkg-config cmake clang_11 git python3]; + nativeBuildInputs = with pkgs; [ + pkg-config + cmake + clang_11 + git + python3 + ]; buildInputs = with pkgs; [ llvm_11 @@ -32,10 +38,9 @@ clang11Stdenv.mkDerivation rec { libusb1.dev bzip2.dev (lib.getLib xz) - (boost.override - { - enableShared = false; - enabledStatic = true; - }) + (boost.override { + enableShared = false; + enabledStatic = true; + }) ]; } diff --git a/packages/nimbus/default.nix b/packages/nimbus/default.nix index 709ad13d..cee441da 100644 --- a/packages/nimbus/default.nix +++ b/packages/nimbus/default.nix @@ -9,7 +9,7 @@ fetchpatch, writeScriptBin, # Options: nimbus_light_client, nimbus_validator_client, nimbus_signing_node - makeTargets ? ["all"], + makeTargets ? [ "all" ], # These are the only platforms tested in CI and considered stable. stablePlatforms ? [ "x86_64-linux" @@ -22,59 +22,69 @@ }: # Nim version(s) that are known to be stable assert nim.version == "1.6.12" || nim.version == "1.6.14"; - stdenv.mkDerivation rec { - pname = "nimbus"; - rev = "60f0a2f6a662abb9c8332d9f0d3eb7cc998fab63"; - version = "23.7.0"; +stdenv.mkDerivation rec { + pname = "nimbus"; + rev = "60f0a2f6a662abb9c8332d9f0d3eb7cc998fab63"; + version = "23.7.0"; - src = fetchFromGitHub { - owner = "status-im"; - repo = "nimbus-eth2"; - inherit rev; - hash = "sha256-gskbdKSlR2s0syqHdD2T4rkkTNWNHL1XKSYfDTbTO9s="; - fetchSubmodules = true; - }; + src = fetchFromGitHub { + owner = "status-im"; + repo = "nimbus-eth2"; + inherit rev; + hash = "sha256-gskbdKSlR2s0syqHdD2T4rkkTNWNHL1XKSYfDTbTO9s="; + fetchSubmodules = true; + }; - # Fix for Nim compiler calling 'git rev-parse' and 'lsb_release'. - nativeBuildInputs = let + # Fix for Nim compiler calling 'git rev-parse' and 'lsb_release'. + nativeBuildInputs = + let fakeGit = writeScriptBin "git" "echo $commit"; fakeLsbRelease = writeScriptBin "lsb_release" "echo nix"; in - [fakeGit fakeLsbRelease nim which cmake] - ++ lib.optionals stdenv.isDarwin [darwin.cctools]; + [ + fakeGit + fakeLsbRelease + nim + which + cmake + ] + ++ lib.optionals stdenv.isDarwin [ darwin.cctools ]; - enableParallelBuilding = true; + enableParallelBuilding = true; - # Disable CPU optmizations that make binary not portable. - NIMFLAGS = "-d:disableMarchNative -d:git_revision_override=${rev}"; + # Disable CPU optmizations that make binary not portable. + NIMFLAGS = "-d:disableMarchNative -d:git_revision_override=${rev}"; - makeFlags = makeTargets ++ ["USE_SYSTEM_NIM=1"]; + makeFlags = makeTargets ++ [ "USE_SYSTEM_NIM=1" ]; - # Generate the nimbus-build-system.paths file. - configurePhase = '' - patchShebangs scripts vendor/nimbus-build-system/scripts - make nimbus-build-system-paths - ''; + # Generate the nimbus-build-system.paths file. + configurePhase = '' + patchShebangs scripts vendor/nimbus-build-system/scripts + make nimbus-build-system-paths + ''; - installPhase = '' - mkdir -p $out/bin - rm build/generate_makefile - cp build/* $out/bin - ''; + installPhase = '' + mkdir -p $out/bin + rm build/generate_makefile + cp build/* $out/bin + ''; - meta = with lib; { - homepage = "https://nimbus.guide/"; - downloadPage = "https://github.com/status-im/nimbus-eth2/releases"; - changelog = "https://github.com/status-im/nimbus-eth2/blob/stable/CHANGELOG.md"; - description = "Nimbus is a lightweight client for the Ethereum consensus layer"; - longDescription = '' - Nimbus is an extremely efficient consensus layer client implementation. - While it's optimised for embedded systems and resource-restricted devices -- - including Raspberry Pis, its low resource usage also makes it an excellent choice - for any server or desktop (where it simply takes up fewer resources). - ''; - license = with licenses; [asl20 mit]; - mainProgram = "nimbus_beacon_node"; - platforms = stablePlatforms; - }; - } + meta = with lib; { + homepage = "https://nimbus.guide/"; + downloadPage = "https://github.com/status-im/nimbus-eth2/releases"; + changelog = "https://github.com/status-im/nimbus-eth2/blob/stable/CHANGELOG.md"; + description = "Nimbus is a lightweight client for the Ethereum consensus layer"; + longDescription = '' + Nimbus is an extremely efficient consensus layer client implementation. + While it's optimised for embedded systems and resource-restricted devices -- + including Raspberry Pis, its low resource usage also makes it an excellent choice + for any server or desktop (where it simply takes up fewer resources). + ''; + license = with licenses; [ + asl20 + mit + ]; + mainProgram = "nimbus_beacon_node"; + platforms = stablePlatforms; + }; +} diff --git a/packages/pistache/default.nix b/packages/pistache/default.nix index 39a6e0bd..e1cb6115 100644 --- a/packages/pistache/default.nix +++ b/packages/pistache/default.nix @@ -21,7 +21,13 @@ stdenv.mkDerivation rec { hash = "sha256-4mqiQRL3ucXudNRvjCExPUAlz8Q5BzEqJUMVK6f30ug="; }; - nativeBuildInputs = [gcc12 meson cmake ninja pkg-config]; + nativeBuildInputs = [ + gcc12 + meson + cmake + ninja + pkg-config + ]; buildInputs = [ openssl @@ -29,9 +35,7 @@ stdenv.mkDerivation rec { howard-hinnant-date ]; - mesonFlags = - lib.optional (openssl != null) - (lib.mesonOption "PISTACHE_USE_SSL" "true"); + mesonFlags = lib.optional (openssl != null) (lib.mesonOption "PISTACHE_USE_SSL" "true"); meta = { homepage = "https://github.com/pistacheio/pistache"; diff --git a/packages/polkadot/default.nix b/packages/polkadot/default.nix index 03256513..2085808c 100644 --- a/packages/polkadot/default.nix +++ b/packages/polkadot/default.nix @@ -13,7 +13,11 @@ Security, SystemConfiguration, libcxx, -}: {enableFastRuntime ? false}: let +}: +{ + enableFastRuntime ? false, +}: +let tags = { "v0.9.40" = { commitSha1 = "a2b62fb872ba22622aaf8e13f9dcd9a4adcc454f"; @@ -48,10 +52,18 @@ sha256 = tags."v${version}".srcSha256; }; - nativeBuildInputs = [rustPlatform.bindgenHook rocksdb clang]; + nativeBuildInputs = [ + rustPlatform.bindgenHook + rocksdb + clang + ]; buildInputs = - [clang libcxx libcxx.dev] + [ + clang + libcxx + libcxx.dev + ] ++ lib.optionals stdenv.isDarwin [ libiconv CoreFoundation @@ -64,25 +76,35 @@ ROCKSDB_LIB_DIR = "${rocksdb}/lib"; }; - cargoArtifacts = craneLib.buildDepsOnly (commonArgs + cargoArtifacts = craneLib.buildDepsOnly ( + commonArgs // { pname = "polkadot"; - }); + } + ); in - craneLib.buildPackage (commonArgs - // rec { - pname = "polkadot" + lib.optionalString enableFastRuntime "-fast"; - inherit cargoArtifacts; +craneLib.buildPackage ( + commonArgs + // rec { + pname = "polkadot" + lib.optionalString enableFastRuntime "-fast"; + inherit cargoArtifacts; - buildFeatures = ["jemalloc-allocator"] ++ lib.optional enableFastRuntime "fast-runtime"; + buildFeatures = [ "jemalloc-allocator" ] ++ lib.optional enableFastRuntime "fast-runtime"; - doCheck = false; + doCheck = false; - meta = with lib; { - description = "Polkadot Node Implementation"; - homepage = "https://polkadot.network"; - license = licenses.gpl3Only; - maintainers = with maintainers; [akru andresilva asymmetric FlorianFranzen RaghavSood]; - platforms = platforms.unix; - }; - }) + meta = with lib; { + description = "Polkadot Node Implementation"; + homepage = "https://polkadot.network"; + license = licenses.gpl3Only; + maintainers = with maintainers; [ + akru + andresilva + asymmetric + FlorianFranzen + RaghavSood + ]; + platforms = platforms.unix; + }; + } +) diff --git a/packages/python-modules/cryptography36/default.nix b/packages/python-modules/cryptography36/default.nix index abfc261d..5e4f3263 100644 --- a/packages/python-modules/cryptography36/default.nix +++ b/packages/python-modules/cryptography36/default.nix @@ -1,81 +1,96 @@ -{pkgs}: let +{ pkgs }: +let version = "36.0.2"; # Also update the hash in vectors.nix - cryptography-vectors = pkgs.callPackage ./vectors.nix {inherit pkgs;} {inherit version;}; + cryptography-vectors = pkgs.callPackage ./vectors.nix { inherit pkgs; } { inherit version; }; in - with pkgs; - python3Packages.buildPythonPackage rec { - pname = "cryptography"; - inherit version; +with pkgs; +python3Packages.buildPythonPackage rec { + pname = "cryptography"; + inherit version; - src = python3Packages.fetchPypi { - inherit pname version; - sha256 = "sha256-cPj097sqyfNAZVy6yJ1oxSevW7Q4dSKoQT6EHj5mKMk="; - }; + src = python3Packages.fetchPypi { + inherit pname version; + sha256 = "sha256-cPj097sqyfNAZVy6yJ1oxSevW7Q4dSKoQT6EHj5mKMk="; + }; - cargoDeps = rustPlatform.fetchCargoTarball { - inherit src; - sourceRoot = "${pname}-${version}/${cargoRoot}"; - name = "${pname}-${version}"; - sha256 = "sha256-6C4N445h4Xf2nCc9rJWpSZaNPilR9GfgbmKvNlSIFqg="; - }; + cargoDeps = rustPlatform.fetchCargoTarball { + inherit src; + sourceRoot = "${pname}-${version}/${cargoRoot}"; + name = "${pname}-${version}"; + sha256 = "sha256-6C4N445h4Xf2nCc9rJWpSZaNPilR9GfgbmKvNlSIFqg="; + }; - cargoRoot = "src/rust"; + cargoRoot = "src/rust"; - outputs = ["out" "dev"]; + outputs = [ + "out" + "dev" + ]; - nativeBuildInputs = with python3Packages; - lib.optionals (!python3Packages.isPyPy) [ - cffi - ] - ++ [ - rustPlatform.cargoSetupHook - setuptools-rust - ] - ++ (with pkgs; [cargo rustc]); + nativeBuildInputs = + with python3Packages; + lib.optionals (!python3Packages.isPyPy) [ + cffi + ] + ++ [ + rustPlatform.cargoSetupHook + setuptools-rust + ] + ++ (with pkgs; [ + cargo + rustc + ]); - buildInputs = - [openssl] - ++ lib.optionals stdenv.isDarwin [darwin.Security libiconv]; + buildInputs = + [ openssl ] + ++ lib.optionals stdenv.isDarwin [ + darwin.Security + libiconv + ]; - propagatedBuildInputs = with python3Packages; - lib.optionals (!python3Packages.isPyPy) [ - cffi - ]; + propagatedBuildInputs = + with python3Packages; + lib.optionals (!python3Packages.isPyPy) [ + cffi + ]; - checkInputs = with python3Packages; [ - cryptography-vectors - hypothesis - iso8601 - pretend - pytestCheckHook - pytest-subtests - pytz - ]; + checkInputs = with python3Packages; [ + cryptography-vectors + hypothesis + iso8601 + pretend + pytestCheckHook + pytest-subtests + pytz + ]; - pytestFlagsArray = [ - "--disable-pytest-warnings" - ]; + pytestFlagsArray = [ + "--disable-pytest-warnings" + ]; - disabledTestPaths = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ - # aarch64-darwin forbids W+X memory, but this tests depends on it: - # * https://cffi.readthedocs.io/en/latest/using.html#callbacks - "--ignore=tests/hazmat/backends/test_openssl_memleak.py" - ]; + disabledTestPaths = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ + # aarch64-darwin forbids W+X memory, but this tests depends on it: + # * https://cffi.readthedocs.io/en/latest/using.html#callbacks + "--ignore=tests/hazmat/backends/test_openssl_memleak.py" + ]; - meta = with lib; { - description = "A package which provides cryptographic recipes and primitives"; - longDescription = '' - Cryptography includes both high level recipes and low level interfaces to - common cryptographic algorithms such as symmetric ciphers, message - digests, and key derivation functions. - Our goal is for it to be your "cryptographic standard library". It - supports Python 2.7, Python 3.5+, and PyPy 5.4+. - ''; - homepage = "https://github.com/pyca/cryptography"; - changelog = - "https://cryptography.io/en/latest/changelog/#v" - + replaceStrings ["."] ["-"] version; - license = with licenses; [asl20 bsd3 psfl]; - maintainers = with maintainers; [SuperSandro2000]; - }; - } + meta = with lib; { + description = "A package which provides cryptographic recipes and primitives"; + longDescription = '' + Cryptography includes both high level recipes and low level interfaces to + common cryptographic algorithms such as symmetric ciphers, message + digests, and key derivation functions. + Our goal is for it to be your "cryptographic standard library". It + supports Python 2.7, Python 3.5+, and PyPy 5.4+. + ''; + homepage = "https://github.com/pyca/cryptography"; + changelog = + "https://cryptography.io/en/latest/changelog/#v" + replaceStrings [ "." ] [ "-" ] version; + license = with licenses; [ + asl20 + bsd3 + psfl + ]; + maintainers = with maintainers; [ SuperSandro2000 ]; + }; +} diff --git a/packages/python-modules/cryptography36/vectors.nix b/packages/python-modules/cryptography36/vectors.nix index 25fa2f56..99e61199 100644 --- a/packages/python-modules/cryptography36/vectors.nix +++ b/packages/python-modules/cryptography36/vectors.nix @@ -1,25 +1,29 @@ -{pkgs}: {version}: +{ pkgs }: +{ version }: with pkgs; - python3Packages.buildPythonPackage rec { - pname = "cryptography-vectors"; - inherit version; +python3Packages.buildPythonPackage rec { + pname = "cryptography-vectors"; + inherit version; - src = python3Packages.fetchPypi { - pname = "cryptography_vectors"; - inherit version; - sha256 = "sha256-KnkkRJoDAl+vf4dUpvQgAAHKshBzSmzmrB9r2s06aOQ="; - }; + src = python3Packages.fetchPypi { + pname = "cryptography_vectors"; + inherit version; + sha256 = "sha256-KnkkRJoDAl+vf4dUpvQgAAHKshBzSmzmrB9r2s06aOQ="; + }; - # No tests included - doCheck = false; + # No tests included + doCheck = false; - pythonImportsCheck = ["cryptography_vectors"]; + pythonImportsCheck = [ "cryptography_vectors" ]; - meta = with lib; { - description = "Test vectors for the cryptography package"; - homepage = "https://cryptography.io/en/latest/development/test-vectors/"; - # Source: https://github.com/pyca/cryptography/tree/master/vectors; - license = with licenses; [asl20 bsd3]; - maintainers = with maintainers; [SuperSandro2000]; - }; - } + meta = with lib; { + description = "Test vectors for the cryptography package"; + homepage = "https://cryptography.io/en/latest/development/test-vectors/"; + # Source: https://github.com/pyca/cryptography/tree/master/vectors; + license = with licenses; [ + asl20 + bsd3 + ]; + maintainers = with maintainers; [ SuperSandro2000 ]; + }; +} diff --git a/packages/python-modules/ledgercomm/default.nix b/packages/python-modules/ledgercomm/default.nix index 665705d4..79400de5 100644 --- a/packages/python-modules/ledgercomm/default.nix +++ b/packages/python-modules/ledgercomm/default.nix @@ -1,27 +1,33 @@ -{pkgs}: +{ pkgs }: with pkgs; - python3Packages.buildPythonPackage rec { - pname = "ledgercomm"; - version = "1.1.0"; +python3Packages.buildPythonPackage rec { + pname = "ledgercomm"; + version = "1.1.0"; - format = "wheel"; - dist = "py3"; - python = "py3"; + format = "wheel"; + dist = "py3"; + python = "py3"; - src = python3Packages.fetchPypi { - inherit pname version format dist python; + src = python3Packages.fetchPypi { + inherit + pname + version + format + dist + python + ; - sha256 = "a85c16d3e2967ae6c0fa1bc9da2d99f766c166f32cd4d52a7e3537f2c849bf5f"; - }; + sha256 = "a85c16d3e2967ae6c0fa1bc9da2d99f766c166f32cd4d52a7e3537f2c849bf5f"; + }; - propagatedBuildInputs = with python3Packages; [ - cython - hidapi - hid - ]; + propagatedBuildInputs = with python3Packages; [ + cython + hidapi + hid + ]; - meta = with lib; { - homepage = "https://github.com/LedgerHQ/ledgercomm"; - platforms = with platforms; linux ++ darwin; - }; - } + meta = with lib; { + homepage = "https://github.com/LedgerHQ/ledgercomm"; + platforms = with platforms; linux ++ darwin; + }; +} diff --git a/packages/python-modules/py-ecc/default.nix b/packages/python-modules/py-ecc/default.nix index 74b2e258..c42dd5f0 100644 --- a/packages/python-modules/py-ecc/default.nix +++ b/packages/python-modules/py-ecc/default.nix @@ -32,12 +32,12 @@ buildPythonPackage rec { pytestCheckHook ]; - pythonImportsCheck = ["py_ecc"]; + pythonImportsCheck = [ "py_ecc" ]; meta = with lib; { description = "ECC pairing and bn_128 and bls12_381 curve operations"; homepage = "https://github.com/ethereum/py_ecc"; license = licenses.mit; - maintainers = with maintainers; [SuperSandro2000]; + maintainers = with maintainers; [ SuperSandro2000 ]; }; } diff --git a/packages/python-modules/requests-cache/default.nix b/packages/python-modules/requests-cache/default.nix index 61c3cebb..9550c7fc 100644 --- a/packages/python-modules/requests-cache/default.nix +++ b/packages/python-modules/requests-cache/default.nix @@ -3,37 +3,43 @@ cattrs22-2, }: with pkgs; - python3Packages.buildPythonPackage rec { - pname = "requests_cache"; - version = "0.9.7"; +python3Packages.buildPythonPackage rec { + pname = "requests_cache"; + version = "0.9.7"; - format = "wheel"; - dist = "py3"; - python = "py3"; + format = "wheel"; + dist = "py3"; + python = "py3"; - src = python3Packages.fetchPypi { - inherit pname version format dist python; + src = python3Packages.fetchPypi { + inherit + pname + version + format + dist + python + ; - sha256 = "3f57badcd8406ecda7f8eaa8145afd0b180c5ae4ff05165a2c4d40f3dc88a6e5"; - }; + sha256 = "3f57badcd8406ecda7f8eaa8145afd0b180c5ae4ff05165a2c4d40f3dc88a6e5"; + }; - propagatedBuildInputs = with python3Packages; [ - cattrs22-2 - attrs - urllib3 - url-normalize - requests - appdirs - toml - prettytable - semver - bottle - pynacl - pycryptodomex - ]; + propagatedBuildInputs = with python3Packages; [ + cattrs22-2 + attrs + urllib3 + url-normalize + requests + appdirs + toml + prettytable + semver + bottle + pynacl + pycryptodomex + ]; - meta = with lib; { - homepage = "https://github.com/requests-cache/requests-cache"; - platforms = with platforms; linux ++ darwin; - }; - } + meta = with lib; { + homepage = "https://github.com/requests-cache/requests-cache"; + platforms = with platforms; linux ++ darwin; + }; +} diff --git a/packages/rapidsnark-server/default.nix b/packages/rapidsnark-server/default.nix index 50d4e4dd..4357f7a6 100644 --- a/packages/rapidsnark-server/default.nix +++ b/packages/rapidsnark-server/default.nix @@ -5,29 +5,33 @@ ffiasm, zqfield-bn254, rapidsnark, -}: let +}: +let ffiasm-c = "${ffiasm}/lib/node_modules/ffiasm/c"; in - stdenv.mkDerivation rec { - pname = "rapidsnark-server"; - inherit (rapidsnark) version src nativeBuildInputs doCheck; - meta = - rapidsnark.meta - // { - platforms = with lib.platforms; linux; - }; - buildInputs = rapidsnark.buildInputs ++ [pistache]; +stdenv.mkDerivation rec { + pname = "rapidsnark-server"; + inherit (rapidsnark) + version + src + nativeBuildInputs + doCheck + ; + meta = rapidsnark.meta // { + platforms = with lib.platforms; linux; + }; + buildInputs = rapidsnark.buildInputs ++ [ pistache ]; - buildPhase = '' - mkdir -p $out/bin - c++ \ - -I{${ffiasm-c},${zqfield-bn254}/lib} \ - $(pkg-config --cflags --libs nlohmann_json libpistache libsodium) \ - ./src/{binfile_utils,fullprover,main_proofserver,logger,proverapi,wtns_utils,zkey_utils}.cpp \ - ${ffiasm-c}/{alt_bn128,misc,naf,splitparstr}.cpp \ - ${zqfield-bn254}/lib/{fq,fr}.{cpp,o} \ - -L${pistache}/lib -lpistache \ - -pthread -std=c++17 -fopenmp -lgmp -lsodium -g -DSANITY_CHECK \ - -o $out/bin/proverServer - ''; - } + buildPhase = '' + mkdir -p $out/bin + c++ \ + -I{${ffiasm-c},${zqfield-bn254}/lib} \ + $(pkg-config --cflags --libs nlohmann_json libpistache libsodium) \ + ./src/{binfile_utils,fullprover,main_proofserver,logger,proverapi,wtns_utils,zkey_utils}.cpp \ + ${ffiasm-c}/{alt_bn128,misc,naf,splitparstr}.cpp \ + ${zqfield-bn254}/lib/{fq,fr}.{cpp,o} \ + -L${pistache}/lib -lpistache \ + -pthread -std=c++17 -fopenmp -lgmp -lsodium -g -DSANITY_CHECK \ + -o $out/bin/proverServer + ''; +} diff --git a/packages/rapidsnark/default.nix b/packages/rapidsnark/default.nix index 4fd8408b..60ee27bb 100644 --- a/packages/rapidsnark/default.nix +++ b/packages/rapidsnark/default.nix @@ -8,37 +8,42 @@ libsodium, fetchFromGitHub, pkg-config, -}: let +}: +let ffiasm-c = "${ffiasm}/lib/node_modules/ffiasm/c"; in - stdenv.mkDerivation rec { - pname = "rapidsnark"; - version = "2023-03-08"; +stdenv.mkDerivation rec { + pname = "rapidsnark"; + version = "2023-03-08"; - src = fetchFromGitHub { - owner = "PetarKirov"; - repo = "rapidsnark"; - rev = "fix/prover/macos-build"; - hash = "sha256-nLKy1zTeiIIZFFnEGhO3yFysQrJqe1VZOAMaBNxPMqY="; - }; + src = fetchFromGitHub { + owner = "PetarKirov"; + repo = "rapidsnark"; + rev = "fix/prover/macos-build"; + hash = "sha256-nLKy1zTeiIIZFFnEGhO3yFysQrJqe1VZOAMaBNxPMqY="; + }; - nativeBuildInputs = [pkg-config]; - buildInputs = [nlohmann_json gmp libsodium] ++ ffiasm.passthru.openmp; + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ + nlohmann_json + gmp + libsodium + ] ++ ffiasm.passthru.openmp; - buildPhase = '' - mkdir -p $out/bin - c++ \ - -I{${ffiasm-c},${zqfield-bn254}/lib} \ - ./src/{main_prover,binfile_utils,zkey_utils,wtns_utils,logger}.cpp \ - ${ffiasm-c}/{alt_bn128,misc,naf,splitparstr}.cpp \ - ${zqfield-bn254}/lib/{fq,fr}.{cpp,o} \ - $(pkg-config --cflags --libs libsodium gmp nlohmann_json) \ - -std=c++17 -pthread -O3 -fopenmp \ - -o $out/bin/prover - ''; + buildPhase = '' + mkdir -p $out/bin + c++ \ + -I{${ffiasm-c},${zqfield-bn254}/lib} \ + ./src/{main_prover,binfile_utils,zkey_utils,wtns_utils,logger}.cpp \ + ${ffiasm-c}/{alt_bn128,misc,naf,splitparstr}.cpp \ + ${zqfield-bn254}/lib/{fq,fr}.{cpp,o} \ + $(pkg-config --cflags --libs libsodium gmp nlohmann_json) \ + -std=c++17 -pthread -O3 -fopenmp \ + -o $out/bin/prover + ''; - meta = { - homepage = "https://github.com/iden3/rapidsnark"; - platforms = with lib.platforms; linux ++ darwin; - }; - } + meta = { + homepage = "https://github.com/iden3/rapidsnark"; + platforms = with lib.platforms; linux ++ darwin; + }; +} diff --git a/packages/solana-validator/default.nix b/packages/solana-validator/default.nix index b1aa8f9c..dfaf59e3 100644 --- a/packages/solana-validator/default.nix +++ b/packages/solana-validator/default.nix @@ -1,4 +1,4 @@ -{pkgs}: +{ pkgs }: pkgs.solana-validator.overrideAttrs (old: { # patches = old.patches ++ [../cargo-build-bpf/patches/main.rs.diff]; }) diff --git a/packages/wasmd/default.nix b/packages/wasmd/default.nix index fb83c73d..6cfc79cc 100644 --- a/packages/wasmd/default.nix +++ b/packages/wasmd/default.nix @@ -6,7 +6,8 @@ autoPatchelfHook, pkgs, gccForLibs, -}: let +}: +let inherit (stdenv.targetPlatform) system; libwasmvm_files = { x86_64-linux = "libwasmvm.x86_64.so"; @@ -18,43 +19,43 @@ aarch64-darwin = "libwasmvm.dylib"; }; so_name = libwasmvm_files.${system} or (throw "Unsupported system: ${system}"); - buildGoModule = pkgs.buildGoModule.override {go = go_1_22;}; + buildGoModule = pkgs.buildGoModule.override { go = go_1_22; }; in - buildGoModule rec { - pname = "wasmd"; - version = "0.31.0"; - - src = fetchFromGitHub { - owner = "CosmWasm"; - repo = "wasmd"; - rev = "v${version}"; - hash = "sha256-lxx1rKvgzvWKeGnUG4Ij7K6tfL7u3cIaf6/CYRvkqLg="; - }; - - proxyVendor = true; - vendorHash = "sha256-xf4yCCb+VnU+fGHTyJ4Y9DKDDZpgUeemuEQCavHhFdM="; - - subPackages = ["cmd/wasmd"]; - - nativeBuildInputs = lib.optionals stdenv.isLinux [autoPatchelfHook]; - buildInputs = lib.optionals stdenv.isLinux [gccForLibs.libgcc]; - - postBuild = '' - mkdir -p "$out/lib" - cp "$GOPATH/pkg/mod/github.com/!cosm!wasm/wasmvm@v1.2.1/internal/api/${so_name}" "$out/lib" - ''; - - postInstall = '' - addAutoPatchelfSearchPath "$out/lib" - # TODO: autoPatchElf is Linux-specific. We need a cross-platform solution - autoPatchelf -- "$out/bin" - ''; - - doCheck = false; - meta = with lib; { - description = "Basic cosmos-sdk app with web assembly smart contracts"; - homepage = "https://github.com/CosmWasm/wasmd"; - license = licenses.asl20; - maintainers = with maintainers; []; - }; - } +buildGoModule rec { + pname = "wasmd"; + version = "0.31.0"; + + src = fetchFromGitHub { + owner = "CosmWasm"; + repo = "wasmd"; + rev = "v${version}"; + hash = "sha256-lxx1rKvgzvWKeGnUG4Ij7K6tfL7u3cIaf6/CYRvkqLg="; + }; + + proxyVendor = true; + vendorHash = "sha256-xf4yCCb+VnU+fGHTyJ4Y9DKDDZpgUeemuEQCavHhFdM="; + + subPackages = [ "cmd/wasmd" ]; + + nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ]; + buildInputs = lib.optionals stdenv.isLinux [ gccForLibs.libgcc ]; + + postBuild = '' + mkdir -p "$out/lib" + cp "$GOPATH/pkg/mod/github.com/!cosm!wasm/wasmvm@v1.2.1/internal/api/${so_name}" "$out/lib" + ''; + + postInstall = '' + addAutoPatchelfSearchPath "$out/lib" + # TODO: autoPatchElf is Linux-specific. We need a cross-platform solution + autoPatchelf -- "$out/bin" + ''; + + doCheck = false; + meta = with lib; { + description = "Basic cosmos-sdk app with web assembly smart contracts"; + homepage = "https://github.com/CosmWasm/wasmd"; + license = licenses.asl20; + maintainers = with maintainers; [ ]; + }; +} diff --git a/scripts/ci-matrix.sh b/scripts/ci-matrix.sh index c411c849..183db7be 100755 --- a/scripts/ci-matrix.sh +++ b/scripts/ci-matrix.sh @@ -95,4 +95,3 @@ printTableForCacheStatus() { } printTableForCacheStatus "$@" - diff --git a/scripts/commit_flake_update.bash b/scripts/commit_flake_update.bash index 521de5d6..298d5442 100755 --- a/scripts/commit_flake_update.bash +++ b/scripts/commit_flake_update.bash @@ -19,4 +19,3 @@ chore(flake.lock): Update all Flake inputs ($(date -I)) $(git log -1 '--pretty=format:%b' | sed '1,2d') EOF - diff --git a/scripts/nix-eval-jobs.sh b/scripts/nix-eval-jobs.sh index 913f91e4..a2443296 100755 --- a/scripts/nix-eval-jobs.sh +++ b/scripts/nix-eval-jobs.sh @@ -50,4 +50,3 @@ nix_eval_for_all_systems() { nix_eval_jobs "${flake_pre}.${system}${flake_post}" done } - diff --git a/shells/all.nix b/shells/all.nix index b52e418e..a8f53e34 100644 --- a/shells/all.nix +++ b/shells/all.nix @@ -2,95 +2,97 @@ pkgs, self', }: -with pkgs; let - example-container = - nix2container.buildImage - { - name = "example"; - tag = "latest"; - config = { - entrypoint = ["${pkgs.figlet}/bin/figlet" "MCL"]; - }; +with pkgs; +let + example-container = nix2container.buildImage { + name = "example"; + tag = "latest"; + config = { + entrypoint = [ + "${pkgs.figlet}/bin/figlet" + "MCL" + ]; }; + }; in - mkShell { - packages = - [ - # For priting the direnv banner - figlet - - # For formatting Nix files - alejandra - - # Packages defined in this repo - metacraft-labs.cosmos-theta-testnet - metacraft-labs.bnb-beacon-node - metacraft-labs.circom - - metacraft-labs.circ - - metacraft-labs.go-opera - - metacraft-labs.polkadot - metacraft-labs.polkadot-fast - - # noir - # self'.legacyPackages.noir.nargo - # self'.legacyPackages.noir.noirc_abi_wasm - # self'.legacyPackages.noir.acvm_js - - # ethereum.nix - self'.legacyPackages.ethereum_nix.geth - - # avalanche cli - metacraft-labs.avalanche-cli - - # Node.js related - metacraft-labs.corepack-shims - ] - ++ lib.optionals (stdenv.hostPlatform.isx86) [ - metacraft-labs.rapidsnark - - # Cardano - metacraft-labs.cardano - ] - ++ lib.optionals (stdenv.hostPlatform.isx86 && stdenv.isLinux) [ - # Rapidsnark depends on Pistache, which supports only Linux, see - # https://github.com/pistacheio/pistache/issues/6#issuecomment-242398225 - # for more information - metacraft-labs.rapidsnark-server - - # Ethereum - self'.legacyPackages.ethereum_nix.nimbus - - # Test nix2container - example-container.copyToDockerDaemon - ] - ++ lib.optionals (!stdenv.isDarwin) [ - # Solana is still not compatible with macOS on M1 - # metacraft-labs.solana - metacraft-labs.wasmd - - # Disabled until elrond-go can build with Go >= 1.19 - # Elrond - metacraft-labs.cryptography36 - # metacraft-labs.erdpy - # metacraft-labs.elrond-go - # metacraft-labs.elrond-proxy-go - - # EOS - metacraft-labs.leap - metacraft-labs.eos-vm - metacraft-labs.cdt - - # py-ecc - metacraft-labs.py-ecc - - # emscripten - metacraft-labs.emscripten - ]; - - shellHook = '' - figlet -w$COLUMNS "nix-blockchain-development" - ''; - } +mkShell { + packages = + [ + # For priting the direnv banner + figlet + + # For formatting Nix files + alejandra + + # Packages defined in this repo + metacraft-labs.cosmos-theta-testnet + metacraft-labs.bnb-beacon-node + metacraft-labs.circom + + metacraft-labs.circ + + metacraft-labs.go-opera + + metacraft-labs.polkadot + metacraft-labs.polkadot-fast + + # noir + # self'.legacyPackages.noir.nargo + # self'.legacyPackages.noir.noirc_abi_wasm + # self'.legacyPackages.noir.acvm_js + + # ethereum.nix + self'.legacyPackages.ethereum_nix.geth + + # avalanche cli + metacraft-labs.avalanche-cli + + # Node.js related + metacraft-labs.corepack-shims + ] + ++ lib.optionals (stdenv.hostPlatform.isx86) [ + metacraft-labs.rapidsnark + + # Cardano + metacraft-labs.cardano + ] + ++ lib.optionals (stdenv.hostPlatform.isx86 && stdenv.isLinux) [ + # Rapidsnark depends on Pistache, which supports only Linux, see + # https://github.com/pistacheio/pistache/issues/6#issuecomment-242398225 + # for more information + metacraft-labs.rapidsnark-server + + # Ethereum + self'.legacyPackages.ethereum_nix.nimbus + + # Test nix2container + example-container.copyToDockerDaemon + ] + ++ lib.optionals (!stdenv.isDarwin) [ + # Solana is still not compatible with macOS on M1 + # metacraft-labs.solana + metacraft-labs.wasmd + + # Disabled until elrond-go can build with Go >= 1.19 + # Elrond + metacraft-labs.cryptography36 + # metacraft-labs.erdpy + # metacraft-labs.elrond-go + # metacraft-labs.elrond-proxy-go + + # EOS + metacraft-labs.leap + metacraft-labs.eos-vm + metacraft-labs.cdt + + # py-ecc + metacraft-labs.py-ecc + + # emscripten + metacraft-labs.emscripten + ]; + + shellHook = '' + figlet -w$COLUMNS "nix-blockchain-development" + ''; +} diff --git a/shells/ci.nix b/shells/ci.nix index 181a419e..0091f982 100644 --- a/shells/ci.nix +++ b/shells/ci.nix @@ -1,7 +1,14 @@ -{pkgs, ...}: +{ pkgs, config, ... }: pkgs.mkShellNoCC { packages = with pkgs; [ jq nix-eval-jobs + figlet ]; + + shellHook = + '' + figlet -w$COLUMNS "nix-blockchain-development" + '' + + config.pre-commit.installationScript; } diff --git a/statix.toml b/statix.toml new file mode 100644 index 00000000..c6fd6470 --- /dev/null +++ b/statix.toml @@ -0,0 +1,3 @@ +disabled = [ + "empty_pattern" +]