at 25.11-pre 973 B view raw
1{ lib, pkgs, ... }: 2 3{ 4 imports = [ 5 ../../../modules/virtualisation/lxc-container.nix 6 ]; 7 8 virtualisation.lxc.templates.nix = { 9 enable = true; 10 target = "/etc/nixos/lxd.nix"; 11 template = ./nix.tpl; 12 when = [ 13 "create" 14 "copy" 15 ]; 16 }; 17 18 # copy the config for nixos-rebuild 19 system.activationScripts.config = 20 let 21 config = pkgs.replaceVars ./lxd-container-image-inner.nix { 22 stateVersion = lib.trivial.release; 23 }; 24 in 25 '' 26 if [ ! -e /etc/nixos/configuration.nix ]; then 27 install -m 0644 -D ${config} /etc/nixos/configuration.nix 28 fi 29 ''; 30 31 networking = { 32 dhcpcd.enable = false; 33 useDHCP = false; 34 useHostResolvConf = false; 35 }; 36 37 systemd.network = { 38 enable = true; 39 networks."50-eth0" = { 40 matchConfig.Name = "eth0"; 41 networkConfig = { 42 DHCP = "ipv4"; 43 IPv6AcceptRA = true; 44 }; 45 linkConfig.RequiredForOnline = "routable"; 46 }; 47 }; 48}