This guide will explain how to install NixOS as an LXC container inside of proxmox. Do be warned that this setup isn’t extensively tested for stability or officially supported.
Getting the container tarball
The first step is to download the NixOS container tarball. To do so
simply go to its pipeline. And click on the latest successful build, and download the corresponding .tar.xz
file.
After it’s downloaded we should rename the file to follow proxmox conventions (recommended but optional):
|
|
Uploading to proxmox
Uploading it to proxmox is quite easy: just go to your storage, most likely called “local” then to “CT Templates” and click on upload and upload the tarball.
Creating the container
To create the container on proxmox we need to either ssh
into it or use the web shell.
After in a shell on the proxmox host execute the following command. However, make sure you understand what the options
do before executing it. You can see the proxmox docs if you are unsure.
|
|
after running this the container should show up in the Proxmox Web UI.
Enable nesting
We are now done with all the cli configuration and need to enable a feature flag in the web interface. Under container options, go to “Features” and enable “Nesting”. This is needed as nix makes heavy use of sandboxing.

Do note the following (from the proxmox wiki)
Nesting is best used with unprivileged containers with additional id mapping. Note that this will expose procfs and sysfs contents of the host to the guest.
Fix Network settings
If you didn’t specify a full network configuration during container creation you must now do so in the web UI or else the container won’t start. The easiest being to just to set both ipv4 and ipv6 to dhcp.
Do mind that these network settings seem mostly to just be defaults that are able to be overwritten inside of the container, except things like MAC address presumably.
In-Container tweaks
Now you can finally start up the container! But we are not done yet, we need to set some minor settings to make NixOS play nice with the fact that it is running inside of an lxc container.
Populate Nixpkgs
nixpkgs
isn’t properly initialized when booting a fresh container, which would result in errors when running other
nix commands, to fix this simply run:
|
|
configuration.nix tweak
Finally we need to add a small tweak inside of /etc/nixos/configuration.nix
. We will
supress some systemds unit as they will otherwise error upon
every invocation of nixos-rebuild switch
which can be annoying.
|
|
Done!
After doing the final tweaks you should be done and able to runnixos-rebuild switch
without any errors.

References
This guide is based heavily on the resources below