nixos-facter-modules
nixos-facter-modules copied to clipboard
Difference in kernel modules from `nixos-generate-config` and `facter`
Describe the bug
Hi! Thanks for this cool new way of defining hardware config. I am not sure, but I think I ran into a bug.
I am not using nixos-hardware on my machine (as my laptop not defined in there), and using facter I observed changes in my available kernel modules.
In short, the following kernel modules did not appear when using facter instead of the generated hardware-configuration.nix:
> "usb_storage"
> "sd_mod"
Hardware config
nix hardware scan config:
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [
"xhci_pci"
"thunderbolt"
"nvme"
"usb_storage" # < -- missing in facter
"sd_mod" # < -- missing in facter
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/...";
fsType = "ext4";
};
boot.initrd.luks.devices."luks-..".device = "/dev/disk/by-uuid/...";
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/...";
fsType = "vfat";
};
swapDevices = [ ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
generates the following kernel modules:
nixosConfigurations.<< host >>.config.boot.kernelModules
[
"kvm-intel"
"bridge"
"macvlan"
"tap"
"tun"
"tun"
"loop"
"atkbd"
"ctr"
"msr"
]
nixosConfigurations.nolte.config.boot.initrd.availableKernelModules
[
"xhci_pci"
"thunderbolt"
"nvme"
"usb_storage"
"sd_mod"
"ext2"
"ext4"
"dm_mod"
"dm_crypt"
"cryptd"
"input_leds"
"aes"
"aes_generic"
"blowfish"
"twofish"
"serpent"
"cbc"
"xts"
"lrw"
"sha1"
"sha256"
"sha512"
"af_alg"
"algif_skcipher"
"ecb"
"ahci"
"sata_nv"
"sata_via"
"sata_sis"
"sata_uli"
"ata_piix"
"pata_marvell"
"nvme"
"sd_mod"
"sr_mod"
"mmc_block"
"uhci_hcd"
"ehci_hcd"
"ehci_pci"
"ohci_hcd"
"ohci_pci"
"xhci_hcd"
"xhci_pci"
"usbhid"
"hid_generic"
"hid_lenovo"
"hid_apple"
"hid_roccat"
"hid_logitech_hidpp"
"hid_logitech_dj"
"hid_microsoft"
"hid_cherry"
"hid_corsair"
"pcips2"
"atkbd"
"i8042"
"rtc_cmos"
]
Using facter
With the following relevant config:
...
modules = [
inputs.nixos-facter-modules.nixosModules.facter
# configure the facter report
{ config.facter.reportPath = "${self}/inventory/${systemAttrs.hostname}/facter.json"; }
]
...
I observed the following diff:
Version changes:
[C.] nix-community/nixos-facter#1 udev-rules <none> x2 -> <none>
Removed packages:
[R.] nix-community/nixos-facter#1 extra-utils <none>
[R.] nix-community/nixos-facter#2 initrd-fsinfo <none>
[R.] nix-community/nixos-facter#3 keymap <none>
[R.] nix-community/nixos-facter#4 link-units <none>
[R.] nix-community/nixos-facter#5 stage 1-init.sh
Closure size: 2605 -> 2599 (14 paths added, 20 paths removed, delta -6, disk usage -15.5MiB).
nix-repl> nixosConfigurations.nolte.config.boot.kernelModules
[
"kvm-intel"
"bridge"
"macvlan"
"tap"
"tun"
"tun"
"loop"
"atkbd"
"ctr"
"msr"
]
nixosConfigurations.nolte.config.boot.initrd.availableKernelModules
[
"thunderbolt"
"xhci_pci"
"nvme"
"ext2"
"ext4"
"dm_mod"
"dm_crypt"
"cryptd"
"input_leds"
"aes"
"aes_generic"
"blowfish"
"twofish"
"serpent"
"cbc"
"xts"
"lrw"
"sha1"
"sha256"
"sha512"
"af_alg"
"algif_skcipher"
"ecb"
"ahci"
"sata_nv"
"sata_via"
"sata_sis"
"sata_uli"
"ata_piix"
"pata_marvell"
"nvme"
"sd_mod"
"sr_mod"
"mmc_block"
"uhci_hcd"
"ehci_hcd"
"ehci_pci"
"ohci_hcd"
"ohci_pci"
"xhci_hcd"
"xhci_pci"
"usbhid"
"hid_generic"
"hid_lenovo"
"hid_apple"
"hid_roccat"
"hid_logitech_hidpp"
"hid_logitech_dj"
"hid_microsoft"
"hid_cherry"
"hid_corsair"
"pcips2"
"atkbd"
"i8042"
"rtc_cmos"
]
If I am correct, the facter hardware scan does not include the following 'extra' nixosConfigurations.<< host >>.config.boot.initrd.availableKernelModules, which appear when using hardware-configuration.nix:
> "usb_storage"
> "sd_mod"
Expected behavior
I expect the kernel modules to remain the same, as with hardware-configuration.nix. It might have to do with kernel modules which are generated on initial install via a USB stick, as when I re-generate the config these kernel modules seem to match the ones generated by facter, the missing kernel modules might indeed then be superfluous. I wonder whether this is expected behaviour. Regenerating it generates the following relevant config:
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" ];
System information
HP HP ZBook Firefly 14 inch G10 Mobile Workstation PC
Linux ... 6.6.56 nix-community/nixos-facter#1-NixOS SMP PREEMPT_DYNAMIC Thu Oct 10 10:50:06 UTC 2024 x86_64 GNU/Linux
And I am running NixOS unstable. I can share the full report if you want, but I am not sure whether that is relevant.
Hi, thanks for the detailed feedback. I will have a look in the next few days.
@pimvh, it's been longer than I expected, but I can finally look at this.
Please re-run with the latest and greatest, and let me know if the kernel modules are still missing.