mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 13:10:33 +00:00
Merge pull request #8220 from offlinehacker/nixos/ripple-rest2
Add ripple rest module
This commit is contained in:
commit
e83aa95669
|
@ -219,6 +219,7 @@
|
|||
bird = 195;
|
||||
grafana = 196;
|
||||
skydns = 197;
|
||||
ripple-rest = 198;
|
||||
|
||||
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
|
||||
|
||||
|
@ -416,6 +417,7 @@
|
|||
bird = 195;
|
||||
#grafana = 196; #unused
|
||||
#skydns = 197; #unused
|
||||
#ripple-rest = 198; #unused
|
||||
|
||||
# When adding a gid, make sure it doesn't match an existing
|
||||
# uid. Users and groups with the same name should have equal
|
||||
|
|
|
@ -212,6 +212,7 @@
|
|||
./services/misc/plex.nix
|
||||
./services/misc/redmine.nix
|
||||
./services/misc/rippled.nix
|
||||
./services/misc/ripple-rest.nix
|
||||
./services/misc/ripple-data-api.nix
|
||||
./services/misc/rogue.nix
|
||||
./services/misc/siproxd.nix
|
||||
|
|
110
nixos/modules/services/misc/ripple-rest.nix
Normal file
110
nixos/modules/services/misc/ripple-rest.nix
Normal file
|
@ -0,0 +1,110 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.rippleRest;
|
||||
|
||||
configFile = pkgs.writeText "ripple-rest-config.json" (builtins.toJSON {
|
||||
config_version = "2.0.3";
|
||||
debug = cfg.debug;
|
||||
port = cfg.port;
|
||||
host = cfg.host;
|
||||
ssl_enabled = cfg.ssl.enable;
|
||||
ssl = {
|
||||
key_path = cfg.ssl.keyPath;
|
||||
cert_path = cfg.ssl.certPath;
|
||||
reject_unathorized = cfg.ssl.rejectUnathorized;
|
||||
};
|
||||
db_path = cfg.dbPath;
|
||||
max_transaction_fee = cfg.maxTransactionFee;
|
||||
rippled_servers = cfg.rippleds;
|
||||
});
|
||||
|
||||
in {
|
||||
options.services.rippleRest = {
|
||||
enable = mkEnableOption "Whether to enable ripple rest.";
|
||||
|
||||
debug = mkEnableOption "Wheter to enable debug for ripple-rest.";
|
||||
|
||||
host = mkOption {
|
||||
description = "Ripple rest host.";
|
||||
default = "localhost";
|
||||
type = types.str;
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
description = "Ripple rest port.";
|
||||
default = 5990;
|
||||
type = types.int;
|
||||
};
|
||||
|
||||
ssl = {
|
||||
enable = mkEnableOption "Whether to enable ssl.";
|
||||
|
||||
keyPath = mkOption {
|
||||
description = "Path to the ripple rest key file.";
|
||||
default = null;
|
||||
type = types.nullOr types.path;
|
||||
};
|
||||
|
||||
|
||||
certPath = mkOption {
|
||||
description = "Path to the ripple rest cert file.";
|
||||
default = null;
|
||||
type = types.nullOr types.path;
|
||||
};
|
||||
|
||||
rejectUnathorized = mkOption {
|
||||
description = "Whether to reject unatohroized.";
|
||||
default = true;
|
||||
type = types.bool;
|
||||
};
|
||||
};
|
||||
|
||||
dbPath = mkOption {
|
||||
description = "Ripple rest database path.";
|
||||
default = "${cfg.dataDir}/ripple-rest.db";
|
||||
type = types.path;
|
||||
};
|
||||
|
||||
maxTransactionFee = mkOption {
|
||||
description = "Ripple rest max transaction fee.";
|
||||
default = 1000000;
|
||||
type = types.int;
|
||||
};
|
||||
|
||||
rippleds = mkOption {
|
||||
description = "List of rippled servers.";
|
||||
default = [
|
||||
"wss://s1.ripple.com:443"
|
||||
];
|
||||
type = types.listOf types.str;
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
description = "Ripple rest data directory.";
|
||||
default = "/var/lib/ripple-rest";
|
||||
type = types.path;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf (cfg.enable) {
|
||||
systemd.services.ripple-rest = {
|
||||
wantedBy = [ "multi-user.target"];
|
||||
after = ["network.target" ];
|
||||
environment.NODE_PATH="${pkgs.ripple-rest}/lib/node_modules/ripple-rest/node_modules";
|
||||
serviceConfig = {
|
||||
ExecStart = "${pkgs.nodejs}/bin/node ${pkgs.ripple-rest}/lib/node_modules/ripple-rest/server/server.js --config ${configFile}";
|
||||
User = "ripple-rest";
|
||||
};
|
||||
};
|
||||
|
||||
users.extraUsers.postgres = {
|
||||
name = "ripple-rest";
|
||||
uid = config.ids.uids.ripple-rest;
|
||||
createHome = true;
|
||||
home = cfg.dataDir;
|
||||
};
|
||||
};
|
||||
}
|
File diff suppressed because it is too large
Load diff
26
pkgs/servers/rippled/ripple-rest.nix
Normal file
26
pkgs/servers/rippled/ripple-rest.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ lib, fetchFromGitHub, nodePackages }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
np = nodePackages.override { generated = ./package.nix; self = np; };
|
||||
in nodePackages.buildNodePackage rec {
|
||||
name = "ripple-rest-${version}";
|
||||
version = "1.7.0-rc1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
repo = "ripple-rest";
|
||||
owner = "ripple";
|
||||
rev = version;
|
||||
sha256 = "19ixgrz40iawd927jan0g1ac8w56wxh2vy3n3sa3dn9cmjd4k2r3";
|
||||
};
|
||||
|
||||
deps = (filter (v: nixType v == "derivation") (attrValues np));
|
||||
|
||||
meta = {
|
||||
description = " RESTful API for submitting payments and monitoring accounts on the Ripple Network";
|
||||
homepage = https://github.com/ripple/ripple-rest;
|
||||
maintainers = with maintainers; [ offline ];
|
||||
license = [ licenses.mit ];
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue