2014-04-14 14:26:48 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2009-01-02 16:07:30 +00:00
|
|
|
|
2014-04-14 14:26:48 +00:00
|
|
|
with lib;
|
2012-10-23 11:50:23 +00:00
|
|
|
|
2009-01-02 16:07:30 +00:00
|
|
|
let
|
2009-05-27 23:14:38 +00:00
|
|
|
|
2019-07-15 17:18:49 +00:00
|
|
|
useHostResolvConf = config.networking.resolvconf.enable && config.networking.useHostResolvConf;
|
|
|
|
|
2013-09-04 11:05:09 +00:00
|
|
|
bootStage2 = pkgs.substituteAll {
|
|
|
|
src = ./stage-2-init.sh;
|
|
|
|
shellDebug = "${pkgs.bashInteractive}/bin/bash";
|
2018-03-01 19:03:41 +00:00
|
|
|
shell = "${pkgs.bash}/bin/bash";
|
2021-03-15 18:34:09 +00:00
|
|
|
inherit (config.boot) systemdExecutable extraSystemdUnitPaths;
|
2013-09-04 11:05:09 +00:00
|
|
|
isExecutable = true;
|
|
|
|
inherit (config.nix) readOnlyStore;
|
2019-07-15 17:18:49 +00:00
|
|
|
inherit useHostResolvConf;
|
2016-08-27 10:29:38 +00:00
|
|
|
inherit (config.system.build) earlyMountScript;
|
2019-07-15 17:18:49 +00:00
|
|
|
path = lib.makeBinPath ([
|
2017-04-04 20:50:48 +00:00
|
|
|
pkgs.coreutils
|
2020-11-24 15:29:28 +00:00
|
|
|
pkgs.util-linux
|
2019-07-15 17:18:49 +00:00
|
|
|
] ++ lib.optional useHostResolvConf pkgs.openresolv);
|
2018-08-22 01:39:27 +00:00
|
|
|
fsPackagesPath = lib.makeBinPath config.system.fsPackages;
|
2021-03-15 18:34:09 +00:00
|
|
|
systemdUnitPathEnvVar = lib.optionalString (config.boot.extraSystemdUnitPaths != [])
|
|
|
|
("SYSTEMD_UNIT_PATH="
|
|
|
|
+ builtins.concatStringsSep ":" config.boot.extraSystemdUnitPaths
|
|
|
|
+ ":"); # If SYSTEMD_UNIT_PATH ends with an empty component (":"), the usual unit load path will be appended to the contents of the variable
|
2013-09-04 11:05:09 +00:00
|
|
|
postBootCommands = pkgs.writeText "local-cmds"
|
|
|
|
''
|
|
|
|
${config.boot.postBootCommands}
|
|
|
|
${config.powerManagement.powerUpCommands}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2009-05-27 23:14:38 +00:00
|
|
|
options = {
|
|
|
|
|
2010-04-17 15:20:13 +00:00
|
|
|
boot = {
|
2012-10-23 11:50:23 +00:00
|
|
|
|
|
|
|
postBootCommands = mkOption {
|
2010-04-17 15:20:13 +00:00
|
|
|
default = "";
|
|
|
|
example = "rm -f /var/log/messages";
|
2013-10-30 16:37:45 +00:00
|
|
|
type = types.lines;
|
2010-04-17 15:20:13 +00:00
|
|
|
description = ''
|
2013-01-21 23:14:09 +00:00
|
|
|
Shell commands to be executed just before systemd is started.
|
2010-04-17 15:20:13 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-10-23 11:50:23 +00:00
|
|
|
devSize = mkOption {
|
2012-05-17 19:33:12 +00:00
|
|
|
default = "5%";
|
2010-04-17 15:20:13 +00:00
|
|
|
example = "32m";
|
2013-10-30 10:02:04 +00:00
|
|
|
type = types.str;
|
2010-04-17 15:20:13 +00:00
|
|
|
description = ''
|
|
|
|
Size limit for the /dev tmpfs. Look at mount(8), tmpfs size option,
|
|
|
|
for the accepted syntax.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-10-23 11:50:23 +00:00
|
|
|
devShmSize = mkOption {
|
2010-04-17 15:20:13 +00:00
|
|
|
default = "50%";
|
|
|
|
example = "256m";
|
2013-10-30 10:02:04 +00:00
|
|
|
type = types.str;
|
2010-04-17 15:20:13 +00:00
|
|
|
description = ''
|
|
|
|
Size limit for the /dev/shm tmpfs. Look at mount(8), tmpfs size option,
|
|
|
|
for the accepted syntax.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-10-23 11:50:23 +00:00
|
|
|
runSize = mkOption {
|
2012-05-17 19:33:12 +00:00
|
|
|
default = "25%";
|
2011-09-13 18:49:47 +00:00
|
|
|
example = "256m";
|
2013-10-30 10:02:04 +00:00
|
|
|
type = types.str;
|
2011-09-13 18:49:47 +00:00
|
|
|
description = ''
|
|
|
|
Size limit for the /run tmpfs. Look at mount(8), tmpfs size option,
|
|
|
|
for the accepted syntax.
|
|
|
|
'';
|
|
|
|
};
|
2012-06-11 07:05:11 +00:00
|
|
|
|
2020-07-14 12:10:38 +00:00
|
|
|
systemdExecutable = mkOption {
|
|
|
|
default = "systemd";
|
|
|
|
type = types.str;
|
|
|
|
description = ''
|
|
|
|
The program to execute to start systemd. Typically
|
|
|
|
<literal>systemd</literal>, which will find systemd in the
|
|
|
|
PATH.
|
|
|
|
'';
|
|
|
|
};
|
2021-03-15 18:34:09 +00:00
|
|
|
|
|
|
|
extraSystemdUnitPaths = mkOption {
|
|
|
|
default = [];
|
|
|
|
type = types.listOf types.str;
|
|
|
|
description = ''
|
|
|
|
Additional paths that get appended to the SYSTEMD_UNIT_PATH environment variable
|
|
|
|
that can contain mutable unit files.
|
|
|
|
'';
|
|
|
|
};
|
2009-05-27 23:14:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2009-01-02 16:07:30 +00:00
|
|
|
|
2013-09-04 11:05:09 +00:00
|
|
|
config = {
|
2013-03-08 00:00:21 +00:00
|
|
|
|
2013-09-04 11:05:09 +00:00
|
|
|
system.build.bootStage2 = bootStage2;
|
2009-01-02 16:07:30 +00:00
|
|
|
|
2013-09-04 11:05:09 +00:00
|
|
|
};
|
2006-11-04 00:01:13 +00:00
|
|
|
}
|