# Share the flake's pinned development toolchain with legacy nix-shell users. let flakeLock = builtins.fromJSON (builtins.readFile ./flake.lock); rootInputs = flakeLock.nodes.${flakeLock.root}.inputs; nixpkgsSource = flakeLock.nodes.${rootInputs.nixpkgs}.locked; pkgs = import (builtins.fetchTarball { url = "https://github.com/${nixpkgsSource.owner}/${nixpkgsSource.repo}/archive/${nixpkgsSource.rev}.tar.gz"; sha256 = nixpkgsSource.narHash; }) { system = builtins.currentSystem; config.allowUnfree = true; config.android_sdk.accept_license = true; }; in with pkgs; let # unstable packages electron = electron_42; nodejs = nodejs_24; useAndroid = builtins.getEnv "USE_ANDROID" == "1"; androidEnv = if useAndroid then import ./.nix/android.nix { inherit pkgs; } else {}; useRust = builtins.getEnv "USE_RUST" == "1"; rustEnv = if useRust then import ./.nix/rust.nix { inherit pkgs; } else {}; extraBuildInputs = pkgs.lib.concatLists [ (if useAndroid then [ androidEnv.jdk androidEnv.androidSdk ] ++ androidEnv.extraPackages else [jre]) (if useRust then rustEnv.extraPackages else []) ]; in stdenv.mkDerivation { name = "trezor-suite-dev"; buildInputs = [ bash jq git git-lfs gnupg mdbook docker # for e2e tests running on localhost docker-compose # for e2e tests running on localhost nodejs (yarn.override { nodejs = null; # use input nodejs }) python3 python3Packages.pip p7zip electron pkg-config pixman cairo giflib libjpeg libpng librsvg pango # build dependencies for node-canvas shellcheck vips ] ++ extraBuildInputs ++ lib.optionals stdenv.hostPlatform.isLinux [ nsis openjpeg osslsigncode p7zip squashfsTools # binaries used by node_module: electron-builder udev # used by node_module: usb ]; # used by patchelf for WabiSabiClientLibrary in dev mode (see webpack nixos-interpreter-plugin) NIX_PATCHELF_LIBRARY_PATH = "${openssl.out}/lib:${zlib}/lib:${gcc.cc.lib}/lib"; NIX_CC="${gcc}"; shellHook = '' export NODE_OPTIONS=--max_old_space_size=8192 export CURDIR="$(pwd)" export PATH="$PATH:$CURDIR/node_modules/.bin" export ELECTRON_BUILDER_CACHE="$CURDIR/.cache/electron-builder" '' + lib.optionalString useAndroid androidEnv.shellHook + lib.optionalString stdenv.hostPlatform.isDarwin '' export ELECTRON_OVERRIDE_DIST_PATH="${electron}/Applications/" '' + lib.optionalString stdenv.hostPlatform.isLinux '' export ELECTRON_OVERRIDE_DIST_PATH="${electron}/bin/" export ELECTRON_DISABLE_SANDBOX=1 export npm_config_build_from_source=true # tell yarn to not download binaries, but build from source export PLAYWRIGHT_BROWSERS_PATH="$CURDIR/.cache/ms-playwright" ''; }