[Nix-dev] nixops - nix-channel per machine

Nicolas Pierron nicolas.b.pierron at gmail.com
Mon Jul 27 19:39:26 CEST 2015


The problem of using the `_module.args.pkgs` is that you have the
NixOS module system of the nix-channel, but the package resolution of
the version that you specified.  The error that you are seeing is that
the latest module might use a package which got packaged/renamed
recently.

Strangely `pkgs.ipset` does not seems to be used, apart from being
listed as an non-literal example (which is a bug) [1].
One option would be for you to make a dummy derivation for ipset, or
use the one from the latest nixpkgs.

[1] https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/networking/firewall.nix#L425


On Mon, Jul 27, 2015 at 1:50 PM, Tomas Hlavaty
<tomas.hlavaty at knowledgetools.de> wrote:
> I got the _module.args.pkgs to (almost) work but I think it somehow
> mixes up the two nixpkgs versions (running on unstable, overriding
> _module.args.pkgs to stable):
>
>    error: attribute ‘ipset’ missing, at
>    /nix/store/fdv2bhnjgdanr87wjqa7rbbm5gf6k4hr-nixos-15.06pre65267.6ad8fab/nixos/nixpkgs/nixos/modules/services/networking/firewall.nix:446:50
>
> Tomas
>
> Tomas Hlavaty <tomas.hlavaty at knowledgetools.de> writes:
>
>> Hi Rob & Nicolas,
>>
>> thank you for your suggestions.
>>
>> The option -I nixpkgs=/path/to/your/nixpkgs sets the nixpkgs "globally"
>> for nixops.  That is not what I need.
>>
>> I have tried using nixops set-attrs, but that is also doesn't allow me
>> to use stable for one machine and unstable for the other.
>>
>> Maybe this could work if I created two separate networks depending on
>> nixpks.  But this is not a nice workaround.
>>
>> It looks like the module suggestion might be what I need but that gives
>> me an error:
>>
>>    error: Module `foo/configuration.nix' has an unsupported attribute
>>    `boot'. This is caused by assignments to the top-level attributes
>>    `config' or `options'.  (use ‘--show-trace’ to show detailed location
>>    information) error: evaluation of the deployment specification failed
>>
>> It seems that I am not allowed to change that.  Moreover, it doesn't
>> seem to be the same as specifying a different nixos-channel.
>>
>> What I need is something like:
>>
>> test-logical.nix:
>>
>> {
>>   network.description = "test network";
>>   foo = with-stable-channel ./foo/configuration.nix;
>>   bar = with-unstable-channel ./bar/configuration.nix;
>> }
>>
>> Is there a way to achieve that?
>>
>> Thanks a lot!
>>
>> Tomas
>>
>> Nicolas Pierron <nicolas.b.pierron at gmail.com> writes:
>>
>>> Otherwise, if you are using the latest master of NixOS, then you
>>> should be able to define which set of packages you are interested in
>>> within the module system, while using the modules from the latest
>>> NixOS.
>>>
>>> { config, lib, ... }:
>>>
>>> {
>>>   config = {
>>>     _module.args.pkgs = lib.mkForce (import <my-nixpkgs> {
>>>       inherit (config.nixpkgs) system config;
>>>     });
>>>   };
>>> }
>>>
>>>
>>> On Fri, Jul 24, 2015 at 5:56 PM, Rob Vermaas <rob.vermaas at gmail.com> wrote:
>>>> Hi Tomas,
>>>>
>>>> you can use -I nixpkgs=/path/to/your/nixpkgs when using nixops. You
>>>> can also make it persistent using 'nixops create/modify', the nix path
>>>> will be stored in the nixops database, and you can inspect it with
>>>> 'nixops info'.
>>>>
>>>> Cheers,
>>>> Rob
>>>>
>>>> On Fri, Jul 24, 2015 at 3:10 PM, Tomas Hlavaty
>>>> <tomas.hlavaty at knowledgetools.de> wrote:
>>>>> Hi,
>>>>>
>>>>> in nixops, how can i specify a nix-channel per machine?  Or any other
>>>>> way to have different machines running different versions of nixos?
>>>>>
>>>>> Thank you,
>>>>>
>>>>> Tomas
>>>>> _______________________________________________
>>>>> nix-dev mailing list
>>>>> nix-dev at lists.science.uu.nl
>>>>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>>>
>>>>
>>>>
>>>> --
>>>> Rob Vermaas
>>>>
>>>> [email] rob.vermaas at gmail.com
>>>> _______________________________________________
>>>> nix-dev mailing list
>>>> nix-dev at lists.science.uu.nl
>>>> http://lists.science.uu.nl/mailman/listinfo/nix-dev



-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/


More information about the nix-dev mailing list