diff --git a/nixos/modules/services/hardware/trezord.nix b/nixos/modules/services/hardware/trezord.nix index 38d0a3a1d752..fa0496114684 100644 --- a/nixos/modules/services/hardware/trezord.nix +++ b/nixos/modules/services/hardware/trezord.nix @@ -38,7 +38,7 @@ in { path = []; serviceConfig = { Type = "simple"; - ExecStart = "${pkgs.trezord}/bin/trezord -f"; + ExecStart = "${pkgs.trezord}/bin/trezord-go"; User = "trezord"; }; }; diff --git a/pkgs/servers/trezord/default.nix b/pkgs/servers/trezord/default.nix index bdc37b700e5d..a3c505646214 100644 --- a/pkgs/servers/trezord/default.nix +++ b/pkgs/servers/trezord/default.nix @@ -1,65 +1,26 @@ -{ stdenv, fetchgit, fetchFromGitHub, curl, cmake, boost, gcc, protobuf, pkgconfig, jsoncpp -, libusb1, libmicrohttpd -}: +{ stdenv, buildGoPackage, fetchFromGitHub }: -let - version = "1.2.1"; -in +buildGoPackage rec { + name = "trezord-go-${version}"; + version = "2.0.12"; -stdenv.mkDerivation rec { - name = "trezord-${version}"; + # Fixes Cgo related build failures (see https://github.com/NixOS/nixpkgs/issues/25959 ) + hardeningDisable = [ "fortify" ]; - src = fetchgit { - url = "https://github.com/trezor/trezord"; - rev = "refs/tags/v${version}"; - sha256 = "1iaxmwyidjdcrc6jg0859v6v5x3qnz5b0p78pq0bypvmgyijhpm4"; - }; + goPackagePath = "github.com/trezor/trezord-go"; - common = fetchFromGitHub { - owner = "trezor"; - repo = "trezor-common"; - rev = "b55fb61218431e9c99c9d6c1673801902fc9e92e"; - sha256 = "1zanbgz1qjs8wfwp0z91sqcvj77a9iis694k415jyd2dn4riqhdg"; + src = fetchFromGitHub { + owner = "trezor"; + repo = "trezord-go"; + rev = "v${version}"; + sha256 = "03pz223jjfbd0g9gkk21q6d27jc8vd1bc1jz00i0f3dzvsyfx5g6"; }; meta = with stdenv.lib; { - description = "TREZOR Bridge daemon for TREZOR bitcoin hardware wallet"; + description = "TREZOR Communication Daemon aka TREZOR Bridge"; homepage = https://mytrezor.com; license = licenses.gpl3; maintainers = with stdenv.lib.maintainers; [ canndrew jb55 ]; platforms = platforms.linux; }; - - patches = [ ./dynamic-link.patch ]; - - nativeBuildInputs = [ - cmake - gcc - pkgconfig - ]; - - buildInputs = [ - curl - boost - protobuf - libusb1 - libmicrohttpd - jsoncpp - ]; - - preConfigure = '' - ( cd src/config - ln -s $common/protob/config.proto - protoc -I . --cpp_out=. config.proto - ) - ''; - - LD_LIBRARY_PATH = "${stdenv.lib.makeLibraryPath [ curl ]}"; - cmakeFlags = [ "-DJSONCPP_LIBRARY='${jsoncpp}/lib/libjsoncpp.so'" ]; - - installPhase = '' - mkdir -p $out/bin - cp trezord $out/bin - ''; } - diff --git a/pkgs/servers/trezord/dynamic-link.patch b/pkgs/servers/trezord/dynamic-link.patch deleted file mode 100644 index 0f1f448a3f79..000000000000 --- a/pkgs/servers/trezord/dynamic-link.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7c0e2cf..0e3f4ac 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -59,13 +59,6 @@ target_link_libraries(trezord ${OS_LIBRARIES}) - find_package(CURL REQUIRED) - find_package(libmicrohttpd REQUIRED) - --# add static libs --if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") -- set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") -- set(BUILD_SHARED_LIBS off) -- set(Boost_USE_STATIC_LIBS on) -- set(CMAKE_FIND_STATIC FIRST) --endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - find_package(Boost 1.53.0 REQUIRED - regex thread system unit_test_framework program_options chrono) - find_package(Protobuf 2.5.0 REQUIRED)