From d60a5aa4db891cd26e85f7a268af8022ea64a0fe Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Tue, 7 Apr 2020 23:05:01 +0200 Subject: [PATCH] define rpc.users submodule inline Improves readability. --- modules/bitcoind.nix | 45 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/modules/bitcoind.nix b/modules/bitcoind.nix index 29661f2..de1f1e8 100644 --- a/modules/bitcoind.nix +++ b/modules/bitcoind.nix @@ -41,28 +41,6 @@ let # Extra config options (from bitcoind nixos service) ${cfg.extraConfig} ''; - rpcUserOpts = { name, ... }: { - options = { - name = mkOption { - type = types.str; - example = "alice"; - description = '' - Username for JSON-RPC connections. - ''; - }; - passwordHMAC = mkOption { - type = with types; uniq (strMatching "[0-9a-f]+\\$[0-9a-f]{64}"); - example = "f7efda5c189b999524f151318c0c86$d5b51b3beffbc02b724e5d095828e0bc8b2456e9ac8757ae3211a5d9b16a22ae"; - description = '' - Password HMAC-SHA-256 for JSON-RPC connections. Must be a string of the - format $. - ''; - }; - }; - config = { - name = mkDefault name; - }; - }; in { options = { @@ -120,7 +98,28 @@ in { alice.passwordHMAC = "f7efda5c189b999524f151318c0c86$d5b51b3beffbc02b724e5d095828e0bc8b2456e9ac8757ae3211a5d9b16a22ae"; bob.passwordHMAC = "b2dd077cb54591a2f3139e69a897ac$4e71f08d48b4347cf8eff3815c0e25ae2e9a4340474079f55705f40574f4ec99"; }; - type = with types; loaOf (submodule rpcUserOpts); + type = with types; loaOf (submodule ({ name, ... }: { + options = { + name = mkOption { + type = types.str; + example = "alice"; + description = '' + Username for JSON-RPC connections. + ''; + }; + passwordHMAC = mkOption { + type = with types; uniq (strMatching "[0-9a-f]+\\$[0-9a-f]{64}"); + example = "f7efda5c189b999524f151318c0c86$d5b51b3beffbc02b724e5d095828e0bc8b2456e9ac8757ae3211a5d9b16a22ae"; + description = '' + Password HMAC-SHA-256 for JSON-RPC connections. Must be a string of the + format $. + ''; + }; + }; + config = { + name = mkDefault name; + }; + })); description = '' RPC user information for JSON-RPC connnections. '';