Skip to content

parametric owned modules conflicting value must be set once. #101

@vic

Description

@vic

It seems that when using parametric, the owned modules are set twice, causing conflicts with options that can only be applied once:

eg:

  den.aspects.wayland._.cosmic = den.lib.parametric {
    includes = [ den.aspects.wayland._.base ];
    homeManager =
      { pkgs, lib, ... }:
      {
        gtk.iconTheme = {
          name = lib.mkForce "Cosmic";
          package = lib.mkForce pkgs.cosmic-icons;
        };
      };
};

Error:

nix-repl> nixosConfigurations.hades.config.home-manager.users.quasi.gtk.iconTheme
{
  name = "Cosmic";
  package = «error: The option `home-manager.users.quasi.gtk.iconTheme.package' is defined multiple times while it's expected to be unique.

Definition values:
- In `<unknown-file>, via option den.aspects.wayland.provides.cosmic.<function body>.includes."[definition 1-entry 2]".<function body>.homeManager': <derivation cosmic-icons-1.0.0-beta.5>
- In `<unknown-file>, via option den.aspects.wayland.provides.cosmic.<function body>.includes."[definition 1-entry 2]".<function body>.homeManager': <derivation cosmic-icons-1.0.0-beta.5>
Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.
»;
}

I found that moving the homeManager config to the includes fixed this:

  den.aspects.wayland._.cosmic = den.lib.parametric {
    includes = [
      den.aspects.wayland._.base
      (
        { host, ... }:
        {
          homeManager =
            { pkgs, lib, ... }:
            {
              xdg.configFile = {
                # using cosmics automatic gtk theming
                "gtk-4.0/assets".enable = false;
                "gtk-4.0/gtk.css".enable = false;
                "gtk-4.0/gtk-dark.css".enable = false;
              };
              gtk.iconTheme = {
                name = lib.mkForce "Cosmic";
                package = lib.mkForce pkgs.cosmic-icons;
              };
            };
        }
      )
    ];
};

I wanted to see if there was a better solution.

Originally posted by @michaelBelsanti in #99

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