Proxmox Virtual Environment: Difference between revisions

imported>Vater
mNo edit summary
imported>Benley
Document supported PVE version, remove outdated section about patching pve-container
Line 74: Line 74:


== LXC ==
== LXC ==
NixOS containers are supported on Proxmox VE starting with version 7.2.


=== Generating LXC template ===
=== Generating LXC template ===
Line 108: Line 110:
   ];
   ];
}
}
</pre>
=== Patching pve-container ===
<blockquote>
This is not needed on pve-container version 4.1-5 (released on 27 April 2022) and newer. If you have an older version, you will have to patch it to add NixOS LXC support. If you have a newer version, skip ahead to the next section.
</blockquote>
* install some dependencies <code>apt install git devscripts gdebi</code>
* clone https://github.com/proxmox/pve-container
<pre>
root@pve:~# git clone https://github.com/proxmox/pve-container
...
root@pve:~# cd pve-container/
</pre>
* get the installed version of pve-container
<pre>
root@pve:~/pve-container# pveversion -v | grep pve-container
pve-container: 4.1-2
</pre>
* check out the commit of the version you want
<pre>
root@pve:~/pve-container# git log --grep &quot;4.1-2&quot;
commit 5d5f81f645bd1e8fd0ffff878fe249253e1be777
Author: Thomas Lamprecht &lt;t.lamprecht@proxmox.com&gt;
Date:  Fri Nov 12 19:21:25 2021 +0100
    bump version to 4.1-2
    Signed-off-by: Thomas Lamprecht &lt;t.lamprecht@proxmox.com&gt;
</pre>
<pre>
root@pve:~/pve-container# git checkout 5d5f81f645bd1e8fd0ffff878fe249253e1be777
Note: switching to '5d5f81f645bd1e8fd0ffff878fe249253e1be777'.
...
HEAD is now at 5d5f81f bump version to 4.1-2
</pre>
* cherry-pick the [https://github.com/proxmox/pve-container/commit/6226d0101652914744cb5c657414bf286ccd857d patch that adds NixOS LXC support]
<pre>
root@pve:~/pve-container# git cherry-pick 6226d0101652914744cb5c657414bf286ccd857d
Auto-merging src/PVE/LXC/Config.pm
[detached HEAD 6f3cd03] Setup: add NixOS support
Author: Harikrishnan R via pve-devel &lt;pve-devel@lists.proxmox.com&gt;
Date: Tue Feb 15 22:58:46 2022 +0530
Committer: root &lt;root@pve&gt;
...
4 files changed, 50 insertions(+), 1 deletion(-)
create mode 100644 src/PVE/LXC/Setup/NixOS.pm</pre>
If the version of pve-container you’re applying the patch to is older than 4.1, it might encounter merge conflicts that would need to be manually resolved.
* Install build deps
<pre>
root@pve:~/pve-container# mk-build-deps
...
The package has been created.
Attention, the package has been created in the current directory,
not in &quot;..&quot; as indicated by the message above!
</pre>
<pre>
root@pve:~/pve-container# gdebi pve-container-build-deps_4.1-2_all.deb
Reading package lists... Done
...
Fetched 432 MB in 6s (17.8 MB/s)
...
Unpacking pve-container-build-deps (4.1-2) ...
Setting up pve-container-build-deps (4.1-2) ...
</pre>
* build the patched pve-container
<pre>
root@pve:~/pve-container# make
...
dpkg-buildpackage: info: binary-only upload (no source included)
lintian pve-container_4.1-2_all.deb
warning: running with root privileges is not recommended!
</pre>
* install the deb
<pre>
root@pve:~/pve-container# dpkg -i pve-container_4.1-2_all.deb
</pre>
* verify that the installed pve-container package added NixOS support
<pre>
root@pve:~# ls /usr/share/perl5/PVE/LXC/Setup/NixOS.pm
/usr/share/perl5/PVE/LXC/Setup/NixOS.pm
</pre>
</pre>