disko
disko copied to clipboard
NixOS modules with disko config don't merge
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
but you have conflicting definitions? not sure whats the error here? what should happen otherwise?
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"
Seems related: https://github.com/NixOS/nixpkgs/pull/254790#discussion_r1358073458
Ah this should be fixed now
Fixed by #1094