2011-07-24 23:36:30 +00:00
|
|
|
{ config, pkgs, ... }:
|
2009-01-02 16:07:30 +00:00
|
|
|
|
2012-10-23 11:50:23 +00:00
|
|
|
with pkgs.lib;
|
|
|
|
|
2009-01-02 16:07:30 +00:00
|
|
|
let
|
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";
|
2012-10-23 11:50:23 +00:00
|
|
|
type = types.string;
|
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";
|
2012-10-23 11:50:23 +00:00
|
|
|
type = types.uniq types.string;
|
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";
|
2012-10-23 11:50:23 +00:00
|
|
|
type = types.uniq types.string;
|
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";
|
2012-10-23 11:50:23 +00:00
|
|
|
type = types.uniq types.string;
|
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
|
|
|
|
2012-10-23 11:50:23 +00:00
|
|
|
cleanTmpDir = mkOption {
|
2012-06-11 07:05:11 +00:00
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
description = ''
|
|
|
|
Delete all files in /tmp/ during boot.
|
|
|
|
'';
|
|
|
|
};
|
2012-10-23 11:50:23 +00:00
|
|
|
|
2009-05-27 23:14:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2009-01-02 16:07:30 +00:00
|
|
|
kernel = config.boot.kernelPackages.kernel;
|
|
|
|
activateConfiguration = config.system.activationScripts.script;
|
|
|
|
|
2013-03-08 00:00:21 +00:00
|
|
|
readonlyMountpoint = pkgs.runCommand "readonly-mountpoint" {} ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cc -O3 ${./readonly-mountpoint.c} -o $out/bin/readonly-mountpoint
|
|
|
|
strip -s $out/bin/readonly-mountpoint
|
|
|
|
'';
|
|
|
|
|
2011-07-24 23:36:30 +00:00
|
|
|
bootStage2 = pkgs.substituteAll {
|
2009-05-25 14:19:33 +00:00
|
|
|
src = ./stage-2-init.sh;
|
2012-03-11 22:43:37 +00:00
|
|
|
shellDebug = "${pkgs.bashInteractive}/bin/bash";
|
2009-01-02 16:07:30 +00:00
|
|
|
isExecutable = true;
|
2012-06-11 07:05:11 +00:00
|
|
|
inherit (config.boot) devShmSize runSize cleanTmpDir;
|
2012-09-25 20:33:21 +00:00
|
|
|
inherit (config.nix) readOnlyStore;
|
2010-01-09 14:23:20 +00:00
|
|
|
ttyGid = config.ids.gids.tty;
|
2009-06-05 16:02:58 +00:00
|
|
|
path =
|
2011-07-24 23:36:30 +00:00
|
|
|
[ pkgs.coreutils
|
|
|
|
pkgs.utillinux
|
|
|
|
pkgs.sysvtools
|
2013-03-08 00:00:21 +00:00
|
|
|
] ++ (optional config.boot.cleanTmpDir pkgs.findutils)
|
|
|
|
++ optional config.nix.readOnlyStore readonlyMountpoint;
|
2011-07-24 23:36:30 +00:00
|
|
|
postBootCommands = pkgs.writeText "local-cmds"
|
2009-11-15 12:56:40 +00:00
|
|
|
''
|
|
|
|
${config.boot.postBootCommands}
|
|
|
|
${config.powerManagement.powerUpCommands}
|
|
|
|
'';
|
2009-01-02 16:07:30 +00:00
|
|
|
};
|
2011-09-13 18:49:50 +00:00
|
|
|
|
2009-01-02 16:07:30 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2009-05-27 23:14:38 +00:00
|
|
|
require = [options];
|
2009-01-02 16:07:30 +00:00
|
|
|
|
2009-06-05 13:24:23 +00:00
|
|
|
system.build.bootStage2 = bootStage2;
|
2006-11-04 00:01:13 +00:00
|
|
|
}
|