1{lib, stdenv, fetchgit, rcinit ? null, rcshutdown ? null, rcreboot ? null}:
2let
3 s = # Generated upstream information
4 rec {
5 baseName="sinit";
6 version="1.1";
7 name="${baseName}-${version}";
8 url="https://git.suckless.org/sinit/";
9 sha256="sha256-VtXkgixgElKKOT26uKN9feXDVjjtSgTWvcgk5o5MLmw=";
10 rev = "refs/tags/v${version}";
11 };
12 buildInputs = [
13 (lib.getOutput "static" stdenv.cc.libc)
14 ];
15in
16stdenv.mkDerivation {
17 inherit (s) name version;
18 inherit buildInputs;
19 src = fetchgit {
20 inherit (s) url sha256 rev;
21 };
22 makeFlags = ["PREFIX=$(out)"];
23 preConfigure = ""
24 + (lib.optionalString (rcinit != null) ''sed -re 's@(rcinitcmd[^"]*")[^"]*"@\1${rcinit}"@' -i config.def.h; '')
25 + (lib.optionalString (rcshutdown != null) ''sed -re 's@(rc(reboot|poweroff)cmd[^"]*")[^"]*"@\1${rcshutdown}"@' -i config.def.h; '')
26 + (lib.optionalString (rcreboot != null) ''sed -re 's@(rc(reboot)cmd[^"]*")[^"]*"@\1${rcreboot}"@' -i config.def.h; '')
27 ;
28 meta = {
29 inherit (s) version;
30 description = "A very minimal Linux init implementation from suckless.org";
31 license = lib.licenses.mit ;
32 maintainers = [lib.maintainers.raskin];
33 platforms = lib.platforms.linux;
34 homepage = "https://tools.suckless.org/sinit";
35 downloadPage = "https://git.suckless.org/sinit";
36 };
37}