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

Игорь Пашев pashev.igor at gmail.com
Sat Jan 23 07:12:30 CET 2016


Use enum and pkgs.${foo} ?
22 янв. 2016 г. 7:31 пользователь "Eric Sagnes" <eric.sagnes at gmail.com>
написал:

> 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
> サニエ エリック
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160123/33f6ed46/attachment.html 


More information about the nix-dev mailing list