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
+11 -29
View File
@@ -1,32 +1,21 @@
{ stdenv, execline, fetchgit, skalibs }:
{ stdenv, skawarePackages }:
let
with skawarePackages;
buildPackage {
pname = "s6";
version = "2.7.2.0";
sha256 = "07j4is7kxkynschwbf83q5rw1872kg3ij2vhxyfp3bg71k5pw1az";
in stdenv.mkDerivation rec {
name = "s6-${version}";
src = fetchgit {
url = "git://git.skarnet.org/s6";
rev = "refs/tags/v${version}";
sha256 = "07j4is7kxkynschwbf83q5rw1872kg3ij2vhxyfp3bg71k5pw1az";
};
description = "skarnet.org's small & secure supervision software suite";
# NOTE lib: cannot split lib from bin at the moment,
# since some parts of lib depend on executables in bin.
# (the `*_startf` functions in `libs6`)
outputs = [ /*"bin" "lib"*/ "out" "dev" "doc" ];
dontDisableStatic = true;
enableParallelBuilding = true;
# TODO: nsss support
configureFlags = [
"--enable-absolute-paths"
"--libdir=\${out}/lib"
"--libexecdir=\${out}/libexec"
"--dynlibdir=\${out}/lib"
@@ -39,22 +28,15 @@ in stdenv.mkDerivation rec {
"--with-lib=${execline.lib}/lib"
"--with-dynlib=${skalibs.lib}/lib"
"--with-dynlib=${execline.lib}/lib"
]
++ (if stdenv.isDarwin then [ "--disable-shared" ] else [ "--enable-shared" ])
++ (stdenv.lib.optional stdenv.isDarwin "--build=${stdenv.hostPlatform.system}");
];
postInstall = ''
mkdir -p $doc/share/doc/s6/
# remove all s6 executables from build directory
rm $(find -type f -mindepth 1 -maxdepth 1 -executable)
rm libs6.*
mv doc $doc/share/doc/s6/html
mv examples $doc/share/doc/s6/examples
'';
meta = {
homepage = http://www.skarnet.org/software/s6/;
description = "skarnet.org's small & secure supervision software suite";
platforms = stdenv.lib.platforms.all;
license = stdenv.lib.licenses.isc;
maintainers = with stdenv.lib.maintainers; [ pmahoney Profpatsch ];
};
}