Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NixOS modules with disko config don't merge #678

Open
jmbaur opened this issue Jun 17, 2024 · 3 comments
Open

NixOS modules with disko config don't merge #678

jmbaur opened this issue Jun 17, 2024 · 3 comments
Labels
bug Something isn't working confirmed Issue has been confirmed/reproduced contributions welcome There's nothing left to discuss, feel free to submit a PR for this!

Comments

@jmbaur
Copy link
Contributor

jmbaur commented Jun 17, 2024

I would expect setting disko config in two different NixOS modules would properly merge together. A minimal reproducer is the config below, where I would expect evaluating it to fail with conflicting definitions for mountpoint, but rather the mountpoint ends up getting set to /boot.

let
  nixpkgs = builtins.getFlake "github:nixos/nixpkgs/nixos-unstable";
  disko = builtins.getFlake "github:nix-community/disko/master";
in
(nixpkgs.lib.nixosSystem {
  modules = [
    disko.nixosModules.default
    { nixpkgs.hostPlatform = "x86_64-linux"; }
    {
      disko.devices.disk.disk0 = {
        device = "/dev/foobar";
        type = "disk";
        content = {
          type = "gpt";
          partitions.foo = {
            type = "EF00";
            content = {
              type = "filesystem";
              format = "vfat";
              mountpoint = "/boot";
            };
          };
        };
      };
    }
    {
      disko.devices.disk.disk0 = {
        type = "disk";
        content = {
          type = "gpt";
          partitions.foo = {
            type = "EF00";
            content = {
              type = "filesystem";
              mountpoint = null;
            };
          };
        };
      };
    }
  ];
}).config.disko.devices.disk.disk0.content.partitions.foo.content.mountpoint
@Lassulus
Copy link
Collaborator

but you have conflicting definitions? not sure whats the error here? what should happen otherwise?

@jmbaur
Copy link
Contributor Author

jmbaur commented Jun 17, 2024

That's the thing, I would expect that evaluating the above expression would error out due to the fact that there are conflicting definitions, but it does not.

Result from evaluation (where test.nix contains the contents as posted above):

~ > nix eval -f test.nix
"/boot"

@jmbaur
Copy link
Contributor Author

jmbaur commented Jun 17, 2024

Seems related: NixOS/nixpkgs#254790 (comment)

@iFreilicht iFreilicht added bug Something isn't working contributions welcome There's nothing left to discuss, feel free to submit a PR for this! confirmed Issue has been confirmed/reproduced labels Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed Issue has been confirmed/reproduced contributions welcome There's nothing left to discuss, feel free to submit a PR for this!
Projects
None yet
Development

No branches or pull requests

3 participants