1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 m4,
6 installShellFiles,
7 util-linux,
8}:
9
10stdenv.mkDerivation rec {
11 pname = "dinit";
12 version = "0.19.4";
13
14 src = fetchFromGitHub {
15 owner = "davmac314";
16 repo = "dinit";
17 rev = "v${version}";
18 # fix for case-insensitive filesystems
19 postFetch = ''
20 [ -f "$out/BUILD" ] && rm "$out/BUILD"
21 '';
22 hash = "sha256-IKT4k2eXCOCXtiypGbsIpN0OHS+WKqXvr4Mb61fbl0M=";
23 };
24
25 postPatch = ''
26 substituteInPlace src/shutdown.cc \
27 --replace-fail '"/bin/umount"' '"${util-linux}/bin/umount"' \
28 --replace-fail '"/sbin/swapoff"' '"${util-linux}/bin/swapoff"'
29 '';
30
31 nativeBuildInputs = [
32 m4
33 installShellFiles
34 ];
35
36 configureFlags = [
37 "--prefix=${placeholder "out"}"
38 "--sbindir=${placeholder "out"}/bin"
39 ];
40
41 postInstall = ''
42 installShellCompletion --cmd dinitctl \
43 --bash contrib/shell-completion/bash/dinitctl \
44 --fish contrib/shell-completion/fish/dinitctl.fish \
45 --zsh contrib/shell-completion/zsh/_dinit
46 '';
47
48 meta = {
49 description = "Service manager / supervision system, which can (on Linux) also function as a system manager and init";
50 homepage = "https://davmac.org/projects/dinit";
51 license = lib.licenses.asl20;
52 maintainers = with lib.maintainers; [ aanderse ];
53 platforms = lib.platforms.unix;
54 };
55}