2014-04-14 07:26:48 -07:00
|
|
|
{ config, lib, pkgs, ... }:
|
2009-12-16 22:04:36 -08:00
|
|
|
|
2014-04-14 07:26:48 -07:00
|
|
|
with lib;
|
2009-12-16 22:04:36 -08:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
initScriptBuilder = pkgs.substituteAll {
|
|
|
|
src = ./init-script-builder.sh;
|
|
|
|
isExecutable = true;
|
2018-12-28 11:41:51 -08:00
|
|
|
inherit (pkgs.buildPackages) bash;
|
|
|
|
path = with pkgs.buildPackages; [coreutils gnused gnugrep];
|
2009-12-16 22:04:36 -08:00
|
|
|
};
|
2011-09-14 11:20:50 -07:00
|
|
|
|
2009-12-16 22:04:36 -08:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
boot.loader.initScript = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
2009-12-17 03:43:12 -08:00
|
|
|
default = false;
|
2015-02-23 09:00:21 -08:00
|
|
|
type = types.bool;
|
2009-12-16 22:04:36 -08: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.
|
|
|
|
|
2013-08-10 14:07:13 -07:00
|
|
|
Additionally this script will create
|
2009-12-16 22:04:36 -08:00
|
|
|
/boot/init-other-configurations-contents.txt containing
|
|
|
|
contents of remaining configurations. You can copy paste them into
|
2013-08-10 14:07:13 -07:00
|
|
|
/sbin/init manually running a rescue system or such.
|
2009-12-16 22:04:36 -08:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
2011-09-14 11:20:50 -07:00
|
|
|
|
2009-12-16 22:04:36 -08:00
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
2012-07-25 08:30:16 -07:00
|
|
|
config = mkIf config.boot.loader.initScript.enable {
|
2011-09-14 11:20:50 -07:00
|
|
|
|
2012-07-25 08:30:16 -07:00
|
|
|
system.build.installBootLoader = initScriptBuilder;
|
2009-12-16 22:04:36 -08:00
|
|
|
|
|
|
|
};
|
2011-09-14 11:20:50 -07:00
|
|
|
|
2009-12-16 22:04:36 -08:00
|
|
|
}
|