Skip to content

Why is settings.x.custom expected to be unique? #428

@bglgwyng

Description

@bglgwyng

I have a haskell-flake module whose output is imported from multiple haksell-flake module, and they form a diamond.

It includes settings.hmatrix-gsl.custom config like,

{
  settings = {
    hmatrix-gsl = ({ super, ... }: {
      custom = _: super.hmatrix-gsl.override {
        gsl = pkgs.symlinkJoin {
          name = pkgs.gsl.name;
          paths = [ pkgs.gsl.out pkgs.gsl.dev ];
          buildInputs = [ pkgs.patchelf ];
          postBuild = ''
            cd $out/lib
            mv libgsl.so .libgsl.so
            patchelf --add-rpath ${pkgs.gsl}/lib \
                     --add-needed libgslcblas.so \
                     --output libgsl.so \
                     .libgsl.so

          '';
        };
      };
    });
  };
}

When the configuration of the module placed at the bottom of the diamond is evaluated, the following error occurs.

error: The option `custom.<function body>' is defined multiple times while it's expected to be unique.

Definition values:
  - In `/nix/store/sqa8r0w39lrzmcbpffzg1zniiy5ir06g-source/flake.nix, via option perSystem, via option perSystem.x86_64-linux.haskellProjects.default.settings.hmatrix-gsl': <derivation hmatrix-gsl-0.19.0.1>
  - In `/nix/store/sqa8r0w39lrzmcbpffzg1zniiy5ir06g-source/flake.nix, via option perSystem, via option perSystem.x86_64-linux.haskellProjects.default.settings.hmatrix-gsl': <derivation hmatrix-gsl-0.19.0.1>

I don't understand why this error occurs.
custom option's type is types.functionTo types.package and it allows multiple configurations and can merge them when the result of the function is equal, as far as I know. Do we have an extra unique constraint in the other part of the source code? Or am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions