mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 03:17:13 +00:00
73e19e1a8d
Enables networkd instead of dhcpcd for DHCP/RA. It offers a solid base for network configuration, that is much more extensible than dhcpcd and also better maintained than our bespoke `networking.interfaces` modules. Closes: #287269
46 lines
954 B
Nix
46 lines
954 B
Nix
{ 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.substituteAll {
|
|
src = ./lxd-virtual-machine-image-inner.nix;
|
|
stateVersion = lib.trivial.release;
|
|
};
|
|
in ''
|
|
if [ ! -e /etc/nixos/configuration.nix ]; then
|
|
mkdir -p /etc/nixos
|
|
cp ${config} /etc/nixos/configuration.nix
|
|
fi
|
|
'';
|
|
|
|
# Network
|
|
networking = {
|
|
dhcdpcd.enable = false;
|
|
useDHCP = false;
|
|
};
|
|
|
|
systemd.network = {
|
|
enable = true;
|
|
networks."50-enp5s0" = {
|
|
matchConfig.Name = "enp5s0";
|
|
networkConfig = {
|
|
DHCP = "ipv4";
|
|
IPv6AcceptRA = true;
|
|
};
|
|
linkConfig.RequiredForOnline = "routable";
|
|
};
|
|
};
|
|
}
|