[Nix-dev] [nix-dev] private NixOS modules

Rok Garbas rok at garbas.si
Thu Nov 19 13:35:01 CET 2015


i think musnix is a nice example how to do this:

    https://github.com/musnix/musnix


Quoting Sergey Mironov (2015-11-18 10:45:54)
> Oh, Thanks. I really should re-read the manual :)
> 
> Sergey
> 
> 2015-11-18 12:16 GMT+03:00 Nicolas Pierron <nicolas.b.pierron at gmail.com>:
> > Hi Sergey,
> >
> > We have a some documenation in the NixOS Manual [1] which explains how
> > to do that.  To make it short, your configuration.nix file should have
> > an import attribute which is a list of additional modules that you
> > want to include.
> > So if you file configuration.nix looks something like (a), you want to
> > convert it to something similar to (b)
> >
> > ** (a):
> > {
> >   services.openssh.enable = true = …;
> >   …
> > }
> >
> > ** (b):
> >
> > {
> >   imports = [ ./custom-service.nix ];
> >   services.openssh.enable = true = …;
> >   …
> > }
> >
> > [1] http://nixos.org/nixos/manual/index.html#sec-modularity
> >
> > On Wed, Nov 18, 2015 at 8:14 AM, Sergey Mironov <grrwlf at gmail.com> wrote:
> >> Nicolas, I didn't know about NIXOS_EXTRA_MODULE_PATH, thanks.
> >> Could you explain other possible solution in a bit more details? How
> >> can we include modified module list in configuration.nix?
> >>
> >> Regards,
> >> Sergey
> >>
> >> 2015-11-17 17:43 GMT+03:00 Nicolas Pierron <nicolas.b.pierron at gmail.com>:
> >>> Hi Sergey,
> >>>
> >>> I think you can set the NIXOS_EXTRA_MODULE_PATH [1] environment
> >>> variable to achieve that.
> >>> Otherwise, you can change your configuration.nix file to always
> >>> include your new module list, and to include your own real-config.nix
> >>>
> >>> [1] https://github.com/NixOS/nixpkgs/blob/master/nixos/lib/eval-config.nix#L30
> >>>
> >>>
> >>> On Tue, Nov 17, 2015 at 2:04 PM, Sergey Mironov <grrwlf at gmail.com> wrote:
> >>>> Hi. I'd like to write a couple of NixOS modules which probably don't
> >>>> look meaningful for large audience. Normally, we keep modules in
> >>>> nixpkgs/nixos/modules directory and list them in module-list.nix file.
> >>>> In my case, I'd like to put module in a private place (which is my git
> >>>> repo which keeps nixpkgs as a Git submodule). Is it possible to
> >>>> 'include' them in the public list to make them accessible from
> >>>> per-system.nix files?
> >>>>
> >>>> As a result, I'd like to be able to write in configuration.nix
> >>>> something like the following:
> >>>>
> >>>> services.my-custom-service = {
> >>>>   enable = true;
> >>>>   ...
> >>>> }
> >>>>
> >>>> without including expression for my-custom-service in the public tree.
> >>>>
> >>>> Regards,
> >>>> Sergey
> >>>> _______________________________________________
> >>>> 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/
> >
> >
> >
> > --
> > Nicolas Pierron
> > http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev


--
Rok Garbas - http://www.garbas.si
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: signature
Url : http://lists.science.uu.nl/pipermail/nix-dev/attachments/20151119/dc4316c8/attachment.bin 


More information about the nix-dev mailing list