From ad97c268c639a30cff19bb380ce4feec63f77af4 Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Mon, 13 Sep 2021 13:40:48 +0200 Subject: [PATCH] modules: move user/group options to bottom These are insignificant, generic options; place them above readonly options. We already do this in other services. Also move user/group config to bottom in spark-wallet. --- modules/bitcoind.nix | 20 ++++++++++---------- modules/btcpayserver.nix | 20 ++++++++++---------- modules/electrs.nix | 20 ++++++++++---------- modules/joinmarket.nix | 14 +++++++------- modules/liquid.nix | 21 ++++++++++----------- modules/spark-wallet.nix | 14 +++++++------- 6 files changed, 54 insertions(+), 55 deletions(-) diff --git a/modules/bitcoind.nix b/modules/bitcoind.nix index 50f1a88..e52b525 100644 --- a/modules/bitcoind.nix +++ b/modules/bitcoind.nix @@ -43,16 +43,6 @@ let default = "/var/lib/bitcoind"; description = "The data directory for bitcoind."; }; - user = mkOption { - type = types.str; - default = "bitcoin"; - description = "The user as which to run bitcoind."; - }; - group = mkOption { - type = types.str; - default = cfg.user; - description = "The group as which to run bitcoind."; - }; rpc = { address = mkOption { type = types.str; @@ -221,6 +211,16 @@ let example = "bech32"; description = "The type of addresses to use"; }; + user = mkOption { + type = types.str; + default = "bitcoin"; + description = "The user as which to run bitcoind."; + }; + group = mkOption { + type = types.str; + default = cfg.user; + description = "The group as which to run bitcoind."; + }; cli = mkOption { readOnly = true; type = types.package; diff --git a/modules/btcpayserver.nix b/modules/btcpayserver.nix index f35b7f6..682b5c7 100644 --- a/modules/btcpayserver.nix +++ b/modules/btcpayserver.nix @@ -67,16 +67,6 @@ let default = "/var/lib/btcpayserver"; description = "The data directory for btcpayserver."; }; - user = mkOption { - type = types.str; - default = "btcpayserver"; - description = "The user as which to run btcpayserver."; - }; - group = mkOption { - type = types.str; - default = cfg.btcpayserver.user; - description = "The group as which to run btcpayserver."; - }; lightningBackend = mkOption { type = types.nullOr (types.enum [ "clightning" "lnd" ]); default = null; @@ -93,6 +83,16 @@ let example = "btcpayserver"; description = "The prefix for root-relative btcpayserver URLs."; }; + user = mkOption { + type = types.str; + default = "btcpayserver"; + description = "The user as which to run btcpayserver."; + }; + group = mkOption { + type = types.str; + default = cfg.btcpayserver.user; + description = "The group as which to run btcpayserver."; + }; enforceTor = nbLib.enforceTor; }; }; diff --git a/modules/electrs.nix b/modules/electrs.nix index f650954..095f6a0 100644 --- a/modules/electrs.nix +++ b/modules/electrs.nix @@ -19,16 +19,6 @@ let default = "/var/lib/electrs"; description = "The data directory for electrs."; }; - user = mkOption { - type = types.str; - default = "electrs"; - description = "The user as which to run electrs."; - }; - group = mkOption { - type = types.str; - default = cfg.user; - description = "The group as which to run electrs."; - }; high-memory = mkOption { type = types.bool; default = false; @@ -46,6 +36,16 @@ let default = ""; description = "Extra command line arguments passed to electrs."; }; + user = mkOption { + type = types.str; + default = "electrs"; + description = "The user as which to run electrs."; + }; + group = mkOption { + type = types.str; + default = cfg.user; + description = "The group as which to run electrs."; + }; enforceTor = nbLib.enforceTor; }; diff --git a/modules/joinmarket.nix b/modules/joinmarket.nix index 632a4b0..f2e92d9 100644 --- a/modules/joinmarket.nix +++ b/modules/joinmarket.nix @@ -9,6 +9,13 @@ let default = "/var/lib/joinmarket"; description = "The data directory for JoinMarket."; }; + rpcWalletFile = mkOption { + type = types.nullOr types.str; + default = "jm_wallet"; + description = '' + Name of the watch-only bitcoind wallet the JoinMarket addresses are imported to. + ''; + }; user = mkOption { type = types.str; default = "joinmarket"; @@ -19,13 +26,6 @@ let default = cfg.user; description = "The group as which to run JoinMarket."; }; - rpcWalletFile = mkOption { - type = types.nullOr types.str; - default = "jm_wallet"; - description = '' - Name of the watch-only bitcoind wallet the JoinMarket addresses are imported to. - ''; - }; cli = mkOption { default = cli; }; diff --git a/modules/liquid.nix b/modules/liquid.nix index b729a11..e2a57e8 100644 --- a/modules/liquid.nix +++ b/modules/liquid.nix @@ -3,7 +3,6 @@ with lib; let options = { - services.liquidd = { enable = mkEnableOption "Liquid sidechain"; address = mkOption { @@ -31,16 +30,6 @@ let default = "/var/lib/liquidd"; description = "The data directory for liquidd."; }; - user = mkOption { - type = types.str; - default = "liquid"; - description = "The user as which to run liquidd."; - }; - group = mkOption { - type = types.str; - default = cfg.user; - description = "The group as which to run liquidd."; - }; rpc = { address = mkOption { type = types.str; @@ -120,6 +109,16 @@ let Validate pegin claims. All functionaries must run this. ''; }; + user = mkOption { + type = types.str; + default = "liquid"; + description = "The user as which to run liquidd."; + }; + group = mkOption { + type = types.str; + default = cfg.user; + description = "The group as which to run liquidd."; + }; cli = mkOption { readOnly = true; default = pkgs.writeScriptBin "elements-cli" '' diff --git a/modules/spark-wallet.nix b/modules/spark-wallet.nix index 73b2b9a..0ca153c 100644 --- a/modules/spark-wallet.nix +++ b/modules/spark-wallet.nix @@ -65,13 +65,6 @@ in { config = mkIf cfg.enable { services.clightning.enable = true; - users.users.${cfg.user} = { - isSystemUser = true; - group = cfg.group; - extraGroups = [ config.services.clightning.group ]; - }; - users.groups.${cfg.group} = {}; - systemd.services.spark-wallet = { wantedBy = [ "multi-user.target" ]; requires = [ "clightning.service" ]; @@ -85,6 +78,13 @@ in { // nbLib.nodejs; }; + users.users.${cfg.user} = { + isSystemUser = true; + group = cfg.group; + extraGroups = [ config.services.clightning.group ]; + }; + users.groups.${cfg.group} = {}; + nix-bitcoin.secrets.spark-wallet-login.user = cfg.user; nix-bitcoin.generateSecretsCmds.spark-wallet = '' makePasswordSecret spark-wallet-password