2021-08-15 02:28:45 -07:00
|
|
|
{ config, pkgs, lib, ... }:
|
2020-04-07 13:47:33 -07:00
|
|
|
|
2021-08-15 02:28:45 -07:00
|
|
|
with lib;
|
2020-04-07 13:47:34 -07:00
|
|
|
{
|
2021-08-15 02:28:45 -07:00
|
|
|
options = {
|
|
|
|
nix-bitcoin = {
|
|
|
|
pkgs = mkOption {
|
|
|
|
type = types.attrs;
|
|
|
|
default = (import ../pkgs { inherit pkgs; }).modulesPkgs;
|
2021-12-07 19:07:27 -08:00
|
|
|
defaultText = "nix-bitcoin/pkgs.modulesPkgs";
|
2021-08-15 02:28:45 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
lib = mkOption {
|
|
|
|
readOnly = true;
|
2022-10-22 10:37:56 -07:00
|
|
|
default = import ../pkgs/lib.nix lib pkgs config;
|
2021-12-07 19:07:27 -08:00
|
|
|
defaultText = "nix-bitcoin/pkgs/lib.nix";
|
2021-08-15 02:28:45 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
torClientAddressWithPort = mkOption {
|
|
|
|
readOnly = true;
|
2021-10-01 02:51:55 -07:00
|
|
|
default = with config.services.tor.client.socksListenAddress;
|
2021-08-15 02:28:45 -07:00
|
|
|
"${addr}:${toString port}";
|
2021-12-07 19:07:27 -08:00
|
|
|
defaultText = "(See source)";
|
2021-08-15 02:28:45 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
# Torify binary that works with custom Tor SOCKS addresses
|
|
|
|
# Related issue: https://github.com/NixOS/nixpkgs/issues/94236
|
|
|
|
torify = mkOption {
|
|
|
|
readOnly = true;
|
2022-11-08 13:45:19 -08:00
|
|
|
default = pkgs.writers.writeBashBin "torify" ''
|
2021-08-15 02:28:45 -07:00
|
|
|
${pkgs.tor}/bin/torify \
|
|
|
|
--address ${config.services.tor.client.socksListenAddress.addr} \
|
|
|
|
"$@"
|
|
|
|
'';
|
2021-12-07 19:07:27 -08:00
|
|
|
defaultText = "(See source)";
|
2021-08-15 02:28:45 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
# A helper for using doas instead of sudo when doas is enabled
|
|
|
|
runAsUserCmd = mkOption {
|
|
|
|
readOnly = true;
|
|
|
|
default = if config.security.doas.enable
|
2023-01-03 07:17:27 -08:00
|
|
|
then "doas -u"
|
2021-08-15 02:28:45 -07:00
|
|
|
else "sudo -u";
|
2021-12-07 19:07:27 -08:00
|
|
|
defaultText = "(See source)";
|
2021-08-15 02:28:45 -07:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2020-04-07 13:47:34 -07:00
|
|
|
}
|