diff --git a/badvpn.nix b/badvpn.nix new file mode 100644 index 000000000..a13baf025 --- /dev/null +++ b/badvpn.nix @@ -0,0 +1,13 @@ +{ stdenv, cmake, pkgconfig, openssl, nspr, nss, debug ? false }: +let + compileFlags = "-O3 ${stdenv.lib.optionalString (!debug) "-DNDEBUG"}"; +in +stdenv.mkDerivation { + name = "badvpn"; + nativeBuildInputs = [ cmake pkgconfig ]; + buildInputs = [ openssl nspr nss ]; + src = stdenv.lib.cleanSource ./.; + preConfigure = '' + cmakeFlagsArray=( "-DCMAKE_BUILD_TYPE=" "-DCMAKE_C_FLAGS=${compileFlags}" ); + ''; +} diff --git a/build.nix b/build.nix index cdc5343ac..8a5264d86 100644 --- a/build.nix +++ b/build.nix @@ -1,22 +1,6 @@ -let - badvpnLocal = ( - { stdenv, cmake, pkgconfig, openssl, nspr, nss, debug ? false }: - let - compileFlags = "-O3 ${stdenv.lib.optionalString (!debug) "-DNDEBUG"}"; - in - stdenv.mkDerivation { - name = "badvpn"; - nativeBuildInputs = [ cmake pkgconfig ]; - buildInputs = [ openssl nspr nss ]; - src = stdenv.lib.cleanSource ./.; - preConfigure = '' - cmakeFlagsArray=( "-DCMAKE_BUILD_TYPE=" "-DCMAKE_C_FLAGS=${compileFlags}" ); - ''; - } - ); -in with import {}; rec { - badvpn = pkgs.callPackage badvpnLocal {}; - badvpnDebug = pkgs.callPackage badvpnLocal { debug = true; }; + badvpnFunc = import ./badvpn.nix; + badvpn = pkgs.callPackage badvpnFunc {}; + badvpnDebug = pkgs.callPackage badvpnFunc { debug = true; }; }