You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.4 KiB
71 lines
1.4 KiB
![]()
7 years ago
|
{ config, lib, pkgs, ... }:
|
||
|
|
||
|
with lib;
|
||
|
let
|
||
|
cfg = config.services.trezord;
|
||
|
in {
|
||
![]()
5 years ago
|
|
||
|
### docs
|
||
|
|
||
|
meta = {
|
||
|
doc = ./trezord.xml;
|
||
|
};
|
||
![]()
4 years ago
|
|
||
![]()
7 years ago
|
### interface
|
||
|
|
||
|
options = {
|
||
|
services.trezord = {
|
||
|
enable = mkOption {
|
||
|
type = types.bool;
|
||
|
default = false;
|
||
|
description = ''
|
||
|
Enable Trezor bridge daemon, for use with Trezor hardware bitcoin wallets.
|
||
|
'';
|
||
|
};
|
||
![]()
5 years ago
|
|
||
|
emulator.enable = mkOption {
|
||
|
type = types.bool;
|
||
|
default = false;
|
||
|
description = ''
|
||
|
Enable Trezor emulator support.
|
||
|
'';
|
||
|
};
|
||
|
|
||
|
emulator.port = mkOption {
|
||
|
type = types.port;
|
||
|
default = 21324;
|
||
|
description = ''
|
||
|
Listening port for the Trezor emulator.
|
||
|
'';
|
||
|
};
|
||
![]()
7 years ago
|
};
|
||
|
};
|
||
![]()
4 years ago
|
|
||
![]()
7 years ago
|
### implementation
|
||
|
|
||
|
config = mkIf cfg.enable {
|
||
![]()
5 years ago
|
services.udev.packages = [ pkgs.trezor-udev-rules ];
|
||
![]()
7 years ago
|
|
||
|
systemd.services.trezord = {
|
||
![]()
4 years ago
|
description = "Trezor Bridge";
|
||
![]()
3 years ago
|
after = [ "network.target" ];
|
||
![]()
7 years ago
|
wantedBy = [ "multi-user.target" ];
|
||
|
path = [];
|
||
|
serviceConfig = {
|
||
|
Type = "simple";
|
||
![]()
5 years ago
|
ExecStart = "${pkgs.trezord}/bin/trezord-go ${optionalString cfg.emulator.enable "-e ${builtins.toString cfg.emulator.port}"}";
|
||
![]()
7 years ago
|
User = "trezord";
|
||
|
};
|
||
|
};
|
||
|
|
||
|
users.users.trezord = {
|
||
|
group = "trezord";
|
||
|
description = "Trezor bridge daemon user";
|
||
![]()
5 years ago
|
isSystemUser = true;
|
||
![]()
7 years ago
|
};
|
||
|
|
||
|
users.groups.trezord = {};
|
||
|
};
|
||
|
}
|
||
|
|