From 78889cf07a518d4c019cdf4999da43f07f998307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Tue, 27 Jan 2026 12:51:44 +0000 Subject: [PATCH] locales, halt, reboot --- pkgs/mrescue.nix | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/pkgs/mrescue.nix b/pkgs/mrescue.nix index 29fb15c..19c6f42 100644 --- a/pkgs/mrescue.nix +++ b/pkgs/mrescue.nix @@ -4,6 +4,26 @@ }: let + # Minimal locale package with only en_US.UTF-8 + minimalLocales = pkgs.glibcLocales.override { + allLocales = false; + locales = [ "en_US.UTF-8/UTF-8" ]; + }; + + # Simple halt script + haltScript = pkgs.writeScriptBin "halt" '' + #!${pkgs.bash}/bin/bash + sync + echo o > /proc/sysrq-trigger + ''; + + # Simple reboot script + rebootScript = pkgs.writeScriptBin "reboot" '' + #!${pkgs.bash}/bin/bash + sync + echo b > /proc/sysrq-trigger + ''; + # Simple init script init = pkgs.writeScript "init" '' #!${pkgs.bash}/bin/bash @@ -14,6 +34,12 @@ let export HOME=/root export TERM=linux + # Set up UTF-8 locale + export LOCALE_ARCHIVE=/lib/locale/locale-archive + export LC_ALL=en_US.utf8 + export LANG=en_US.utf8 + export LC_CTYPE=en_US.utf8 + # Create mount points mkdir -p /proc /sys /dev /run /tmp @@ -115,6 +141,18 @@ let source = "${pkgs.linuxPackages_latest.kernel.modules}/lib/modules"; target = "/lib/modules"; } + { + source = "${minimalLocales}/lib/locale/locale-archive"; + target = "/lib/locale/locale-archive"; + } + { + source = "${haltScript}/bin/halt"; + target = "/bin/halt"; + } + { + source = "${rebootScript}/bin/reboot"; + target = "/bin/reboot"; + } ] ++ binaryEntries; # makeInitrdNG will auto-resolve dependencies for these };