forked from DGNum/liminix
225fc6fe51
allows modules to add to the busybox applets and change config
32 lines
864 B
Nix
32 lines
864 B
Nix
{
|
|
s6-linux-init
|
|
, execline
|
|
, writeScript
|
|
, stdenvNoCC
|
|
, lib
|
|
, s6-rc
|
|
}:
|
|
let
|
|
hpr = name: arg: writeScript name ''
|
|
#!${execline}/bin/execlineb -S0
|
|
${s6-linux-init}/bin/s6-linux-init-hpr ${arg} \$@
|
|
'';
|
|
init = writeScript "init" ''
|
|
#!${execline}/bin/execlineb -S0
|
|
${s6-linux-init}/bin/s6-linux-init -c /etc/s6-linux-init/current -m 0022 -p ${lib.makeBinPath [execline s6-linux-init s6-rc]}:/usr/bin:/bin -d /dev -- "\$@"
|
|
'';
|
|
in stdenvNoCC.mkDerivation {
|
|
name = "s6-init-bin";
|
|
phases = ["installPhase"];
|
|
installPhase = ''
|
|
bin=$out/bin
|
|
mkdir -p $bin
|
|
cd $bin
|
|
ln -s ${s6-linux-init}/bin/s6-linux-init-shutdown shutdown
|
|
ln -s ${s6-linux-init}/bin/s6-linux-init-telinit telinit
|
|
ln -s ${hpr "reboot" "-r"} reboot
|
|
ln -s ${hpr "poweroff" "-p"} poweroff
|
|
ln -s ${hpr "halt" "-h"} halt
|
|
ln -s ${init} init
|
|
'';
|
|
}
|