diff --git a/lib/make-disk-image.nix b/lib/make-disk-image.nix index 11e7f5a..33f68bb 100644 --- a/lib/make-disk-image.nix +++ b/lib/make-disk-image.nix @@ -44,6 +44,7 @@ let ${pkgs.systemdMinimal}/lib/systemd/systemd-udevd --daemon udevadm trigger --action=add udevadm settle + partprobe # populate nix db, so nixos-install doesn't complain export NIX_STATE_DIR=$TMPDIR/state diff --git a/lib/types/gpt.nix b/lib/types/gpt.nix index ec2a55f..d7cc373 100644 --- a/lib/types/gpt.nix +++ b/lib/types/gpt.nix @@ -107,6 +107,7 @@ in # ensure /dev/disk/by-path/..-partN exists before continuing udevadm trigger --subsystem-match=block udevadm settle + partprobe ${lib.optionalString (partition.content != null) partition.content._create} '') sortedPartitions)} diff --git a/lib/types/mdadm.nix b/lib/types/mdadm.nix index bfef542..47eb272 100644 --- a/lib/types/mdadm.nix +++ b/lib/types/mdadm.nix @@ -44,6 +44,7 @@ "''${disk_devices[@]}" udevadm trigger --subsystem-match=block udevadm settle + partprobe # for some reason mdadm devices spawn with an existing partition table, so we need to wipe it sgdisk --zap-all /dev/md/${config.name} ${lib.optionalString (config.content != null) config.content._create} diff --git a/lib/types/table.nix b/lib/types/table.nix index bc492aa..7d99011 100644 --- a/lib/types/table.nix +++ b/lib/types/table.nix @@ -93,6 +93,7 @@ # ensure /dev/disk/by-path/..-partN exists before continuing udevadm trigger --subsystem-match=block udevadm settle + partprobe ${lib.optionalString partition.bootable '' parted -s ${config.device} -- set ${toString partition._index} boot on ''} @@ -102,6 +103,7 @@ # ensure further operations can detect new partitions udevadm trigger --subsystem-match=block udevadm settle + partprobe ${lib.optionalString (partition.content != null) partition.content._create} '') config.partitions)} ''; diff --git a/lib/types/zfs_volume.nix b/lib/types/zfs_volume.nix index 51f5aef..6cedd10 100644 --- a/lib/types/zfs_volume.nix +++ b/lib/types/zfs_volume.nix @@ -52,6 +52,7 @@ -V ${config.size} udevadm trigger --subsystem-match=block udevadm settle + partprobe ${lib.optionalString (config.content != null) config.content._create} ''; };