Skip to content

Conflicting option definitions when adding an option to zpool datasets #1110

@sylvorg

Description

@sylvorg

Hello!

I'm trying to add a snapshot option to the zpool datasets, but can't because of a conflicting option definition:

error: The option `disko.devices.zpool.behemoth.datasets' in `/nix/store/27fy4ihy16233z2ipadgivvq2zkl69nn-source/common' is already declared in `/nix/store/0gqwnbivnyh3maw495r22l6k6d8bl9hd-source/lib/types/zpool.nix'.

Here's the entire option config:

{
  config,
  lib,
  ...
}:
{
  options.disko.devices.zpool =
    with lib;
    mkOption {
      type =
        with types;
        attrsOf (
          submodule (
            { name, config, ... }:
            {
              options.datasets = mkOption {
                type = attrsOf (
                  submodule (
                    {
                      name,
                      config,
                      options,
                      diskoLib,
                      ...
                    }:
                    {
                      options = {
                        snapshot = mkOption {
                          type = types.nullOr types.str;
                          default = null;
                          description = "The blank snapshot";
                        };
                        _create = diskoLib.mkCreateOption {
                          inherit config options;
                          default = ''
                            ${options._create.default}
                            ${optionalString (config.snapshot != null) ''
                              zfs snapshot ${config._name}@${config.snapshot}
                              zfs hold blank ${config._name}@${config.snapshot}
                            ''}
                          '';
                        };
                      };
                    }
                  )
                );
              };
            }
          )
        );
    };
}

I was under the assumption that the options would be merged automatically.

Any help would be greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions