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.
This commit is contained in:
Erik Arvstedt 2021-09-13 13:40:48 +02:00
parent 27c45b82cc
commit ad97c268c6
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
6 changed files with 54 additions and 55 deletions

View File

@ -43,16 +43,6 @@ let
default = "/var/lib/bitcoind"; default = "/var/lib/bitcoind";
description = "The data directory for 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 = { rpc = {
address = mkOption { address = mkOption {
type = types.str; type = types.str;
@ -221,6 +211,16 @@ let
example = "bech32"; example = "bech32";
description = "The type of addresses to use"; 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 { cli = mkOption {
readOnly = true; readOnly = true;
type = types.package; type = types.package;

View File

@ -67,16 +67,6 @@ let
default = "/var/lib/btcpayserver"; default = "/var/lib/btcpayserver";
description = "The data directory for 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 { lightningBackend = mkOption {
type = types.nullOr (types.enum [ "clightning" "lnd" ]); type = types.nullOr (types.enum [ "clightning" "lnd" ]);
default = null; default = null;
@ -93,6 +83,16 @@ let
example = "btcpayserver"; example = "btcpayserver";
description = "The prefix for root-relative btcpayserver URLs."; 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; enforceTor = nbLib.enforceTor;
}; };
}; };

View File

@ -19,16 +19,6 @@ let
default = "/var/lib/electrs"; default = "/var/lib/electrs";
description = "The data directory for 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 { high-memory = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
@ -46,6 +36,16 @@ let
default = ""; default = "";
description = "Extra command line arguments passed to electrs."; 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; enforceTor = nbLib.enforceTor;
}; };

View File

@ -9,6 +9,13 @@ let
default = "/var/lib/joinmarket"; default = "/var/lib/joinmarket";
description = "The data directory for 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 { user = mkOption {
type = types.str; type = types.str;
default = "joinmarket"; default = "joinmarket";
@ -19,13 +26,6 @@ let
default = cfg.user; default = cfg.user;
description = "The group as which to run JoinMarket."; 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 { cli = mkOption {
default = cli; default = cli;
}; };

View File

@ -3,7 +3,6 @@
with lib; with lib;
let let
options = { options = {
services.liquidd = { services.liquidd = {
enable = mkEnableOption "Liquid sidechain"; enable = mkEnableOption "Liquid sidechain";
address = mkOption { address = mkOption {
@ -31,16 +30,6 @@ let
default = "/var/lib/liquidd"; default = "/var/lib/liquidd";
description = "The data directory for 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 = { rpc = {
address = mkOption { address = mkOption {
type = types.str; type = types.str;
@ -120,6 +109,16 @@ let
Validate pegin claims. All functionaries must run this. 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 { cli = mkOption {
readOnly = true; readOnly = true;
default = pkgs.writeScriptBin "elements-cli" '' default = pkgs.writeScriptBin "elements-cli" ''

View File

@ -65,13 +65,6 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.clightning.enable = true; 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 = { systemd.services.spark-wallet = {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
requires = [ "clightning.service" ]; requires = [ "clightning.service" ];
@ -85,6 +78,13 @@ in {
// nbLib.nodejs; // 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.secrets.spark-wallet-login.user = cfg.user;
nix-bitcoin.generateSecretsCmds.spark-wallet = '' nix-bitcoin.generateSecretsCmds.spark-wallet = ''
makePasswordSecret spark-wallet-password makePasswordSecret spark-wallet-password