Commit Graph

341 Commits

Author SHA1 Message Date
r-vdp
9258f57625
systemd: add a name option to all systemd units
This allows us to set things like dependencies in a way that we can
catch typos at eval time.
So instead of
```nix
systemd.services.foo.wants = [ "bar.service" ];
```
we can write
```nix
systemd.services.foo.wants = [ config.systemd.services.bar.name ];
```
which will throw an error if no such service has been defined.

Not all cases can be done like this (eg template services), but in a lot
of cases this will allow to avoid typos.

There is a matching option on the unit option
(`systemd.units."foo.service".name`) as well.
2024-04-15 11:32:45 +02:00
Will Fancher
df32b558b5 nixos/systemd: Enable debug-shell.service. 2024-03-29 17:32:38 -04:00
Viktor Kleen
0aed32b9dd
nixos/systemd: Only include systemd-boot-random-seed if the unit exists
The unit file is only present if systemd was built with bootloader support.
2024-03-08 08:52:11 +00:00
nikstur
380f36f350 nixos/systemd: include systemd-boot-random-seed.service
This is necessary to properly refresh the boot loader random seed.
See https://www.freedesktop.org/software/systemd/man/latest/systemd-boot-random-seed.service.html#
2024-02-28 12:14:06 +01:00
nikstur
bd4c49f29b nixos/systemd: remove a superfluous override
This is already the upstream default.
2024-02-28 11:45:39 +01:00
Will Fancher
0d85bf0efe nixos/systemd: Temporarily bring back multi-user -> network-online
There were several modules, critically including NetworkManager, which
were not prepared for this change. Most of the change was good,
however. Let's bring back the dependency and change the assertion to a
warning for now.
2024-01-25 15:53:52 -05:00
Will Fancher
367d101073 nixos/systemd: assert After=network-online.target -> Wants=
This will catch broken services at the evaluation stage.
2024-01-18 16:28:41 -08:00
Jade Lovelace
62f30634db nixos/systemd: don't require network-online.target for multi-user.target
Previously we required network-online.target for multi-user.target. This
has made a lot of people very angry and has been widely regarded as a
bad move (or at least, very nonstandard):
15d761a525 (commitcomment-128564097)

This was done because of fragile tests and services declaring
dependencies on multi-user.target when they meant network-online.target.

Let's rip off the bandaid and fix our tests.
2024-01-18 16:28:39 -08:00
nikstur
e6b66f08a5 nixos/switch-to-configuration: add sysinit-reactivation.target 2024-01-18 00:46:30 +01:00
Maciej Krüger
c0ef1f9479
nixos/network-interfaces: add assertion if used in after or wants 2024-01-12 17:29:05 +01:00
Ryan Lahfa
176e84d44f
Revert "nixos/systemd-boot: init boot counting" 2024-01-11 01:00:43 +01:00
Julien Malka
eb435897a6 nixos/systemd-boot: init boot counting 2024-01-07 11:34:09 +00:00
nicoo
744b456b49 nixos/systemd: Mark down the options description 2023-11-22 10:49:51 +00:00
nicoo
3f5e19aaf3 nixos/systemd: Link manpages in options' description 2023-11-22 10:49:50 +00:00
nicoo
f1b17edaea nixos/systemd: Refactor package option 2023-11-22 10:49:50 +00:00
nicoo
aba2edda44 nixos/systemd: Refactor references to config.systemd 2023-11-22 10:49:50 +00:00
nicoo
667e7ca0bd nixos/systemd: refactor option definitions
- factor out `config.systemd.`;
- remove `lib.mdDoc` no-op.
2023-11-22 10:49:50 +00:00
Jakub Sokołowski
26c4e35cea
systemd: rename required AUTOFS4_FS to AUTOFS_FS
The `AUTOFS4_FS` name appears to be a legacy naming stub:

>Ok, I ran the script, and also decided that we might as well remove
>the AUTOFS4 legacy naming stub entry by now.
>
>It has been five years, and people will have either picked up the new
>name with 'make oldconfig', or they just don't use 'make oldconfig' at
>all.

https://lore.kernel.org/lkml/CAHk-=wgK9-Tx4BxYMrc0pg==mcaz3cjWF6-CBwVpM_BZAmf4JQ@mail.gmail.com/#r

That has been remove in 6.6 kernel and results in a failure:
```
error:
       Failed assertions:
       - CONFIG_AUTOFS4_FS is not enabled!
```

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-10-20 01:44:13 +02:00
Adam Stephens
b1237da5b2
systemd: revert allow udev-trigger for lxd nested containers 2023-09-28 13:58:11 -04:00
Mario Rodas
25b9f4d2b6
Merge pull request #255116 from adamcstephens/lxd/udev-container
systemd: allow udev-trigger to run on lxd containers with nesting
2023-09-28 02:17:27 -05:00
Adam Stephens
8565cd862a
systemd: allow udev-trigger to run on lxd containers with nesting 2023-09-14 09:17:33 -04:00
Raito Bezarius
97ee93da10 systemd: apply upstream patch for tmpfiles
This fixes notably the fact that /dev/zfs was not usable anymore as a user,
and potentially other things.

