mirror of
https://github.com/nix-community/disko.git
synced 2026-11-30 13:03:28 +01:00
`prepareDiskoConfig` strips disko's `_`-prefixed internal attrs (`_config`, `_meta`, `_create`, `_mount`, `_unmount`, `_pkgs`) — every disko submodule declares these as `internal = true; readOnly = true` with computed defaults. The function then reassigns the cleaned value to `disko.devices` on a fresh module eval; if any `_*` attrs leak through, the node eval's readOnly defaults collide with the carried-through values and the merge errors. The original implementation used `lib.filterAttrsRecursive` which only descends into attrsets, not list elements. The legacy `partitions = [ … ]` list (the disko `table` content type) therefore kept its `_config` per entry — the well-known "set multiple times" error called out in `lib/types/table.nix`'s deprecation warning. Replace it with a small `deepStripUnderscore` helper that descends into both attrsets and lists. Adds a TODO: this whole-tree rewrite becomes unnecessary once test-time substitution moves to per-leaf `disko.devices.disk.<name>.device = lib.mkForce …;` overrides on the existing module-system value (rather than reassigning the whole `disko.devices` value), which is the natural evolution of the disko.test refactor.