Skip to content

Commit

Permalink
Merge pull request #725 from mitchmindtree/trezord
Browse files Browse the repository at this point in the history
  • Loading branch information
Enzime authored Mar 12, 2024
2 parents 5503400 + 66f85cb commit c7ae5dc
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
./services/synapse-bt.nix
./services/synergy
./services/tailscale.nix
./services/trezord.nix
./services/wg-quick.nix
./services/yabai
./services/nextdns
Expand Down
47 changes: 47 additions & 0 deletions modules/services/trezord.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{ config, lib, pkgs, ... }:

with lib;
let
cfg = config.services.trezord;
in {
# Options copied from:
# https://github.com/NixOS/nixpkgs/blob/9d6e454b857fb472fa35fc8b098fa5ac307a0d7d/nixos/modules/services/hardware/trezord.nix#L16
options = {
services.trezord = {
enable = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
Enable Trezor bridge daemon, for use with Trezor hardware wallets.
'';
};

emulator.enable = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
Enable Trezor emulator support.
'';
};

emulator.port = mkOption {
type = types.port;
default = 21324;
description = lib.mdDoc ''
Listening port for the Trezor emulator.
'';
};
};
};

config = mkIf cfg.enable {
launchd.user.agents.trezord = {
serviceConfig = {
ProgramArguments = [ "${pkgs.trezord}/bin/trezord-go" ]
++ optionals cfg.emulator.enable [ "-e" (builtins.toString cfg.emulator.port) ];
KeepAlive = true;
RunAtLoad = true;
};
};
};
}

0 comments on commit c7ae5dc

Please sign in to comment.