2

Can I run NixOS in an LXC container?

To run debian on top of debian, one would use

LANG=C SUITE=jessie MIRROR=http://httpredir.debian.org/debian lxc-create -n debian8 -t debian

What should one do if he wants to run nixos on top of debian?

  • I'd have the ask why you would want to do that. The point behind the debian thing is that your app my use some libraries/commands that are debian-specific. Other than that it's just a generic GNU/Linux image. NixOS is already pretty niche so it's hard to imagine you really need it to run in a container. – Bratchley May 27 '16 at 0:43
  • @Bratchley I want a "normal" host with a minimal easy to replace guest – Charles Shiller May 27 '16 at 3:59
  • I don't think Debian ships with predefined lxc-create templates for NixOS, but you should be able to create the LXC root yourself. Eg: With nixos-install – aij Sep 18 '17 at 16:41
  • Related issue: github.com/NixOS/nixpkgs/issues/9735 – David Costa Dec 23 '17 at 10:19
  • @Bratchley I suppose a valid use case could be having some hard dependency on a particular host distro (e.g. binary drivers working only Ubuntu) but want to configure the services like Postgres in the declarative way provided by NixOS – David Costa Dec 23 '17 at 10:25
0

It appears you can deploy a nixos configuration to libvirt with nixops (see the deployment.libvirtd.. attributes). I've only used nixops to deploy to virtualbox myself but if it's anything like that you should find it pretty straightforward to use.

  • 1
    Unluckily the libvirt backend is currently support only by nixops on NixOS (section 3.8. Deploying to Libvirtd of the nixos.org/nixops/manual) – David Costa Dec 23 '17 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.