From b7047c728616881f6e8052c743146ac59cf208e4 Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Sun, 26 Apr 2020 18:51:28 +0000 Subject: [PATCH 1/7] HWI: allow building with unstable nixpkgs --- .travis.yml | 1 + pkgs/hwi/default.nix | 15 ++++++++++----- pkgs/hwi/ecdsa/default.nix | 28 ++++++++++++++++++++++++++++ pkgs/hwi/mnemonic/default.nix | 20 ++++++++++++++++++++ 4 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 pkgs/hwi/ecdsa/default.nix create mode 100644 pkgs/hwi/mnemonic/default.nix diff --git a/.travis.yml b/.travis.yml index 13ca60c..a74d999 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,6 +21,7 @@ env: jobs: - TestModules=1 STABLE=1 - PKG=hwi STABLE=1 + - PKG=hwi STABLE=0 - PKG=lightning-charge STABLE=1 - PKG=lightning-charge STABLE=0 - PKG=nanopos STABLE=1 diff --git a/pkgs/hwi/default.nix b/pkgs/hwi/default.nix index 9377158..41ec2d5 100644 --- a/pkgs/hwi/default.nix +++ b/pkgs/hwi/default.nix @@ -1,12 +1,18 @@ { stdenv, fetchurl, fetchFromGitHub, python3 }: with stdenv.lib; -with python3.pkgs; let - buildInputs = [ mnemonic ecdsa typing-extensions hidapi libusb1 pyaes ]; + python = python3.override { + packageOverrides = self: super: { + # HWI requires mnemonic <0.19 but nixpkgs has a newer version + mnemonic = self.callPackage ./mnemonic {}; + # HWI requires ecdsa <0.14 but nixpkgs has a newer version + ecdsa = self.callPackage ./ecdsa {}; + }; + }; in -buildPythonPackage rec { +python.pkgs.buildPythonPackage rec { pname = "hwi"; version = "1.0.3"; @@ -20,8 +26,7 @@ buildPythonPackage rec { # TODO: enable tests doCheck = false; - inherit buildInputs; - propagatedBuildInputs = buildInputs; + propagatedBuildInputs = with python.pkgs; [ mnemonic ecdsa typing-extensions hidapi libusb1 pyaes ]; meta = with lib; { homepage = https://github.com/bitcoin-core/hwi; diff --git a/pkgs/hwi/ecdsa/default.nix b/pkgs/hwi/ecdsa/default.nix new file mode 100644 index 0000000..d9c43f5 --- /dev/null +++ b/pkgs/hwi/ecdsa/default.nix @@ -0,0 +1,28 @@ +{ stdenv +, buildPythonPackage +, fetchPypi +, pkgs +, six +}: + +buildPythonPackage rec { + pname = "ecdsa"; + version = "0.13.3"; + + src = fetchPypi { + inherit pname version; + sha256 = "163c80b064a763ea733870feb96f9dd9b92216cfcacd374837af18e4e8ec3d4d"; + }; + + propagatedBuildInputs = [ six ]; + # Only needed for tests + checkInputs = [ pkgs.openssl ]; + + meta = with stdenv.lib; { + description = "ECDSA cryptographic signature library"; + homepage = "https://github.com/warner/python-ecdsa"; + license = licenses.mit; + maintainers = with maintainers; [ aszlig ]; + }; + +} diff --git a/pkgs/hwi/mnemonic/default.nix b/pkgs/hwi/mnemonic/default.nix new file mode 100644 index 0000000..4cb416a --- /dev/null +++ b/pkgs/hwi/mnemonic/default.nix @@ -0,0 +1,20 @@ +{ lib, fetchPypi, buildPythonPackage, pbkdf2 }: + +buildPythonPackage rec { + pname = "mnemonic"; + version = "0.18"; + + src = fetchPypi { + inherit pname version; + sha256 = "02a7306a792370f4a0c106c2cf1ce5a0c84b9dbd7e71c6792fdb9ad88a727f1d"; + }; + + propagatedBuildInputs = [ pbkdf2 ]; + + meta = { + description = "Implementation of Bitcoin BIP-0039"; + homepage = "https://github.com/trezor/python-mnemonic"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ np ]; + }; +} From c03ad1ccfafe420e9148a14c38706c81e0eae89a Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Sun, 26 Apr 2020 18:53:05 +0000 Subject: [PATCH 2/7] Update nixpkgs (stable 19.09 -> 20.03) --- pkgs/nixpkgs-pinned.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/nixpkgs-pinned.nix b/pkgs/nixpkgs-pinned.nix index 40b07a2..9cbcadb 100644 --- a/pkgs/nixpkgs-pinned.nix +++ b/pkgs/nixpkgs-pinned.nix @@ -8,11 +8,11 @@ in { # To update, run ../helper/fetch-channel REV nixpkgs = fetch { - rev = "839cd8d03aa55f067e23a64097fc5b7d7e02f468"; - sha256 = "1w0xklkk9lbwvrx02gng71pyf476h223098692pji5wg5l0sgm02"; + rev = "95b9c99f6d091273572ff1ec62b97b6ad3f68bdf"; + sha256 = "1qcwr9binkwfayix88aljwssxi5djkwscx0rnwlk1yp9q60rgp3d"; }; nixpkgs-unstable = fetch { - rev = "7c2fc1ce23a805f3220d867f528ceb9bd848d2e1"; - sha256 = "1g562hlp5ha11a41daav9bnq86n4nmbm3xzhpzmma8c4jn4k2p8y"; + rev = "22a3bf9fb9edad917fb6cd1066d58b5e426ee975"; + sha256 = "089hqg2r2ar5piw9q5z3iv0qbmfjc4rl5wkx9z16aqnlras72zsa"; }; } From f5dbac318de88043188e0351b1d63af5f8b5167c Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Wed, 8 Apr 2020 11:35:40 +0000 Subject: [PATCH 3/7] nixops: fix format exception from upstream nixops Without this our nixops doesn't build --- pkgs/nixops/release.nix.patch | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/nixops/release.nix.patch b/pkgs/nixops/release.nix.patch index 734159b..940073e 100644 --- a/pkgs/nixops/release.nix.patch +++ b/pkgs/nixops/release.nix.patch @@ -43,7 +43,6 @@ ('destDir', 'string'), ('user', 'string'), ('group', 'string'), - --- a/nixops/ssh_util.py +++ b/nixops/ssh_util.py @@ -278,6 +278,7 @@ class SSH(object): @@ -54,3 +53,15 @@ master = self.get_master(flags, timeout, user) flags = flags + self._get_flags() if logged: + +--- a/nixops/deployment.py ++++ b/nixops/deployment.py +@@ -748,6 +748,6 @@ + if res == 100 or force_reboot or m.state == m.RESCUE: + if not allow_reboot and not force_reboot: + raise Exception("the new configuration requires a " +- "reboot to take effect (hint: use " ++ "reboot of '{}' to take effect (hint: use " + "‘--allow-reboot’)".format(m.name)) + m.reboot_sync() + res = 0 \ No newline at end of file From 2d3a1e839e4839ab2f575ea2226b4003ae65dd4b Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Sat, 2 May 2020 18:07:21 +0200 Subject: [PATCH 4/7] electrs: fix conditional cargoSha256 --- pkgs/electrs/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/electrs/default.nix b/pkgs/electrs/default.nix index 05202cb..e29efd6 100644 --- a/pkgs/electrs/default.nix +++ b/pkgs/electrs/default.nix @@ -13,8 +13,8 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ llvmPackages.clang ]; LIBCLANG_PATH = "${llvmPackages.libclang}/lib"; - cargoSha256 = if pkgs ? cargo-vendor then - # nixpkgs ≤ 19.09 + cargoSha256 = if builtins.pathExists "${pkgs.path}/pkgs/build-support/rust/fetchcargo.nix" then + # nixpkgs ≤ 20.03 "19qs8if8fmygv6j74s6iwzm534fybwasjvmzdqcl996xhg75w6gi" else # for recent nixpkgs with cargo-native vendoring (introduced in nixpkgs PR #69274) From 45de0d427d3f30590abe0ba9f48bdf45509c7538 Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Tue, 28 Apr 2020 21:56:15 +0000 Subject: [PATCH 5/7] Travis: test electrs with unstable nixpkgs as well --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a74d999..2006734 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,8 +30,7 @@ env: - PKG=elementsd STABLE=1 - PKG=elementsd STABLE=0 - PKG=electrs STABLE=1 - # broken - # - PKG=electrs STABLE=0 + - PKG=electrs STABLE=0 - PKG=liquid-swap STABLE=1 - PKG=nixops19_09 STABLE=1 script: From 026a22fcee753d9edfc4786603aff66d23096b23 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Mon, 4 May 2020 11:53:19 +0200 Subject: [PATCH 6/7] use python testing from stable nixpkgs --- test/make-test.nix | 19 +++---------------- test/use-stable-pkgs.patch | 28 ---------------------------- 2 files changed, 3 insertions(+), 44 deletions(-) delete mode 100644 test/use-stable-pkgs.patch diff --git a/test/make-test.nix b/test/make-test.nix index d20ed94..1450f8a 100644 --- a/test/make-test.nix +++ b/test/make-test.nix @@ -1,25 +1,12 @@ testArgs: let - stablePkgs = import { config = {}; overlays = []; }; - unstable = (import ../pkgs/nixpkgs-pinned.nix).nixpkgs-unstable; + pkgs = import { config = {}; overlays = []; }; - # Stable nixpkgs doesn't yet include the Python testing framework. - # Use unstable nixpkgs and patch it so that it uses stable nixpkgs for the VM - # machine configuration. - testingPkgs = - stablePkgs.runCommand "nixpkgs-testing" {} '' - cp -r ${unstable} $out - cd $out - chmod +w -R . - patch -p1 < ${./use-stable-pkgs.patch} - ''; - - test = (import "${testingPkgs}/nixos/tests/make-test-python.nix") testArgs; + test = (import "${pkgs.path}/nixos/tests/make-test-python.nix") testArgs; fixedTest = { system ? builtins.currentSystem, ... }@args: let - pkgs = (import testingPkgs { inherit system; config = {}; overlays = []; } ); pkgsFixed = pkgs // { # Fix the black Python code formatter that's used in the test to allow the test # script to have longer lines. The default width of 88 chars is too restrictive for @@ -35,7 +22,7 @@ let # QEMU 4.20 from unstable fails on Travis build nodes with message # "error: failed to set MSR 0x48b to 0x159ff00000000" # Use version 4.0.1 instead. - inherit (stablePkgs) qemu_test; + inherit (pkgs) qemu_test; }; in test (args // { pkgs = pkgsFixed; }); diff --git a/test/use-stable-pkgs.patch b/test/use-stable-pkgs.patch deleted file mode 100644 index 1a9f0b3..0000000 --- a/test/use-stable-pkgs.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- a/nixos/lib/build-vms.nix -+++ b/nixos/lib/build-vms.nix -@@ -30,10 +30,10 @@ rec { - buildVM = - nodes: configurations: - -- import ./eval-config.nix { -+ import { - inherit system; - modules = configurations ++ extraConfigurations; -- baseModules = (import ../modules/module-list.nix) ++ -+ baseModules = (import ) ++ - [ ../modules/virtualisation/qemu-vm.nix - ../modules/testing/test-instrumentation.nix # !!! should only get added for automated test runs - { key = "no-manual"; documentation.nixos.enable = false; } - - -services.connman doesn't exist in stable nixpkgs ---- a/nixos/modules/virtualisation/qemu-vm.nix -+++ b/nixos/modules/virtualisation/qemu-vm.nix -@@ -620,7 +620,6 @@ in - - # Wireless won't work in the VM. - networking.wireless.enable = mkVMOverride false; -- services.connman.enable = mkVMOverride false; - - # Speed up booting by not waiting for ARP. - networking.dhcpcd.extraConfig = "noarp"; From b9f07bf7065840038abcd310500604c141f41154 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Mon, 4 May 2020 12:01:17 +0200 Subject: [PATCH 7/7] test: use older qemu version for travis compatibility --- test/make-test.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/make-test.nix b/test/make-test.nix index 1450f8a..860751a 100644 --- a/test/make-test.nix +++ b/test/make-test.nix @@ -3,6 +3,11 @@ testArgs: let pkgs = import { config = {}; overlays = []; }; + pkgs19_09 = import (pkgs.fetchzip { + url = "https://github.com/NixOS/nixpkgs-channels/archive/a7ceb2536ab11973c59750c4c48994e3064a75fa.tar.gz"; + sha256 = "0hka65f31njqpq7i07l22z5rs7lkdfcl4pbqlmlsvnysb74ynyg1"; + }) { config = {}; overlays = []; }; + test = (import "${pkgs.path}/nixos/tests/make-test-python.nix") testArgs; fixedTest = { system ? builtins.currentSystem, ... }@args: @@ -22,7 +27,7 @@ let # QEMU 4.20 from unstable fails on Travis build nodes with message # "error: failed to set MSR 0x48b to 0x159ff00000000" # Use version 4.0.1 instead. - inherit (pkgs) qemu_test; + inherit (pkgs19_09) qemu_test; }; in test (args // { pkgs = pkgsFixed; });