diff --git a/mod-seafile-server.nix b/mod-seafile-server.nix index e056d5e..3e40535 100644 --- a/mod-seafile-server.nix +++ b/mod-seafile-server.nix @@ -102,6 +102,17 @@ in description = "listening http port for Seahub web interface"; }; + externalPort = mkOption { + type = types.int; + default = 443; + description = "external port under which Seahub is reachable from the outside. Possibly the external port of a reverse proxy like nginx."; + }; + + enableTLS = mkEnableOption { + default = true; + description = "whether to use TLS and HTTPS for communication"; + }; + openFirewall = mkEnableOption { default = true; description = "whether to open up the firewall ports for ccnet, seafile-server and seahub"; @@ -140,11 +151,19 @@ in ${pkgs.seafile-server.ccnet-server}/bin/ccnet-init -c ./conf -n 'TEMPLATENAME' -H 'TEMPLATEHOST' -P 'TEMPLATEPORT' mv ./conf/ccnet.conf{,.template} fi - # substitute actual config values to template and symlink config file - ${pkgs.gnused}/bin/sed -e 's|TEMPLATENAME|${cfg.name}|g; s|TEMPLATEHOST|${cfg.domainName}|; s|TEMPLATEPORT|${toString cfg.ccnetPort}|' ./conf/ccnet.conf.template > ./conf/ccnet.conf + + # generate actual ccnet config file + echo "[General]" > ./conf/ccnet.conf + grep "^ID =" ./conf/ccnet.conf.template >> ./conf/ccnet.conf + echo 'USER_NAME = ${cfg.name} + NAME = ${cfg.name} + # outside URL + SERVICE_URL = http${if cfg.enableTLS then "s" else ""}://${cfg.domainName}:${toString cfg.externalPort} + + [Network] + Port = ${toString cfg.ccnetPort}' >> ./conf/ccnet.conf ln -s ${pkgs.seafile-server} seafile-server - #${pkgs.seafile-server.ccnet-server}/bin/ccnet-init -c ./ccnet -H "${cfg.domainName}" -P ${toString cfg.ccnetPort} -n "${cfg.name}" ./seafile-server/seafile-server-latest/bin/seafile-admin setup ''}") ];