Skip to content

allow subtype definitions to be broken up#1094

Merged
Lassulus merged 1 commit intonix-community:masterfrom
hgl:subtype
Jul 21, 2025
Merged

allow subtype definitions to be broken up#1094
Lassulus merged 1 commit intonix-community:masterfrom
hgl:subtype

Conversation

@hgl
Copy link
Copy Markdown
Contributor

@hgl hgl commented Jul 19, 2025

Currently subtype suffers from a few issues:

  1. If the definition is broken up, it mistakenly thinks a partial definition is invalid.
  2. Only the last partial definition is used.

This PR addresses them.

@Lassulus
Copy link
Copy Markdown
Collaborator

this looks pretty good, can we add a test that shows that we can split it up now? :)

@Enzime
Copy link
Copy Markdown
Member

Enzime commented Jul 19, 2025

Not sure if this is going to be very heavy because it uses evalModules as part of the merge function

@Lassulus
Copy link
Copy Markdown
Collaborator

hmm, the test framework is really too opinionated to test this. I don't think computation will be heavy with this, since the evalModules should be fast with the few options available. So I'm gonna merge this for now and try to integrate it into the nixpkgs PR at a later point.

Thanks a lot!

@Lassulus Lassulus added this pull request to the merge queue Jul 21, 2025
Merged via the queue into nix-community:master with commit 3db2f04 Jul 21, 2025
2 checks passed
@Enzime
Copy link
Copy Markdown
Member

Enzime commented Jul 22, 2025

Just tested this and it works well 👍 Thanks

One example using this PR is for having a different FDE password for your VM:

{
  virtualisation.vmVariantWithDisko = {
    disko.devices.disk.primary.content.partitions.luks.content.passwordFile =
      lib.mkForce (toString (pkgs.writeText "password" "apple"));
  };
}

@Enzime
Copy link
Copy Markdown
Member

Enzime commented Jul 22, 2025

This PR allows us to finish #480 which I think should refactor makeDiskoTest to instead use evalModules and be brought in line with the virtualisation.vmVariantWithDisko interface

Enzime pushed a commit to Enzime/disko that referenced this pull request Jan 2, 2026
When extendModules is provided (from module.nix), use it to merge
extraSystemConfig with the base configuration BEFORE running
prepareDiskoConfig. This allows users to override disko settings
(partition sizes, LUKS keys, etc.) via disko.tests.extraConfig using
the proper NixOS module system rather than manual attribute merging.

The key change is that test-specific disko overrides are now merged
before device path transformation, so the overrides are included
when prepareDiskoConfig maps devices to QEMU virtio paths.

This makes PR nix-community#480 obsolete by using extendModules (enabled by PR nix-community#1094's
evalModules support for disko subtypes) instead of lib.recursiveUpdate.
Enzime pushed a commit to Enzime/disko that referenced this pull request Jan 2, 2026
When extendModules is provided (from module.nix), use it to merge
extraSystemConfig with the base configuration BEFORE running
prepareDiskoConfig. This allows users to override disko settings
(partition sizes, LUKS keys, etc.) via disko.tests.extraConfig using
the proper NixOS module system rather than manual attribute merging.

The key change is that test-specific disko overrides are now merged
before device path transformation, so the overrides are included
when prepareDiskoConfig maps devices to QEMU virtio paths.

This makes PR nix-community#480 obsolete by using extendModules (enabled by PR nix-community#1094's
evalModules support for disko subtypes) instead of lib.recursiveUpdate.
Enzime pushed a commit to Enzime/disko that referenced this pull request Jan 2, 2026
When extendModules is provided (from module.nix), use it to merge
extraSystemConfig with the base configuration BEFORE running
prepareDiskoConfig. This allows users to override disko settings
(partition sizes, LUKS keys, etc.) via disko.tests.extraConfig using
the proper NixOS module system rather than manual attribute merging.

The key change is that test-specific disko overrides are now merged
before device path transformation, so the overrides are included
when prepareDiskoConfig maps devices to QEMU virtio paths.

This makes PR nix-community#480 obsolete by using extendModules (enabled by PR nix-community#1094's
evalModules support for disko subtypes) instead of lib.recursiveUpdate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants