Commit graph

3062 commits

Author SHA1 Message Date
Wolfgang Walther 5cbdb94f3a
treewide: remove redundant parentheses
Auto-fixed by nixf-diagnose.

(cherry picked from commit 91a8fee3aa)
2025-10-05 12:59:25 +02:00
Wolfgang Walther 1c6af9ba0a
treewide: remove unused with
Auto-fixed by nixf-diagnose.

(cherry picked from commit c283f32d29)
2025-10-05 12:38:28 +02:00
Jason Yundt d5378cec85 nixos/systemd: fix run0 failing to run commands
Fixes #361592.

I was able to test this change by doing the following:

1. Create a file named “test-systemd-run0.nix” that contains this Nix
expression:

    let
      nixpkgs = /path/to/nixpkgs;
      pkgs = import nixpkgs { };
    in
    pkgs.testers.runNixOSTest {
      name = "test-systemd-run0";
      nodes.machine = {
        security.polkit.enable = true;
      };
      testScript = ''
        start_all()
        machine.succeed("run0 env")
      '';
    }

2. Replace “/path/to/nixpkgs” with the actual path to an actual copy of
Nixpkgs.

3. Run the integration test by running this command:

    nix-build <path to test-systemd-run0.nix>

(cherry picked from commit d54262911c)
2025-07-28 21:59:21 +00:00
Wolfgang Walther aefcb0d50d
treewide: run nixfmt 1.0.0 2025-07-24 14:58:18 +02:00
Wolfgang Walther a46262ae77
treewide: run treefmt with mdcr/nixfmt 2025-07-24 14:58:15 +02:00
sanana 5fc31ce1b8 limine-install: fix profile enumeration
Fixes #425158.

(cherry picked from commit 6baed48380)
2025-07-15 08:22:02 +00:00
Peter Marshall 96f0f8b632 nixos/systemd-stage-1: follow systemd /run propagation
We currently bypass systemd's switch-root logic by premounting
/sysroot/run. Make sure to propagate its sub-mounts with the recursive
flag, in accordance with the default switch-root logic.

This is required for creds at /run/credentials to survive the transition
from initrd -> host.

