1{ lib, stdenv, fetchgit, rcinit ? null, rcshutdown ? null, rcreboot ? null }:
2
3stdenv.mkDerivation rec {
4 pname = "sinit";
5 version = "1.1";
6
7 src = fetchgit {
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 ];
15 makeFlags = [ "PREFIX=$(out)" ];
16 preConfigure = ""
17 + (lib.optionalString (rcinit != null) ''sed -re 's@(rcinitcmd[^"]*")[^"]*"@\1${rcinit}"@' -i config.def.h; '')
18 + (lib.optionalString (rcshutdown != null) ''sed -re 's@(rc(reboot|poweroff)cmd[^"]*")[^"]*"@\1${rcshutdown}"@' -i config.def.h; '')
19 + (lib.optionalString (rcreboot != null) ''sed -re 's@(rc(reboot)cmd[^"]*")[^"]*"@\1${rcreboot}"@' -i config.def.h; '')
20 ;
21
22 meta = with lib; {
23 description = "A very minimal Linux init implementation from suckless.org";
24 license = licenses.mit;
25 maintainers = with maintainers; [ raskin ];
26 platforms = platforms.linux;
27 homepage = "https://tools.suckless.org/sinit";
28 downloadPage = "https://git.suckless.org/sinit";
29 };
30}