Commit Graph

2408 Commits

Author SHA1 Message Date
Jörg Thalheim
028b7d27a3
growpart: shellcheck fixes (#340490) 2024-09-28 09:50:11 +02:00
Jörg Thalheim
4f06ecd5a6
systemd/initrd: fix shellcheck issues (#340486) 2024-09-28 09:48:29 +02:00
Will Fancher
ea2838e1ce
nixos/qemu-vm: Ensure 9pnet_virtio module is loaded for shared dirs (#343574) 2024-09-25 23:11:08 -04:00
Will Fancher
1f34534920
Systemd tpm fixes (#343307) 2024-09-25 17:17:57 -04:00
Artturin
e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00
Jörg Thalheim
15f80d9120
Improve assertions for etc.overlay and systemd-sysusers (#332516) 2024-09-23 17:01:30 +02:00
Will Fancher
f0d7076c6a nixos/systemd-stage-1: Include modprobe@.service 2024-09-21 16:37:47 -04:00
Will Fancher
a0165bd5af nixos/systemd/tpm2: Enable tpm2-setup and tpm2.target
tpm2.target was functionally useless without these services and this
generator. When systemd-cryptsetup-generator creates
systemd-cryptsetup@.service units, they are ordered after
systemd-tpm2-setup-early.service, not tpm2.target. These services are
themselves ordered after tpm2.target.

Note: The systemd-tpm2-setup(-early) services will serve no *function*
under a normal NixOS system at the moment. Because of their
ConditionSecurity=measured-uki, they will always be skipped, unless
you are building an appliance with the system.build.uki feature. Thus,
these are enabled solely for their systemd unit ordering properties.
2024-09-20 14:33:36 -04:00
Will Fancher
5034450095 nixos/systemd: Factor out tpm2 support into separate module 2024-09-20 14:33:35 -04:00
Moritz Sanft
5ee6467bd3
nixos: add support for dm-verity
Co-authored-by: nikstur <nikstur@outlook.com>
Co-authored-by: WilliButz <willibutz@posteo.de>
2024-09-20 13:03:10 +02:00
Jörg Thalheim
d66f976cee
nixos/generic-extlinux-compatible: add mirroredBoots option (#335131) 2024-09-18 14:08:31 +02:00
Felix Buehler
a83ffb43de nixos/boot.tmp: remove with lib; 2024-09-15 10:43:58 +02:00
Felix Buehler
2f7c0a170f nixos/boot.loader.efi: remove with lib; 2024-09-15 10:43:58 +02:00
Felix Buehler
0a51fdb520 nixos/systemd.enableEmergencyMode: remove with lib; 2024-09-15 10:43:57 +02:00
Felix Buehler
91cb7594d0 nixos/boot.initrd.clevis: remove with lib; 2024-09-15 10:43:57 +02:00
Jean-François Roche
251b0c958f nixos/systemd-boot: Fix regression in builder script
Avoid running Python scripts in the root of the package, as this
triggers `os.listdir` on the Nix store directory during import. This
operation can be time-consuming on large store directories
(see issue #283795 for more details).

The issue was initially fixed in #284153 but was reverted in #306339.

Co-authored-by: Sönke Hahn <soenkehahn@gmail.com>
2024-09-12 01:29:32 +02:00
Artturin
833c74afa4
kexec: fix shellcheck issues (#340487) 2024-09-09 23:38:36 +03:00
Petr Hodina
a9f77c2fb0 systemd-boot: Add option for consoleMode to support SteamDeck 2024-09-08 22:48:21 +02:00
r-vdp
7d664c0ac1
growpart: shellcheck fixes 2024-09-08 12:28:46 +02:00
r-vdp
955e3cd8fe
kexec: fix shellcheck issues 2024-09-08 12:26:22 +02:00
r-vdp
a236941ad0
systemd/initrd: fix shellcheck issues 2024-09-08 12:25:17 +02:00
Aleksana
3be36da2d2
unl0kr: remove tomfitzhenry@ as maintainer (#333616) 2024-09-06 12:50:55 +08:00
Will Fancher
a96e54fe52
initrd: use the new tmpfiles options to create tmpfiles config (#339503) 2024-09-05 17:02:30 -04:00
Will Fancher
5a575e88b6
Revert "nixos: support dm-verity" 2024-09-05 15:56:49 -04:00
Tom Fitzhenry
752afd12e7 unl0kr: remove tomfitzhenry@ as maintainer 2024-09-05 18:10:59 +10:00
r-vdp
6ccc6bf4d2
initrd: emit a warning when tmpfiles config is created manually 2024-09-05 09:55:29 +02:00
Moritz Sanft
d0213a75e0
nixos: support dm-verity 2024-09-05 08:42:53 +02:00
r-vdp
d558554243
initrd: use the new tmpfiles options to create tmpfiles config
Otherwise we get a clash when generating the initrd since the initrd tmpfiles
options create a symlink at /etc/tmpfiles.d/ and any subsequent writes inside
this directory because of initrd.systemd.contents will cause a permission denied
error.
2024-09-04 14:39:03 +02:00
datafoo
24e08d0e9b nixos/timesyncd: allow NTP servers advertised by DHCP to be used
- add option `fallbackServers` with default to `networking.timeServers`
- option `servers` now default to null

Fix #335050
2024-09-04 12:17:39 +02:00
datafoo
b4cd57870d nixos/timesyncd: allow null for option servers
This gives the ability to not write `NTP=` to the `timesyncd.conf` file
(servers = null) as opposed to writing `NTP=` (servers = []) which is
interpreted slightly differently by systemd:

> When the empty string is assigned, the list of NTP servers is reset,
and all prior assignments will have no effect.
2024-09-04 12:14:24 +02:00
datafoo
34efcf8aef nixos/timesyncd: minor refactoring 2024-09-04 12:14:24 +02:00
datafoo
45c0d04735 nixos/timesyncd: minor refactoring 2024-09-04 12:14:24 +02:00
Luflosi
93fb96ecde
nixos/generic-extlinux-compatible: add mirroredBoots option
Analogous to `boot.loader.grub.mirroredBoots`.
This allows installing the configuration files to multiple locations.
2024-09-04 12:02:57 +02:00
Jörg Thalheim
a9034a9c35
nixos/grub: fix value precedence with optional -> mkIf (#338773) 2024-09-03 08:29:25 +02:00
zimbatm
1ea32d4f69 nixos/grub: fix value precendence with optional -> mkIf
When using `lib.optionals`, the return value of both branches of the
condition get set as a value to the option.

When using `lib.mkIf`, only the positive condition gets set as a value
to the option.

This small distinction is important when dealing with precedence. For
example here, we wanted to set a boot.grub.devices default value with
lib.mkDefault, and that was getting overridden with the empty value of
`lib.optional (cfg.device != "") cfg.device`.

See https://github.com/nix-community/srvos/pull/491#discussion_r1738827651

The general conclusion is that using `lib.mkIf` is preferable to
`lib.optional` or `lib.optionals` when setting values in the NixOS
module system.
2024-09-01 12:13:15 +02:00
Felix Buehler
f3dd1a8bd5 nixos/services.logind: remove with lib; 2024-08-30 23:01:45 +02:00
Felix Buehler
69ca7aa56f nixos/services.journald: remove with lib; 2024-08-30 23:01:42 +02:00
Will Fancher
bf19362974
nixos/systemd-boot: use unique path for devicetree blob (#336263) 2024-08-28 12:36:20 -04:00
Jörg Thalheim
82ac9a1580
Merge pull request #337054 from Mic92/sysusers
sysuser: slightly better assertions message
2024-08-25 09:44:58 +02:00
Franz Pletz
83cd05ff59
Merge pull request #335976 from poscat0x04/nixos-networkd-ipv6ra 2024-08-25 01:51:36 +02:00
Jared Baur
05aefd6f05
nixos/systemd-boot: remove semicolon 2024-08-24 12:50:26 -07:00
Jared Baur
6327b07b25
nixos/systemd-boot: use unique path for devicetree blob
Use the store directory for the devicetree package containing the
desired DTB when installing to the ESP. This allows for more than one
NixOS generation containing differing DTBs to coexist on the same ESP
(similar to how we can have multiple kernels & initrds). This change
removes the assumption that the filepath passed to `copy_from_file` is a
file that lives at the toplevel of a nix output path (which prior to the
systemd-boot DTB support was the case for the kernel and initrd
derivations).
2024-08-24 12:50:24 -07:00
Jörg Thalheim
7211a81060 sysuser: slightly better assertions message 2024-08-24 19:20:28 +02:00
Felix Stupp
4b998d179f
nixos/systemd.network: add support for UseDomains= in [Network] sections
Those options were also added with systemd 256, but sadly were missed out in #307068.

These options are documented in:
- [systemd 256 changelog](https://github.com/systemd/systemd/releases/tag/v256) (search for `UseDomains=`)
- [networkd.conf(5)](https://www.freedesktop.org/software/systemd/man/256/networkd.conf.html#UseDomains=)
- [systemd.network(5)](https://www.freedesktop.org/software/systemd/man/256/systemd.network.html#UseDomains=)
2024-08-21 19:48:29 +00:00
poscat
712e039585
nixos/networkd: add IPv6SendRA options added in systemd 255 2024-08-21 15:59:33 +08:00
Florian Klink
cce9aef6fd
Merge pull request #334337 from eduarrrd/eaccess-null
nixos/systemd/initrd: Fix emergencyAccess to work with `null`.
2024-08-19 14:44:25 +03:00
nikstur
0a810476ad
Merge pull request #307528 from WilliButz/systemd-initrd/tmpfiles-settings
nixos/systemd-tmpfiles: add initrd support
2024-08-19 11:54:42 +02:00
Will Fancher
f84991dc2b
Merge pull request #334288 from ElvishJerricco/systemd-initrd-fully-merge-sbin
Systemd initrd fully merge sbin
2024-08-18 22:41:53 -04:00
Eduard Bachmakov
b33bf6b99a nixos/systemd/initrd: Fix emergencyAccess to work with null.
Implementation is now compatible with the option's .type already defined.

This allows us to pass `config.users.users.<user>.hashedPassword` even if this is null (the default).

Before:
true  => access
false => no access
hash  => access via password
null  => eval error

After:
true  => access
false => no access
hash  => access via password
null  => no access
2024-08-14 10:26:15 +02:00
Will Fancher
0637303ca8 Revert "Merge pull request #330017 from Mic92/boot-counting"
This reverts commit 3d3c0f4d34, reversing
changes made to 47f7e25a77.
2024-08-13 23:11:18 -04:00