diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c5bd1f9a..2f922f36 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,7 +16,9 @@ For development, use `nix/watch.sh s make APP=` to in To do a full Nix build run `nix/build.sh`. You can pass `nix-build` arguments to this to build specific attributes, e.g. `nix/build.sh -A nano.s.wallet`. ### Installing -`nix/install.sh` will install both the wallet and baking apps. Use `nix/install.sh baking` to install just the baking app or `nix/install.sh wallet` to install just the wallet. +`nix/install.sh` will install both the wallet and baking apps. Use +`nix/install.sh s baking` to install just the baking app or +`nix/install.sh s wallet` to install just the wallet. ### Editor Integration @@ -28,7 +30,9 @@ To do a full Nix build run `nix/build.sh`. You can pass `nix-build` arguments to ### Releasing -`nix/build.sh -A release.all` +`nix/build.sh -A nano.s.release.all` + +`nix/build.sh -A nano.x.release.all` ### Notes on testing diff --git a/Makefile b/Makefile index 8adaf170..18b68202 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ APPNAME = "Tezos Baking" else ifeq ($(APP),tezos_wallet) APPNAME = "Tezos Wallet" endif -APP_LOAD_PARAMS=--appFlags 0 --curve ed25519 --curve secp256k1 --curve prime256r1 --path "44'/1729'" $(COMMON_LOAD_PARAMS) +APP_LOAD_PARAMS= --appFlags 0 --curve ed25519 --curve secp256k1 --curve prime256r1 --path "44'/1729'" $(COMMON_LOAD_PARAMS) GIT_DESCRIBE ?= $(shell git describe --tags --abbrev=8 --always --long --dirty 2>/dev/null) @@ -68,6 +68,7 @@ DEFINES += COMMIT=\"$(COMMIT)\" APPVERSION_N=$(APPVERSION_N) APPVERSION_P=$(AP # DEFINES += _Static_assert\(...\)= ifeq ($(TARGET_NAME),TARGET_NANOX) +APP_LOAD_PARAMS += --appFlags 0x240 # with BLE support DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300 DEFINES += HAVE_BLE BLE_COMMAND_TIMEOUT_MS=2000 DEFINES += HAVE_BLE_APDU # basic ledger apdu transport over BLE diff --git a/README.md b/README.md index 544a5a3c..70a4bd5a 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,7 @@ configuration, most often the `udev` configuration. Using `sudo` for commands that should not require it can create security vulnerabilities and corrupt your configuration. -##Hacking +## Hacking See [CONTRIBUTING.md](CONTRIBUTING.md) diff --git a/default.nix b/default.nix index fbb82631..6c33e0d8 100644 --- a/default.nix +++ b/default.nix @@ -99,12 +99,18 @@ let release = rec { wallet = mkRelease "wallet" "Tezos Wallet" walletApp; baking = mkRelease "baking" "Tezos Baking" bakingApp; - all = pkgs.runCommand "${bolos.name}-release.tar.gz" {} '' - cp -r '${wallet}' wallet - cp -r '${baking}' baking - cp '${./release-installer.sh}' install.sh - chmod +x install.sh - tar czf "$out" install.sh wallet baking + all = pkgs.runCommand "ledger-app-tezos-${bolos.name}.tar.gz" {} '' + mkdir ledger-app-tezos-${bolos.name} + + cp -r ${wallet} ledger-app-tezos-${bolos.name}/wallet + # No baking app for Nano X yet + ${pkgs.lib.optionalString (bolos.name == "s") '' + cp -r ${baking} ledger-app-tezos-${bolos.name}/baking + ''} + + install -m a=rx ${./release-installer.sh} ledger-app-tezos-${bolos.name}/install.sh + + tar czf $out ledger-app-tezos-${bolos.name}/* ''; }; }; diff --git a/nix/build.sh b/nix/build.sh index e940cd74..80ed0d38 100755 --- a/nix/build.sh +++ b/nix/build.sh @@ -1,8 +1,10 @@ #!/usr/bin/env bash set -Eeuo pipefail +root="$(git rev-parse --show-toplevel)" + # Override package set by passing --arg pkgs descr=$(git describe --tags --abbrev=8 --always --long --dirty 2>/dev/null) echo >&2 "Git description: $descr" -exec nix-build --no-out-link --argstr gitDescribe "$descr" "$@" ${NIX_BUILD_ARGS:-} +exec nix-build "$root" --no-out-link --argstr gitDescribe "$descr" "$@" ${NIX_BUILD_ARGS:-} diff --git a/nix/install.sh b/nix/install.sh index bca00e47..2352fc11 100755 --- a/nix/install.sh +++ b/nix/install.sh @@ -1,26 +1,33 @@ -#!/usr/bin/env bash +#! /usr/bin/env nix-shell +#! nix-shell -i bash ./ledgerblue.nix -A shell + set -Eeuo pipefail -export target="${1:?Please specify target, either 's' for Nano S or 'x' for Nano X}" +root="$(git rev-parse --show-toplevel)" + +target="${1:?Please specify target, either 's' for Nano S or 'x' for Nano X}" shift -root="$(git rev-parse --show-toplevel)" -export root +case "$target" in + s) ;; x) ;; + *) + >&2 echo "Target must either be 's' for Nano S or 'x' for Nano X" + exit 1 +esac install() { + local app=$1 + shift local release_file - release_file=$("$root/nix/build.sh" -A "nano.${target}.release.$1") + release_file=$("$root/nix/build.sh" -A "nano.$target.release.$app" "$@") bash "$root/release-installer.sh" "$release_file" } -export -f install -nix-shell "$root/nix/ledgerblue.nix" -A shell --run "$(cat <