nix-config/modules/lxc-container.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

67 lines
1.4 KiB
Nix
Raw Normal View History

2021-10-06 19:12:32 +02:00
{ hostRegistry, config, pkgs, lib, modulesPath, ... }:
{
2020-08-04 17:15:07 +02:00
imports = [
(modulesPath + "/profiles/docker-container.nix")
];
2019-12-03 16:25:24 +01:00
boot = {
isContainer = true;
2022-06-12 17:26:32 +02:00
loader = {
2019-12-03 16:25:24 +01:00
grub.enable = false;
# /sbin/init
2019-12-03 16:25:24 +01:00
initScript.enable = true;
2022-06-12 17:26:32 +02:00
};
};
environment.etc."resolv.conf".text = lib.concatMapStrings (ns: ''
nameserver ${ns}
'') config.networking.nameservers;
2019-12-03 16:25:24 +01:00
fileSystems."/" = {
fsType = "rootfs";
device = "rootfs";
};
2019-07-04 04:23:39 +02:00
nix = {
useSandbox = false;
maxJobs = lib.mkDefault 1;
2021-02-24 11:52:19 +01:00
buildCores = lib.mkDefault 4;
};
networking = {
interfaces.eth0 = {
useDHCP = false;
2021-02-24 11:52:19 +01:00
tempAddress = "disabled";
2022-06-12 17:26:32 +02:00
};
nameservers = with hostRegistry.hosts.dnscache; [
2022-06-12 17:26:32 +02:00
ip4
ip6
"9.9.9.9"
2022-06-12 17:26:32 +02:00
];
networkmanager.dns = "unbound";
useDHCP = false;
useHostResolvConf = false;
useNetworkd = true;
2022-06-12 17:26:32 +02:00
};
2019-07-04 04:23:39 +02:00
services = {
# Required for remote deployment
openssh.enable = true;
resolved.enable = false;
2022-06-12 17:26:32 +02:00
};
# Create a few files early before packing tarball for Proxmox architecture/OS detection.
2021-02-22 11:45:12 +01:00
system.extraSystemBuilderCmds = ''
mkdir -m 0755 -p $out/bin
ln -s ${pkgs.bash}/bin/bash $out/bin/sh
mkdir -m 0755 -p $out/sbin
ln -s ../init $out/sbin/init
'';
2021-02-22 11:45:12 +01:00
systemd.network.networks."40-eth0".networkConfig = {
2019-07-04 04:23:39 +02:00
IPv6AcceptRA = true;
2022-01-16 13:26:37 +01:00
LinkLocalAddressing = "ipv6";
2019-07-04 04:23:39 +02:00
};
}