Tracked in systemd upstream under issue number 28653, 28765.
2023-09-13 12:02:41 +02:00
Nathan Henrie
5061d9daf0 systemd.watchdog: (docs): include note about systemd default watchdog reboot time
I found it very confusing to get an error message on reboot about `10min` when that didn't seem to be the NixOS default.
2023-09-08 09:12:29 -06:00
Will Fancher
7a3730f901 nixos/systemd: Add util-linux to systemd-mkswap's path 2023-07-29 14:02:06 -04:00
r-vdp
c3fa4f9170
nixos/systemd: Make the fsck unit depend only on FS packages.
This means that this unit no longer need to be rebuilt when the system path is changed.
2023-06-18 12:46:13 +02:00
Will Fancher
5176a4f113 nixos: Use systemd-makefs for autoFormat 2023-06-04 22:57:20 -04:00
Florian Klink
504d66bae9
Merge pull request #216826 from gdamjan/systemd-253
systemd: 252.5 -> 253
2023-03-13 17:37:39 +01:00
Aaron Andersen
374fc068ec nixos/systemd-oomd: disable systemd-oomd when enableUnifiedCgroupHierarchy is false
fixup for https://github.com/NixOS/nixpkgs/pull/203596
2023-03-08 18:39:18 -05:00
Дамјан Георгиевски
83f65146ab nixos/systemd: systemd-growfs* units are real files now
`systemd-growfs@.service` and `systemd-growfs-root.service` became real units since:
50072ccf1b

we need to add them to the nixos module so growfs works again
2023-03-05 20:05:00 +01:00
Leorize
05420f34cf nixos: add systemd-homed support
As a start, it's not very configurable, but works pretty well.
2022-12-09 12:10:51 -06:00
Bjørn Forsman
19a6b85e8f nixos: disable systemd-oomd when enableUnifiedCgroupHierarchy is false
Or else systemd-oomd gets marked as failed due to
"Userspace Out-Of-Memory (OOM) Killer was skipped because of a failed condition check (ConditionControlGroupController=v2)."
and cause the system to enter degraded state.

Ref https://github.com/NixOS/nixpkgs/issues/195085
2022-11-29 20:39:05 +01:00
Will Fancher
b28ecff1e6 nixos: Add util-linux to systemd PATH to fix fsck with systemd 251.6
This is an alternative to the reverted
d9b1bde390, which broke systemd stage 1
2022-11-15 17:54:32 -05:00
github-actions[bot]
d426366b62
Merge staging-next into staging 2022-10-05 00:05:03 +00:00
Gabriel Arazas
292aab9822 nixos/systemd: update extraConfig description 2022-10-03 11:17:41 +08:00
phaer
fcd5087046 systemd: build with portabled by default. 2022-09-30 14:53:50 +02:00
Sandro Jäckel
03b6d5111a
nixos/systemd: remove not required or true 2022-09-19 13:45:01 +02:00
Yureka
19686a4452 nixos/systemd: conditionally include systemd-update-utmp upstream unit 2022-09-13 10:34:28 +02:00
github-actions[bot]
c5298a170d
Merge staging-next into staging 2022-07-27 18:02:13 +00:00
pennae
860a0449ce nixos/system: invariant option docs MD conversions 2022-07-24 13:01:47 +02:00
K900
c9183d3738 nixos/systemd: make sure all the device nodes are created in stage1
The ConditionFileNotEmpty override patch wasn't correct for stage1, which
does have the modules in /lib. So, remove the patch and set
the right path with overrides in the final system.

Also, make sure systemd-tmpfiles-setup-dev is pulled in to create
all the necessary symlinks.
2022-07-22 10:01:21 +03:00
Sandro Jäckel
3df045e6d5
nixos/systemd: use cfg.package in systemPackages to avoid confusion 2022-06-09 22:44:28 +02:00
Klemens Nanni
cbcc746f8f nixos/systemd: Package only built component units
Account for all `with*` options causing their respective unit files to
not be built, just like the current code `withCryptsetup` already does.

This fixes build errors like the following:
```
missing /nix/store/5fafsfms64fn3ywv274ky7arhm9yq2if-systemd-250.4/example/systemd/system/systemd-importd.service
error: builder for '/nix/store/67rdli5q5akzwmqgf8q0a1yp76jgr0px-system-units.drv' failed with exit code 1
```

Found by using a customised systemd package as follows:
```
systemd.package = pkgs.systemd-small;

nixpkgs.config.packageOverrides = pkgs: {

  "systemd-small" = pkgs.systemd.override {
    withImportd = false;
    withMachined = false;
    ...
  };

};
```
2022-05-16 16:52:25 +02:00
Erik Arvstedt
63528cb1a6
nixos/systemd: remove duplicate definition of systemd.user.timers
It's already defined in `systemd/user.nix`.
This is a leftover from commit b6d50528dd
where all `systemd.user` settings were moved to `systemd/user.nix`.
2022-04-11 13:01:40 +02:00
Janne Heß
7cdc4dd5d1
Merge pull request #164943 from ElvishJerricco/systemd-initrd-reuse-systemd-module
initrd: Opt-in bare bones systemd-based initrd
2022-04-03 15:53:02 +02:00
Dominique Martinet
e92c05349c nixos/logrotate: convert to freeform
using freeform is the new standard way of using modules and should replace
extraConfig.
In particular, this will allow us to place a condition on mails
2022-04-01 07:09:26 +09:00
Janne Heß
a3e0698bf6
nixos/systemd: Switch to ManagerEnvironment=
This accomplishes multiple things:
- Allows us to start systemd without stage-2-init.sh. This was not
  possible before because the environment would have been wrong
- `systemctl daemon-reexec` also changes the environment, giving us
  newer tools for the fs packages
- Starts systemd in a fully clean environment, making everything more
  consistent and pure
2022-03-30 20:24:27 +02:00
Will Fancher
5bfe213315 Clarify suppressed units description 2022-03-22 21:28:51 -04:00
Will Fancher
2d4ebf1259 initrd: Optional systemd-based initrd 2022-03-22 21:28:43 -04:00
Will Fancher
25113740a5 nixos: systemd-lib: Make generateUnits general with default args 2022-03-22 07:02:23 -04:00
Will Fancher
52c98fc3e9 nixos: systemd: Split unit types into separate module 2022-03-21 10:25:27 -04:00