liminix-fork/pkgs/s6-init-bin/default.nix
Daniel Barlow 225fc6fe51 configurable busybox
allows modules to add to the busybox applets and change config
2023-03-10 18:40:45 +00:00

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
'';
}