nix-community / disko

Declarative disk partitioning and formatting using nix [maintainers=@Lassulus @Enzime @iFreilicht]
MIT License
1.8k stars 194 forks source link

Add necessary kernel modules to the config #96

Closed domenkozar closed 1 month ago

domenkozar commented 1 year ago

raid, nvme, etc

Mic92 commented 1 year ago

I am not so sure this is possible without a complete kernel module database and all dependencies (that might change between kernel versions). nixos-generate-config does this by looking at what drivers are used by block devices, however I don't think we can do this statically in a maintainable way.

Mic92 commented 1 year ago

Our long-term plan is to have some form of nixos-generate-config that will get this information from the target machine and combine this with profiles i.e. hetzner server in nixos-remote.

Lassulus commented 1 year ago

we can add nvme if those devices are used, probably the same for mmcblk. for some lvm raids we also need kernel modules. those we can set.

Mic92 commented 1 year ago

I think nixos takes also care of loading raid kernel modules already when it's used.

Mic92 commented 1 year ago

For generic images probably the best option is still just using: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/profiles/all-hardware.nix

Lassulus commented 1 year ago

I think nixos takes also care of loading raid kernel modules already when it's used.

not all of them https://github.com/nix-community/disko/blob/master/tests/lvm-raid.nix#L10

phaer commented 1 year ago

I think nixos takes also care of loading raid kernel modules already when it's used.

not all of them https://github.com/nix-community/disko/blob/master/tests/lvm-raid.nix#L10

Shouldn't that be somewhat redundant with https://github.com/nix-community/disko/blob/df3a607ad7ee431f4831a51af2c464aa8a8813f4/types.nix#L926 or am I missing something? (types.nix only explicitly sets it for initrd though)

Lassulus commented 1 year ago

yes, but afair the heuristic is incomplete and we still need to add extra modules

iFreilicht commented 1 month ago

Are there any real-world implications regarding this? I feel like the issue is formulated very generally and not actionable. I'm thinking of closing it in favor of individual reports (which I haven't found yet, but I'm still working my way through the issues).

Enzime commented 1 month ago

Our long-term plan is to have some form of nixos-generate-config that will get this information from the target machine and combine this with profiles i.e. hetzner server in nixos-remote.

This now exists at https://github.com/numtide/nixos-facter

Mic92 commented 1 month ago

Yes. nixos-facter is not fully integrated into nixos-anywhere yet, but eventually it will be.