Merge pull request #55138 from oxij/tree/random-fixes

random cleanups and a tiny fix
This commit is contained in:
Michael Raskin 2019-02-13 20:16:07 +00:00 committed by GitHub
commit f539a6a70e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 173 additions and 173 deletions

View File

@ -352,9 +352,9 @@ you want them to come from. Add the following to `configuration.nix`.
```nix ```nix
services.hoogle = { services.hoogle = {
enable = true; enable = true;
packages = (hpkgs: with hpkgs; [text cryptonite]); packages = (hpkgs: with hpkgs; [text cryptonite]);
haskellPackages = pkgs.haskellPackages; haskellPackages = pkgs.haskellPackages;
}; };
``` ```

View File

@ -36,14 +36,14 @@ in
nixos.revision = mkOption { nixos.revision = mkOption {
internal = true; internal = true;
type = types.str; type = types.str;
default = lib.trivial.revisionWithDefault "master"; default = trivial.revisionWithDefault "master";
description = "The Git revision from which this NixOS configuration was built."; description = "The Git revision from which this NixOS configuration was built.";
}; };
nixos.codeName = mkOption { nixos.codeName = mkOption {
readOnly = true; readOnly = true;
type = types.str; type = types.str;
default = lib.trivial.codeName; default = trivial.codeName;
description = "The NixOS release code name (e.g. <literal>Emu</literal>)."; description = "The NixOS release code name (e.g. <literal>Emu</literal>).";
}; };

View File

