Commit Graph

3166 Commits

Author SHA1 Message Date
nikstur
e63a403bfb nixos/kernel: don't include append-initrd-secrets when unused 2025-08-10 22:43:48 +02:00
nikstur
bc5eefd2a5 nixos/activation-script: disable userActivationScripts when system is not activatable 2025-08-10 22:43:42 +02:00
nikstur
9e0ac0c7e6 nixos/kexec: add enable option
It is still enabled by default but now you can actively exclude it if
you don't need it.
2025-08-10 22:43:34 +02:00
nikstur
d5ae87bdeb Revert "nixos: allow more things to be disabled" 2025-08-10 22:22:08 +02:00
Arian van Putten
1bb040fae8 nixos: allow more things to be disabled (#429695) 2025-08-10 19:49:52 +02:00
K900
aadb3e60ec linux: remove mentions of extraStructuredConfig & throw error (#432497) 2025-08-10 15:16:42 +03:00
Maximilian Bosch
dccb264578 linux: remove mentions of extraStructuredConfig & throw error
PR #431115 changed extraStructuredConfig to structuredExtraConfig to
follow the deprecation warning about `extraConfig`. However,
`extraStructuredConfig` was mentioned in several places in the docs that
weren't addressed. Also, using this would silently fail since the code
in question would still accept the old key.

This patch updates the docs accordingly and throws an error if the
code-path is reached and `extraStructuredConfig` is being used.
2025-08-10 14:10:50 +02:00
Ryan Lahfa
bcc20cad16 nixos/network-interfaces: let networkd handle privacy extensions (#431967) 2025-08-09 17:53:39 +02:00
nikstur
bb954cddf5 nixos/network-interfaces: let networkd handle privacy extensions
This removes bash from the mandatory system closure.
2025-08-09 00:10:13 +02:00
Alex Lyon
38ee02a873 nixos/limine: fix installation when using initrd secrets 2025-08-01 21:59:49 +05:30
nikstur
cc20f14ae4 nixos/kexec: add enable option
It is still enabled by default but now you can actively exclude it if
you don't need it.
2025-08-01 14:16:48 +02:00
nikstur
089e2e5eaf nixos/activation-script: disable userActivationScripts when system is not activatable 2025-07-31 20:42:36 +02:00
nikstur
400882d409 nixos/kernel: don't include append-initrd-secrets when unused 2025-07-31 20:42:36 +02:00
Will Fancher
0a53886700 nixos/{tmpfiles, wrappers}: explicitly set RestrictSUIDSGID false (#426882) 2025-07-30 04:31:21 -04:00
Grimmauld
fad6dbb9e6 nixos/systemd: remove enableCgroupAccounting option 2025-07-28 11:26:44 +02:00
Grimmauld
231c142766 nixos/systemd: remove obsolete DefaultCPUAccounting option
This option is made uncondiotional in systemd 258 [1].
Earlier, it defaulted to true on kernels newer than 4.15,
which applies to all supported nixos kernels.
This means removing the option does not change behavior.

[1] 29da53dde3
2025-07-28 11:26:37 +02:00
Grimmauld
f47b100763 nixos/systemd: remove obsolete DefaultBlockIOAccounting option
This option is now being ignored by systemd,
so we do not need to explicitly define it.
2025-07-28 11:26:34 +02:00
Grimmauld
265152f770 nixos/systemd: explicitly set systemd.settings.Manager.Default*Accounting 2025-07-28 11:26:30 +02:00
Grimmauld
9c429f004d nixos/systemd: remove obsolete definition for DefaultLimitCORE
The limit was introduced in 2016 in 840f3230a2,
and broken iin 2019 in bafc256915. Since then,
it is the exact same as systemd itself sets as default.
2025-07-28 11:26:27 +02:00
Grimmauld
69e833f187 nixos/systemd: set DefaultLimitCORE in systemd.settings.Manager explicitly 2025-07-28 11:26:24 +02:00
Grimmauld
62acc59148 nixos/systemd: move systemd.watchdog.* to systemd.settings.Manager 2025-07-28 11:26:21 +02:00
Grimmauld
493f1339b0 nixos/systemd: move systemd.watchdog.* to systemd.settings.Manager 2025-07-28 11:26:08 +02:00
Grimmauld
4d3ab0e8d3 nixos/systemd: make systemd.managerEnvironment affect systemd.settings.Manager 2025-07-28 11:24:39 +02:00
Grimmauld
897933fc9e nixos/systemd: move systemd.managerEnvironment to systemd.settings.Manager.ManagerEnvironment 2025-07-28 11:24:36 +02:00
Grimmauld
5bc2d42ba9 nixos/systemd: make boot.initrd.systemd.managerEnvironment affect boot.initrd.systemd.settings.Manager 2025-07-28 11:24:33 +02:00
Grimmauld
071ce0b44a nixos/systemd: remove boot.initrd.systemd.extraConfig 2025-07-28 11:24:29 +02:00
Grimmauld
1a846a2fff nixos/systemd: remove systemd.extraConfig 2025-07-28 11:24:26 +02:00
Grimmauld
f0b71eebdc nixos/systemd: add boot.initrd.systemd.settings.Manager option 2025-07-28 11:24:06 +02:00
Grimmauld
ebaf7a33ec nixos/systemd: add settings.Manager option 2025-07-28 11:23:57 +02:00
Will Fancher
4b3b18a44f nixos/systemd-boot: refactor json.load() logic for better error message (#421916) 2025-07-27 23:08:42 -04:00
jack
dedf852ccd nixos/systemd-boot: refactor json.load() logic for better error message 2025-07-27 13:05:03 +02:00
Grimmauld
fb51cc802d nixos/systemd: run0: enable setLoginUid, disable pamMount
This brings our `run0` in line with the upstream defaults:
bcc73cafdb/src/run/systemd-run0.in

While working on `auditd`, i noticed differences in how `run0` behaves
in regard to `/proc/$pid/sessionid` and `/proc/$pid/loginuid`. Particularly,
both files were set to `4294967295`, the magic value denoting `unset`.

While the manual page says elevators such as sudo should not set the loginuid,
run0 is a bit of a special case: The unit spawned by it is not child of
the running user session, and as such there is no id to inherit.

`systemd` upstream uses `pam_loginuid`, and for consistency we should too.
Especially because it prevents a whole lot of pain when working with `auditd`.

As to pam mounts:
On nixos we enable those if they are globally enabled. Upstream does not.
Considering the password entered into polkit is usually not the user password
of the account which will own the unit, pam mount will fail for any partition
which requires a password. Thus it makes sense to also disable pam mounts
for our run0, it prevents unnecessary unexpected pain.
2025-07-25 23:49:59 +02:00
Robert Hensing
f5ee08446a Modular services (#372170) 2025-07-24 16:46:34 +02:00
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Wolfgang Walther
62fe016519 treewide: run treefmt with mdcr/nixfmt 2025-07-24 13:52:31 +02:00
Grimmauld
248c463f69 nixos/tmpfiles: explicitly set RestrictSUIDSGID = false
This ensures the tmpfiles resetup service has permissions
to create suid/sgid files, even if `DefaultRestrictSUIDSGID`
is set in system.conf. This is required, as tmpfiles
are used to e.g. set file permissions on the journal
directory.`DefaultRestrictSUIDSGID` is a new feature
coming in systemd 258 [1].

[1] https://github.com/systemd/systemd/pull/38126
2025-07-20 12:40:26 +02:00
Robert Hensing
b51a6c3531 nixos/system/service: Use copy of escapeSystemdExecArgs
This unblocks modular services while providing opportunity to
improve this when a solution is agreed on.
2025-07-20 03:02:03 +02:00
Robert Hensing
af04a80c76 modular-services: merge process.argv from executable and args 2025-07-20 03:01:06 +02:00
Robert Hensing
b9e4118e6d nixosTests.modularService: adjust quoting expectations 2025-07-20 03:01:06 +02:00
Robert Hensing
109a6a9d1e Add assertions and warnings to modular services 2025-07-20 03:01:05 +02:00
Robert Hensing
1acabeebed Add modular services, system.services 2025-07-20 03:01:05 +02:00
nikstur
3fd41447c7 nixos/systemd/repart: add extraArgs option and Encrypt=tpm2 test (#422511) 2025-07-18 16:52:18 +02:00
Franz Pletz
71064c4808 nixos/systemd: fix run0 failing to run commands (#419588) 2025-07-17 22:18:10 +02:00
sanana
6baed48380 limine-install: fix profile enumeration
Fixes #425158.
2025-07-15 13:49:05 +05:30
phaer
dd88db29ed modules/systemd-oomd: add After=systemd-sysusers.service
Before this change, systemd-oomd startup was flaky at least with
either systemd-sysusers or userborn enabled. It would restart several
times until users were provisioned, so that it finally succeeded.

An alternative would be to use a DynamicUser which was my first
approach, before I discovered that upstream added the after statement
in Dec 2024[1]. DynamicUsers could have further
implications (sandboxing, etc), so we follow upstream here.

It's not clear to me we why Upstreams "After=systemd-sysusers.service"
doesn't show up on nixos-unstable systems (systemd v257.6).

Userborn is covered, as its unit is aliased to systemd-sysusers.service.

The following test succeeded after this change on x86_64-linux:

  nix-build -A nixosTests.systemd-oomd

[1]: 36dd429680
2025-07-11 15:13:25 +02:00
Martin Weinelt
3beaa4d288 nixos/activatable-script: drop nettools dependency
The hostname is not set over nettools since d300940637.
2025-07-06 00:59:35 +02:00
Florian Klink
e47cbf3942 nixos/systemd/repart: add extraArgs option
There's lots of options regarding dm-crypt, dm-verity and TPMs.
Creating individual NixOS options for all of them would be infeasible.
2025-07-04 23:15:23 +03:00
Sandro Jäckel
5e4801914b nixos/stage-1: fix option path in message 2025-07-03 17:54:49 +02:00
Bogdan-Cristian Tătăroiu
3332613add nixos/systemd-initrd: Fix fsck.xfs failing due to missing sh
When running with a xfs root partition and using systemd for stage 1
initrd, I noticed in journalctl that fsck.xfs always failed to execute.

The issue is that it is trying to use the below sh interpreter:

`#!/nix/store/xy4jjgw87sbgwylm5kn047d9gkbhsr9x-bash-5.2p37/bin/sh -f`

but the file does not exist in the initrd image.

/nix/store/xy4jjgw87sbgwylm5kn047d9gkbhsr9x-bash-5.2p37/bin/**bash**
exists since it gets pulled in by some package, but the rest of the
directory is not being pulled in.

boot/systemd/initrd.nix mentions that xfs_progs references the sh
interpreter and seems to explicitly try to address this by adding
${pkgs.bash}/bin to storePaths, but that's the wrong bash package.

Update the `storePaths` value to pull in `pkgs.bashNonInteractive`
rather than `pkgs.bash`.
2025-06-28 14:50:51 +01:00
Florian Klink
32f7b63557 nixos/systemd-oomd: use the correct name for the top-level user slice (#418480) 2025-06-25 00:06:50 +03:00