(cherry picked from commit 7d36daa76a)
2025-07-01 21:04:10 +03:00
Bogdan-Cristian Tătăroiu 35b1c349e3 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`.

(cherry picked from commit 3332613add)
2025-07-01 15:57:07 +00:00
Wolfgang Walther 9c6636ec49
[Backport release-25.05] nixos/systemd-initrd: honor the enable option in contents (#412109) 2025-06-26 20:19:14 +00:00
r-vdp 54f759989d nixos/systemd-oomd: use the correct name for the top-level user slice
`user-.slice` does not seem to exist, and the config we generate for it is
rejected by systemd (see `systemctl status user-.slice`).
I suppose that what was really intended here, was to configure
`user.slice`, which is the one that is documented in `man systemd.special`.

Reported-by: Ian Sollars <Ian.Sollars@brussels.msf.org>
(cherry picked from commit c28b3143da)
2025-06-24 21:07:45 +00:00
Jared Baur d6822a8edf nixos/networkd: update valid KeepConfiguration values
These changed with the release of systemd v257 from "dhcp*" to
"dynamic*".

(cherry picked from commit d8f9c63512)
2025-06-05 23:18:28 +00:00
Luj f10e84cf9c
[Backport release-25.05] nixos/clevis: fix clevis in scripted initrd (#413635) 2025-06-04 15:27:27 +03:00
Julien Malka a776cc522e nixos/clevis: fix clevis in scripted initrd
Fixes #389750

(cherry picked from commit 9655143028)
2025-06-03 16:00:46 +00:00
Jörg Thalheim 7c0f154132 systemd-boot: improve error message if no previous systemd boot is found.
(cherry picked from commit b6c1663986)
2025-06-03 15:44:47 +00:00
Fiona Behrens c312e3cc8b nixos/systemd-initrd: honor the enable option in contents
The enable attribute of `boot.initrd.systemd.contents.<name>` was
ignored for building initrd storePaths. This resulted in building
derivations for the initrd even if it was disabled.

Found while testing a to build a nixos system with a kernel without
lodable modules[0]

[0]: https://github.com/NixOS/nixpkgs/pull/411792

(cherry picked from commit 99da5ec2bc)
2025-05-29 15:06:51 +00:00
nat 8c8ba680ec nixos/limine: substituteAll -> replaceVarsWith
(cherry picked from commit e51e0da386)
2025-05-26 14:07:33 +05:30
programmerlexi 90f3e90346 nixos/limine: fix boot entry not being created properly (#410935)
(cherry picked from commit 2c673b6e67)
2025-05-26 13:26:56 +05:30
hustlerone d5138ca3d6 nixos/limine: tidy up the boot menu
(cherry picked from commit de6905ee37)
2025-05-22 21:03:39 +05:30
programmerlexi f5c8555577 nixos/limine: don't modify boot order on bootloader update
(cherry picked from commit 95030d7eb3)
2025-05-21 23:38:10 +05:30
programmerlexi d8c429b16a nixos/limine: carefully remove files instead of nuking them
(cherry picked from commit a094b5d8cc)
2025-05-21 15:42:12 +05:30
programmerlexi ecc74afaf4 nixos/limine: atomically copy files
(cherry picked from commit 2c7659b1ff)
2025-05-21 15:42:12 +05:30
benaryorg f551d91f2e nixos/systemd: unconditional systemd-journald-audit.socket
Containers did not have *systemd-journald-audit.socket* in *additionalUpstreamSystemUnits*, which meant that the unit was not provided.
However the *wantedBy* was added without any additional check, therefore creating an empty unit with just the *WantedBy* on *boot.isContainer* machines.
This caused `systemd-analyze verify` to fail:

```text
systemd-journald-audit.socket: Unit has no Listen setting (ListenStream=, ListenDatagram=, ListenFIFO=, ...). Refusing.
systemd-journald-audit.socket: Cannot add dependency job, ignoring: Unit systemd-journald-audit.socket has a bad unit file setting.
systemd-journald-audit.socket: Cannot add dependency job, ignoring: Unit systemd-journald-audit.socket has a bad unit file setting.
```

The upstream unit already contains the following, which should make it safe to include regardless:

```ini
[Unit]
ConditionSecurity=audit
ConditionCapability=CAP_AUDIT_READ
```

For reference, this popped up in the context of #[360426](https://redirect.github.com/NixOS/nixpkgs/issues/360426) as well as #[407696](https://redirect.github.com/NixOS/nixpkgs/pull/407696).

Co-authored-by: Bruce Toll <4109762+tollb@users.noreply.github.com>
Signed-off-by: benaryorg <binary@benary.org>
(cherry picked from commit e434130d0b)
2025-05-20 13:30:26 +00:00
toborwinner 1b2b3e1ea2 nixos/specialisation: escape and restrict specialisation names
Prevent the specialisation names from containing a forward slash.
Also escape them to allow for spaces in specialisation names.

(cherry picked from commit 2b9fc0ccc5)
2025-05-17 17:48:07 +00:00
Sandro c0cd90d343
nixos/etc: remove rogue continue (#399915) 2025-05-16 15:08:17 +02:00
Arian van Putten 871526be1f
nixos/image/repart: Use own assertions / warnings. (#406940) 2025-05-15 19:14:53 +02:00
Vladimír Čunát bf7544999c
Merge master into staging-next 2025-05-14 08:12:15 +02:00
Will Fancher 4b0d1225f5 lib/asserts: Factor out NixOS's toplevel assertion / warning logic. 2025-05-14 01:21:10 -04:00
Berk D. Demir e4bf5ce70d nixos/activation: Fix shellcheck test failure
lib/test.nix relies on `fileset.toSource` which creates a source dir
with the files of interest. `testers.shellcheck` passes all the files in
the source dir to shellcheck. The issue is related to relative path
sourcing, i.e. `source ./lib.sh` where shellcheck cannot make any
assumptions about the working directory.

Options were:
1) Disable this warning with a directive
   Prior disabling in the tree:
    - pkgs/tools/nix/info/info.sh
    - nixos/modules/testing/test-instrumentation.nix

2) Set source-path to SCRIPTDIR with a directive
   https://github.com/koalaman/shellcheck/wiki/Directive#source-path

   Even though we don't enable external script following for shellcheck
   with `-x` flag given every file in the source dir is passed, this
   directive seems to capture the intent to help shellcheck a bit
   better.

Went with option 2.
2025-05-12 09:58:28 -07:00
nixpkgs-ci[bot] 673efed879
Merge master into staging-next 2025-05-11 00:17:35 +00:00
Martin Weinelt 9da9474d63
nixos/boot/tmp: introduce adaptive huge memory pages (#404514) 2025-05-11 01:23:32 +02:00
Florian Klink 180f5a2593
nixos/systemd-initrd: deprecate strip (#404512) 2025-05-10 19:11:16 +03:00
Colin 62cab5dbe8
pkgs/buffybox: 3.2.0-unstable-2025-03-16 -> 3.3.0-unstable-2025-05-06 (#403179) 2025-05-09 02:04:39 +00:00
Gerg-L 98313e2b81
nixos/systemd-initrd: deprecate strip
It only saved ~1MiB of initramfs size, but caused a few issues
like unloadable kernel modules.
2025-05-08 19:08:14 -04:00
hustlerone 90ff6dc49e nixos/unl0kr: fix touchpads 2025-05-09 00:29:43 +02:00
PAEPCKE, Michael b8eb81e873
nixos/boot/tmp: introduce adaptive huge memory pages 2025-05-05 22:52:02 +00:00
Yureka 3b42616f4b nixos/initrd-ssh: include sshd-auth binary in initrd 2025-05-05 17:23:47 +02:00
Sandro 55e8dc37a3
nixos/luksroot: remove useless $new_k_luks (#115832) 2025-04-30 16:51:33 +02:00
nikstur bf2bc08b37
repart: Enable discard option (#397906) 2025-04-28 13:34:32 +02:00
Paul Haerle 86a1af8a7b
nixos/systemd: clarify what enableStrictShellChecks checks (#401460) 2025-04-27 14:15:15 +02:00
Scott Edlund 02555cd0bd nixos/systemd: clarify what enableStrictShellChecks checks
the specifics of this option are in the release notes, but bring
them into the documentation.
2025-04-26 01:46:12 +08:00
Raito Bezarius 139bfb5b5e nixos/system/activation/bootspec: generalize the bootspec tooling package
After RFC-0125 implementation, Determinate Systems was pinged multiple
times to transfer the repository ownership of the tooling to a
vendor-neutral repository.

Unfortunately, this never manifested. Additionally, the leadership of
the NixOS project was too dysfunctional to deal with this sort of
problem. It might even still be the case up to this day.

Nonetheless, nixpkgs is about enabling end users to enact their own
policies. It would be better to live in a world where there is one
obvious choice of bootspec tooling, in the meantime, we can live in a
world where people can choose their bootspec tooling.

The Lix forge possess one fork of the Bootspec tooling:
https://git.lix.systems/lix-community/bootspec which will live its own
life from now on.

Change-Id: I00c4dd64e00b4c24f6641472902e7df60ed13b55
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
2025-04-24 18:22:02 +02:00
Nico Felbinger e0d1b49a46
chore: move meta option to top level in many modules 2025-04-19 18:27:48 +02:00
Sandro Jäckel 484b00be20
nixos/etc: remove rogue continue 2025-04-19 03:01:40 +02:00
Martin Weinelt fbf76bf72b
make-initrd-ng: Restore stripped file permissions (#398396) 2025-04-13 18:11:19 +02:00
Will Fancher c9ea864d6f nixos/shutdown: Create /run/initramfs with mode 0700 2025-04-13 12:02:16 -04:00
Markus Sütter c6476ca119 repart: Enable discard option
systemd-repart can be configured to not automatically issue BLKDISCARD commands
to the underlying hardware.

This PR exposes this option in the repart module.
2025-04-11 12:46:50 +02:00
Hugo Lageneste 1599c37a6b nixos/luksroot: remove useless $new_k_luks
Remove the variable new_k_luks used only once in the code.
2025-04-04 23:39:29 +02:00
nixpkgs-ci[bot] d05ee1c1cb
Merge staging-next into staging 2025-04-02 16:38:11 +00:00
Silvan Mosberger e52d633a63 Merge remote-tracking branch 'upstream/staging-next' into staging 2025-04-02 18:30:54 +02:00
Mikael Voss 045fbc389f
nixos/tmpfiles: properly escape argument option
The systemd.tmpfiles.settings.<name>.<path>.<type>.argument option may
contain arbitrary strings. This could allow intentional or unintentional
introduction of new configuration lines.

The argument field cannot be quoted, C‐style \xNN escape sequences are
however permitted. By escaping whitespace and newline characters, the
issue can be mitigated.
2025-04-02 13:23:42 +02:00