Skip to content

Commit

Permalink
Nix expressions: Separate the package function from the composition.
Browse files Browse the repository at this point in the history
  • Loading branch information
ambrop72 committed Jan 24, 2015
1 parent 17e5542 commit 1be45b4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
13 changes: 13 additions & 0 deletions badvpn.nix
Original file line number Diff line number Diff line change
@@ -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}" );
'';
}
22 changes: 3 additions & 19 deletions build.nix
Original file line number Diff line number Diff line change
@@ -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 <nixpkgs> {};
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; };
}

0 comments on commit 1be45b4

Please sign in to comment.