summaryrefslogtreecommitdiff
path: root/pkgs/os-specific/linux/sinit/default.nix
blob: 2272c3a43ef580d39b6bc181cc76a12584036b62 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
  lib,
  stdenv,
  fetchgit,
  rcinit ? null,
  rcshutdown ? null,
  rcreboot ? null,
}:

stdenv.mkDerivation rec {
  pname = "sinit";
  version = "1.1";

  src = fetchgit {
    url = "https://git.suckless.org/sinit/";
    sha256 = "sha256-VtXkgixgElKKOT26uKN9feXDVjjtSgTWvcgk5o5MLmw=";
    tag = "v${version}";
  };
  buildInputs = [
    (lib.getOutput "static" stdenv.cc.libc)
  ];
  makeFlags = [ "PREFIX=$(out)" ];
  preConfigure =
    ""
    + (lib.optionalString (
      rcinit != null
    ) ''sed -re 's@(rcinitcmd[^"]*")[^"]*"@\1${rcinit}"@' -i config.def.h; '')
    + (lib.optionalString (
      rcshutdown != null
    ) ''sed -re 's@(rc(reboot|poweroff)cmd[^"]*")[^"]*"@\1${rcshutdown}"@' -i config.def.h; '')
    + (lib.optionalString (
      rcreboot != null
    ) ''sed -re 's@(rc(reboot)cmd[^"]*")[^"]*"@\1${rcreboot}"@' -i config.def.h; '');

  meta = {
    description = "Very minimal Linux init implementation from suckless.org";
    mainProgram = "sinit";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ raskin ];
    platforms = lib.platforms.linux;
    homepage = "https://tools.suckless.org/sinit";
    downloadPage = "https://git.suckless.org/sinit";
  };
}