Merge pull request #46381 from Chiiruno/dev/zeronet

nixos/zeronet: Fix TOR permissions, add torAlways option
This commit is contained in:
Joachim F 2018-09-11 10:28:32 +00:00 committed by GitHub
commit e02575b906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,8 @@ let
log_dir = ${cfg.logDir} log_dir = ${cfg.logDir}
'' + lib.optionalString (cfg.port != null) '' '' + lib.optionalString (cfg.port != null) ''
ui_port = ${toString cfg.port} ui_port = ${toString cfg.port}
'' + lib.optionalString (cfg.torAlways) ''
tor = always
'' + cfg.extraConfig; '' + cfg.extraConfig;
}; };
in with lib; { in with lib; {
@ -35,11 +37,17 @@ in with lib; {
port = mkOption { port = mkOption {
type = types.nullOr types.int; type = types.nullOr types.int;
default = null; default = null;
example = 15441; example = 43110;
description = "Optional zeronet port."; description = "Optional zeronet web UI port.";
}; };
tor = mkOption { tor = mkOption {
type = types.bool;
default = false;
description = "Use TOR for zeronet traffic where possible.";
};
torAlways = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = "Use TOR for all zeronet traffic."; description = "Use TOR for all zeronet traffic.";
@ -60,7 +68,11 @@ in with lib; {
services.tor = mkIf cfg.tor { services.tor = mkIf cfg.tor {
enable = true; enable = true;
controlPort = 9051; controlPort = 9051;
extraConfig = "CookieAuthentication 1"; extraConfig = ''
CacheDirectoryGroupReadable 1
CookieAuthentication 1
CookieAuthFileGroupReadable 1
'';
}; };
systemd.services.zeronet = { systemd.services.zeronet = {