2021-04-28 05:06:20 +01:00
|
|
|
{ lib, config, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
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 = ''
|
|
|
|
if [ ! -e /etc/nixos/configuration.nix ]; then
|
|
|
|
mkdir -p /etc/nixos
|
|
|
|
cat ${./lxd-image-inner.nix} > /etc/nixos/configuration.nix
|
2021-10-19 16:27:01 +01:00
|
|
|
sed 's|../../../modules/virtualisation/lxc-container.nix|<nixpkgs/nixos/modules/virtualisation/lxc-container.nix>|g' -i /etc/nixos/configuration.nix
|
2021-04-28 05:06:20 +01:00
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Network
|
|
|
|
networking.useDHCP = false;
|
|
|
|
networking.interfaces.eth0.useDHCP = true;
|
2021-04-30 23:47:56 +01:00
|
|
|
|
|
|
|
# As this is intended as a stadalone image, undo some of the minimal profile stuff
|
|
|
|
documentation.enable = true;
|
|
|
|
documentation.nixos.enable = true;
|
|
|
|
environment.noXlibs = false;
|
2021-04-28 05:06:20 +01:00
|
|
|
}
|