Skip to content

tests/plotinus, or NixOS environment variables can not be merged #122244

@roberth

Description

@roberth

Describe the bug

nix-build -A nixosTests.plotinus

The unique option `environment.variables.XDG_DATA_DIRS' is defined multiple times. Definition values:
- In `/home/user/h/nixpkgs/nixos/modules/programs/plotinus.nix':
    [
      "/nix/store/ak6k93ba1vngvf4yjw7rsa3an9s0w4if-plotinus-0.2.0/share/gsettings-schemas/plotinus-0.2.0"
    ]
- In `/home/user/h/nixpkgs/nixos/modules/config/shells-environment.nix': "/nix/store/s1635zhdyz4ysmwncrkdnp6n7n1in3ml-desktops/share"

environment.variables can not be merged when multiple definitions of type str are defined. It does work when all definitions are list, although merging may not be appropriate.

To Reproduce
Steps to reproduce the behavior:

  1. nix-build -A nixosTests.plotinus

Expected behavior

A merge, as is appropriate for XDG_DATA_DIRS, using :

Additional context

Environment variables could be modeled RFC42-style. This allows accurate merging of variables where merging makes sense. It would disallow merging where it is not know to make sense. Merging variables that don't join by : would be possible.
This type could be exposed to all of NixOS (not just environment.variables, but environments in systemd as well, for example). They could even be used outside NixOS; for example in arion, nix-processmgt, etc.

Notify maintainers

Metadata
Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: module systemAbout "NixOS" module system internals6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions