[Nix-dev] NixOS modules: restrict the values of a `types.listOf x`

Eric Sagnes eric.sagnes at gmail.com
Fri Jan 22 05:31:37 CET 2016


Hi,

I would like to force an option of type `types.listOf packages` to allow only a certain list of packages.
Something like `types.someOf packages [ pkgs.pluginA pkgs.pluginB pkgs.pluginC ]`.

So that if a user set `myModule.plugins = [ pkgs.pluginA pkgs.firefox ]`, it gives an error like 
"Invalid value `pkgs.firefox` for `myModule.plugins. Values should be some of [ pkgs.pluginA pkgs.pluginB pkgs.pluginC ]";

Is there a way to achieve this?

-- 
Eric Sagnes
サニエ エリック


More information about the nix-dev mailing list