From 591a02c490fdc8617e9c20f66b9e1ca7c86a6fde Mon Sep 17 00:00:00 2001 From: huangyi Date: Fri, 16 Feb 2024 20:55:26 +0800 Subject: [PATCH] Problem: nixpkgs is too old Solution: - update to release-23.11 --- default.nix | 2 +- flake.lock | 20 ++--- flake.nix | 6 +- go.mod | 2 +- integration_tests/poetry.lock | 6 +- integration_tests/pyproject.toml | 6 +- nix/build_overlay.nix | 11 --- nix/bundle-win-exe.nix | 6 +- nix/default.nix | 1 + nix/sources.json | 26 +++++-- nix/testenv.nix | 2 +- nix/zstd.nix | 122 ------------------------------- 12 files changed, 45 insertions(+), 165 deletions(-) delete mode 100644 nix/zstd.nix diff --git a/default.nix b/default.nix index 72d04fcbb..055782984 100644 --- a/default.nix +++ b/default.nix @@ -39,7 +39,7 @@ in buildGoApplication rec { pname = "chain-maind"; version = "4.2.8"; - go = buildPackages.go_1_20; + go = buildPackages.go_1_21; src = lib.cleanSourceWith { name = "src"; src = lib.sourceByRegex ./. src_regexes; diff --git a/flake.lock b/flake.lock index 6f8778999..d71b302aa 100644 --- a/flake.lock +++ b/flake.lock @@ -17,19 +17,19 @@ }, "gomod2nix": { "inputs": { + "flake-utils": [ + "flake-utils" + ], "nixpkgs": [ "nixpkgs" - ], - "utils": [ - "flake-utils" ] }, "locked": { - "lastModified": 1677459247, - "narHash": "sha256-JbakfAiPYmCCV224yAMq/XO0udN5coWv/oazblMKdoY=", + "lastModified": 1705314449, + "narHash": "sha256-yfQQ67dLejP0FLK76LKHbkzcQqNIrux6MFe32MMFGNQ=", "owner": "nix-community", "repo": "gomod2nix", - "rev": "3cbf3a51fe32e2f57af4c52744e7228bab22983d", + "rev": "30e3c3a9ec4ac8453282ca7f67fca9e1da12c3e6", "type": "github" }, "original": { @@ -56,16 +56,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1682538316, - "narHash": "sha256-YuHgVsR7S9zxJWHo7lo2ugd+uDC4ESWg1hA4bEZQv3Y=", + "lastModified": 1708053705, + "narHash": "sha256-K6kCu54cOM3zSUkVmfB9zPqWyKFpEkMkDLbRl9sxES4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "15b75800dce80225b44f067c9012b09de37dfad2", + "rev": "0ed7136921ea094c771db674c9d2566b14852a01", "type": "github" }, "original": { "owner": "NixOS", - "ref": "release-22.11", + "ref": "release-23.11", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 37401fad2..c2caf0a8f 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/release-22.11"; + nixpkgs.url = "github:NixOS/nixpkgs/release-23.11"; flake-utils.url = "github:numtide/flake-utils"; nix-bundle-exe = { url = "github:3noch/nix-bundle-exe"; @@ -9,7 +9,7 @@ gomod2nix = { url = "github:nix-community/gomod2nix"; inputs.nixpkgs.follows = "nixpkgs"; - inputs.utils.follows = "flake-utils"; + inputs.flake-utils.follows = "flake-utils"; }; }; @@ -49,7 +49,7 @@ devShells = { chain-maind = pkgs.mkShell { buildInputs = with pkgs; [ - go_1_20 + go_1_21 rocksdb ]; }; diff --git a/go.mod b/go.mod index d38f5ff43..542a7fd62 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/crypto-org-chain/chain-main/v4 -go 1.20 +go 1.21 require ( cosmossdk.io/errors v1.0.0-beta.7 diff --git a/integration_tests/poetry.lock b/integration_tests/poetry.lock index e51619f5a..c0306a46c 100644 --- a/integration_tests/poetry.lock +++ b/integration_tests/poetry.lock @@ -801,8 +801,8 @@ tomlkit = "^0.7.0" [package.source] type = "git" url = "https://github.com/crypto-com/pystarport.git" -reference = "main" -resolved_reference = "b2aa98544958811429948aff3ab4bb3881f56a1f" +reference = "403b845" +resolved_reference = "403b84548623d8139082689e38a7a786efa1d3ac" [[package]] name = "pytest" @@ -1156,4 +1156,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "e49dc78a7fc6e19c0929da8ddaff97feaebeabcc0dd357311253adc7f7e9f286" +content-hash = "cb4ef440f8f06480333fb8a97873c16d454a9a8f9673b6158bf94edea9b0a45d" diff --git a/integration_tests/pyproject.toml b/integration_tests/pyproject.toml index 0ce35572b..dd5cdb70d 100644 --- a/integration_tests/pyproject.toml +++ b/integration_tests/pyproject.toml @@ -19,7 +19,7 @@ pytest-github-actions-annotate-failures = "^0.1.7" protobuf = "^3.20.2" pyyaml = "^6.0.1" python-dateutil = "^2.8.1" -pystarport = { git = "https://github.com/crypto-com/pystarport.git", branch = "main" } +pystarport = { git = "https://github.com/crypto-com/pystarport.git", branch = "main", rev = "403b845" } chainlibpy = "^2.2.0" # manually upgrade to make hatchling build success in poetry2nix @@ -28,5 +28,5 @@ pathspec = "^0.10.1" [tool.poetry.dev-dependencies] [build-system] -requires = ["poetry>=0.12"] -build-backend = "poetry.masonry.api" +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/nix/build_overlay.nix b/nix/build_overlay.nix index 6875e06dc..476654e66 100644 --- a/nix/build_overlay.nix +++ b/nix/build_overlay.nix @@ -1,15 +1,4 @@ # some basic overlays nessesary for the build final: super: { - # include the fix: https://github.com/NixOS/nixpkgs/pull/211515 - zstd = final.callPackage ./zstd.nix { - cmake = final.buildPackages.cmakeMinimal; - }; rocksdb = final.callPackage ./rocksdb.nix { }; - go_1_20 = super.go_1_20.overrideAttrs (prev: rec { - version = "1.20.4"; - src = final.fetchurl { - url = "https://go.dev/dl/go${version}.src.tar.gz"; - hash = "sha256-nzSs4Sh2S3o6SyOLgFhWzBshhDBN+eVpCCWwcQ9CAtY="; - }; - }); } diff --git a/nix/bundle-win-exe.nix b/nix/bundle-win-exe.nix index 5a156c542..ed31cdf9f 100644 --- a/nix/bundle-win-exe.nix +++ b/nix/bundle-win-exe.nix @@ -20,9 +20,9 @@ runCommand "tarball-${chain-maind.name}" "${zlib}/bin/zlib1.dll" "${zstd.bin}/bin/libzstd.dll" "${windows.mingw_w64_pthreads}/bin/libwinpthread-1.dll" - "${windows.mcfgthreads}/bin/mcfgthread-12.dll" - "${stdenv.cc.cc}/x86_64-w64-mingw32/lib/libgcc_s_seh-1.dll" - "${stdenv.cc.cc}/x86_64-w64-mingw32/lib/libstdc++-6.dll" + "${windows.mcfgthreads}/bin/libmcfgthread-1.dll" + "${stdenv.cc.cc.lib}/x86_64-w64-mingw32/lib/libgcc_s_seh-1.dll" + "${stdenv.cc.cc.lib}/x86_64-w64-mingw32/lib/libstdc++-6.dll" ]; } '' mkdir -p $out diff --git a/nix/default.nix b/nix/default.nix index 393ce79c9..67645b9b7 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -11,6 +11,7 @@ import sources.nixpkgs { }; hermes = pkgs.callPackage ./hermes.nix { src = sources.ibc-rs; }; }) + (import "${sources.poetry2nix}/overlay.nix") (import "${sources.gomod2nix}/overlay.nix") (import ./build_overlay.nix) (pkgs: prev: { diff --git a/nix/sources.json b/nix/sources.json index 20aba3331..3464eb3e4 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -17,10 +17,10 @@ "homepage": null, "owner": "nix-community", "repo": "gomod2nix", - "rev": "3cbf3a51fe32e2f57af4c52744e7228bab22983d", - "sha256": "11kn199nxcw6zspqawkrsfwv8wzx581wif3day160qlg11ya9di5", + "rev": "30e3c3a9ec4ac8453282ca7f67fca9e1da12c3e6", + "sha256": "1m0q0p1xidsp61xfrbj8ld1dqk3fhyrfifxj2ks36yjbnzmi1x69", "type": "tarball", - "url": "https://github.com/nix-community/gomod2nix/archive/3cbf3a51fe32e2f57af4c52744e7228bab22983d.tar.gz", + "url": "https://github.com/nix-community/gomod2nix/archive/30e3c3a9ec4ac8453282ca7f67fca9e1da12c3e6.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, "ibc-rs": { @@ -36,15 +36,27 @@ "url_template": "https://github.com///archive/.tar.gz" }, "nixpkgs": { - "branch": "master", + "branch": "release-23.11", "description": "Nix Packages collection", "homepage": "", "owner": "NixOS", "repo": "nixpkgs", - "rev": "90aa73fc8e1550b16d1ebdc436e48d9951f7989b", - "sha256": "0jh4npbcqjlszhnaz5mkziv5g1p5ig6wqp68yjxkjllsc7vhsrw6", + "rev": "0ed7136921ea094c771db674c9d2566b14852a01", + "sha256": "0bhi67drgldn1hj464k9l749dyncgpq9j5a997rwsf0wksxh5a9b", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/0ed7136921ea094c771db674c9d2566b14852a01.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, + "poetry2nix": { + "branch": "master", + "description": "Convert poetry projects to nix automagically [maintainer=@adisbladis] ", + "homepage": "", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "4eb2ac54029af42a001c9901194e9ce19cbd8a40", + "sha256": "16fi71fpywiqsya1z99kkb14dansyrmkkrb2clzs3b5qqx673wf4", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/90aa73fc8e1550b16d1ebdc436e48d9951f7989b.tar.gz", + "url": "https://github.com/nix-community/poetry2nix/archive/4eb2ac54029af42a001c9901194e9ce19cbd8a40.tar.gz", "url_template": "https://github.com///archive/.tar.gz" } } diff --git a/nix/testenv.nix b/nix/testenv.nix index 7499d2145..b76aef6b8 100644 --- a/nix/testenv.nix +++ b/nix/testenv.nix @@ -8,7 +8,7 @@ poetry2nix.mkPoetryEnv { buildSystems = { pyparsing = [ "flit-core" ]; hdwallets = [ "poetry" ]; - pystarport = [ "poetry" ]; + pystarport = [ "poetry-core" ]; durations = [ "setuptools" ]; multitail2 = [ "setuptools" ]; pytest-github-actions-annotate-failures = [ "setuptools" ]; diff --git a/nix/zstd.nix b/nix/zstd.nix deleted file mode 100644 index ff8860056..000000000 --- a/nix/zstd.nix +++ /dev/null @@ -1,122 +0,0 @@ -{ lib -, stdenv -, fetchFromGitHub -, cmake -, bash -, gnugrep -, fixDarwinDylibNames -, file -, fetchpatch -, legacySupport ? false -, static ? stdenv.hostPlatform.isStatic - # these need to be ran on the host, thus disable when cross-compiling -, buildContrib ? stdenv.hostPlatform == stdenv.buildPlatform -, doCheck ? stdenv.hostPlatform == stdenv.buildPlatform -, nix-update-script -}: - -stdenv.mkDerivation rec { - pname = "zstd"; - version = "1.5.2"; - - src = fetchFromGitHub { - owner = "facebook"; - repo = "zstd"; - rev = "v${version}"; - sha256 = "sha256-yJvhcysxcbUGuDOqe/TQ3Y5xyM2AUw6r1THSHOqmUy0="; - }; - - nativeBuildInputs = [ cmake ] - ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; - buildInputs = lib.optional stdenv.hostPlatform.isUnix bash; - - patches = [ - # This patches makes sure we do not attempt to use the MD5 implementation - # of the host platform when running the tests - ./playtests-darwin.patch - ]; - - postPatch = lib.optionalString (!static) '' - substituteInPlace build/cmake/CMakeLists.txt \ - --replace 'message(SEND_ERROR "You need to build static library to build tests")' "" - substituteInPlace build/cmake/tests/CMakeLists.txt \ - --replace 'libzstd_static' 'libzstd_shared' - sed -i \ - "1aexport ${lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH=$PWD/build_/lib" \ - tests/playTests.sh - ''; - - LDFLAGS = lib.optionalString stdenv.hostPlatform.isRiscV "-latomic"; - - cmakeFlags = lib.attrsets.mapAttrsToList - (name: value: "-DZSTD_${name}:BOOL=${if value then "ON" else "OFF"}") - { - BUILD_SHARED = !static; - BUILD_STATIC = static; - BUILD_CONTRIB = buildContrib; - PROGRAMS_LINK_SHARED = !static; - LEGACY_SUPPORT = legacySupport; - BUILD_TESTS = doCheck; - }; - - cmakeDir = "../build/cmake"; - dontUseCmakeBuildDir = true; - preConfigure = '' - mkdir -p build_ && cd $_ - ''; - - checkInputs = [ file ]; - inherit doCheck; - checkPhase = '' - runHook preCheck - # Patch shebangs for playTests - patchShebangs ../programs/zstdgrep - ctest -R playTests # The only relatively fast test. - runHook postCheck - ''; - - preInstall = '' - mkdir -p $bin/bin - substituteInPlace ../programs/zstdgrep \ - --replace ":-grep" ":-${gnugrep}/bin/grep" \ - --replace ":-zstdcat" ":-$bin/bin/zstdcat" - - substituteInPlace ../programs/zstdless \ - --replace "zstdcat" "$bin/bin/zstdcat" - '' + lib.optionalString buildContrib ( - '' - cp contrib/pzstd/pzstd $bin/bin/pzstd - '' + lib.optionalString stdenv.isDarwin '' - install_name_tool -change @rpath/libzstd.1.dylib $out/lib/libzstd.1.dylib $bin/bin/pzstd - '' - ); - - outputs = [ "bin" "dev" ] - ++ lib.optional stdenv.hostPlatform.isUnix "man" - ++ [ "out" ]; - - passthru = { - updateScript = nix-update-script { - attrPath = pname; - }; - }; - - meta = with lib; { - description = "Zstandard real-time compression algorithm"; - longDescription = '' - Zstd, short for Zstandard, is a fast lossless compression algorithm, - targeting real-time compression scenarios at zlib-level compression - ratio. Zstd can also offer stronger compression ratio at the cost of - compression speed. Speed/ratio trade-off is configurable by small - increment, to fit different situations. Note however that decompression - speed is preserved and remain roughly the same at all settings, a - property shared by most LZ compression algorithms, such as zlib. - ''; - homepage = "https://facebook.github.io/zstd/"; - changelog = "https://github.com/facebook/zstd/blob/v${version}/CHANGELOG"; - license = with licenses; [ bsd3 ]; # Or, at your opinion, GPL-2.0-only. - - platforms = platforms.all; - maintainers = with maintainers; [ orivej ]; - }; -}