The Trezor dependency (which enables support for the Trezor hardware wallet) was gated behind the
enablePythonEcdsa override prior to this change because the trezor python package used to depend on
the ecdsa python package which is marked insecure. However, modern versions of the trezor package no
longer depend on ecdsa so it should be enabled by default, like the Ledger hardware wallet package.
This commit was created by a combination of scripts and tools:
- an ast-grep script to prefix things in meta with `lib.`,
- a modified nixf-diagnose / nixf combination to remove unused `with
lib;`, and
- regular nixfmt.
Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
Switch to the PEP 517 build pipeline so we rely on the native
build system rather than the deprecated setuptools path.
Use pythonRelaxDepsHook to ease upstream's strict version pins
and keep protobuf available at runtime.
Starting from version 4.3.1, source-only Electrum tarball excludes
generated protobuf files.
Build generated protobuf file from electrum/paymentrequest.proto.
Tests and wrappers include protobuf dependencies to start successfully.
Some Electrum plugins use python-ecdsa which is known to be vulnerable
(CVE-2024-23342). In this commit these plugins are disabled. It is possible
to re-enable it via option enablePythonEcdsa.
The list of affected plugins:
- ckcc-protocol
- keepkey
- trezor
- bitbox02
If a Python package does not come with either `format` or `pyproject` we
consider it a setuptools build, that calls `setup.py` directly, which is
deprecated.
This change, as a first step, migrates a large chunk of these packages to
set setuptools as their explicit format
This is so we can unify the problem space for the next step of the
migration.
electrum is quite strict about the aiorpcx version is accepts.
With commit 4bbf5300d4 ,
Upstream already has a patch to extend
the range of aiorpcx versions it permits:
171aa5ee5a
As the patch does not cleanly apply to the
distribution tarball we're using, we instead apply the
required changes "by hand", with `substituteInPlace`.
On top of the changes adapted from the upstream commit,
we have to change the file `./electrum/electrum`:
It is not part of the upstream source repository,
but it gets created from `./run_electrum` when
upstream creates the distribution tarball.
Note that the commit at hand is similar to
0e513f0435 .
The old `--replace` is deprecated,
we use `--replace-fail` so changes in source code that
might invalidate substitute invocations get noticed.
Cf. commit e07a2fab7f .
This reverts commit a879c72552.
It is no longer needed,
as electrum removed the PATH manipulation:
f15abd7cbd
However, this commit also deviates from a plain revert,
as it adds an additional replacement command to still
substitute the `--testnet` command line, as it was done before.
Note:
Those `--replace` calls are removed here in order to stricten
substitute calls with `--replace-fail` in a follow-up commit.
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build a08b3a4d19.tar.gz \
--argstr baseRev b32a094368
result/bin/apply-formatting $NIXPKGS_PATH
Since the update to version 5 with
7cdaa0b80c ,
the `python3Packages.protobuf` package
no longer provides the `protoc` program.
Instead, one has to add the `protobuf` package
(not the python package) directly.
In preparation for the deprecation of `stdenv.isX`.
These shorthands are not conducive to cross-compilation because they
hide the platforms.
Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way
One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059
There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.
```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
electrum is quite strict about the aiorpcx version is accepts.
With commit 97b53be707 ,
aiorpcx got updated to 0.23.1 which is too much for electrum.
Upstream already has a patch to extend the
range of aiorpcx versions it permits.
We apply that patch until a the next release of electrum.
Unfortunatelly, the patch -- which we take from the
GitHub source repository -- does not patch every file
that that is needed to be patched in the distribution tarball.
Hence we have to copy the patched file over another file
in the `postPatch` hook of the build process.
See the comments there for more information.