Commit Graph

3816 Commits

Author SHA1 Message Date
r-vdp
c44bf2a69d nixos/bootspec: remove enable option
Bootspec has been enabled by default and marked internal for a long
time.

Dropping this option avoids us needing fallbacks in bootloader scripts.
2026-06-09 21:45:54 +03:00
Masum Reza
4b59bc72ab nixos/limine: fix fwupd-efi signing script under strict shell checks (#526918) 2026-06-09 16:37:53 +00:00
nixpkgs-ci[bot]
f3fe341d1f Merge master into staging-nixos 2026-06-06 00:45:45 +00:00
Will Fancher
2964861f87 systemd-logind: allow service reloads to apply new configuration (#523985) 2026-06-05 22:06:29 +00:00
r-vdp
919b70b29f nixos/systemd-boot: refuse to wipe ESP when no generations found 2026-06-05 18:01:06 +03:00
Dmitry Voronin
be84ec22c5 systemd-logind: allow service reloads to apply new configuration 2026-06-05 11:18:12 +03:00
nikstur
bd0813cd48 nixos/systemd: gnupg -> gnupgMinimal (#527976) 2026-06-04 23:05:38 +02:00
nikstur
603f171aa8 nixos/systemd: gnupg -> gnupgMinimal
This fixes the bashless tests as gnupgMinimal doest not depend on bash.
2026-06-04 22:53:26 +02:00
K900
c519e3619d Merge remote-tracking branch 'origin/master' into staging-nixos 2026-06-04 22:22:00 +03:00
nikstur
661e163702 nixos/timesyncd: migrate to RFC 42-style settings (#516318) 2026-06-04 15:21:45 +00:00
Jamie Magee
1460350c4c nixos/timesyncd: migrate to RFC 42-style settings
Replace `services.timesyncd.extraConfig` with a freeform `services.timesyncd.settings.Time` submodule, rendered via `utils.systemdUtils.lib.settingsToSections`. `extraConfig` is removed via `mkRemovedOptionModule`.

`servers` and `fallbackServers` are kept as typed wrappers; they now bridge into `settings.Time.NTP` / `settings.Time.FallbackNTP` via `mkDefault` so users can still override them through `settings.Time`.

Adds `nixos/tests/systemd-timesyncd` to assert the rendered `timesyncd.conf` contents.
2026-06-04 16:56:31 +02:00
nikstur
bf343540cd nixos/systemd/user: migrate to RFC 42-style settings (#516329) 2026-06-04 14:42:22 +00:00
nixpkgs-ci[bot]
1735c5d0c3 Merge master into staging-nixos 2026-06-04 13:06:58 +00:00
r-vdp
69dc41f083 nixos/preSwitchChecks: actually set errexit inside check bodies
The previous `if ! ( ... )` wrapper put the check body in a context
where bash ignores `set -e`, so a failing command in the middle of a
check would not abort it and the switch would proceed. Run the
subshell outside any conditional and capture $? explicitly instead.
2026-06-04 02:18:34 +03:00
nixpkgs-ci[bot]
4bc901828f Merge master into staging-nixos 2026-06-03 13:39:45 +00:00
Ramses
b431330672 nixos/etc: create uninitialized /etc/machine-id with readonly /etc/ (#523894) 2026-06-03 12:20:48 +00:00
Ramses
46ff137a45 nixos/systemd: ship time-set.target (#526425) 2026-06-02 14:04:55 +00:00
r-vdp
9eb570f453 nixos/systemd-boot-builder: drop unused BootFile.{current,system_identifier}
Both fields are now write-only after the previous two commits, so
remove them. BootFile is back to being just a (path, writer) pair.
2026-06-02 12:20:55 +03:00
r-vdp
c38ca6ab7d nixos/systemd-boot-builder: handle initrd-secrets failure in the writer
The CalledProcessError can only come from the append-initrd-secrets
script, so catching it in the generic write loop and then asserting
on the writer type to reach back into its `source` is the wrong
layer. Move the catch, the pristine-initrd fallback and the warning
into InitrdWithSecretsWriter itself, and pass `critical` through the
writer protocol so it can decide between aborting and falling back.

The writer carries the generation number so the warning can still
name the affected generation. write_boot_files no longer knows
anything about secrets and the isinstance assertion is gone.

Suggested-by: Will Fancher <elvishjerricco@gmail.com>
2026-06-02 12:20:55 +03:00
r-vdp
9d46e91c49 nixos/systemd-boot-builder: track critical paths separately from BootFile
Whether a write failure must be fatal is a property of the destination
path (is it needed by the configuration we are switching to?), not of
the particular BootFile instance that happened to survive
deduplication. Compute the set of critical paths up front and look it
up in write_boot_files, so the dedup loop no longer needs to pick the
"right" instance and becomes a plain order-preserving seen-set walk.

This leaves BootFile.current unused.

Suggested-by: Will Fancher <elvishjerricco@gmail.com>
2026-06-02 12:20:55 +03:00
r-vdp
dff3315fac nixos/systemd-boot-builder: use with for the secrets temp file
This guarantees the descriptor is closed even when copyfileobj raises,
matching the other writer implementations. The append-initrd-secrets
script reopens the file by path, so flush() is enough before invoking
it and the explicit close() is no longer needed.
2026-06-02 12:20:55 +03:00
r-vdp
30552ab00b nixos/systemd-boot-builder: clarify stale initrd secrets warning
Tell the user what actually happens (the old secrets stay in place) and
how to get rid of the warning, instead of just saying it is "normal".

Suggested-by: Will Fancher <elvishjerricco@gmail.com>
2026-06-02 12:20:54 +03:00
r-vdp
b4e756627d nixos/systemd-boot-builder: write each ESP path only once
Shared kernels and initrds appear once per generation in boot_files, so
InitrdWithSecretsWriter rebuilt the same file repeatedly. Prefer the
current configuration's entry so its failures stay fatal.
2026-06-02 12:20:54 +03:00
r-vdp
76673e2736 nixos/systemd-boot-builder: fall back to pristine initrd when secrets fail
Otherwise the .conf for that generation references a missing initrd and
the boot entry fails to load.
2026-06-02 12:20:54 +03:00
r-vdp
3ff32972f8 nixos/systemd-boot-builder: verify content of existing entry files
A file named nixos-<hash>.conf whose content no longer hashes to <hash>
is corrupt. Skip it so GC removes it and a fresh entry is written.
2026-06-02 12:20:54 +03:00
r-vdp
820d20f8b9 nixos/systemd-boot-builder: cache boot_path()
It calls Path.resolve() and is invoked several times per generation for
the same store paths.
2026-06-02 12:20:53 +03:00
r-vdp
85d59c4f3d nixos/systemd-boot-builder: use a set for GC root lookup
has_gc_root() iterated the entire BootFileList for every file on the
ESP, giving O(files * roots) comparisons. Build the set of kept paths
once and use O(1) membership tests instead.
2026-06-02 12:20:53 +03:00
r-vdp
146acf965f nixos/systemd-boot-builder: warn instead of aborting when an old gen's secrets fail
After removing or renaming a file in boot.initrd.secrets, older
generations' append scripts start failing. Aborting on that blocks
deploying the new configuration, so only treat a failure as fatal when
it belongs to the configuration being switched to.
2026-06-02 12:20:53 +03:00
r-vdp
6eba7d60f3 nixos/systemd-boot-builder: rebuild secret-bearing initrds atomically each run
Appending to the existing file made it grow on every rebuild and a
failed script could leave it half-written. Always rebuild from the
pristine initrd into a temp file and rename into place.
2026-06-02 12:20:53 +03:00
r-vdp
6ef460ec9d nixos/systemd-boot-builder: write loader.conf after the entries it points at
A crash between the two would leave `default <id>` referring to a
.conf that does not exist yet.
2026-06-02 12:20:53 +03:00
Will Fancher
44a974d0eb nixos/systemd-boot: Rerun secrets every switch 2026-06-02 12:20:52 +03:00
Will Fancher
1d081050c3 nixos/systemd-boot: Separate finding the placement of files from writing files 2026-06-02 12:20:52 +03:00
r-vdp
b4c278c06b nixos/systemd-boot-builder: store boot loader configs using content hashing
Co-Authored-By: AkechiShiro <14914796+AkechiShiro@users.noreply.github.com>
2026-06-02 12:20:51 +03:00
r-vdp
69ce6b2391 nixos/systemd-boot-builder: re-instate boot counting
Co-Authored-By: Julien Malka <julien@malka.sh>
Co-Authored-By: AkechiShiro <14914796+AkechiShiro@users.noreply.github.com>
2026-06-02 12:20:12 +03:00
r-vdp
ac2410be5d nixos/systemd-boot-builder: format 2026-06-02 12:20:12 +03:00
Aliaksandr
e5ec5c94d8 nixos/limine: fix fwupd-efi signing script under strict shell checks
The signing service builds `fwupd_efi` as a bash array but referenced
it as a scalar, tripping SC2128 (array expanded without index) and
SC2046 (unquoted command substitution). With enableStrictShellChecks
these are promoted to errors, breaking the unit-script build when
secureBoot, fwupd and strict shell checks are all enabled.

Loop over the array and sign every matched fwupd EFI binary, quoting
the basename and the -o argument. Indexing a single element would
silently skip any additional files the glob matches.

Assisted-by: claude-code with claude-opus-4-8[1m]-high
2026-06-02 02:46:28 +03:00
nixpkgs-ci[bot]
90f8f42740 Merge master into staging-nixos 2026-06-01 14:03:25 +00:00
Matt Sturgeon
05f0fc6f6a nixos/kernel_config: remove redundant mergeEqualOption (#525746) 2026-06-01 08:43:29 +00:00
nixpkgs-ci[bot]
db581f6e08 Merge master into staging-nixos 2026-06-01 07:49:08 +00:00
Sizhe Zhao
f4bb29c620 nixos/limine: correct timeout logic (#523423) 2026-06-01 03:41:00 +00:00
r-vdp
b2f185c25b nixos/etc: inline small regular files into the metadata erofs image
Regular (non-symlink) /etc entries with an explicit mode are currently
written to the metadata erofs image as stubs that redirect to a
separate basedir layer. Every open() of such a file makes overlayfs open
two real files (the metadata stub and the basedir target).

composefs-dump supports embedding file content directly via the CONTENT
field (raw size limit LCFS_INLINE_CONTENT_MAX = 5000 bytes). Use it for
files up to 4096 bytes so they are served straight from erofs with a
single underlying open. Files above the threshold keep the existing basedir
redirect.

Basedir entries that are provably inlineable are filtered at eval time
(text-backed entries) so changing a small /etc file no longer rebuilds
etc-lowerdir. Other entries are filtered at build time using the
same size check as the dump generator.

On a minimal config the basedir becomes empty and an open+read+close of
/etc/sudoers drops from ~46k to ~12k kernel instructions (-73%).
The metadata image size is unchanged (content fits in erofs block slack).
2026-05-31 23:46:03 +03:00
r-vdp
5197842329 nixos/systemd: ship time-set.target
time-sync.target has Wants/After=time-set.target, every OnCalendar=
timer gains an implicit After=time-set.target, and
systemd.special(7) documents it as the hook for "system clock has
been set from a local source". Without the unit file the target is
not-found, so WantedBy=time-set.target on third-party units is
silently ignored and the timer ordering is a no-op.
2026-05-31 21:12:39 +03:00
Asa Paparo
6e5b63357b nixos/etc: create uninitialized /etc/machine-id with readonly /etc/
This resolves #523878 where /etc/ is readonly and /etc/machine-id
cannot be created. Instead, /etc/machine-id is initialized to
"uninitialized" by systemd-tmpfiles in initrd and persisted in
/var/lib/nixos.
2026-05-30 16:52:46 -05:00
Johannes Kirschbauer
6996a952c9 nixos/kernel_config: remove redundant mergeEqualOption 2026-05-30 00:25:06 +02:00
Zack Weinberg
dac30f5f49 nixos/stage-1: make "testing patched programs" build output more useful
Most of the commands executed during the "testing patched programs"
phase of the extra-utils build don't produce any output whatsoever.
Therefore, if something goes wrong in that phase, the build log is
uninformative.  Mitigate this by adding a `set -x` immediately after the
"testing patched programs" message is printed, causing the shell to print
an execution trace.  This way we'll at least know _which command_ failed.
2026-05-27 11:42:03 -04:00
nixpkgs-ci[bot]
deaa80b018 Merge master into staging-nixos 2026-05-27 00:45:11 +00:00
Ramses
907350b66c switch-to-configuration-ng: harden user-unit migration second pass (#517768) 2026-05-26 20:19:08 +00:00
Aliaksandr
5edd54e7ec nixos/kernel: drop boot.vesa
Deprecated in 2020 because Xorg works better with kernel modesetting,
and the original 800x600 default is rarely the right choice anyway.
Users who still need a VESA fallback can inline
`boot.kernelParams = [ "vga=0x317" "nomodeset" ];`.

`mkRemovedOptionModule` makes the removal noisy: setting `boot.vesa`
will now fail evaluation with a pointer to the replacement.
2026-05-25 09:25:01 +03:00
Viktor Fedorov
c982604bb8 nixos/limine: correct timeout logic
Although the documentation for `boot.loader.timeout` says to use `null` for an indefinite display, in limine nixos module it incorrectly sets `10` instead of `no`. https://github.com/Limine-Bootloader/Limine/blob/v12.x/CONFIG.md
2026-05-23 19:30:36 +02:00
r-vdp
663a59e0b6 nixos/activation: run user nixos-activation.service exactly once per switch
stc-ng starts every active target (including default.target) and then
explicitly restarts nixos-activation.service. As a Type=oneshot without
RemainAfterExit the unit is inactive after login, so the default.target
start job re-runs it via Wants=, and the explicit restart runs it again
(or, depending on ordering, SIGTERMs the currently running script and re-runs it).

Set RemainAfterExit=yes so target starts are a no-op for an already-run
activation, and restartIfChanged=false so the unit-diff pass leaves it
alone when the script changes. The explicit restart in stc-ng remains
the single trigger per switch. Print that restart so it is visible in
the switch output, and drop it from the "NOT restarting" list.

Extend the user-activation-scripts test to assert the activation is
only run once, and never killed.
2026-05-23 12:50:40 +02:00