Commit Graph

86 Commits

Author SHA1 Message Date
Sandro
3814255973
Merge pull request #300995 from SuperSandro2000/udev-nixos-wsl
nixos/udev: make more NixOS WSL friendly
2024-04-17 22:39:10 +02:00
stuebinm
6afb255d97 nixos: remove all uses of lib.mdDoc
these changes were generated with nixq 0.0.2, by running

  nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix
  nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix

two mentions of the mdDoc function remain in nixos/, both of which
are inside of comments.

Since lib.mdDoc is already defined as just id, this commit is a no-op as
far as Nix (and the built manual) is concerned.
2024-04-13 10:07:35 -07:00
Bjørn Forsman
a29010fe79 nixos: improve many 'enable' descriptions 2024-04-09 07:10:17 +02:00
Sandro Jäckel
4677729c56
nixos/udev: only load firmware from udev when the nixos kernel is used
This is not the case for eg. NixOS in WSL
2024-04-02 18:14:50 +02:00
Sandro Jäckel
413f779bc0
nixos/udev: don't create modprobe config if modprobe is disabled 2024-04-02 18:14:25 +02:00
Florian Klink
fe446f8bb4 nixos/udev: allow /bin/sh in udev rules
Using `/bin/sh` in udev rules is fine (as it's guaranteed to point to a
(bash) shell on NixOS), and actually is better than hardcoding absolute
paths, at least in cases where these rules are also added to the
(systemd-based) initrd (via boot.initrd.services.udev.rules).

To allow this, we need to update the check routine that assembles the
list of files needing fixup, to explicitly exclude `/bin/sh` occurences.

To do this, we convert the pattern to a PCRE regex (which requires "/"
to be escaped), and add `(?!/bin/sh\b)` as a negative lookahead.

This subsequently allows udev rules to (start using) `/bin/sh` again, so
they'll work in-initrd.
2023-12-14 19:14:13 +02:00
Florian Klink
cb0fb74a2b nixos/udev: update description for services.udev.path
services.udev.path already contains some defaults, these are however
defined in the module implementation, not options.

Update the description to make this more clear.
2023-12-14 18:09:54 +02:00
Anthony Roussel
e30f48be94
treewide: fix redirected and broken URLs
Using the script in maintainers/scripts/update-redirected-urls.sh
2023-11-11 10:49:01 +01:00
Will Fancher
cca22054c0 systemd-stage-1: Add assertions for unsupported options. 2023-10-30 12:15:58 +01:00
Lily Foster
e9207b0501
nixos/*: unhide remaining systemd stage-1 options
These options were missed in NixOS/nixpkgs#226237, but they all were
specifically added for systemd stage-1.
2023-07-03 08:41:38 -04:00
rnhmjoj
dbcd187add
nixos/udev: silence harmless warnings
`udevRulesFor` generates a lot of warnings like:

  substituteStream(): WARNING: pattern '"/sbin/modprobe' doesn't match anything in file '/nix/store/.../95-dm-notify.rules'

due to the (preemptive) substitution of common paths in the default
udev rules. In this case a file having no matches is not unepected
and poses no issue at all.
2023-06-06 19:42:18 +02:00
Bruce Toll
0fce0749b5 nixos/udev: Fix hwdb conflict handling; build with systemdb-hwdb
Switch to systemdb-hwdb to build the udev hwdb.bin, as "udevadm hwdb" is
deprecated. This fixes an issue where the order of conflicting keys is
not respected.  The systemd-hwdb command creates a newer format (v3) of
hwdb.bin that respects the ordering of duplicate keys, with later
values replacing earlier occurrences.

A release note is included, as some mappings may be affected.
2023-04-21 19:08:37 -04:00
Will Fancher
dd392d7c76 systemd-initrd: networkd 2023-04-17 16:41:34 -04:00
Nick Cao
51e4bd298f
nixos/udev: enable initrd-udevadm-cleanup-db.service in systemd stage 1 2022-11-21 14:33:27 +08:00
Sandro Jäckel
7fe3f63da6
nixos/udev: add enable option 2022-10-26 19:24:14 +02:00
Nick Cao
309ea5a1af nixos/udev: allow marking firmware as not compressible 2022-10-07 19:40:58 +00:00
pennae
9547123258 nixos/*: convert internal option descriptions to MD
we'll have to do it eventually, may as well be now.
2022-08-31 16:32:54 +02:00
pennae
ef176dcf7e nixos/*: automatically convert option descriptions
conversions were done using https://github.com/pennae/nix-doc-munge
using (probably) rev f34e145 running

    nix-doc-munge nixos/**/*.nix
    nix-doc-munge --import nixos/**/*.nix

