nixos/zfs: install zfs udev rules on stage1

Install zfs udev rules on initrd, so that /dev/zvol gets populated.
This commit is contained in:
Luís Fonseca 2024-04-08 01:14:26 +01:00
parent c5707d8602
commit 38b68216a5
No known key found for this signature in database

View file

@ -576,6 +576,8 @@ in
copy_bin_and_libs ${cfgZfs.package}/sbin/zfs
copy_bin_and_libs ${cfgZfs.package}/sbin/zdb
copy_bin_and_libs ${cfgZfs.package}/sbin/zpool
copy_bin_and_libs ${cfgZfs.package}/lib/udev/vdev_id
copy_bin_and_libs ${cfgZfs.package}/lib/udev/zvol_id
'';
extraUtilsCommandsTest =
mkIf (!config.boot.initrd.systemd.enable) ''
@ -632,7 +634,12 @@ in
zfs = "${cfgZfs.package}/sbin/zfs";
awk = "${pkgs.gawk}/bin/awk";
};
storePaths = [
"${cfgZfs.package}/lib/udev/vdev_id"
"${cfgZfs.package}/lib/udev/zvol_id"
];
};
services.udev.packages = [cfgZfs.package]; # to hook zvol naming, in stage 1
};
systemd.shutdownRamfs.contents."/etc/systemd/system-shutdown/zpool".source = pkgs.writeShellScript "zpool-sync-shutdown" ''