Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 runCommandCC,
4 skalibs,
5}:
6
7let
8 # From https://skarnet.org/software/misc/sdnotify-wrapper.c,
9 # which is unversioned.
10 src = ./sdnotify-wrapper.c;
11
12in
13runCommandCC "sdnotify-wrapper"
14 {
15
16 outputs = [
17 "bin"
18 "doc"
19 "out"
20 ];
21
22 meta = {
23 homepage = "https://skarnet.org/software/misc/sdnotify-wrapper.c";
24 description = "Use systemd sd_notify without having to link against libsystemd";
25 mainProgram = "sdnotify-wrapper";
26 platforms = lib.platforms.linux;
27 license = lib.licenses.isc;
28 maintainers = with lib.maintainers; [ Profpatsch ];
29 };
30
31 }
32 ''
33 mkdir -p $bin/bin
34 mkdir $out
35
36 # the -lskarnet has to come at the end to support static builds
37 $CC \
38 -o $bin/bin/sdnotify-wrapper \
39 -I${skalibs.dev}/include \
40 -L${skalibs.lib}/lib \
41 ${src} \
42 -lskarnet
43
44 mkdir -p $doc/share/doc/sdnotify-wrapper
45 # copy the documentation comment
46 sed -ne '/Usage:/,/*\//p' ${src} > $doc/share/doc/sdnotify-wrapper/README
47 ''