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