2023-08-25 04:00:42 +01:00
|
|
|
{ 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
|
2023-10-27 09:30:17 +01:00
|
|
|
system.activationScripts.config = let
|
|
|
|
config = pkgs.substituteAll {
|
|
|
|
src = ./lxd-virtual-machine-image-inner.nix;
|
|
|
|
stateVersion = lib.trivial.release;
|
|
|
|
};
|
|
|
|
in ''
|
2023-08-25 04:00:42 +01:00
|
|
|
if [ ! -e /etc/nixos/configuration.nix ]; then
|
|
|
|
mkdir -p /etc/nixos
|
2023-10-27 09:30:17 +01:00
|
|
|
cp ${config} /etc/nixos/configuration.nix
|
2023-08-25 04:00:42 +01:00
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Network
|
2024-02-08 16:20:04 +00:00
|
|
|
networking = {
|
|
|
|
dhcdpcd.enable = false;
|
|
|
|
useDHCP = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
systemd.network = {
|
|
|
|
enable = true;
|
|
|
|
networks."50-enp5s0" = {
|
|
|
|
matchConfig.Name = "enp5s0";
|
|
|
|
networkConfig = {
|
|
|
|
DHCP = "ipv4";
|
|
|
|
IPv6AcceptRA = true;
|
|
|
|
};
|
|
|
|
linkConfig.RequiredForOnline = "routable";
|
|
|
|
};
|
|
|
|
};
|
2023-08-25 04:00:42 +01:00
|
|
|
}
|