From fbeb32994b835ea20599aa72c77a6342a1b409c4 Mon Sep 17 00:00:00 2001 From: gnidorah Date: Thu, 22 Feb 2018 18:37:59 +0300 Subject: [PATCH 1/2] softether module: fix dataDir option --- .../modules/services/networking/softether.nix | 33 +++++++++---------- pkgs/servers/softether/4.18.nix | 4 +-- pkgs/servers/softether/4.20.nix | 4 +-- 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 9087b75c29c1..65df93a00da9 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 69c6cbe2c864..d8c3fe944cc3 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 c6ef5a3a4df2..5d6f642ddc0a 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 b1e9c5c1a455..2dcb69d28f14 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"; From c6cd69341afe66ee15d4eb0ab3b6e203ac8b99f2 Mon Sep 17 00:00:00 2001 From: gnidorah Date: Fri, 23 Feb 2018 15:23:50 +0300 Subject: [PATCH 2/2] softether: blacklist aarch64-linux platform --- pkgs/servers/softether/4.18.nix | 2 +- pkgs/servers/softether/4.20.nix | 2 +- pkgs/servers/softether/4.25.nix | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/softether/4.18.nix b/pkgs/servers/softether/4.18.nix index d8c3fe944cc3..5b0d15136f89 100644 --- a/pkgs/servers/softether/4.18.nix +++ b/pkgs/servers/softether/4.18.nix @@ -48,6 +48,6 @@ stdenv.mkDerivation rec { homepage = https://www.softether.org/; license = licenses.gpl2; maintainers = [ maintainers.rick68 ]; - platforms = platforms.linux; + platforms = filter (p: p != "aarch64-linux") platforms.linux; }; } diff --git a/pkgs/servers/softether/4.20.nix b/pkgs/servers/softether/4.20.nix index 5d6f642ddc0a..91dd0d0411f8 100644 --- a/pkgs/servers/softether/4.20.nix +++ b/pkgs/servers/softether/4.20.nix @@ -48,6 +48,6 @@ stdenv.mkDerivation rec { homepage = https://www.softether.org/; license = licenses.gpl2; maintainers = [ maintainers.rick68 ]; - platforms = platforms.linux; + platforms = filter (p: p != "aarch64-linux") platforms.linux; }; } diff --git a/pkgs/servers/softether/4.25.nix b/pkgs/servers/softether/4.25.nix index 2dcb69d28f14..04053174f4e4 100644 --- a/pkgs/servers/softether/4.25.nix +++ b/pkgs/servers/softether/4.25.nix @@ -48,6 +48,6 @@ stdenv.mkDerivation rec { homepage = https://www.softether.org/; license = licenses.gpl2; maintainers = [ maintainers.rick68 ]; - platforms = platforms.linux; + platforms = filter (p: p != "aarch64-linux") platforms.linux; }; }