skawarePackages: factor out the common parts

Introduce a `skawarePackages.buildPackage` function that contains the
common setup, removing a lot of duplication.
In particular, we require that the build directory has to be empty
after the `fixupPhase`, to make sure every relevant file is moved to
the outputs.

A next step would be to deduplicate the `configureFlags` attributes
and only require a `skawareInputs` field.
This commit is contained in:
Profpatsch
2018-09-06 11:53:22 +02:00
parent 57b431590b
commit 0071ae1d4f
10 changed files with 228 additions and 223 deletions
+14 -27
View File
@@ -1,4 +1,4 @@
{ stdenv, execline, fetchgit, s6, s6-dns, skalibs
{ stdenv, skawarePackages
# Whether to build the TLS/SSL tools and what library to use
# acceptable values: "libressl", false
@@ -6,11 +6,9 @@
, sslSupport ? "libressl" , libressl
}:
with skawarePackages;
let
inherit (stdenv) lib;
version = "2.3.0.3";
sslSupportEnabled = sslSupport != false;
sslLibs = {
"libressl" = libressl;
@@ -19,25 +17,18 @@ let
in
assert sslSupportEnabled -> sslLibs ? ${sslSupport};
stdenv.mkDerivation rec {
name = "s6-networking-${version}";
buildPackage {
pname = "s6-networking";
version = "2.3.0.3";
sha256 = "06kv2l31ch0zw538bpivgnwymb056x5hpmqafglffgkbq3izp7wc";
src = fetchgit {
url = "git://git.skarnet.org/s6-networking";
rev = "refs/tags/v${version}";
sha256 = "06kv2l31ch0zw538bpivgnwymb056x5hpmqafglffgkbq3izp7wc";
};
description = "A suite of small networking utilities for Unix systems";
outputs = [ "bin" "lib" "dev" "doc" "out" ];
dontDisableStatic = true;
enableParallelBuilding = true;
# TODO: nsss support
configureFlags = [
"--enable-absolute-paths"
"--libdir=\${lib}/lib"
"--libexecdir=\${lib}/libexec"
"--dynlibdir=\${lib}/lib"
@@ -61,20 +52,16 @@ stdenv.mkDerivation rec {
"--enable-ssl=${sslSupport}"
"--with-include=${lib.getDev sslLibs.${sslSupport}}/include"
"--with-lib=${lib.getLib sslLibs.${sslSupport}}/lib"
])
++ (lib.optional stdenv.isDarwin "--build=${stdenv.hostPlatform.system}");
"--with-dynlib=${lib.getLib sslLibs.${sslSupport}}/lib"
]);
postInstall = ''
mkdir -p $doc/share/doc/s6-networking/
# remove all s6 executables from build directory
rm $(find -name "s6-*" -type f -mindepth 1 -maxdepth 1 -executable)
rm minidentd
rm libs6net.* libstls.*
mv doc $doc/share/doc/s6-networking/html
'';
meta = {
homepage = http://www.skarnet.org/software/s6-networking/;
description = "A suite of small networking utilities for Unix systems";
platforms = lib.platforms.all;
license = lib.licenses.isc;
maintainers = with stdenv.lib.maintainers; [ pmahoney Profpatsch ];
};
}