NixOS as OpenVZ 7 guest

Steps:

  1. Booting from iso - https://channels.nixos.org/nixos-20.09/latest-nixos-minimal-x86_64-linux.iso (I did it from OpenVZ virtual machine prlctl create nixos --ostype linux --vmtype vm )
  2. Creating NixOS file system via nixos-generate -f lxc
  3. Copying archive nixos-system-x86_64-linux.tar.xz to a folder on the hardware node
  4. Creating OpenVZ container ( I did it prlctl create nixos.ct --vmtype ct --ostemplate centos-8-x86_64)
  5. Mounting container root (prlctl mount nixos.ct)
  6. Removing all data from root of the container (prlctl list -a finding container id then /vz/root/containerid)
  7. Unpacking nixos-system-x86_64-linux.tar.xz to the root of the container
  8. Creating config file on the hardware node /usr/libexec/libvzctl/dists (i did unknown.conf)
# This configuration file is meant to be used with
# the Gentoo distribution kit.
#
# Copyright (c) 1999-2017, Parallels International GmbH
# Copyright (c) 2017-2019 Virtuozzo International GmbH. All rights reserved.
#
# This file is part of OpenVZ libraries. OpenVZ is free software; you can
# redistribute it and/or modify it under the terms of the GNU Lesser General
# Public License as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# Our contact details: Virtuozzo International GmbH, Vordergasse 59, 8200
# Schaffhausen, Switzerland.

ADD_IP=unknown_ip.sh
DEL_IP=unknown-del_ip.sh
NETIF_ADD=gentoo-add_netif.sh
NETIF_DEL=gentoo-del_netif.sh
SET_HOSTNAME=unknown-set_hostname.sh
SET_DNS=unknown-set_dns.sh
SET_USERPASS=set_userpass.sh
SET_UGID_QUOTA=unknown-set_ugid_quota.sh
POST_CREATE=postcreate.sh
POST_MIGRATE=unknown-post_migrate.sh
GET_V2PMIGRATE_EXCLUDES=gentoo-v2pmigrate-excludes.sh
SET_CONSOLE=set_console.sh
  1. Changing in configuration file of the container /vz/private/containerid/ve.conf set the DISTRIBUTION=“unknown”

That’s all now prlct umount ct name
prlct start ct name
prlct enter ct name

1 Like