Added chute
This commit is contained in:
parent
3ae2c5ce8e
commit
8ad501e21d
@ -137,7 +137,11 @@ in {
|
|||||||
};
|
};
|
||||||
settings = mkIf (cfg.ssh != null) {
|
settings = mkIf (cfg.ssh != null) {
|
||||||
server = {
|
server = {
|
||||||
|
# Displayed in the clone URL
|
||||||
SSH_DOMAIN = cfg.hostname;
|
SSH_DOMAIN = cfg.hostname;
|
||||||
|
SSH_PORT = mkForce cfg.ssh.listen-port;
|
||||||
|
|
||||||
|
# Actual ip/port on which to listen
|
||||||
SSH_LISTEN_PORT = cfg.ssh.listen-port;
|
SSH_LISTEN_PORT = cfg.ssh.listen-port;
|
||||||
SSH_LISTEN_HOST = cfg.ssh.listen-ip;
|
SSH_LISTEN_HOST = cfg.ssh.listen-ip;
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@ let
|
|||||||
|
|
||||||
user-type = import ../types/user.nix { inherit lib; };
|
user-type = import ../types/user.nix { inherit lib; };
|
||||||
|
|
||||||
stringJoin = concatStringsSep;
|
join-lines = concatStringsSep "\n";
|
||||||
|
|
||||||
getUserGidNumber = user: group-map: group-map.${user.primary-group}.gid;
|
getUserGidNumber = user: group-map: group-map.${user.primary-group}.gid;
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ let
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
toMemberList = userList:
|
toMemberList = userList:
|
||||||
stringJoin "\n" (map (username: "memberUid: ${username}") userList);
|
join-lines (map (username: "memberUid: ${username}") userList);
|
||||||
|
|
||||||
groupLdif = base: name: opts: ''
|
groupLdif = base: name: opts: ''
|
||||||
dn: cn=${name},ou=groups,${base}
|
dn: cn=${name},ou=groups,${base}
|
||||||
@ -69,15 +69,15 @@ let
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
systemUsersLdif = base: user-map:
|
systemUsersLdif = base: user-map:
|
||||||
stringJoin "\n"
|
join-lines
|
||||||
(mapAttrsToList (name: opts: systemUserLdif base name opts) user-map);
|
(mapAttrsToList (name: opts: systemUserLdif base name opts) user-map);
|
||||||
|
|
||||||
groupsLdif = base: group-map:
|
groupsLdif = base: group-map:
|
||||||
stringJoin "\n"
|
join-lines
|
||||||
(mapAttrsToList (name: opts: groupLdif base name opts) group-map);
|
(mapAttrsToList (name: opts: groupLdif base name opts) group-map);
|
||||||
|
|
||||||
usersLdif = base: group-map: user-map:
|
usersLdif = base: group-map: user-map:
|
||||||
stringJoin "\n"
|
join-lines
|
||||||
(mapAttrsToList (name: opts: userLdif base name group-map opts) user-map);
|
(mapAttrsToList (name: opts: userLdif base name group-map opts) user-map);
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
@ -305,6 +305,7 @@ in {
|
|||||||
|
|
||||||
targets.${strip-ext cfg.systemd-target} = {
|
targets.${strip-ext cfg.systemd-target} = {
|
||||||
description = "Postgresql and associated systemd services.";
|
description = "Postgresql and associated systemd services.";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
|
@ -5,7 +5,7 @@ let
|
|||||||
cfg = config.informis.chute;
|
cfg = config.informis.chute;
|
||||||
|
|
||||||
currencyOpts = { ... }: {
|
currencyOpts = { ... }: {
|
||||||
options = {
|
options = with types; {
|
||||||
stop-percentile = mkOption {
|
stop-percentile = mkOption {
|
||||||
type = int;
|
type = int;
|
||||||
description = "Percentile of observed max at which to sell.";
|
description = "Percentile of observed max at which to sell.";
|
||||||
@ -50,9 +50,10 @@ let
|
|||||||
description = "Chute ${stage} job for ${currency}";
|
description = "Chute ${stage} job for ${currency}";
|
||||||
path = [ package ];
|
path = [ package ];
|
||||||
environmentFile = credential-file;
|
environmentFile = credential-file;
|
||||||
execStart = "chute --currency=${currency} --stop-at-percent=${toString stop-at-percent}";
|
execStart = "${package}/bin/chute --currency=${currency} --stop-at-percent=${toString stop-at-percent}";
|
||||||
privateNetwork = false;
|
privateNetwork = false;
|
||||||
addressFamilies = [ "AF_INET" ];
|
addressFamilies = [ "AF_INET" ];
|
||||||
|
memoryDenyWriteExecute = false; # Needed becuz Clojure
|
||||||
};
|
};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
@ -78,7 +79,7 @@ in {
|
|||||||
config = mkIf (cfg.enable) {
|
config = mkIf (cfg.enable) {
|
||||||
fudo = {
|
fudo = {
|
||||||
system.services = concatMapAttrs (stage: stageOpts:
|
system.services = concatMapAttrs (stage: stageOpts:
|
||||||
mapAttrs (currency: currencyOpts: {
|
concatMapAttrs (currency: currencyOpts: {
|
||||||
"chute-${stage}-${currency}" = chute-job-definition {
|
"chute-${stage}-${currency}" = chute-job-definition {
|
||||||
inherit stage currency;
|
inherit stage currency;
|
||||||
credential-file = stageOpts.credential-file;
|
credential-file = stageOpts.credential-file;
|
||||||
@ -87,5 +88,10 @@ in {
|
|||||||
};
|
};
|
||||||
}) stageOpts.currencies) cfg.stages;
|
}) stageOpts.currencies) cfg.stages;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.targets.chute = {
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
description = "Chute cryptocurrency safety parachute.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user