the tool ensures that only changes that could affect the generated
manual *but don't* are committed, other changes require manual review
and are discarded.
2022-08-31 16:32:53 +02:00
pennae
61e93df189 nixos/*: automatically convert option docs to MD
once again using nix-doc-munge (69d080323a)
2022-08-03 22:46:41 +02:00
pennae
3aebb4a2be nixos/*: normalize link format
make (almost) all links appear on only a single line, with no
unnecessary whitespace, using double quotes for attributes. this lets us
automatically convert them to markdown easily.

the few remaining links are extremely long link in a gnome module, we'll
come back to those at a later date.
2022-08-03 21:57:46 +02:00
pennae
9c8531c8a5 nixos/*: replace <replaceable>s with «thing»
we can't embed syntactic annotations of this kind in markdown code
blocks without yet another extension. replaceable is rare enough to make
this not much worth it, so we'll go with «thing» instead. the module
system already uses this format for its placeholder names in attrsOf
paths.
2022-08-03 21:08:58 +02:00
pennae
2e751c0772 treewide: automatically md-convert option descriptions
the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
2022-07-30 15:16:34 +02:00
Alyssa Ross
8aa8e0ce7f
nixos/udev: compress all firmware if supported
This should be a significant disk space saving for most NixOS
installations.  This method is a bit more complicated than doing it in
the postInstall for the firmware derivations, but this way it's
automatic, so each firmware package doesn't have to separately
implement its compression.

Currently, only xz compression is supported, but it's likely that
future versions of Linux will additionally support zstd, so I've
written the code in such a way that it would be very easy to implement
zstd compression for those kernels when they arrive, falling back to
xz for older (current) kernels.

I chose the highest possible level of compression (xz -9) because even
at this level, decompression time is negligible.  Here's how long it took
to decompress every firmware file my laptop uses:

	i915/kbl_dmc_ver1_04.bin                  	2ms
	regulatory.db                             	4ms
	regulatory.db.p7s                         	3ms
	iwlwifi-7265D-29.ucode                    	62ms
	9d71-GOOGLE-EVEMAX-0-tplg.bin             	22ms
	intel/dsp_fw_kbl.bin                      	65ms
	dsp_lib_dsm_core_spt_release.bin          	6ms
	intel/ibt-hw-37.8.10-fw-22.50.19.14.f.bseq	7ms

And since booting NixOS is a parallel process, it's unlikely (but
difficult to measure) that the time to user interaction was held up at
all by most of these.

Fixes (partially?) #148197
2022-05-13 14:36:34 +00:00
Janne Heß
89ace3967e
nixos/udev: systemd initrd improvements
First, add the builtin udev rules to /etc/udev/rules.d so they are used.
Then, add all networkd .link units to the initrd. This is done in the
old stage 1 as well so I assume this is needed even when networkd is not
used. I assume this is for things like changing the MAC address.

Also limit the number of udev/lib binaries that is put into the initrd
because the old initrd doesn't use all units either.
2022-04-30 14:17:29 +02:00
Lassulus
65cc198539
Merge pull request #167349 from helsinki-systems/feat/udev-systemd-stage-1
nixos/udev: Add systemd stage 1 support
2022-04-12 21:02:52 +01:00
Janne Heß
7024b4e5e3
nixos/udev: Put all initrd options into a namespace 2022-04-12 20:06:13 +01:00
Janne Heß
fb44ecd129
nixos/udev: Add systemd stage 1 support 2022-04-11 19:43:26 +01:00
Alyssa Ross
46a3a7b9a2 nixos/udev: remove rule for kqemu
kqemu was removed from Nixpkgs in 2013 in 181dc4032d ("Remove the old
KQEMU accelerator module"), so it should be safe to drop this rule
now.
2022-04-11 12:17:03 +00:00
Nikolay Amiantov
2b3f77b716 nixos/udev: set firmware path in a separate modprobe.d file
This way we don't bloat ramdisk with the whole Linux firmware packages.
2022-02-04 17:47:32 +03:00
rnhmjoj
8e59a682a5
nixos/udev: add option to install rules in initrd
Note: this moves the example rule used to rename network interfaces in
the new udev.initrdRules option, which is required since 115cdd1c.
2021-02-19 09:26:13 +01:00
Florian Klink
80b0997499 nixos/udev: harmonize extraRules example
Use the same sample as in https://wiki.debian.org/NetworkInterfaceNames,
which includes the `ACTION=="add"` condition.
2020-12-22 11:16:29 +01:00
Graham Christensen
bc49a0815a
utillinux: rename to util-linux 2020-11-24 12:42:06 -05:00
Florian Klink
d64d42e023 nixos/udev: support /run/current-system/systemd in udevRules
https://github.com/NixOS/nixpkgs/pull/88492 flipped some references to
systemctl from config.systemd.package to /run/current-system/systemd/,
which udevRules obviously isn't able resolve.

If we encounter such references, replace them with
config.systemd.package before doing the check.
2020-05-22 14:43:58 +02:00
rnhmjoj
1d61efb7f1 treewide: use attrs instead of list for types.loaOf options 2020-01-06 10:39:18 -05:00
Tom Hall
08d31b74ec udev: fix option description
The two file paths were changed from 10-local to 99-local, but only one
of the descriptions was changed.
2019-12-25 20:51:01 +00:00
Daniel Frank
b40a38fe8a udev: be more verbose about the error 2019-06-21 18:05:14 +02:00
Daniel Frank
f8cf9de7ce udev: change error message if RUN entry is not executable 2019-06-21 11:27:56 +02:00
Andreas Rammhold
1f03f6fc43
nixos/udev: switch networking.usePredicatableInterfaceNames to a kernel param
The udev rules we are shipping no longer work with systemd v242 and were
remove upstream some time ago. It seems like the entire renaming is now
done in C and not in the udev rules.
2019-06-03 15:05:12 +02:00
volth
6d2857a311 [bot] treewide: remove unused 'inherit' in let blocks 2018-07-20 19:38:19 +00:00
Shea Levy
c0e814a434
nixos: udev: Generate hwdb with build-native udevadm. 2018-02-28 15:01:31 -05:00
Nikolay Amiantov
6555ec03c3 udev module: filter duplicate udev paths
Fixes #24174
2017-03-21 20:22:27 +03:00
Nikolay Amiantov
6dbcf7d2e9 udev service: verify that hwdb is generated without errors 2017-01-12 11:11:59 +03:00
Eelco Dolstra
75a1ec8a65 NixOS: Use runCommand instead of mkDerivation in a few places 2016-09-29 13:05:28 +02:00
Nikolay Amiantov
6b41f1132c nixos treewide: don't set MODULE_DIR 2016-08-19 17:56:54 +03:00
Nikolay Amiantov
5ff6e98486 modprobe service: drop kmod wrapper 2016-08-19 17:56:49 +03:00
Shea Levy
9adad8612b Revert "Merge branch 'modprobe-fix' of git://github.com/abbradar/nixpkgs"
Was meant to go into staging, sorry

This reverts commit 57b2d1e9b0, reversing
changes made to 760b2b9048.
2016-08-15 19:05:52 -04:00
Nikolay Amiantov
1f63958772 nixos treewide: don't set MODULE_DIR 2016-08-16 00:19:25 +03:00
Nikolay Amiantov
b2ebecd9e5 modprobe service: drop kmod wrapper 2016-08-16 00:19:25 +03:00
Nikolay Amiantov
cd5dd9f82e udev service: fix packages' paths 2016-05-14 05:12:52 +03:00
Vladimír Čunát
09af15654f Merge master into closure-size
The kde-5 stuff still didn't merge well.
I hand-fixed what I saw, but there may be more problems.
2016-03-08 09:58:19 +01:00