1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-19 12:11:28 +00:00

trezord: init at 1.2.0 (#22054)

This commit is contained in:
Andrew Cann 2017-02-09 00:18:22 +08:00 committed by Joachim F
parent ae02508c2a
commit 3082647e74
6 changed files with 127 additions and 0 deletions

View file

@ -81,6 +81,7 @@
c0dehero = "CodeHero <codehero@nerdpol.ch>"; c0dehero = "CodeHero <codehero@nerdpol.ch>";
calrama = "Moritz Maxeiner <moritz@ucworks.org>"; calrama = "Moritz Maxeiner <moritz@ucworks.org>";
campadrenalin = "Philip Horger <campadrenalin@gmail.com>"; campadrenalin = "Philip Horger <campadrenalin@gmail.com>";
canndrew = "Andrew Cann <shum@canndrew.org>";
carlsverre = "Carl Sverre <accounts@carlsverre.com>"; carlsverre = "Carl Sverre <accounts@carlsverre.com>";
cdepillabout = "Dennis Gosnell <cdep.illabout@gmail.com>"; cdepillabout = "Dennis Gosnell <cdep.illabout@gmail.com>";
cfouche = "Chaddaï Fouché <chaddai.fouche@gmail.com>"; cfouche = "Chaddaï Fouché <chaddai.fouche@gmail.com>";

View file

@ -206,6 +206,7 @@
./services/hardware/tcsd.nix ./services/hardware/tcsd.nix
./services/hardware/tlp.nix ./services/hardware/tlp.nix
./services/hardware/thinkfan.nix ./services/hardware/thinkfan.nix
./services/hardware/trezord.nix
./services/hardware/udev.nix ./services/hardware/udev.nix
./services/hardware/udisks2.nix ./services/hardware/udisks2.nix
./services/hardware/upower.nix ./services/hardware/upower.nix

View file

@ -0,0 +1,54 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.trezord;
in {
### interface
options = {
services.trezord = {
enable = mkOption {
type = types.bool;
default = false;
description = ''
Enable Trezor bridge daemon, for use with Trezor hardware bitcoin wallets.
'';
};
};
};
### implementation
config = mkIf cfg.enable {
services.udev.packages = lib.singleton (pkgs.writeTextFile {
name = "trezord-udev-rules";
destination = "/etc/udev/rules.d/51-trezor.rules";
text = ''
SUBSYSTEM=="usb", ATTR{idVendor}=="534c", ATTR{idProduct}=="0001", MODE="0666", GROUP="dialout", SYMLINK+="trezor%n"
KERNEL=="hidraw*", ATTRS{idVendor}=="534c", ATTRS{idProduct}=="0001", MODE="0666", GROUP="dialout"
'';
});
systemd.services.trezord = {
description = "TREZOR Bridge";
after = [ "systemd-udev-settle.service" "network.target" ];
wantedBy = [ "multi-user.target" ];
path = [];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.trezord}/bin/trezord -f";
User = "trezord";
};
};
users.users.trezord = {
group = "trezord";
description = "Trezor bridge daemon user";
};
users.groups.trezord = {};
};
}

View file

@ -0,0 +1,51 @@
{ stdenv, fetchgit, curl, cmake, boost, gcc5, protobuf, pkgconfig, jsoncpp
, libusb1, libmicrohttpd
}:
let
version = "1.2.0";
in
stdenv.mkDerivation rec {
name = "trezord-${version}";
src = fetchgit {
url = "https://github.com/trezor/trezord";
rev = "refs/tags/v${version}";
sha256 = "1606j5cfngryk4q21yiga1zvc3zpx4q8vqn6ljrvr679hpvlwni4";
};
meta = with stdenv.lib; {
description = "TREZOR Bridge daemon for TREZOR bitcoin hardware wallet";
homepage = https://mytrezor.com;
license = licenses.gpl3;
maintainers = with stdenv.lib.maintainers; [ canndrew jb55 ];
platforms = platforms.linux;
};
patches = [ ./dynamic-link.patch ];
nativeBuildInputs = [
cmake
gcc5
pkgconfig
];
buildInputs = [
curl
boost
protobuf
libusb1
libmicrohttpd
jsoncpp
];
LD_LIBRARY_PATH = "${stdenv.lib.makeLibraryPath [ curl ]}";
cmakeFlags="-DJSONCPP_LIBRARY='${jsoncpp}/lib/libjsoncpp.so'";
installPhase = ''
mkdir -p $out/bin
cp trezord $out/bin
'';
}

View file

@ -0,0 +1,18 @@
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)

View file

@ -4086,6 +4086,8 @@ with pkgs;
tpm-luks = callPackage ../tools/security/tpm-luks { }; tpm-luks = callPackage ../tools/security/tpm-luks { };
trezord = callPackage ../servers/trezord { };
tthsum = callPackage ../applications/misc/tthsum { }; tthsum = callPackage ../applications/misc/tthsum { };
chaps = callPackage ../tools/security/chaps { }; chaps = callPackage ../tools/security/chaps { };