@ -85,70 +85,70 @@ let
portOptions = { name, ...}: { portOptions = { name, ...}: {
options = { options = {
name = mkOption { name = mkOption {
internal = true; internal = true;
default = name; default = name;
}; };
ip = mkOption { ip = mkOption {
default = "127.0.0.1"; default = "127.0.0.1";
description = "Ip where rippled listens."; description = "Ip where rippled listens.";
type = types.str; type = types.str;
}; };
port = mkOption { port = mkOption {
description = "Port where rippled listens."; description = "Port where rippled listens.";
type = types.int; type = types.int;
}; };
protocol = mkOption { protocol = mkOption {
description = "Protocols expose by rippled."; description = "Protocols expose by rippled.";
type = types.listOf (types.enum ["http" "https" "ws" "wss" "peer"]); type = types.listOf (types.enum ["http" "https" "ws" "wss" "peer"]);
}; };
user = mkOption { user = mkOption {
description = "When set, these credentials will be required on HTTP/S requests."; description = "When set, these credentials will be required on HTTP/S requests.";
type = types.str; type = types.str;
default = ""; default = "";
}; };
password = mkOption { password = mkOption {
description = "When set, these credentials will be required on HTTP/S requests."; description = "When set, these credentials will be required on HTTP/S requests.";
type = types.str; type = types.str;
default = ""; default = "";
}; };
admin = mkOption { admin = mkOption {
description = "A comma-separated list of admin IP addresses."; description = "A comma-separated list of admin IP addresses.";
type = types.listOf types.str; type = types.listOf types.str;
default = ["127.0.0.1"]; default = ["127.0.0.1"];
}; };
ssl = { ssl = {
key = mkOption { key = mkOption {
description = '' description = ''
Specifies the filename holding the SSL key in PEM format. Specifies the filename holding the SSL key in PEM format.
''; '';
default = null; default = null;
type = types.nullOr types.path; type = types.nullOr types.path;
}; };
cert = mkOption { cert = mkOption {
description = '' description = ''
Specifies the path to the SSL certificate file in PEM format. Specifies the path to the SSL certificate file in PEM format.
This is not needed if the chain includes it. This is not needed if the chain includes it.
''; '';
default = null; default = null;
type = types.nullOr types.path; type = types.nullOr types.path;
}; };
chain = mkOption { chain = mkOption {
description = '' description = ''
If you need a certificate chain, specify the path to the If you need a certificate chain, specify the path to the
certificate chain here. The chain may include the end certificate. certificate chain here. The chain may include the end certificate.
''; '';
default = null; default = null;
type = types.nullOr types.path; type = types.nullOr types.path;
}; };
}; };
}; };
}; };
@ -175,14 +175,14 @@ let
onlineDelete = mkOption { onlineDelete = mkOption {
description = "Enable automatic purging of older ledger information."; description = "Enable automatic purging of older ledger information.";
type = types.addCheck (types.nullOr types.int) (v: v > 256); type = types.nullOr (types.addCheck types.int (v: v > 256));
default = cfg.ledgerHistory; default = cfg.ledgerHistory;
}; };
advisoryDelete = mkOption { advisoryDelete = mkOption {
description = '' description = ''
If set, then require administrative RPC call "can_delete" If set, then require administrative RPC call "can_delete"
to enable online deletion of ledger records. to enable online deletion of ledger records.
''; '';
type = types.nullOr types.bool; type = types.nullOr types.bool;
default = null; default = null;
@ -207,168 +207,168 @@ in
enable = mkEnableOption "rippled"; enable = mkEnableOption "rippled";
package = mkOption { package = mkOption {
description = "Which rippled package to use."; description = "Which rippled package to use.";
type = types.package; type = types.package;
default = pkgs.rippled; default = pkgs.rippled;
defaultText = "pkgs.rippled"; defaultText = "pkgs.rippled";
}; };
ports = mkOption { ports = mkOption {
description = "Ports exposed by rippled"; description = "Ports exposed by rippled";
type = with types; attrsOf (submodule portOptions); type = with types; attrsOf (submodule portOptions);
default = { default = {
rpc = { rpc = {
port = 5005; port = 5005;
admin = ["127.0.0.1"]; admin = ["127.0.0.1"];
protocol = ["http"]; protocol = ["http"];
}; };
peer = { peer = {
port = 51235; port = 51235;
ip = "0.0.0.0"; ip = "0.0.0.0";
protocol = ["peer"]; protocol = ["peer"];
}; };
ws_public = { ws_public = {
port = 5006; port = 5006;
ip = "0.0.0.0"; ip = "0.0.0.0";
protocol = ["ws" "wss"]; protocol = ["ws" "wss"];
}; };
}; };
}; };
nodeDb = mkOption { nodeDb = mkOption {
description = "Rippled main database options."; description = "Rippled main database options.";
type = with types; nullOr (submodule dbOptions); type = with types; nullOr (submodule dbOptions);
default = { default = {
type = "rocksdb"; type = "rocksdb";
extraOpts = '' extraOpts = ''
open_files=2000 open_files=2000
filter_bits=12 filter_bits=12
cache_mb=256 cache_mb=256
file_size_pb=8 file_size_pb=8
file_size_mult=2; file_size_mult=2;
''; '';
}; };
}; };
tempDb = mkOption { tempDb = mkOption {
description = "Rippled temporary database options."; description = "Rippled temporary database options.";
type = with types; nullOr (submodule dbOptions); type = with types; nullOr (submodule dbOptions);
default = null; default = null;
}; };
importDb = mkOption { importDb = mkOption {
description = "Settings for performing a one-time import."; description = "Settings for performing a one-time import.";
type = with types; nullOr (submodule dbOptions); type = with types; nullOr (submodule dbOptions);
default = null; default = null;
}; };
nodeSize = mkOption { nodeSize = mkOption {
description = '' description = ''
Rippled size of the node you are running. Rippled size of the node you are running.
"tiny", "small", "medium", "large", and "huge" "tiny", "small", "medium", "large", and "huge"
''; '';
type = types.enum ["tiny" "small" "medium" "large" "huge"]; type = types.enum ["tiny" "small" "medium" "large" "huge"];
default = "small"; default = "small";
}; };
ips = mkOption { ips = mkOption {
description = '' description = ''
List of hostnames or ips where the Ripple protocol is served. List of hostnames or ips where the Ripple protocol is served.
For a starter list, you can either copy entries from: For a starter list, you can either copy entries from:
https://ripple.com/ripple.txt or if you prefer you can let it https://ripple.com/ripple.txt or if you prefer you can let it
default to r.ripple.com 51235 default to r.ripple.com 51235
A port may optionally be specified after adding a space to the A port may optionally be specified after adding a space to the
address. By convention, if known, IPs are listed in from most address. By convention, if known, IPs are listed in from most
to least trusted. to least trusted.
''; '';
type = types.listOf types.str; type = types.listOf types.str;
default = ["r.ripple.com 51235"]; default = ["r.ripple.com 51235"];
}; };
ipsFixed = mkOption { ipsFixed = mkOption {
description = '' description = ''
List of IP addresses or hostnames to which rippled should always List of IP addresses or hostnames to which rippled should always
attempt to maintain peer connections with. This is useful for attempt to maintain peer connections with. This is useful for
manually forming private networks, for example to configure a manually forming private networks, for example to configure a
validation server that connects to the Ripple network through a validation server that connects to the Ripple network through a
public-facing server, or for building a set of cluster peers. public-facing server, or for building a set of cluster peers.
A port may optionally be specified after adding a space to the address A port may optionally be specified after adding a space to the address
''; '';
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [];
}; };
validators = mkOption { validators = mkOption {
description = '' description = ''
List of nodes to always accept as validators. Nodes are specified by domain List of nodes to always accept as validators. Nodes are specified by domain
or public key. or public key.
''; '';
type = types.listOf types.str; type = types.listOf types.str;
default = [ default = [
"n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7 RL1" "n949f75evCHwgyP4fPVgaHqNHxUVN15PsJEZ3B3HnXPcPjcZAoy7 RL1"
"n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj RL2" "n9MD5h24qrQqiyBC8aeqqCWvpiBiYQ3jxSr91uiDvmrkyHRdYLUj RL2"
"n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C RL3" "n9L81uNCaPgtUJfaHh89gmdvXKAmSt5Gdsw2g1iPWaPkAHW5Nm4C RL3"
"n9KiYM9CgngLvtRCQHZwgC2gjpdaZcCcbt3VboxiNFcKuwFVujzS RL4" "n9KiYM9CgngLvtRCQHZwgC2gjpdaZcCcbt3VboxiNFcKuwFVujzS RL4"
"n9LdgEtkmGB9E2h3K4Vp7iGUaKuq23Zr32ehxiU8FWY7xoxbWTSA RL5" "n9LdgEtkmGB9E2h3K4Vp7iGUaKuq23Zr32ehxiU8FWY7xoxbWTSA RL5"
]; ];
}; };
databasePath = mkOption { databasePath = mkOption {
description = '' description = ''
Path to the ripple database. Path to the ripple database.
''; '';
type = types.path; type = types.path;
default = "/var/lib/rippled"; default = "/var/lib/rippled";
}; };
validationQuorum = mkOption { validationQuorum = mkOption {
description = '' description = ''
The minimum number of trusted validations a ledger must have before The minimum number of trusted validations a ledger must have before
the server considers it fully validated. the server considers it fully validated.
''; '';
type = types.int; type = types.int;
default = 3; default = 3;
}; };
ledgerHistory = mkOption { ledgerHistory = mkOption {
description = '' description = ''
The number of past ledgers to acquire on server startup and the minimum The number of past ledgers to acquire on server startup and the minimum
to maintain while running. to maintain while running.
''; '';
type = types.either types.int (types.enum ["full"]); type = types.either types.int (types.enum ["full"]);
default = 1296000; # 1 month default = 1296000; # 1 month
}; };
fetchDepth = mkOption { fetchDepth = mkOption {
description = '' description = ''
The number of past ledgers to serve to other peers that request historical The number of past ledgers to serve to other peers that request historical
ledger data (or "full" for no limit). ledger data (or "full" for no limit).
''; '';
type = types.either types.int (types.enum ["full"]); type = types.either types.int (types.enum ["full"]);
default = "full"; default = "full";
}; };
sntpServers = mkOption { sntpServers = mkOption {
description = '' description = ''
IP address or domain of NTP servers to use for time synchronization.; IP address or domain of NTP servers to use for time synchronization.;
''; '';
type = types.listOf types.str; type = types.listOf types.str;
default = [ default = [
"time.windows.com" "time.windows.com"
"time.apple.com" "time.apple.com"
"time.nist.gov" "time.nist.gov"
"pool.ntp.org" "pool.ntp.org"
]; ];
}; };
logLevel = mkOption { logLevel = mkOption {
description = "Logging verbosity."; description = "Logging verbosity.";
type = types.enum ["debug" "error" "info"]; type = types.enum ["debug" "error" "info"];
default = "error"; default = "error";
}; };
statsd = { statsd = {
@ -389,14 +389,14 @@ in
extraConfig = mkOption { extraConfig = mkOption {
default = ""; default = "";
description = '' description = ''
Extra lines to be added verbatim to the rippled.cfg configuration file. Extra lines to be added verbatim to the rippled.cfg configuration file.
''; '';
}; };
config = mkOption { config = mkOption {
internal = true; internal = true;
default = pkgs.writeText "rippled.conf" rippledCfg; default = pkgs.writeText "rippled.conf" rippledCfg;
}; };
}; };
}; };
@ -410,8 +410,8 @@ in
{ name = "rippled"; { name = "rippled";
description = "Ripple server user"; description = "Ripple server user";
uid = config.ids.uids.rippled; uid = config.ids.uids.rippled;
home = cfg.databasePath; home = cfg.databasePath;
createHome = true; createHome = true;
}; };
systemd.services.rippled = { systemd.services.rippled = {
@ -421,8 +421,8 @@ in
serviceConfig = { serviceConfig = {
ExecStart = "${cfg.package}/bin/rippled --fg --conf ${cfg.config}"; ExecStart = "${cfg.package}/bin/rippled --fg --conf ${cfg.config}";
User = "rippled"; User = "rippled";
Restart = "on-failure"; Restart = "on-failure";
LimitNOFILE=10000; LimitNOFILE=10000;
}; };
}; };