3
0
Fork 0
forked from mirrors/nixpkgs

sinit: refactor

This commit is contained in:
Felix Buehler 2022-01-16 16:23:21 +01:00
parent baf11b26b2
commit 34950c7359

View file

@ -1,10 +1,10 @@
{ lib, stdenv, fetchgit, rcinit ? null, rcshutdown ? null, rcreboot ? null }: { lib, stdenv, fetchgit, rcinit ? null, rcshutdown ? null, rcreboot ? null }:
let
s = # Generated upstream information stdenv.mkDerivation rec {
rec { pname = "sinit";
baseName="sinit";
version = "1.1"; version = "1.1";
name="${baseName}-${version}";
src = fetchgit {
url = "https://git.suckless.org/sinit/"; url = "https://git.suckless.org/sinit/";
sha256 = "sha256-VtXkgixgElKKOT26uKN9feXDVjjtSgTWvcgk5o5MLmw="; sha256 = "sha256-VtXkgixgElKKOT26uKN9feXDVjjtSgTWvcgk5o5MLmw=";
rev = "refs/tags/v${version}"; rev = "refs/tags/v${version}";
@ -12,25 +12,18 @@ let
buildInputs = [ buildInputs = [
(lib.getOutput "static" stdenv.cc.libc) (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 = "" preConfigure = ""
+ (lib.optionalString (rcinit != null) ''sed -re 's@(rcinitcmd[^"]*")[^"]*"@\1${rcinit}"@' -i config.def.h; '') + (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 (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; '') + (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"; description = "A very minimal Linux init implementation from suckless.org";
license = lib.licenses.mit ; license = licenses.mit;
maintainers = [lib.maintainers.raskin]; maintainers = with maintainers; [ raskin ];
platforms = lib.platforms.linux; platforms = platforms.linux;
homepage = "https://tools.suckless.org/sinit"; homepage = "https://tools.suckless.org/sinit";
downloadPage = "https://git.suckless.org/sinit"; downloadPage = "https://git.suckless.org/sinit";
}; };