nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 skawarePackages,
5 targetPackages,
6 skalibs,
7 execline,
8 s6,
9}:
10
11skawarePackages.buildPackage {
12 pname = "s6-rc";
13 version = "0.5.6.0";
14 sha256 = "sha256-gSd/aAXo2ZmtKVv5FAqQmUO2h//Ptao8Tv2EsaV0WG4=";
15
16 manpages = skawarePackages.buildManPages {
17 pname = "s6-rc-man-pages";
18 version = "0.5.5.0.1";
19 sha256 = "sha256-Ywke3FG/xhhUd934auDB+iFRDCvy8IJs6IkirP6O/As=";
20 description = "mdoc(7) versions of the documentation for the s6-rc service manager";
21 maintainers = [ lib.maintainers.qyliss ];
22 };
23
24 description = "Service manager for s6-based systems";
25 platforms = lib.platforms.unix;
26
27 outputs = [
28 "bin"
29 "lib"
30 "dev"
31 "doc"
32 "out"
33 ];
34
35 configureFlags = [
36 "--libdir=\${lib}/lib"
37 "--libexecdir=\${lib}/libexec"
38 "--dynlibdir=\${lib}/lib"
39 "--bindir=\${bin}/bin"
40 "--includedir=\${dev}/include"
41 "--with-sysdeps=${skalibs.lib}/lib/skalibs/sysdeps"
42 "--with-include=${skalibs.dev}/include"
43 "--with-include=${execline.dev}/include"
44 "--with-include=${s6.dev}/include"
45 "--with-lib=${skalibs.lib}/lib"
46 "--with-lib=${execline.lib}/lib"
47 "--with-lib=${s6.out}/lib"
48 "--with-dynlib=${skalibs.lib}/lib"
49 "--with-dynlib=${execline.lib}/lib"
50 "--with-dynlib=${s6.out}/lib"
51 ];
52
53 # s6-rc-compile generates built-in service definitions containing
54 # absolute paths to execline, s6, and s6-rc programs. If we're
55 # running s6-rc-compile as part of a Nix derivation, and we want to
56 # cross-compile that derivation, those paths will be wrong --
57 # they'll be for execline, s6, and s6-rc on the platform we're
58 # running s6-rc-compile on, not the platform we're targeting.
59 #
60 # We can detect this special case of s6-rc being used at build time
61 # in a derivation that's being cross-compiled, because that's the
62 # only time hostPlatform != targetPlatform. When that happens we
63 # modify s6-rc-compile to use the configuration headers for the
64 # system we're cross-compiling for.
65 postConfigure = lib.optionalString (stdenv.hostPlatform != stdenv.targetPlatform) ''
66 substituteInPlace src/s6-rc/s6-rc-compile.c \
67 --replace-fail '<execline/config.h>' '"${targetPackages.execline.dev}/include/execline/config.h"' \
68 --replace-fail '<s6/config.h>' '"${targetPackages.s6.dev}/include/s6/config.h"' \
69 --replace-fail '<s6-rc/config.h>' '"${targetPackages.s6-rc.dev}/include/s6-rc/config.h"'
70 '';
71
72 postInstall = ''
73 # remove all s6 executables from build directory
74 rm $(find -name "s6-rc-*" -type f -mindepth 1 -maxdepth 1 -executable)
75 rm s6-rc libs6rc.*
76
77 mv doc $doc/share/doc/s6-rc/html
78 mv examples $doc/share/doc/s6-rc/examples
79 '';
80
81}