Merge pull request #226237 from ElvishJerricco/systemd-stage-1-unhide-docs
Systemd stage 1: Unhide docs and round out assertions about unsupported features.
This commit is contained in:
commit
7ad24e96ea
@ -185,6 +185,10 @@ in
|
|||||||
assertion = cfg.loginAll -> cfg.target == null;
|
assertion = cfg.loginAll -> cfg.target == null;
|
||||||
message = "iSCSI target name is set while login on all portals is enabled.";
|
message = "iSCSI target name is set while login on all portals is enabled.";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
assertion = !config.boot.initrd.systemd.enable;
|
||||||
|
message = "systemd stage 1 does not support iscsi yet.";
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,11 @@ with lib;
|
|||||||
|
|
||||||
config = mkIf config.boot.growPartition {
|
config = mkIf config.boot.growPartition {
|
||||||
|
|
||||||
|
assertions = [{
|
||||||
|
assertion = !config.boot.initrd.systemd.enable;
|
||||||
|
message = "systemd stage 1 does not support 'boot.growPartition' yet.";
|
||||||
|
}];
|
||||||
|
|
||||||
boot.initrd.extraUtilsCommands = ''
|
boot.initrd.extraUtilsCommands = ''
|
||||||
copy_bin_and_libs ${pkgs.gawk}/bin/gawk
|
copy_bin_and_libs ${pkgs.gawk}/bin/gawk
|
||||||
copy_bin_and_libs ${pkgs.gnused}/bin/sed
|
copy_bin_and_libs ${pkgs.gnused}/bin/sed
|
||||||
|
@ -2944,9 +2944,9 @@ let
|
|||||||
value.source = "${cfg.units.${name}.unit}/${name}";
|
value.source = "${cfg.units.${name}.unit}/${name}";
|
||||||
}) (attrNames cfg.units));
|
}) (attrNames cfg.units));
|
||||||
|
|
||||||
commonOptions = {
|
commonOptions = visible: {
|
||||||
|
|
||||||
systemd.network.enable = mkOption {
|
enable = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
@ -2954,31 +2954,35 @@ let
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.network.links = mkOption {
|
links = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
|
inherit visible;
|
||||||
type = with types; attrsOf (submodule [ { options = linkOptions; } ]);
|
type = with types; attrsOf (submodule [ { options = linkOptions; } ]);
|
||||||
description = lib.mdDoc "Definition of systemd network links.";
|
description = lib.mdDoc "Definition of systemd network links.";
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.network.netdevs = mkOption {
|
netdevs = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
|
inherit visible;
|
||||||
type = with types; attrsOf (submodule [ { options = netdevOptions; } ]);
|
type = with types; attrsOf (submodule [ { options = netdevOptions; } ]);
|
||||||
description = lib.mdDoc "Definition of systemd network devices.";
|
description = lib.mdDoc "Definition of systemd network devices.";
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.network.networks = mkOption {
|
networks = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
|
inherit visible;
|
||||||
type = with types; attrsOf (submodule [ { options = networkOptions; } networkConfig ]);
|
type = with types; attrsOf (submodule [ { options = networkOptions; } networkConfig ]);
|
||||||
description = lib.mdDoc "Definition of systemd networks.";
|
description = lib.mdDoc "Definition of systemd networks.";
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.network.config = mkOption {
|
config = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
|
inherit visible;
|
||||||
type = with types; submodule [ { options = networkdOptions; } networkdConfig ];
|
type = with types; submodule [ { options = networkdOptions; } networkdConfig ];
|
||||||
description = lib.mdDoc "Definition of global systemd network config.";
|
description = lib.mdDoc "Definition of global systemd network config.";
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.network.units = mkOption {
|
units = mkOption {
|
||||||
description = lib.mdDoc "Definition of networkd units.";
|
description = lib.mdDoc "Definition of networkd units.";
|
||||||
default = {};
|
default = {};
|
||||||
internal = true;
|
internal = true;
|
||||||
@ -2991,7 +2995,7 @@ let
|
|||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.network.wait-online = {
|
wait-online = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
@ -3225,8 +3229,9 @@ let
|
|||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
options = commonOptions // {
|
options = {
|
||||||
boot.initrd = commonOptions;
|
systemd.network = commonOptions true;
|
||||||
|
boot.initrd.systemd.network = commonOptions "shallow";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkMerge [
|
config = mkMerge [
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ lib, config, utils, pkgs, ... }:
|
{ lib, options, config, utils, pkgs, ... }:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
@ -126,18 +126,20 @@ in {
|
|||||||
options.boot.initrd.systemd = {
|
options.boot.initrd.systemd = {
|
||||||
enable = mkEnableOption (lib.mdDoc "systemd in initrd") // {
|
enable = mkEnableOption (lib.mdDoc "systemd in initrd") // {
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
Whether to enable systemd in initrd.
|
Whether to enable systemd in initrd. The unit options such as
|
||||||
|
{option}`boot.initrd.systemd.services` are the same as their
|
||||||
|
stage 2 counterparts such as {option}`systemd.services`,
|
||||||
|
except that `restartTriggers` and `reloadTriggers` are not
|
||||||
|
supported.
|
||||||
|
|
||||||
Note: This is in very early development and is highly
|
Note: This is experimental. Some of the `boot.initrd` options
|
||||||
experimental. Most of the features NixOS supports in initrd are
|
are not supported when this is enabled, and the options under
|
||||||
not yet supported by the intrd generated with this option.
|
`boot.initrd.systemd` are subject to change.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = (mkPackageOptionMD pkgs "systemd" {
|
package = mkPackageOptionMD pkgs "systemd" {
|
||||||
default = "systemdStage1";
|
default = "systemdStage1";
|
||||||
}) // {
|
|
||||||
visible = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
@ -167,7 +169,6 @@ in {
|
|||||||
"/etc/hostname".text = "mymachine";
|
"/etc/hostname".text = "mymachine";
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
visible = false;
|
|
||||||
default = {};
|
default = {};
|
||||||
type = utils.systemdUtils.types.initrdContents;
|
type = utils.systemdUtils.types.initrdContents;
|
||||||
};
|
};
|
||||||
@ -217,7 +218,6 @@ in {
|
|||||||
|
|
||||||
emergencyAccess = mkOption {
|
emergencyAccess = mkOption {
|
||||||
type = with types; oneOf [ bool (nullOr (passwdEntry str)) ];
|
type = with types; oneOf [ bool (nullOr (passwdEntry str)) ];
|
||||||
visible = false;
|
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
Set to true for unauthenticated emergency access, and false for
|
Set to true for unauthenticated emergency access, and false for
|
||||||
no emergency access.
|
no emergency access.
|
||||||
@ -231,7 +231,6 @@ in {
|
|||||||
initrdBin = mkOption {
|
initrdBin = mkOption {
|
||||||
type = types.listOf types.package;
|
type = types.listOf types.package;
|
||||||
default = [];
|
default = [];
|
||||||
visible = false;
|
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
Packages to include in /bin for the stage 1 emergency shell.
|
Packages to include in /bin for the stage 1 emergency shell.
|
||||||
'';
|
'';
|
||||||
@ -240,7 +239,6 @@ in {
|
|||||||
additionalUpstreamUnits = mkOption {
|
additionalUpstreamUnits = mkOption {
|
||||||
default = [ ];
|
default = [ ];
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
visible = false;
|
|
||||||
example = [ "debug-shell.service" "systemd-quotacheck.service" ];
|
example = [ "debug-shell.service" "systemd-quotacheck.service" ];
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
Additional units shipped with systemd that shall be enabled.
|
Additional units shipped with systemd that shall be enabled.
|
||||||
@ -251,7 +249,6 @@ in {
|
|||||||
default = [ ];
|
default = [ ];
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
example = [ "systemd-backlight@.service" ];
|
example = [ "systemd-backlight@.service" ];
|
||||||
visible = false;
|
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
A list of units to skip when generating system systemd configuration directory. This has
|
A list of units to skip when generating system systemd configuration directory. This has
|
||||||
priority over upstream units, {option}`boot.initrd.systemd.units`, and
|
priority over upstream units, {option}`boot.initrd.systemd.units`, and
|
||||||
@ -264,13 +261,12 @@ in {
|
|||||||
units = mkOption {
|
units = mkOption {
|
||||||
description = lib.mdDoc "Definition of systemd units.";
|
description = lib.mdDoc "Definition of systemd units.";
|
||||||
default = {};
|
default = {};
|
||||||
visible = false;
|
visible = "shallow";
|
||||||
type = systemdUtils.types.units;
|
type = systemdUtils.types.units;
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = mkOption {
|
packages = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
visible = false;
|
|
||||||
type = types.listOf types.package;
|
type = types.listOf types.package;
|
||||||
example = literalExpression "[ pkgs.systemd-cryptsetup-generator ]";
|
example = literalExpression "[ pkgs.systemd-cryptsetup-generator ]";
|
||||||
description = lib.mdDoc "Packages providing systemd units and hooks.";
|
description = lib.mdDoc "Packages providing systemd units and hooks.";
|
||||||
@ -278,7 +274,7 @@ in {
|
|||||||
|
|
||||||
targets = mkOption {
|
targets = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
visible = false;
|
visible = "shallow";
|
||||||
type = systemdUtils.types.initrdTargets;
|
type = systemdUtils.types.initrdTargets;
|
||||||
description = lib.mdDoc "Definition of systemd target units.";
|
description = lib.mdDoc "Definition of systemd target units.";
|
||||||
};
|
};
|
||||||
@ -286,35 +282,35 @@ in {
|
|||||||
services = mkOption {
|
services = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
type = systemdUtils.types.initrdServices;
|
type = systemdUtils.types.initrdServices;
|
||||||
visible = false;
|
visible = "shallow";
|
||||||
description = lib.mdDoc "Definition of systemd service units.";
|
description = lib.mdDoc "Definition of systemd service units.";
|
||||||
};
|
};
|
||||||
|
|
||||||
sockets = mkOption {
|
sockets = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
type = systemdUtils.types.initrdSockets;
|
type = systemdUtils.types.initrdSockets;
|
||||||
visible = false;
|
visible = "shallow";
|
||||||
description = lib.mdDoc "Definition of systemd socket units.";
|
description = lib.mdDoc "Definition of systemd socket units.";
|
||||||
};
|
};
|
||||||
|
|
||||||
timers = mkOption {
|
timers = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
type = systemdUtils.types.initrdTimers;
|
type = systemdUtils.types.initrdTimers;
|
||||||
visible = false;
|
visible = "shallow";
|
||||||
description = lib.mdDoc "Definition of systemd timer units.";
|
description = lib.mdDoc "Definition of systemd timer units.";
|
||||||
};
|
};
|
||||||
|
|
||||||
paths = mkOption {
|
paths = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
type = systemdUtils.types.initrdPaths;
|
type = systemdUtils.types.initrdPaths;
|
||||||
visible = false;
|
visible = "shallow";
|
||||||
description = lib.mdDoc "Definition of systemd path units.";
|
description = lib.mdDoc "Definition of systemd path units.";
|
||||||
};
|
};
|
||||||
|
|
||||||
mounts = mkOption {
|
mounts = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
type = systemdUtils.types.initrdMounts;
|
type = systemdUtils.types.initrdMounts;
|
||||||
visible = false;
|
visible = "shallow";
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
Definition of systemd mount units.
|
Definition of systemd mount units.
|
||||||
This is a list instead of an attrSet, because systemd mandates the names to be derived from
|
This is a list instead of an attrSet, because systemd mandates the names to be derived from
|
||||||
@ -325,7 +321,7 @@ in {
|
|||||||
automounts = mkOption {
|
automounts = mkOption {
|
||||||
default = [];
|
default = [];
|
||||||
type = systemdUtils.types.automounts;
|
type = systemdUtils.types.automounts;
|
||||||
visible = false;
|
visible = "shallow";
|
||||||
description = lib.mdDoc ''
|
description = lib.mdDoc ''
|
||||||
Definition of systemd automount units.
|
Definition of systemd automount units.
|
||||||
This is a list instead of an attrSet, because systemd mandates the names to be derived from
|
This is a list instead of an attrSet, because systemd mandates the names to be derived from
|
||||||
@ -336,12 +332,31 @@ in {
|
|||||||
slices = mkOption {
|
slices = mkOption {
|
||||||
default = {};
|
default = {};
|
||||||
type = systemdUtils.types.slices;
|
type = systemdUtils.types.slices;
|
||||||
visible = false;
|
visible = "shallow";
|
||||||
description = lib.mdDoc "Definition of slice configurations.";
|
description = lib.mdDoc "Definition of slice configurations.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (config.boot.initrd.enable && cfg.enable) {
|
config = mkIf (config.boot.initrd.enable && cfg.enable) {
|
||||||
|
assertions = map (name: {
|
||||||
|
assertion = config.boot.initrd.${name} == "";
|
||||||
|
message = ''
|
||||||
|
systemd stage 1 does not support 'boot.initrd.${name}'. Please
|
||||||
|
convert it to analogous systemd units in 'boot.initrd.systemd'.
|
||||||
|
|
||||||
|
Definitions:
|
||||||
|
${lib.concatMapStringsSep "\n" ({ file, ... }: "- ${file}") options.boot.initrd.${name}.definitionsWithLocations}
|
||||||
|
'';
|
||||||
|
}) [
|
||||||
|
"preFailCommands"
|
||||||
|
"preDeviceCommands"
|
||||||
|
"preLVMCommands"
|
||||||
|
"postDeviceCommands"
|
||||||
|
"postMountCommands"
|
||||||
|
"extraUtilsCommands"
|
||||||
|
"extraUtilsCommandsTest"
|
||||||
|
];
|
||||||
|
|
||||||
system.build = { inherit initialRamdisk; };
|
system.build = { inherit initialRamdisk; };
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [
|
boot.initrd.availableKernelModules = [
|
||||||
|
Loading…
Reference in New Issue
Block a user