summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hoang <Enzime@users.noreply.github.com>2024-03-13 02:00:15 +1100
committerGitHub <noreply@github.com>2024-03-13 02:00:15 +1100
commitc7ae5dc969b93f3221f5c228f0ec3de3e2b8084e (patch)
treea088e7d472bcf26507c12b2035ad98b1d0982741
parent550340062c16d7ef8c2cc20a3d2b97bcd3c6b6f6 (diff)
parent66f85cb9db2144fe6434caee80838cbf7cfd0176 (diff)
Merge pull request #725 from mitchmindtree/trezord
-rw-r--r--modules/module-list.nix1
-rw-r--r--modules/services/trezord.nix47
2 files changed, 48 insertions, 0 deletions
diff --git a/modules/module-list.nix b/modules/module-list.nix
index 043d1ee..415ea49 100644
--- a/modules/module-list.nix
+++ b/modules/module-list.nix
@@ -82,6 +82,7 @@
./services/synapse-bt.nix
./services/synergy
./services/tailscale.nix
+ ./services/trezord.nix
./services/wg-quick.nix
./services/yabai
./services/nextdns
diff --git a/modules/services/trezord.nix b/modules/services/trezord.nix
new file mode 100644
index 0000000..97db519
--- /dev/null
+++ b/modules/services/trezord.nix
@@ -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;
+ };
+ };
+ };
+}