From 8f375784085df6a9d1a5d0cf0b297d3742cf58a6 Mon Sep 17 00:00:00 2001 From: Martin Milata Date: Thu, 21 Nov 2024 22:38:00 +0100 Subject: [PATCH] ci(nix): update to latest nixpkgs-unstable, rustc [no changelog] --- .github/workflows/common.yml | 3 +- core/Makefile | 3 ++ shell.nix | 75 +++++++++++++----------------------- tools/build_protobuf | 2 + 4 files changed, 34 insertions(+), 49 deletions(-) diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index f4d659ddb6..5c48d3163d 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -85,7 +85,8 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable - run: nix-shell --run "poetry install" - - run: nix-shell --arg fullDeps true --run "cd python && poetry run tox" + # LD_LIBRARY_PATH workaround: https://discourse.nixos.org/t/nixpkgs-nixos-unstable-many-package-fail-with-glibc-2-38-not-found/35078 https://github.com/NixOS/nixpkgs/issues/287764 + - run: nix-shell --arg fullDeps true --run "unset LD_LIBRARY_PATH && cd python && poetry run tox" python_support_test: name: Python support test diff --git a/core/Makefile b/core/Makefile index d27be9d0a9..88dd98f228 100644 --- a/core/Makefile +++ b/core/Makefile @@ -150,6 +150,9 @@ endif SCONS = scons $(SCONS_OPTS) $(SCONS_VARS) +# LD_LIBRARY_PATH workaround: https://discourse.nixos.org/t/nixpkgs-nixos-unstable-many-package-fail-with-glibc-2-38-not-found/35078 https://github.com/NixOS/nixpkgs/issues/287764 +unexport LD_LIBRARY_PATH + ## help commands: help: ## show this help diff --git a/shell.nix b/shell.nix index d4d711f207..affef508c1 100644 --- a/shell.nix +++ b/shell.nix @@ -4,35 +4,28 @@ }: let - # the last commit from master as of 2024-01-22 + # the last commit from master as of 2024-11-21 rustOverlay = import (builtins.fetchTarball { - url = "https://github.com/oxalica/rust-overlay/archive/e36f66bb10b09f5189dc3b1706948eaeb9a1c555.tar.gz"; - sha256 = "1vivsmqmqajbvv7181y7mfl48fxmm75hq2c8rj6h1l2ymq28zcpg"; + url = "https://github.com/oxalica/rust-overlay/archive/2d484c7a0db32f2700e253160bcd2aaa6cdca3ba.tar.gz"; + sha256 = "17b32lz7kc12l8fwg8kc7ma83b51105z0xp2j0lfnsjr9qqc5r2y"; }); # define this variable and devTools if you want nrf{util,connect} acceptJlink = builtins.getEnv "TREZOR_FIRMWARE_ACCEPT_JLINK_LICENSE" == "yes"; - # the last successful build of nixpkgs-unstable as of 2023-04-14 + # the last successful build of nixpkgs-unstable as of 2024-11-21 nixpkgs = import (builtins.fetchTarball { + url = "https://github.com/NixOS/nixpkgs/archive/5083ec887760adfe12af64830a66807423a859a7.tar.gz"; + sha256 = "0sr45csfh2ff8w7jpnkkgl22aa89sza4jlhs6wq0368dpmklsl8g"; + }) { + config = { + allowUnfree = acceptJlink; + segger-jlink.acceptLicense = acceptJlink; + }; + overlays = [ rustOverlay ]; + }; + oldNixpkgs = import (builtins.fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/c58e6fbf258df1572b535ac1868ec42faf7675dd.tar.gz"; sha256 = "18pna0yinvdprhhcmhyanlgrmgf81nwpc0j2z9fy9mc8cqkx3937"; - }) { - config = { - allowUnfree = acceptJlink; - segger-jlink.acceptLicense = acceptJlink; - }; - overlays = [ rustOverlay ]; - }; - # 23.11 from 15. 4. 2024 - newNixpkgs = import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/53a2c32bc66f5ae41a28d7a9a49d321172af621e.tar.gz"; - sha256 = "0yqbwqbripb1bbhlwjfbqmg9qb0lai2fc0k1vfh674d6rrc8igwv"; - }) { - config = { - allowUnfree = acceptJlink; - segger-jlink.acceptLicense = acceptJlink; - }; - overlays = [ rustOverlay ]; - }; + }) { }; moneroTests = nixpkgs.fetchurl { url = "https://github.com/ph4r05/monero/releases/download/v0.18.3.1-dev-tests-u18.04-01/trezor_tests"; sha256 = "d8938679b69f53132ddacea1de4b38b225b06b37b3309aa17911cfbe09b70b4a"; @@ -68,33 +61,19 @@ let # to use official binary, remove rustfmt from buildInputs and add it to extensions: extensions = [ "rust-src" "clippy" "rustfmt" ]; }; - openocd-stm = (newNixpkgs.openocd.overrideAttrs (oldAttrs: { - src = newNixpkgs.fetchFromGitHub { + openocd-stm = (nixpkgs.openocd.overrideAttrs (oldAttrs: { + src = nixpkgs.fetchFromGitHub { owner = "STMicroelectronics"; repo = "OpenOCD"; rev = "openocd-cubeide-v1.13.0"; sha256 = "a811402e19f0bfe496f6eecdc05ecea57f79a323879a810efaaff101cb0f420f"; }; version = "stm-cubeide-v1.13.0"; - nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ newNixpkgs.autoreconfHook ]; + nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ nixpkgs.autoreconfHook ]; })); - # backport https://github.com/NixOS/nixpkgs/pull/229537 - # remove after nixpkgs bump - gcc-arm-embedded-gdbfix = (nixpkgs.gcc-arm-embedded.overrideAttrs (oldAttrs: { - postFixup = '' - mv $out/bin/arm-none-eabi-gdb $out/bin/arm-none-eabi-gdb-unwrapped - cat < $out/bin/arm-none-eabi-gdb - #!${nixpkgs.runtimeShell} - export PYTHONPATH=${nixpkgs.python38}/lib/python3.8 - export PYTHONHOME=${nixpkgs.python38}/bin/python3.8 - exec $out/bin/arm-none-eabi-gdb-unwrapped "\$@" - EOF - chmod +x $out/bin/arm-none-eabi-gdb - ''; - })); - llvmPackages = nixpkgs.llvmPackages_14; + llvmPackages = nixpkgs.llvmPackages_17; # see pyright/README.md for update procedure - pyright = nixpkgs.callPackage ./ci/pyright {}; + pyright = oldNixpkgs.callPackage ./ci/pyright {}; in with nixpkgs; stdenvNoCC.mkDerivation ({ @@ -107,7 +86,7 @@ stdenvNoCC.mkDerivation ({ python311 python310 python39 - python38 + oldNixpkgs.python38 ] ++ [ SDL2 SDL2_image @@ -116,8 +95,9 @@ stdenvNoCC.mkDerivation ({ check crowdin-cli # for translations curl # for connect tests - newNixpkgs.editorconfig-checker - (if devTools then gcc-arm-embedded-gdbfix else gcc-arm-embedded) + editorconfig-checker + gcc-arm-embedded + gcc14 git gitAndTools.git-subrepo gnumake @@ -125,11 +105,11 @@ stdenvNoCC.mkDerivation ({ libffi libjpeg libusb1 - newNixpkgs.llvmPackages_17.clang + llvmPackages.clang openssl - pkgconfig + pkg-config poetry - protobuf3_19 + oldNixpkgs.protobuf3_19 pyright (mkBinOnlyWrapper rustNightly) wget @@ -137,7 +117,6 @@ stdenvNoCC.mkDerivation ({ moreutils ] ++ lib.optionals (!stdenv.isDarwin) [ autoPatchelfHook - gcc12 procps valgrind ] ++ lib.optionals (stdenv.isDarwin) [ diff --git a/tools/build_protobuf b/tools/build_protobuf index a4417b5dd7..84b1872549 100755 --- a/tools/build_protobuf +++ b/tools/build_protobuf @@ -26,6 +26,8 @@ do_rebuild() { local param="--python-outdir" fi + # LD_LIBRARY_PATH workaround: https://discourse.nixos.org/t/nixpkgs-nixos-unstable-many-package-fail-with-glibc-2-38-not-found/35078 https://github.com/NixOS/nixpkgs/issues/287764 + unset LD_LIBRARY_PATH # note $SOURCES is unquoted - we want wildcard expansion and multiple args $PROTOB/pb2py "$@" $param="$OUTPUT" $SOURCES }