nixos/iodine: nixpkgs-fmt
This commit is contained in:
parent
683fa30931
commit
7437bff7d1
@ -35,45 +35,48 @@ in
|
|||||||
corresponding attribute name.
|
corresponding attribute name.
|
||||||
'';
|
'';
|
||||||
example = literalExample ''
|
example = literalExample ''
|
||||||
{
|
{
|
||||||
foo = {
|
foo = {
|
||||||
server = "tunnel.mdomain.com";
|
server = "tunnel.mdomain.com";
|
||||||
relay = "8.8.8.8";
|
relay = "8.8.8.8";
|
||||||
extraConfig = "-v";
|
extraConfig = "-v";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
'';
|
'';
|
||||||
type = types.attrsOf (types.submodule (
|
type = types.attrsOf (
|
||||||
{
|
types.submodule (
|
||||||
options = {
|
{
|
||||||
server = mkOption {
|
options = {
|
||||||
type = types.str;
|
server = mkOption {
|
||||||
default = "";
|
type = types.str;
|
||||||
description = "Domain or Subdomain of server running iodined";
|
default = "";
|
||||||
example = "tunnel.mydomain.com";
|
description = "Domain or Subdomain of server running iodined";
|
||||||
};
|
example = "tunnel.mydomain.com";
|
||||||
|
};
|
||||||
|
|
||||||
relay = mkOption {
|
relay = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "";
|
default = "";
|
||||||
description = "DNS server to use as a intermediate relay to the iodined server";
|
description = "DNS server to use as a intermediate relay to the iodined server";
|
||||||
example = "8.8.8.8";
|
example = "8.8.8.8";
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "";
|
default = "";
|
||||||
description = "Additional command line parameters";
|
description = "Additional command line parameters";
|
||||||
example = "-l 192.168.1.10 -p 23";
|
example = "-l 192.168.1.10 -p 23";
|
||||||
};
|
};
|
||||||
|
|
||||||
passwordFile = mkOption {
|
passwordFile = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "";
|
default = "";
|
||||||
description = "File that contains password";
|
description = "File that contains password";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}));
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
server = {
|
server = {
|
||||||
@ -121,31 +124,31 @@ in
|
|||||||
boot.kernelModules = [ "tun" ];
|
boot.kernelModules = [ "tun" ];
|
||||||
|
|
||||||
systemd.services =
|
systemd.services =
|
||||||
let
|
let
|
||||||
createIodineClientService = name: cfg:
|
createIodineClientService = name: cfg:
|
||||||
{
|
{
|
||||||
description = "iodine client - ${name}";
|
description = "iodine client - ${name}";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
script = "exec ${pkgs.iodine}/bin/iodine -f -u ${iodinedUser} ${cfg.extraConfig} ${optionalString (cfg.passwordFile != "") "< \"${cfg.passwordFile}\""} ${cfg.relay} ${cfg.server}";
|
script = "exec ${pkgs.iodine}/bin/iodine -f -u ${iodinedUser} ${cfg.extraConfig} ${optionalString (cfg.passwordFile != "") "< \"${cfg.passwordFile}\""} ${cfg.relay} ${cfg.server}";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
RestartSec = "30s";
|
RestartSec = "30s";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
listToAttrs (
|
||||||
|
mapAttrsToList
|
||||||
|
(name: value: nameValuePair "iodine-${name}" (createIodineClientService name value))
|
||||||
|
cfg.clients
|
||||||
|
) // {
|
||||||
|
iodined = mkIf (cfg.server.enable) {
|
||||||
|
description = "iodine, ip over dns server daemon";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
script = "exec ${pkgs.iodine}/bin/iodined -f -u ${iodinedUser} ${cfg.server.extraConfig} ${optionalString (cfg.server.passwordFile != "") "< \"${cfg.server.passwordFile}\""} ${cfg.server.ip} ${cfg.server.domain}";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
in
|
|
||||||
listToAttrs (
|
|
||||||
mapAttrsToList
|
|
||||||
(name: value: nameValuePair "iodine-${name}" (createIodineClientService name value))
|
|
||||||
cfg.clients
|
|
||||||
) // {
|
|
||||||
iodined = mkIf (cfg.server.enable) {
|
|
||||||
description = "iodine, ip over dns server daemon";
|
|
||||||
after = [ "network.target" ];
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
script = "exec ${pkgs.iodine}/bin/iodined -f -u ${iodinedUser} ${cfg.server.extraConfig} ${optionalString (cfg.server.passwordFile != "") "< \"${cfg.server.passwordFile}\""} ${cfg.server.ip} ${cfg.server.domain}";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
users.users.${iodinedUser} = {
|
users.users.${iodinedUser} = {
|
||||||
uid = config.ids.uids.iodined;
|
uid = config.ids.uids.iodined;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user