diff options
-rw-r--r-- | nixos/modules/services/networking/softether.nix | 33 | ||||
-rw-r--r-- | pkgs/servers/softether/4.18.nix | 4 | ||||
-rw-r--r-- | pkgs/servers/softether/4.20.nix | 4 | ||||
-rw-r--r-- | pkgs/servers/softether/4.25.nix | 4 |
4 files changed, 22 insertions, 23 deletions
diff --git a/nixos/modules/services/networking/softether.nix b/nixos/modules/services/networking/softether.nix index 9087b75c29c10..65df93a00da94 100644 --- a/nixos/modules/services/networking/softether.nix +++ b/nixos/modules/services/networking/softether.nix @@ -5,6 +5,8 @@ with lib; let cfg = config.services.softether; + package = cfg.package.override { dataDir = cfg.dataDir; }; + in { @@ -49,7 +51,7 @@ in dataDir = mkOption { type = types.string; - default = "${cfg.package.dataDir}"; + default = "/var/lib/softether"; description = '' Data directory for SoftEther VPN. ''; @@ -64,11 +66,8 @@ in config = mkIf cfg.enable ( mkMerge [{ - environment.systemPackages = [ - (pkgs.lib.overrideDerivation cfg.package (attrs: { - dataDir = cfg.dataDir; - })) - ]; + environment.systemPackages = [ package ]; + systemd.services."softether-init" = { description = "SoftEther VPN services initial task"; wantedBy = [ "network.target" ]; @@ -80,11 +79,11 @@ in for d in vpnserver vpnbridge vpnclient vpncmd; do if ! test -e ${cfg.dataDir}/$d; then ${pkgs.coreutils}/bin/mkdir -m0700 -p ${cfg.dataDir}/$d - install -m0600 ${cfg.package}${cfg.dataDir}/$d/hamcore.se2 ${cfg.dataDir}/$d/hamcore.se2 + install -m0600 ${package}${cfg.dataDir}/$d/hamcore.se2 ${cfg.dataDir}/$d/hamcore.se2 fi done rm -rf ${cfg.dataDir}/vpncmd/vpncmd - ln -s ${cfg.package}${cfg.dataDir}/vpncmd/vpncmd ${cfg.dataDir}/vpncmd/vpncmd + ln -s ${package}${cfg.dataDir}/vpncmd/vpncmd ${cfg.dataDir}/vpncmd/vpncmd ''; }; } @@ -97,12 +96,12 @@ in wantedBy = [ "network.target" ]; serviceConfig = { Type = "forking"; - ExecStart = "${cfg.package}/bin/vpnserver start"; - ExecStop = "${cfg.package}/bin/vpnserver stop"; + ExecStart = "${package}/bin/vpnserver start"; + ExecStop = "${package}/bin/vpnserver stop"; }; preStart = '' rm -rf ${cfg.dataDir}/vpnserver/vpnserver - ln -s ${cfg.package}${cfg.dataDir}/vpnserver/vpnserver ${cfg.dataDir}/vpnserver/vpnserver + ln -s ${package}${cfg.dataDir}/vpnserver/vpnserver ${cfg.dataDir}/vpnserver/vpnserver ''; postStop = '' rm -rf ${cfg.dataDir}/vpnserver/vpnserver @@ -118,12 +117,12 @@ in wantedBy = [ "network.target" ]; serviceConfig = { Type = "forking"; - ExecStart = "${cfg.package}/bin/vpnbridge start"; - ExecStop = "${cfg.package}/bin/vpnbridge stop"; + ExecStart = "${package}/bin/vpnbridge start"; + ExecStop = "${package}/bin/vpnbridge stop"; }; preStart = '' rm -rf ${cfg.dataDir}/vpnbridge/vpnbridge - ln -s ${cfg.package}${cfg.dataDir}/vpnbridge/vpnbridge ${cfg.dataDir}/vpnbridge/vpnbridge + ln -s ${package}${cfg.dataDir}/vpnbridge/vpnbridge ${cfg.dataDir}/vpnbridge/vpnbridge ''; postStop = '' rm -rf ${cfg.dataDir}/vpnbridge/vpnbridge @@ -139,12 +138,12 @@ in wantedBy = [ "network.target" ]; serviceConfig = { Type = "forking"; - ExecStart = "${cfg.package}/bin/vpnclient start"; - ExecStop = "${cfg.package}/bin/vpnclient stop"; + ExecStart = "${package}/bin/vpnclient start"; + ExecStop = "${package}/bin/vpnclient stop"; }; preStart = '' rm -rf ${cfg.dataDir}/vpnclient/vpnclient - ln -s ${cfg.package}${cfg.dataDir}/vpnclient/vpnclient ${cfg.dataDir}/vpnclient/vpnclient + ln -s ${package}${cfg.dataDir}/vpnclient/vpnclient ${cfg.dataDir}/vpnclient/vpnclient ''; postStart = '' sleep 1 diff --git a/pkgs/servers/softether/4.18.nix b/pkgs/servers/softether/4.18.nix index 69c6cbe2c8646..d8c3fe944cc31 100644 --- a/pkgs/servers/softether/4.18.nix +++ b/pkgs/servers/softether/4.18.nix @@ -1,5 +1,6 @@ { stdenv, fetchurl -, openssl, readline, ncurses, zlib }: +, openssl, readline, ncurses, zlib +, dataDir ? "/var/lib/softether" }: let os = if stdenv.isLinux then "1" @@ -17,7 +18,6 @@ stdenv.mkDerivation rec { version = "4.18"; build = "9570"; compiledDate = "2015.07.26"; - dataDir = "/var/lib/softether"; src = fetchurl { url = "http://www.softether-download.com/files/softether/v${version}-${build}-rtm-${compiledDate}-tree/Source_Code/softether-src-v${version}-${build}-rtm.tar.gz"; diff --git a/pkgs/servers/softether/4.20.nix b/pkgs/servers/softether/4.20.nix index c6ef5a3a4df2e..5d6f642ddc0a0 100644 --- a/pkgs/servers/softether/4.20.nix +++ b/pkgs/servers/softether/4.20.nix @@ -1,5 +1,6 @@ { stdenv, fetchurl -, openssl, readline, ncurses, zlib }: +, openssl, readline, ncurses, zlib +, dataDir ? "/var/lib/softether" }: let os = if stdenv.isLinux then "1" @@ -17,7 +18,6 @@ stdenv.mkDerivation rec { version = "4.20"; build = "9608"; compiledDate = "2016.04.17"; - dataDir = "/var/lib/softether"; src = fetchurl { url = "http://www.softether-download.com/files/softether/v${version}-${build}-rtm-${compiledDate}-tree/Source_Code/softether-src-v${version}-${build}-rtm.tar.gz"; diff --git a/pkgs/servers/softether/4.25.nix b/pkgs/servers/softether/4.25.nix index b1e9c5c1a4553..2dcb69d28f143 100644 --- a/pkgs/servers/softether/4.25.nix +++ b/pkgs/servers/softether/4.25.nix @@ -1,5 +1,6 @@ { stdenv, fetchurl -, openssl, readline, ncurses, zlib }: +, openssl, readline, ncurses, zlib +, dataDir ? "/var/lib/softether" }: let os = if stdenv.isLinux then "1" @@ -17,7 +18,6 @@ stdenv.mkDerivation rec { version = "4.25"; build = "9656"; compiledDate = "2018.01.15"; - dataDir = "/var/lib/softether"; src = fetchurl { url = "http://www.softether-download.com/files/softether/v${version}-${build}-rtm-${compiledDate}-tree/Source_Code/softether-src-v${version}-${build}-rtm.tar.gz"; |