Nixpkgs: Deprecate `loaOf`

Created on 20 Feb 2014  路  10Comments  路  Source: NixOS/nixpkgs

types.loaOf only exists for backwards compatibility, and it's kind of a hack and doesn't merge well. We should fix all modules that set a list instead of an attribute set in nixpkgs, then once that's done add a trace message when a config is encountered that uses a list instead of a set.

enhancement

Most helpful comment

All 10 comments

Usages:
As type = types.loaOf types.optionSet:

nixos/modules/config/users-groups.nix: users.users, users.groups
nixos/modules/security/pam.nix: security.pam.services
nixos/modules/services/logging/logcheck.nix: ignore, ignoreCron
nixos/modules/services/networking/i2pd.nix: outTunnels, inTunnels
nixos/modules/services/networking/prosody.nix: virtualHosts
nixos/modules/services/networking/tinc.nix: networks
nixos/modules/services/web-servers/zope2.nix: services.zope2.instances
nixos/modules/system/etc/etc.nix: environment.etc
nixos/modules/system/upstart/upstart.nix: jobs
nixos/modules/tasks/filesystems.nix: fileSystems
nixos/modules/tasks/network-interfaces.nix: networking.interfaces
nixos/modules/virtualisation/containers.nix: bindMounts

Others:

nixos/modules/programs/ssh.nix: knownHosts
nixos/modules/services/networking/tinc.nix: hosts

Is it still relevant?

The file systems and users/groups are used in a lot of places in NixOS. It would be a lot of work to change them, but possible. Personally I like having the list / attribute set choice, and now we have loeOf as well, and maybe a loaoeOf is in the future.

I still wonder what @shlevy meant by "doesn't merge well", as that seems to be the key point.

I still wonder what @shlevy meant by "doesn't merge well", as that seems to be the key point.

The problem is that you cannot make list element modular. Using list in NixOS breaks the modularity.

This issue is still valid.

I still wonder what @shlevy meant by "doesn't merge well", as that seems to be the key point.

Uniqueness of names can be nicely enforced by the set too.

What would replace this type?

attrsOf

I have made PR #63103 that should safely deprecate loaOf but I need help with testing.
I'm trying to get attention and hopefully speeding this up because maintaining the branch up-to-date is getting complicated as time goes on.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tomberek picture tomberek  路  3Comments

domenkozar picture domenkozar  路  3Comments

edolstra picture edolstra  路  3Comments

lverns picture lverns  路  3Comments

matthiasbeyer picture matthiasbeyer  路  3Comments