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

2016-01-22 Thread aszlig
On Fri, Jan 22, 2016 at 01:31:37PM +0900, Eric Sagnes wrote: > 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

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

2016-01-22 Thread Игорь Пашев
Use enum and pkgs.${foo} ? 22 янв. 2016 г. 7:31 пользователь "Eric Sagnes" написал: > 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 >

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

2016-01-21 Thread Eric Sagnes
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

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

2016-01-21 Thread Eric Sagnes
Following the previous email, As I found nothing doing that in lib.types, I played a little with nix-repl and made a PR adding this functionality https://github.com/NixOS/nixpkgs/pull/12534 It was the first time I seriously used nix-repl and it is really nice. Thanks for making a such useful