1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-15 17:51:01 +00:00
nix-darwin/modules/services/trezord.nix
2024-04-19 04:05:50 +02:00

47 lines
1.1 KiB
Nix

{ 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 = ''
Enable Trezor bridge daemon, for use with Trezor hardware wallets.
'';
};
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.
'';
};
};
};
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;
};
};
};
}