2020-04-24 23:36:52 +00:00
|
|
|
|
{ config, lib, pkgs, utils, ... }:
|
|
|
|
|
|
|
|
|
|
with utils;
|
2021-12-19 01:06:50 +00:00
|
|
|
|
with systemdUtils.unitOptions;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
|
|
cfg = config.systemd;
|
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
|
inherit (systemdUtils.lib)
|
|
|
|
|
generateUnits
|
|
|
|
|
targetToUnit
|
|
|
|
|
serviceToUnit
|
|
|
|
|
socketToUnit
|
|
|
|
|
timerToUnit
|
|
|
|
|
pathToUnit
|
|
|
|
|
mountToUnit
|
|
|
|
|
automountToUnit
|
|
|
|
|
sliceToUnit;
|
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
upstreamSystemUnits =
|
|
|
|
|
[ # Targets.
|
|
|
|
|
"basic.target"
|
|
|
|
|
"sysinit.target"
|
|
|
|
|
"sockets.target"
|
|
|
|
|
"exit.target"
|
|
|
|
|
"graphical.target"
|
|
|
|
|
"multi-user.target"
|
|
|
|
|
"network.target"
|
|
|
|
|
"network-pre.target"
|
|
|
|
|
"network-online.target"
|
|
|
|
|
"nss-lookup.target"
|
|
|
|
|
"nss-user-lookup.target"
|
|
|
|
|
"time-sync.target"
|
2022-06-16 17:23:12 +00:00
|
|
|
|
] ++ optionals cfg.package.withCryptsetup [
|
2020-09-25 04:45:31 +00:00
|
|
|
|
"cryptsetup.target"
|
2021-10-28 06:52:43 +00:00
|
|
|
|
"cryptsetup-pre.target"
|
|
|
|
|
"remote-cryptsetup.target"
|
2024-07-31 10:19:44 +00:00
|
|
|
|
] ++ optionals cfg.package.withTpm2Tss [
|
|
|
|
|
"tpm2.target"
|
2022-06-16 17:23:12 +00:00
|
|
|
|
] ++ [
|
2020-04-24 23:36:52 +00:00
|
|
|
|
"sigpwr.target"
|
|
|
|
|
"timers.target"
|
|
|
|
|
"paths.target"
|
|
|
|
|
"rpcbind.target"
|
|
|
|
|
|
|
|
|
|
# Rescue mode.
|
|
|
|
|
"rescue.target"
|
|
|
|
|
"rescue.service"
|
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
|
# systemd-debug-generator
|
|
|
|
|
"debug-shell.service"
|
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
# Udev.
|
|
|
|
|
"systemd-udevd-control.socket"
|
|
|
|
|
"systemd-udevd-kernel.socket"
|
|
|
|
|
"systemd-udevd.service"
|
|
|
|
|
"systemd-udev-settle.service"
|
2021-12-06 16:07:01 +00:00
|
|
|
|
] ++ (optional (!config.boot.isContainer) "systemd-udev-trigger.service") ++ [
|
2020-04-24 23:36:52 +00:00
|
|
|
|
# hwdb.bin is managed by NixOS
|
|
|
|
|
# "systemd-hwdb-update.service"
|
|
|
|
|
|
|
|
|
|
# Consoles.
|
|
|
|
|
"getty.target"
|
|
|
|
|
"getty-pre.target"
|
|
|
|
|
"getty@.service"
|
|
|
|
|
"serial-getty@.service"
|
|
|
|
|
"console-getty.service"
|
|
|
|
|
"container-getty@.service"
|
|
|
|
|
"systemd-vconsole-setup.service"
|
|
|
|
|
|
|
|
|
|
# Hardware (started by udev when a relevant device is plugged in).
|
|
|
|
|
"sound.target"
|
|
|
|
|
"bluetooth.target"
|
|
|
|
|
"printer.target"
|
|
|
|
|
"smartcard.target"
|
|
|
|
|
|
|
|
|
|
# Kernel module loading.
|
|
|
|
|
"systemd-modules-load.service"
|
|
|
|
|
"kmod-static-nodes.service"
|
2021-04-05 15:23:46 +00:00
|
|
|
|
"modprobe@.service"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
# Filesystems.
|
|
|
|
|
"systemd-fsck@.service"
|
|
|
|
|
"systemd-fsck-root.service"
|
2023-03-27 19:17:25 +00:00
|
|
|
|
"systemd-growfs@.service"
|
|
|
|
|
"systemd-growfs-root.service"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
"systemd-remount-fs.service"
|
2021-05-20 23:08:51 +00:00
|
|
|
|
"systemd-pstore.service"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
"local-fs.target"
|
|
|
|
|
"local-fs-pre.target"
|
|
|
|
|
"remote-fs.target"
|
|
|
|
|
"remote-fs-pre.target"
|
|
|
|
|
"swap.target"
|
|
|
|
|
"dev-hugepages.mount"
|
|
|
|
|
"dev-mqueue.mount"
|
|
|
|
|
"sys-fs-fuse-connections.mount"
|
2020-08-20 17:08:02 +00:00
|
|
|
|
] ++ (optional (!config.boot.isContainer) "sys-kernel-config.mount") ++ [
|
2020-04-24 23:36:52 +00:00
|
|
|
|
"sys-kernel-debug.mount"
|
|
|
|
|
|
|
|
|
|
# Maintaining state across reboots.
|
|
|
|
|
"systemd-random-seed.service"
|
2024-04-21 15:54:59 +00:00
|
|
|
|
] ++ (optional cfg.package.withBootloader "systemd-boot-random-seed.service") ++ [
|
2020-04-24 23:36:52 +00:00
|
|
|
|
"systemd-backlight@.service"
|
|
|
|
|
"systemd-rfkill.service"
|
|
|
|
|
"systemd-rfkill.socket"
|
|
|
|
|
|
|
|
|
|
# Hibernate / suspend.
|
|
|
|
|
"hibernate.target"
|
|
|
|
|
"suspend.target"
|
|
|
|
|
"suspend-then-hibernate.target"
|
|
|
|
|
"sleep.target"
|
|
|
|
|
"hybrid-sleep.target"
|
|
|
|
|
"systemd-hibernate.service"
|
2024-07-31 10:19:44 +00:00
|
|
|
|
"systemd-hibernate-clear.service"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
"systemd-hybrid-sleep.service"
|
|
|
|
|
"systemd-suspend.service"
|
|
|
|
|
"systemd-suspend-then-hibernate.service"
|
|
|
|
|
|
|
|
|
|
# Reboot stuff.
|
|
|
|
|
"reboot.target"
|
|
|
|
|
"systemd-reboot.service"
|
|
|
|
|
"poweroff.target"
|
|
|
|
|
"systemd-poweroff.service"
|
|
|
|
|
"halt.target"
|
|
|
|
|
"systemd-halt.service"
|
|
|
|
|
"shutdown.target"
|
|
|
|
|
"umount.target"
|
|
|
|
|
"final.target"
|
|
|
|
|
"kexec.target"
|
|
|
|
|
"systemd-kexec.service"
|
2022-09-22 12:36:57 +00:00
|
|
|
|
] ++ lib.optional cfg.package.withUtmp "systemd-update-utmp.service" ++ [
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
# Password entry.
|
|
|
|
|
"systemd-ask-password-console.path"
|
|
|
|
|
"systemd-ask-password-console.service"
|
|
|
|
|
"systemd-ask-password-wall.path"
|
|
|
|
|
"systemd-ask-password-wall.service"
|
|
|
|
|
|
2024-07-31 10:19:44 +00:00
|
|
|
|
# Varlink APIs
|
|
|
|
|
"systemd-bootctl@.service"
|
|
|
|
|
"systemd-bootctl.socket"
|
|
|
|
|
"systemd-creds@.service"
|
|
|
|
|
"systemd-creds.socket"
|
|
|
|
|
] ++ lib.optional cfg.package.withTpm2Tss [
|
|
|
|
|
"systemd-pcrlock@.service"
|
|
|
|
|
"systemd-pcrlock.socket"
|
|
|
|
|
] ++ [
|
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
# Slices / containers.
|
|
|
|
|
"slices.target"
|
2022-06-16 17:23:12 +00:00
|
|
|
|
] ++ optionals cfg.package.withImportd [
|
|
|
|
|
"systemd-importd.service"
|
|
|
|
|
] ++ optionals cfg.package.withMachined [
|
2020-04-24 23:36:52 +00:00
|
|
|
|
"machine.slice"
|
|
|
|
|
"machines.target"
|
|
|
|
|
"systemd-machined.service"
|
2022-06-16 17:23:12 +00:00
|
|
|
|
] ++ [
|
2020-04-24 23:36:52 +00:00
|
|
|
|
"systemd-nspawn@.service"
|
|
|
|
|
|
|
|
|
|
# Misc.
|
|
|
|
|
"systemd-sysctl.service"
|
2022-06-16 17:23:12 +00:00
|
|
|
|
] ++ optionals cfg.package.withTimedated [
|
2020-04-24 23:36:52 +00:00
|
|
|
|
"dbus-org.freedesktop.timedate1.service"
|
|
|
|
|
"systemd-timedated.service"
|
2022-06-16 17:23:12 +00:00
|
|
|
|
] ++ optionals cfg.package.withLocaled [
|
|
|
|
|
"dbus-org.freedesktop.locale1.service"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
"systemd-localed.service"
|
2022-06-16 17:23:12 +00:00
|
|
|
|
] ++ optionals cfg.package.withHostnamed [
|
|
|
|
|
"dbus-org.freedesktop.hostname1.service"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
"systemd-hostnamed.service"
|
2024-07-31 10:19:44 +00:00
|
|
|
|
"systemd-hostnamed.socket"
|
2022-10-30 15:09:59 +00:00
|
|
|
|
] ++ optionals cfg.package.withPortabled [
|
|
|
|
|
"dbus-org.freedesktop.portable1.service"
|
|
|
|
|
"systemd-portabled.service"
|
2022-06-16 17:23:12 +00:00
|
|
|
|
] ++ [
|
2020-04-24 23:36:52 +00:00
|
|
|
|
"systemd-exit.service"
|
|
|
|
|
"systemd-update-done.service"
|
|
|
|
|
] ++ cfg.additionalUpstreamSystemUnits;
|
|
|
|
|
|
|
|
|
|
upstreamSystemWants =
|
|
|
|
|
[ "sysinit.target.wants"
|
|
|
|
|
"sockets.target.wants"
|
|
|
|
|
"local-fs.target.wants"
|
|
|
|
|
"multi-user.target.wants"
|
|
|
|
|
"timers.target.wants"
|
|
|
|
|
];
|
|
|
|
|
|
2020-05-15 21:57:56 +00:00
|
|
|
|
proxy_env = config.networking.proxy.envVars;
|
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
###### interface
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
options.systemd = {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
package = mkPackageOption pkgs "systemd" {};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
units = mkOption {
|
|
|
|
|
description = "Definition of systemd units; see {manpage}`systemd.unit(5)`.";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = {};
|
2022-04-03 18:54:34 +00:00
|
|
|
|
type = systemdUtils.types.units;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
packages = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = [];
|
|
|
|
|
type = types.listOf types.package;
|
2021-10-06 13:57:05 +00:00
|
|
|
|
example = literalExpression "[ pkgs.systemd-cryptsetup-generator ]";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = "Packages providing systemd units and hooks.";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
targets = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = {};
|
2022-04-03 18:54:34 +00:00
|
|
|
|
type = systemdUtils.types.targets;
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = "Definition of systemd target units; see {manpage}`systemd.target(5)`";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
services = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = {};
|
2022-04-03 18:54:34 +00:00
|
|
|
|
type = systemdUtils.types.services;
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = "Definition of systemd service units; see {manpage}`systemd.service(5)`.";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
sockets = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = {};
|
2022-04-03 18:54:34 +00:00
|
|
|
|
type = systemdUtils.types.sockets;
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = "Definition of systemd socket units; see {manpage}`systemd.socket(5)`.";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
timers = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = {};
|
2022-04-03 18:54:34 +00:00
|
|
|
|
type = systemdUtils.types.timers;
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = "Definition of systemd timer units; see {manpage}`systemd.timer(5)`.";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
paths = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = {};
|
2022-04-03 18:54:34 +00:00
|
|
|
|
type = systemdUtils.types.paths;
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = "Definition of systemd path units; see {manpage}`systemd.path(5)`.";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
mounts = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = [];
|
2022-04-03 18:54:34 +00:00
|
|
|
|
type = systemdUtils.types.mounts;
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
|
|
|
|
Definition of systemd mount units; see {manpage}`systemd.mount(5)`.
|
|
|
|
|
|
|
|
|
|
This is a list instead of an attrSet, because systemd mandates
|
|
|
|
|
the names to be derived from the `where` attribute.
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
automounts = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = [];
|
2022-04-03 18:54:34 +00:00
|
|
|
|
type = systemdUtils.types.automounts;
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
|
|
|
|
Definition of systemd automount units; see {manpage}`systemd.automount(5)`.
|
|
|
|
|
|
|
|
|
|
This is a list instead of an attrSet, because systemd mandates
|
|
|
|
|
the names to be derived from the `where` attribute.
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
slices = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = {};
|
2022-04-03 18:54:34 +00:00
|
|
|
|
type = systemdUtils.types.slices;
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = "Definition of slice configurations; see {manpage}`systemd.slice(5)`.";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
generators = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
type = types.attrsOf types.path;
|
|
|
|
|
default = {};
|
|
|
|
|
example = { systemd-gpt-auto-generator = "/dev/null"; };
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
|
|
|
|
Definition of systemd generators; see {manpage}`systemd.generator(5)`.
|
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
|
For each `NAME = VALUE` pair of the attrSet, a link is generated from
|
|
|
|
|
`/etc/systemd/system-generators/NAME` to `VALUE`.
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
shutdown = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
type = types.attrsOf types.path;
|
|
|
|
|
default = {};
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
|
Definition of systemd shutdown executables.
|
2022-08-12 12:06:08 +00:00
|
|
|
|
For each `NAME = VALUE` pair of the attrSet, a link is generated from
|
|
|
|
|
`/etc/systemd/system-shutdown/NAME` to `VALUE`.
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
defaultUnit = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = "multi-user.target";
|
|
|
|
|
type = types.str;
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
|
|
|
|
Default unit started when the system boots; see {manpage}`systemd.special(7)`.
|
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
ctrlAltDelUnit = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = "reboot.target";
|
|
|
|
|
type = types.str;
|
|
|
|
|
example = "poweroff.target";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
|
|
|
|
Target that should be started when Ctrl-Alt-Delete is pressed;
|
|
|
|
|
see {manpage}`systemd.special(7)`.
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
globalEnvironment = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
type = with types; attrsOf (nullOr (oneOf [ str path package ]));
|
|
|
|
|
default = {};
|
|
|
|
|
example = { TZ = "CET"; };
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
2022-08-12 12:06:08 +00:00
|
|
|
|
Environment variables passed to *all* systemd units.
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
managerEnvironment = mkOption {
|
2022-04-03 18:54:34 +00:00
|
|
|
|
type = with types; attrsOf (nullOr (oneOf [ str path package ]));
|
|
|
|
|
default = {};
|
|
|
|
|
example = { SYSTEMD_LOG_LEVEL = "debug"; };
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
2022-04-03 18:54:34 +00:00
|
|
|
|
Environment variables of PID 1. These variables are
|
2022-08-12 12:06:08 +00:00
|
|
|
|
*not* passed to started units.
|
2022-04-03 18:54:34 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
enableCgroupAccounting = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = true;
|
|
|
|
|
type = types.bool;
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
|
|
|
|
Whether to enable cgroup accounting; see {manpage}`cgroups(7)`.
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
extraConfig = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = "";
|
|
|
|
|
type = types.lines;
|
|
|
|
|
example = "DefaultLimitCORE=infinity";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
|
|
|
|
Extra config options for systemd. See {manpage}`systemd-system.conf(5)` man page
|
2022-10-06 18:32:54 +00:00
|
|
|
|
for available options.
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
sleep.extraConfig = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = "";
|
|
|
|
|
type = types.lines;
|
|
|
|
|
example = "HibernateDelaySec=1h";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
|
Extra config options for systemd sleep state logic.
|
2024-01-02 11:29:13 +00:00
|
|
|
|
See {manpage}`sleep.conf.d(5)` man page for available options.
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
additionalUpstreamSystemUnits = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = [ ];
|
|
|
|
|
type = types.listOf types.str;
|
|
|
|
|
example = [ "debug-shell.service" "systemd-quotacheck.service" ];
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
|
Additional units shipped with systemd that shall be enabled.
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
suppressedSystemUnits = mkOption {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
default = [ ];
|
|
|
|
|
type = types.listOf types.str;
|
|
|
|
|
example = [ "systemd-backlight@.service" ];
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
2022-04-03 18:54:34 +00:00
|
|
|
|
A list of units to skip when generating system systemd configuration directory. This has
|
2022-08-12 12:06:08 +00:00
|
|
|
|
priority over upstream units, {option}`systemd.units`, and
|
|
|
|
|
{option}`systemd.additionalUpstreamSystemUnits`. The main purpose of this is to
|
2022-04-03 18:54:34 +00:00
|
|
|
|
prevent a upstream systemd unit from being added to the initrd with any modifications made to it
|
|
|
|
|
by other NixOS modules.
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
watchdog.device = mkOption {
|
2020-07-18 16:06:22 +00:00
|
|
|
|
type = types.nullOr types.path;
|
|
|
|
|
default = null;
|
|
|
|
|
example = "/dev/watchdog";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
2020-07-18 16:06:22 +00:00
|
|
|
|
The path to a hardware watchdog device which will be managed by systemd.
|
2024-01-02 11:29:13 +00:00
|
|
|
|
If not specified, systemd will default to `/dev/watchdog`.
|
2020-07-18 16:06:22 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
watchdog.runtimeTime = mkOption {
|
2020-07-18 16:06:22 +00:00
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
|
default = null;
|
|
|
|
|
example = "30s";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
2020-07-18 16:06:22 +00:00
|
|
|
|
The amount of time which can elapse before a watchdog hardware device
|
2024-01-02 11:29:13 +00:00
|
|
|
|
will automatically reboot the system.
|
|
|
|
|
|
|
|
|
|
Valid time units include "ms", "s", "min", "h", "d", and "w";
|
|
|
|
|
see {manpage}`systemd.time(7)`.
|
2020-07-18 16:06:22 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
watchdog.rebootTime = mkOption {
|
2020-07-18 16:06:22 +00:00
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
|
default = null;
|
|
|
|
|
example = "10m";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
2020-07-18 16:06:22 +00:00
|
|
|
|
The amount of time which can elapse after a reboot has been triggered
|
|
|
|
|
before a watchdog hardware device will automatically reboot the system.
|
2024-01-02 11:29:13 +00:00
|
|
|
|
If left `null`, systemd will use its default of 10 minutes;
|
|
|
|
|
see {manpage}`systemd-system.conf(5)`.
|
|
|
|
|
|
|
|
|
|
Valid time units include "ms", "s", "min", "h", "d", and "w";
|
|
|
|
|
see also {manpage}`systemd.time(7)`.
|
2020-07-18 16:06:22 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
watchdog.kexecTime = mkOption {
|
2020-07-18 16:06:22 +00:00
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
|
default = null;
|
|
|
|
|
example = "10m";
|
2024-01-02 11:29:13 +00:00
|
|
|
|
description = ''
|
|
|
|
|
The amount of time which can elapse when `kexec` is being executed before
|
2020-07-18 16:06:22 +00:00
|
|
|
|
a watchdog hardware device will automatically reboot the system. This
|
2024-01-02 11:29:13 +00:00
|
|
|
|
option should only be enabled if `reloadTime` is also enabled;
|
|
|
|
|
see {manpage}`kexec(8)`.
|
|
|
|
|
|
|
|
|
|
Valid time units include "ms", "s", "min", "h", "d", and "w";
|
|
|
|
|
see also {manpage}`systemd.time(7)`.
|
2020-07-18 16:06:22 +00:00
|
|
|
|
'';
|
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
|
2024-02-07 01:22:34 +00:00
|
|
|
|
warnings = let
|
|
|
|
|
mkOneNetOnlineWarn = typeStr: name: def: lib.optional
|
|
|
|
|
(lib.elem "network-online.target" def.after && !(lib.elem "network-online.target" (def.wants ++ def.requires ++ def.bindsTo)))
|
|
|
|
|
"${name}.${typeStr} is ordered after 'network-online.target' but doesn't depend on it";
|
|
|
|
|
mkNetOnlineWarns = typeStr: defs: lib.concatLists (lib.mapAttrsToList (mkOneNetOnlineWarn typeStr) defs);
|
|
|
|
|
mkMountNetOnlineWarns = typeStr: defs: lib.concatLists (map (m: mkOneNetOnlineWarn typeStr m.what m) defs);
|
|
|
|
|
in concatLists (
|
2020-11-03 02:18:15 +00:00
|
|
|
|
mapAttrsToList
|
|
|
|
|
(name: service:
|
|
|
|
|
let
|
|
|
|
|
type = service.serviceConfig.Type or "";
|
|
|
|
|
restart = service.serviceConfig.Restart or "no";
|
|
|
|
|
hasDeprecated = builtins.hasAttr "StartLimitInterval" service.serviceConfig;
|
|
|
|
|
in
|
|
|
|
|
concatLists [
|
|
|
|
|
(optional (type == "oneshot" && (restart == "always" || restart == "on-success"))
|
|
|
|
|
"Service '${name}.service' with 'Type=oneshot' cannot have 'Restart=always' or 'Restart=on-success'"
|
|
|
|
|
)
|
|
|
|
|
(optional hasDeprecated
|
|
|
|
|
"Service '${name}.service' uses the attribute 'StartLimitInterval' in the Service section, which is deprecated. See https://github.com/NixOS/nixpkgs/issues/45786."
|
|
|
|
|
)
|
2022-02-20 05:27:41 +00:00
|
|
|
|
(optional (service.reloadIfChanged && service.reloadTriggers != [])
|
|
|
|
|
"Service '${name}.service' has both 'reloadIfChanged' and 'reloadTriggers' set. This is probably not what you want, because 'reloadTriggers' behave the same whay as 'restartTriggers' if 'reloadIfChanged' is set."
|
|
|
|
|
)
|
2020-11-03 02:18:15 +00:00
|
|
|
|
]
|
|
|
|
|
)
|
|
|
|
|
cfg.services
|
2024-02-07 01:22:34 +00:00
|
|
|
|
)
|
|
|
|
|
++ (mkNetOnlineWarns "target" cfg.targets)
|
|
|
|
|
++ (mkNetOnlineWarns "service" cfg.services)
|
|
|
|
|
++ (mkNetOnlineWarns "socket" cfg.sockets)
|
|
|
|
|
++ (mkNetOnlineWarns "timer" cfg.timers)
|
|
|
|
|
++ (mkNetOnlineWarns "path" cfg.paths)
|
|
|
|
|
++ (mkMountNetOnlineWarns "mount" cfg.mounts)
|
|
|
|
|
++ (mkMountNetOnlineWarns "automount" cfg.automounts)
|
|
|
|
|
++ (mkNetOnlineWarns "slice" cfg.slices);
|
|
|
|
|
|
|
|
|
|
assertions = concatLists (
|
|
|
|
|
mapAttrsToList
|
|
|
|
|
(name: service:
|
|
|
|
|
map (message: {
|
|
|
|
|
assertion = false;
|
|
|
|
|
inherit message;
|
|
|
|
|
}) (concatLists [
|
|
|
|
|
(optional ((builtins.elem "network-interfaces.target" service.after) || (builtins.elem "network-interfaces.target" service.wants))
|
|
|
|
|
"Service '${name}.service' is using the deprecated target network-interfaces.target, which no longer exists. Using network.target is recommended instead."
|
|
|
|
|
)
|
|
|
|
|
])
|
|
|
|
|
)
|
|
|
|
|
cfg.services
|
2020-11-03 02:18:15 +00:00
|
|
|
|
);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
system.build.units = cfg.units;
|
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
|
system.nssModules = [ cfg.package.out ];
|
2020-05-15 21:57:56 +00:00
|
|
|
|
system.nssDatabases = {
|
|
|
|
|
hosts = (mkMerge [
|
2024-07-01 15:47:52 +00:00
|
|
|
|
(mkOrder 400 ["mymachines"]) # 400 to ensure it comes before resolve (which is 501)
|
2021-07-24 12:14:16 +00:00
|
|
|
|
(mkOrder 999 ["myhostname"]) # after files (which is 998), but before regular nss modules
|
2020-05-15 21:57:56 +00:00
|
|
|
|
]);
|
|
|
|
|
passwd = (mkMerge [
|
|
|
|
|
(mkAfter [ "systemd" ])
|
|
|
|
|
]);
|
|
|
|
|
group = (mkMerge [
|
2023-01-20 10:41:00 +00:00
|
|
|
|
(mkAfter [ "[success=merge] systemd" ]) # need merge so that NSS won't stop at file-based groups
|
2020-05-15 21:57:56 +00:00
|
|
|
|
]);
|
|
|
|
|
};
|
|
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
|
environment.systemPackages = [ cfg.package ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
environment.etc = let
|
2024-06-05 15:53:02 +00:00
|
|
|
|
# generate contents for /etc/systemd/${dir} from attrset of links and packages
|
|
|
|
|
hooks = dir: links: pkgs.runCommand "${dir}" {
|
2020-04-24 23:36:52 +00:00
|
|
|
|
preferLocalBuild = true;
|
|
|
|
|
packages = cfg.packages;
|
|
|
|
|
} ''
|
|
|
|
|
set -e
|
|
|
|
|
mkdir -p $out
|
|
|
|
|
for package in $packages
|
|
|
|
|
do
|
2024-06-05 15:53:02 +00:00
|
|
|
|
for hook in $package/lib/systemd/${dir}/*
|
2020-04-24 23:36:52 +00:00
|
|
|
|
do
|
|
|
|
|
ln -s $hook $out/
|
|
|
|
|
done
|
|
|
|
|
done
|
|
|
|
|
${concatStrings (mapAttrsToList (exec: target: "ln -s ${target} $out/${exec};\n") links)}
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
enabledUpstreamSystemUnits = filter (n: ! elem n cfg.suppressedSystemUnits) upstreamSystemUnits;
|
|
|
|
|
enabledUnits = filterAttrs (n: v: ! elem n cfg.suppressedSystemUnits) cfg.units;
|
2022-04-03 18:54:34 +00:00
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
in ({
|
2022-04-03 18:54:34 +00:00
|
|
|
|
"systemd/system".source = generateUnits {
|
|
|
|
|
type = "system";
|
|
|
|
|
units = enabledUnits;
|
|
|
|
|
upstreamUnits = enabledUpstreamSystemUnits;
|
|
|
|
|
upstreamWants = upstreamSystemWants;
|
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
|
|
"systemd/system.conf".text = ''
|
|
|
|
|
[Manager]
|
2022-04-03 18:54:34 +00:00
|
|
|
|
ManagerEnvironment=${lib.concatStringsSep " " (lib.mapAttrsToList (n: v: "${n}=${lib.escapeShellArg v}") cfg.managerEnvironment)}
|
2024-01-02 11:29:13 +00:00
|
|
|
|
${optionalString cfg.enableCgroupAccounting ''
|
2020-04-24 23:36:52 +00:00
|
|
|
|
DefaultCPUAccounting=yes
|
|
|
|
|
DefaultIOAccounting=yes
|
|
|
|
|
DefaultBlockIOAccounting=yes
|
|
|
|
|
DefaultIPAccounting=yes
|
|
|
|
|
''}
|
|
|
|
|
DefaultLimitCORE=infinity
|
2024-01-02 11:29:13 +00:00
|
|
|
|
${optionalString (cfg.watchdog.device != null) ''
|
|
|
|
|
WatchdogDevice=${cfg.watchdog.device}
|
2020-07-18 16:06:22 +00:00
|
|
|
|
''}
|
2024-01-02 11:29:13 +00:00
|
|
|
|
${optionalString (cfg.watchdog.runtimeTime != null) ''
|
|
|
|
|
RuntimeWatchdogSec=${cfg.watchdog.runtimeTime}
|
2020-07-18 16:06:22 +00:00
|
|
|
|
''}
|
2024-01-02 11:29:13 +00:00
|
|
|
|
${optionalString (cfg.watchdog.rebootTime != null) ''
|
|
|
|
|
RebootWatchdogSec=${cfg.watchdog.rebootTime}
|
2020-07-18 16:06:22 +00:00
|
|
|
|
''}
|
2024-01-02 11:29:13 +00:00
|
|
|
|
${optionalString (cfg.watchdog.kexecTime != null) ''
|
|
|
|
|
KExecWatchdogSec=${cfg.watchdog.kexecTime}
|
2020-07-18 16:06:22 +00:00
|
|
|
|
''}
|
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
|
${cfg.extraConfig}
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
"systemd/sleep.conf".text = ''
|
|
|
|
|
[Sleep]
|
2024-01-02 11:29:13 +00:00
|
|
|
|
${cfg.sleep.extraConfig}
|
2020-04-24 23:36:52 +00:00
|
|
|
|
'';
|
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
|
"systemd/user-generators" = { source = hooks "user-generators" cfg.user.generators; };
|
|
|
|
|
"systemd/system-generators" = { source = hooks "system-generators" cfg.generators; };
|
|
|
|
|
"systemd/system-shutdown" = { source = hooks "system-shutdown" cfg.shutdown; };
|
2020-04-24 23:36:52 +00:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
services.dbus.enable = true;
|
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
|
users.users.systemd-network = {
|
|
|
|
|
uid = config.ids.uids.systemd-network;
|
|
|
|
|
group = "systemd-network";
|
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
users.groups.systemd-network.gid = config.ids.gids.systemd-network;
|
2021-09-18 10:52:07 +00:00
|
|
|
|
users.users.systemd-resolve = {
|
|
|
|
|
uid = config.ids.uids.systemd-resolve;
|
|
|
|
|
group = "systemd-resolve";
|
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
users.groups.systemd-resolve.gid = config.ids.gids.systemd-resolve;
|
|
|
|
|
|
|
|
|
|
# Target for ‘charon send-keys’ to hook into.
|
|
|
|
|
users.groups.keys.gid = config.ids.gids.keys;
|
|
|
|
|
|
|
|
|
|
systemd.targets.keys =
|
|
|
|
|
{ description = "Security Keys";
|
|
|
|
|
unitConfig.X-StopOnReconfiguration = true;
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
|
# This target only exists so that services ordered before sysinit.target
|
|
|
|
|
# are restarted in the correct order, notably BEFORE the other services,
|
|
|
|
|
# when switching configurations.
|
|
|
|
|
systemd.targets.sysinit-reactivation = {
|
|
|
|
|
description = "Reactivate sysinit units";
|
|
|
|
|
};
|
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
systemd.units =
|
2024-05-15 15:35:15 +00:00
|
|
|
|
let
|
|
|
|
|
withName = cfgToUnit: cfg: lib.nameValuePair cfg.name (cfgToUnit cfg);
|
|
|
|
|
in
|
|
|
|
|
mapAttrs' (_: withName pathToUnit) cfg.paths
|
|
|
|
|
// mapAttrs' (_: withName serviceToUnit) cfg.services
|
|
|
|
|
// mapAttrs' (_: withName sliceToUnit) cfg.slices
|
|
|
|
|
// mapAttrs' (_: withName socketToUnit) cfg.sockets
|
|
|
|
|
// mapAttrs' (_: withName targetToUnit) cfg.targets
|
|
|
|
|
// mapAttrs' (_: withName timerToUnit) cfg.timers
|
|
|
|
|
// listToAttrs (map (withName mountToUnit) cfg.mounts)
|
|
|
|
|
// listToAttrs (map (withName automountToUnit) cfg.automounts);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
|
# Environment of PID 1
|
|
|
|
|
systemd.managerEnvironment = {
|
|
|
|
|
# Doesn't contain systemd itself - everything works so it seems to use the compiled-in value for its tools
|
2022-11-21 17:40:18 +00:00
|
|
|
|
# util-linux is needed for the main fsck utility wrapping the fs-specific ones
|
|
|
|
|
PATH = lib.makeBinPath (config.system.fsPackages ++ [cfg.package.util-linux]);
|
2022-04-03 18:54:34 +00:00
|
|
|
|
LOCALE_ARCHIVE = "/run/current-system/sw/lib/locale/locale-archive";
|
|
|
|
|
TZDIR = "/etc/zoneinfo";
|
|
|
|
|
# If SYSTEMD_UNIT_PATH ends with an empty component (":"), the usual unit load path will be appended to the contents of the variable
|
|
|
|
|
SYSTEMD_UNIT_PATH = lib.mkIf (config.boot.extraSystemdUnitPaths != []) "${builtins.concatStringsSep ":" config.boot.extraSystemdUnitPaths}:";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
system.requiredKernelConfig = map config.lib.kernelConfig.isEnabled
|
|
|
|
|
[ "DEVTMPFS" "CGROUPS" "INOTIFY_USER" "SIGNALFD" "TIMERFD" "EPOLL" "NET"
|
|
|
|
|
"SYSFS" "PROC_FS" "FHANDLE" "CRYPTO_USER_API_HASH" "CRYPTO_HMAC"
|
2023-11-16 04:20:00 +00:00
|
|
|
|
"CRYPTO_SHA256" "DMIID" "AUTOFS_FS" "TMPFS_POSIX_ACL"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
"TMPFS_XATTR" "SECCOMP"
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
# Generate timer units for all services that have a ‘startAt’ value.
|
|
|
|
|
systemd.timers =
|
|
|
|
|
mapAttrs (name: service:
|
|
|
|
|
{ wantedBy = [ "timers.target" ];
|
|
|
|
|
timerConfig.OnCalendar = service.startAt;
|
|
|
|
|
})
|
|
|
|
|
(filterAttrs (name: service: service.enable && service.startAt != []) cfg.services);
|
|
|
|
|
|
|
|
|
|
# Some overrides to upstream units.
|
|
|
|
|
systemd.services."systemd-backlight@".restartIfChanged = false;
|
|
|
|
|
systemd.services."systemd-fsck@".restartIfChanged = false;
|
2023-07-15 17:15:38 +00:00
|
|
|
|
systemd.services."systemd-fsck@".path = [ pkgs.util-linux ] ++ config.system.fsPackages;
|
|
|
|
|
systemd.services."systemd-makefs@" = {
|
|
|
|
|
restartIfChanged = false;
|
|
|
|
|
path = [ pkgs.util-linux ] ++ config.system.fsPackages;
|
|
|
|
|
# Since there is no /etc/systemd/system/systemd-makefs@.service
|
|
|
|
|
# file, the units generated in /run/systemd/generator would
|
|
|
|
|
# override anything we put here. But by forcing the use of a
|
|
|
|
|
# drop-in in /etc, it does apply.
|
|
|
|
|
overrideStrategy = "asDropin";
|
|
|
|
|
};
|
2023-08-04 22:07:22 +00:00
|
|
|
|
systemd.services."systemd-mkswap@" = {
|
|
|
|
|
restartIfChanged = false;
|
|
|
|
|
path = [ pkgs.util-linux ];
|
|
|
|
|
overrideStrategy = "asDropin";
|
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
systemd.services.systemd-random-seed.restartIfChanged = false;
|
|
|
|
|
systemd.services.systemd-remount-fs.restartIfChanged = false;
|
|
|
|
|
systemd.services.systemd-update-utmp.restartIfChanged = false;
|
|
|
|
|
systemd.services.systemd-udev-settle.restartIfChanged = false; # Causes long delays in nixos-rebuild
|
|
|
|
|
systemd.targets.local-fs.unitConfig.X-StopOnReconfiguration = true;
|
|
|
|
|
systemd.targets.remote-fs.unitConfig.X-StopOnReconfiguration = true;
|
2024-02-07 01:22:34 +00:00
|
|
|
|
systemd.targets.network-online.wantedBy = [ "multi-user.target" ];
|
2020-05-15 21:57:56 +00:00
|
|
|
|
systemd.services.systemd-importd.environment = proxy_env;
|
2021-05-20 23:08:51 +00:00
|
|
|
|
systemd.services.systemd-pstore.wantedBy = [ "sysinit.target" ]; # see #81138
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
|
# NixOS has kernel modules in a different location, so override that here.
|
|
|
|
|
systemd.services.kmod-static-nodes.unitConfig.ConditionFileNotEmpty = [
|
|
|
|
|
"" # required to unset the previous value!
|
|
|
|
|
"/run/booted-system/kernel-modules/lib/modules/%v/modules.devname"
|
|
|
|
|
];
|
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
# Don't bother with certain units in containers.
|
|
|
|
|
systemd.services.systemd-remount-fs.unitConfig.ConditionVirtualization = "!container";
|
|
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
|
# Increase numeric PID range (set directly instead of copying a one-line file from systemd)
|
|
|
|
|
# https://github.com/systemd/systemd/pull/12226
|
|
|
|
|
boot.kernel.sysctl."kernel.pid_max" = mkIf pkgs.stdenv.is64bit (lib.mkDefault 4194304);
|
|
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
|
services.logrotate.settings = {
|
2022-03-05 16:20:37 +00:00
|
|
|
|
"/var/log/btmp" = mapAttrs (_: mkDefault) {
|
|
|
|
|
frequency = "monthly";
|
2022-04-03 18:54:34 +00:00
|
|
|
|
rotate = 1;
|
|
|
|
|
create = "0660 root ${config.users.groups.utmp.name}";
|
|
|
|
|
minsize = "1M";
|
2022-03-05 16:20:37 +00:00
|
|
|
|
};
|
|
|
|
|
"/var/log/wtmp" = mapAttrs (_: mkDefault) {
|
|
|
|
|
frequency = "monthly";
|
2022-04-03 18:54:34 +00:00
|
|
|
|
rotate = 1;
|
|
|
|
|
create = "0664 root ${config.users.groups.utmp.name}";
|
|
|
|
|
minsize = "1M";
|
2022-03-05 16:20:37 +00:00
|
|
|
|
};
|
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# FIXME: Remove these eventually.
|
|
|
|
|
imports =
|
|
|
|
|
[ (mkRenamedOptionModule [ "boot" "systemd" "sockets" ] [ "systemd" "sockets" ])
|
|
|
|
|
(mkRenamedOptionModule [ "boot" "systemd" "targets" ] [ "systemd" "targets" ])
|
|
|
|
|
(mkRenamedOptionModule [ "boot" "systemd" "services" ] [ "systemd" "services" ])
|
|
|
|
|
(mkRenamedOptionModule [ "jobs" ] [ "systemd" "services" ])
|
|
|
|
|
(mkRemovedOptionModule [ "systemd" "generator-packages" ] "Use systemd.packages instead.")
|
2024-09-19 14:19:46 +00:00
|
|
|
|
(mkRemovedOptionModule ["systemd" "enableUnifiedCgroupHierarchy"] ''
|
|
|
|
|
In 256 support for cgroup v1 ('legacy' and 'hybrid' hierarchies) is now considered obsolete and systemd by default will refuse to boot under it.
|
|
|
|
|
To forcibly reenable cgroup v1 support, you can set boot.kernelParams = [ "systemd.unified_cgroup_hierachy=0" "SYSTEMD_CGROUP_ENABLE_LEGACY_FORCE=1" ].
|
|
|
|
|
NixOS does not officially support this configuration and might cause your system to be unbootable in future versions. You are on your own.
|
|
|
|
|
'')
|
2020-04-24 23:36:52 +00:00
|
|
|
|
];
|
|
|
|
|
}
|