mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-10-20 20:53:19 +02:00
6efcfe03ae
A new internal config option `fileSystems.<name>.early` is added to indicate that the filesystem needs to be loaded very early (i.e. in initrd). They are transformed to a shell script in `system.build.earlyMountScript` with calls to an undefined `specialMount` function, which is expected to be caller-specific. This option is used by stage-1, stage-2 and activation script to set up and remount those filesystems. Options for them are updated according to systemd defaults.
95 lines
2.1 KiB
Nix
95 lines
2.1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
kernel = config.boot.kernelPackages.kernel;
|
|
activateConfiguration = config.system.activationScripts.script;
|
|
|
|
readonlyMountpoint = pkgs.stdenv.mkDerivation {
|
|
name = "readonly-mountpoint";
|
|
unpackPhase = "true";
|
|
installPhase = ''
|
|
mkdir -p $out/bin
|
|
cc -O3 ${./readonly-mountpoint.c} -o $out/bin/readonly-mountpoint
|
|
'';
|
|
};
|
|
|
|
bootStage2 = pkgs.substituteAll {
|
|
src = ./stage-2-init.sh;
|
|
shellDebug = "${pkgs.bashInteractive}/bin/bash";
|
|
isExecutable = true;
|
|
inherit (config.nix) readOnlyStore;
|
|
inherit (config.networking) useHostResolvConf;
|
|
inherit (config.system.build) earlyMountScript;
|
|
path =
|
|
[ pkgs.coreutils
|
|
pkgs.utillinux
|
|
pkgs.openresolv
|
|
] ++ optional config.nix.readOnlyStore readonlyMountpoint;
|
|
postBootCommands = pkgs.writeText "local-cmds"
|
|
''
|
|
${config.boot.postBootCommands}
|
|
${config.powerManagement.powerUpCommands}
|
|
'';
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
options = {
|
|
|
|
boot = {
|
|
|
|
postBootCommands = mkOption {
|
|
default = "";
|
|
example = "rm -f /var/log/messages";
|
|
type = types.lines;
|
|
description = ''
|
|
Shell commands to be executed just before systemd is started.
|
|
'';
|
|
};
|
|
|
|
devSize = mkOption {
|
|
default = "5%";
|
|
example = "32m";
|
|
type = types.str;
|
|
description = ''
|
|
Size limit for the /dev tmpfs. Look at mount(8), tmpfs size option,
|
|
for the accepted syntax.
|
|
'';
|
|
};
|
|
|
|
devShmSize = mkOption {
|
|
default = "50%";
|
|
example = "256m";
|
|
type = types.str;
|
|
description = ''
|
|
Size limit for the /dev/shm tmpfs. Look at mount(8), tmpfs size option,
|
|
for the accepted syntax.
|
|
'';
|
|
};
|
|
|
|
runSize = mkOption {
|
|
default = "25%";
|
|
example = "256m";
|
|
type = types.str;
|
|
description = ''
|
|
Size limit for the /run tmpfs. Look at mount(8), tmpfs size option,
|
|
for the accepted syntax.
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
config = {
|
|
|
|
system.build.bootStage2 = bootStage2;
|
|
|
|
};
|
|
}
|