nixos/lxd: remove container and virtual-machine releases

This commit is contained in:
Adam C. Stephens
2025-09-13 12:44:42 -04:00
parent 2d6368b8a1
commit 7eef130c2c
8 changed files with 5 additions and 322 deletions
@@ -1,34 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ modulesPath, ... }:
{
imports = [
# Include the default lxd configuration.
"${modulesPath}/virtualisation/lxc-container.nix"
# Include the container-specific autogenerated configuration.
./lxd.nix
];
networking = {
dhcpcd.enable = false;
useDHCP = false;
useHostResolvConf = false;
};
systemd.network = {
enable = true;
networks."50-eth0" = {
matchConfig.Name = "eth0";
networkConfig = {
DHCP = "ipv4";
IPv6AcceptRA = true;
};
linkConfig.RequiredForOnline = "routable";
};
};
system.stateVersion = "@stateVersion@"; # Did you read the comment?
}
@@ -1,48 +0,0 @@
{ lib, pkgs, ... }:
{
imports = [
../../../modules/virtualisation/lxc-container.nix
];
virtualisation.lxc.templates.nix = {
enable = true;
target = "/etc/nixos/lxd.nix";
template = ./nix.tpl;
when = [
"create"
"copy"
];
};
# copy the config for nixos-rebuild
system.activationScripts.config =
let
config = pkgs.replaceVars ./lxd-container-image-inner.nix {
stateVersion = lib.trivial.release;
};
in
''
if [ ! -e /etc/nixos/configuration.nix ]; then
install -m 0644 -D ${config} /etc/nixos/configuration.nix
fi
'';
networking = {
dhcpcd.enable = false;
useDHCP = false;
useHostResolvConf = false;
};
systemd.network = {
enable = true;
networks."50-eth0" = {
matchConfig.Name = "eth0";
networkConfig = {
DHCP = "ipv4";
IPv6AcceptRA = true;
};
linkConfig.RequiredForOnline = "routable";
};
};
}
@@ -1,34 +0,0 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ modulesPath, ... }:
{
imports = [
# Include the default lxd configuration.
"${modulesPath}/virtualisation/lxd-virtual-machine.nix"
# Include the container-specific autogenerated configuration.
./lxd.nix
];
networking = {
dhcpcd.enable = false;
useDHCP = false;
useHostResolvConf = false;
};
systemd.network = {
enable = true;
networks."50-enp5s0" = {
matchConfig.Name = "enp5s0";
networkConfig = {
DHCP = "ipv4";
IPv6AcceptRA = true;
};
linkConfig.RequiredForOnline = "routable";
};
};
system.stateVersion = "@stateVersion@"; # Did you read the comment?
}
@@ -1,49 +0,0 @@
{ lib, pkgs, ... }:
{
imports = [
../../../modules/virtualisation/lxd-virtual-machine.nix
];
virtualisation.lxc.templates.nix = {
enable = true;
target = "/etc/nixos/lxd.nix";
template = ./nix.tpl;
when = [
"create"
"copy"
];
};
# copy the config for nixos-rebuild
system.activationScripts.config =
let
config = pkgs.replaceVars ./lxd-virtual-machine-image-inner.nix {
stateVersion = lib.trivial.release;
};
in
''
if [ ! -e /etc/nixos/configuration.nix ]; then
install -m 0644 -D ${config} /etc/nixos/configuration.nix
fi
'';
# Network
networking = {
dhcpcd.enable = false;
useDHCP = false;
useHostResolvConf = false;
};
systemd.network = {
enable = true;
networks."50-enp5s0" = {
matchConfig.Name = "enp5s0";
networkConfig = {
DHCP = "ipv4";
IPv6AcceptRA = true;
};
linkConfig.RequiredForOnline = "routable";
};
};
}
-7
View File
@@ -1,7 +0,0 @@
{ lib, config, pkgs, ... }:
# WARNING: THIS CONFIGURATION IS AUTOGENERATED AND WILL BE OVERWRITTEN AUTOMATICALLY
{
networking.hostName = "{{ container.name }}";
}
+5
View File
@@ -369,6 +369,11 @@ in
(mkRemovedOptionModule [ "services" "gateone" ] ''
The gateone module was removed since the package was removed alongside much other obsolete python 2.
'')
(mkRemovedOptionModule [ "virtualisation" "lxd" ] ''
LXD has been removed from NixOS due to lack of Nixpkgs maintenance.
Consider migrating or switching to Incus, or remove from your configuration.
https://linuxcontainers.org/incus/docs/main/howto/server_migrate_lxd/
'')
# Do NOT add any option renames here, see top of the file
];
}
@@ -1,56 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
serialDevice = if pkgs.stdenv.hostPlatform.isx86 then "ttyS0" else "ttyAMA0"; # aarch64
in
{
imports = [
./lxc-instance-common.nix
../profiles/qemu-guest.nix
];
config = {
system.build.qemuImage = import ../../lib/make-disk-image.nix {
inherit pkgs lib config;
partitionTableType = "efi";
format = "qcow2-compressed";
copyChannel = true;
};
fileSystems = {
"/" = {
device = "/dev/disk/by-label/nixos";
autoResize = true;
fsType = "ext4";
};
"/boot" = {
device = "/dev/disk/by-label/ESP";
fsType = "vfat";
};
};
boot.growPartition = true;
boot.loader.systemd-boot.enable = true;
# image building needs to know what device to install bootloader on
boot.loader.grub.device = "/dev/vda";
boot.kernelParams = [
"console=tty1"
"console=${serialDevice}"
];
services.udev.extraRules = ''
SUBSYSTEM=="cpu", CONST{arch}=="x86-64", TEST=="online", ATTR{online}=="0", ATTR{online}="1"
'';
virtualisation.lxd.agent.enable = lib.mkDefault true;
};
}
-94
View File
@@ -434,100 +434,6 @@ rec {
)
);
# An image that can be imported into lxd and used for container creation
lxdContainerImage = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (
system:
with import ./.. { inherit system; };
hydraJob (
(import lib/eval-config.nix {
inherit system;
modules = [
configuration
versionModule
./maintainers/scripts/lxd/lxd-container-image.nix
];
}).config.system.build.tarball
)
);
lxdContainerImageSquashfs = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (
system:
with import ./.. { inherit system; };
hydraJob (
(import lib/eval-config.nix {
inherit system;
modules = [
configuration
versionModule
./maintainers/scripts/lxd/lxd-container-image.nix
];
}).config.system.build.squashfs
)
);
# Metadata for the lxd image
lxdContainerMeta = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (
system:
with import ./.. { inherit system; };
hydraJob (
(import lib/eval-config.nix {
inherit system;
modules = [
configuration
versionModule
./maintainers/scripts/lxd/lxd-container-image.nix
];
}).config.system.build.metadata
)
);
# An image that can be imported into lxd and used for container creation
lxdVirtualMachineImage = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (
system:
with import ./.. { inherit system; };
hydraJob (
(import lib/eval-config.nix {
inherit system;
modules = [
configuration
versionModule
./maintainers/scripts/lxd/lxd-virtual-machine-image.nix
];
}).config.system.build.qemuImage
)
);
# Metadata for the lxd image
lxdVirtualMachineImageMeta = forMatchingSystems [ "x86_64-linux" "aarch64-linux" ] (
system:
with import ./.. { inherit system; };
hydraJob (
(import lib/eval-config.nix {
inherit system;
modules = [
configuration
versionModule
./maintainers/scripts/lxd/lxd-virtual-machine-image.nix
];
}).config.system.build.metadata
)
);
# Ensure that all packages used by the minimal NixOS config end up in the channel.
dummy = forAllSystems (
system: