Files
nixpkgs/nixos/modules/system/boot/loader/init-script/init-script.nix
T

52 lines
1.0 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
2009-12-17 06:04:36 +00:00
with lib;
2009-12-17 06:04:36 +00:00
let
initScriptBuilder = pkgs.substituteAll {
src = ./init-script-builder.sh;
isExecutable = true;
inherit (pkgs) bash;
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
};
2009-12-17 06:04:36 +00:00
in
{
###### interface
options = {
boot.loader.initScript = {
enable = mkOption {
2009-12-17 11:43:12 +00:00
default = false;
type = types.bool;
2009-12-17 06:04:36 +00:00
description = ''
Some systems require a /sbin/init script which is started.
Or having it makes starting NixOS easier.
This applies to some kind of hosting services and user mode linux.
Additionally this script will create
2009-12-17 06:04:36 +00:00
/boot/init-other-configurations-contents.txt containing
contents of remaining configurations. You can copy paste them into
/sbin/init manually running a rescue system or such.
2009-12-17 06:04:36 +00:00
'';
};
};
};
2009-12-17 06:04:36 +00:00
###### implementation
2012-07-25 11:30:16 -04:00
config = mkIf config.boot.loader.initScript.enable {
2012-07-25 11:30:16 -04:00
system.build.installBootLoader = initScriptBuilder;
2009-12-17 06:04:36 +00:00
};
2009-12-17 06:04:36 +00:00
}