[prev in list] [next in list] [prev in thread] [next in thread]
List: nix-dev
Subject: Re: [Nix-dev] NixOS modules: restrict the values of a `types.listOf x`
From: Иг <pashev.igor () gmail ! com>
Date: 2016-01-23 6:12:30
Message-ID: CALL-Q8zWZn+O1yLcj99XsDPzZ_apuq+A5P27zxEJaU4uh0Fa8Q () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Use enum and pkgs.${foo} ?
22 янв. 2016 г. 7:31 пользователь "Eric Sagnes" <eric.sagnes@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@lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
[Attachment #5 (text/html)]
<p dir="ltr">Use enum and pkgs.${foo} ?</p>
<div class="gmail_quote">22 янв. 2016 г. 7:31 пользователь "Eric \
Sagnes" <<a href="mailto:eric.sagnes@gmail.com">eric.sagnes@gmail.com</a>> \
написал:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 \
0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br> <br>
I would like to force an option of type `types.listOf packages` to allow only a \
certain list of packages.<br> Something like `types.someOf packages [ pkgs.pluginA \
pkgs.pluginB pkgs.pluginC ]`.<br> <br>
So that if a user set `myModule.plugins = [ pkgs.pluginA pkgs.firefox ]`, it gives an \
error like<br> "Invalid value `pkgs.firefox` for `myModule.plugins. Values \
should be some of [ pkgs.pluginA pkgs.pluginB pkgs.pluginC ]";<br> <br>
Is there a way to achieve this?<br>
<br>
--<br>
Eric Sagnes<br>
サニエ エリック<br>
_______________________________________________<br>
nix-dev mailing list<br>
<a href="mailto:nix-dev@lists.science.uu.nl">nix-dev@lists.science.uu.nl</a><br>
<a href="http://lists.science.uu.nl/mailman/listinfo/nix-dev" rel="noreferrer" \
target="_blank">http://lists.science.uu.nl/mailman/listinfo/nix-dev</a><br> \
</blockquote></div>
_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic