nixos-config/modules/nixos/linux/nixos-container.nix
2024-09-28 18:01:53 -04:00

30 lines
733 B
Nix

{ lib, config, ... }:
let
localAddress = (builtins.head (builtins.head (lib.attrValues config.networking.interfaces)).ipv4.addresses).address;
in
{
networking.nat = {
enable = true;
internalInterfaces = [ "ve-+" ];
externalInterface = "eth0";
};
# Proof-of-concept hello world container
#
# $ sudo nixos-container root-login hello
# > hello
containers.hello = {
inherit localAddress;
autoStart = true;
hostAddress = "192.168.100.10";
config = { config, pkgs, ... }: {
environment.systemPackages = with pkgs; [
hello
];
#services.resolved.enable = true;
#networking.useHostResolvConf = lib.mkForce false;
system.stateVersion = "23.11";
};
};
}