at 24.11-pre 1.1 kB view raw
1{ config, lib, pkgs, ... }: 2 3with lib; 4 5let 6 7 initScriptBuilder = pkgs.substituteAll { 8 src = ./init-script-builder.sh; 9 isExecutable = true; 10 inherit (pkgs) bash; 11 inherit (config.system.nixos) distroName; 12 path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep]; 13 }; 14 15in 16 17{ 18 19 ###### interface 20 21 options = { 22 23 boot.loader.initScript = { 24 25 enable = mkOption { 26 default = false; 27 type = types.bool; 28 description = '' 29 Some systems require a /sbin/init script which is started. 30 Or having it makes starting NixOS easier. 31 This applies to some kind of hosting services and user mode linux. 32 33 Additionally this script will create 34 /boot/init-other-configurations-contents.txt containing 35 contents of remaining configurations. You can copy paste them into 36 /sbin/init manually running a rescue system or such. 37 ''; 38 }; 39 }; 40 41 }; 42 43 44 ###### implementation 45 46 config = mkIf config.boot.loader.initScript.enable { 47 48 system.build.installBootLoader = initScriptBuilder; 49 50 }; 51 52}