diff options
author | Felix Buehler | 2022-01-16 16:23:21 +0100 |
---|---|---|
committer | Felix Buehler | 2022-01-16 16:23:21 +0100 |
commit | 34950c73596cd2a8369d929cd5dd412a5ca308e0 (patch) | |
tree | 43922cb7e6fd6dee7c9e819641901743070ce5d1 /pkgs/os-specific | |
parent | baf11b26b230974157e0e5507411661393fd47bc (diff) |
sinit: refactor
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r-- | pkgs/os-specific/linux/sinit/default.nix | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/pkgs/os-specific/linux/sinit/default.nix b/pkgs/os-specific/linux/sinit/default.nix index f88eca9b4873..a412461bfd51 100644 --- a/pkgs/os-specific/linux/sinit/default.nix +++ b/pkgs/os-specific/linux/sinit/default.nix @@ -1,36 +1,29 @@ -{lib, stdenv, fetchgit, rcinit ? null, rcshutdown ? null, rcreboot ? null}: -let - s = # Generated upstream information - rec { - baseName="sinit"; - version="1.1"; - name="${baseName}-${version}"; - url="https://git.suckless.org/sinit/"; - sha256="sha256-VtXkgixgElKKOT26uKN9feXDVjjtSgTWvcgk5o5MLmw="; +{ 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="; rev = "refs/tags/v${version}"; }; buildInputs = [ (lib.getOutput "static" stdenv.cc.libc) ]; -in -stdenv.mkDerivation { - inherit (s) name version; - inherit buildInputs; - src = fetchgit { - inherit (s) url sha256 rev; - }; - makeFlags = ["PREFIX=$(out)"]; + 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 = { - inherit (s) version; + ; + + meta = with lib; { description = "A very minimal Linux init implementation from suckless.org"; - license = lib.licenses.mit ; - maintainers = [lib.maintainers.raskin]; - platforms = lib.platforms.linux; + license = licenses.mit; + maintainers = with maintainers; [ raskin ]; + platforms = platforms.linux; homepage = "https://tools.suckless.org/sinit"; downloadPage = "https://git.suckless.org/sinit"; }; |