container proof of concept

This commit is contained in:
Sridhar Ratnakumar 2024-01-27 05:43:34 -05:00
parent a445d52819
commit c04849f9f1
2 changed files with 31 additions and 0 deletions

View file

@ -2,6 +2,7 @@
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
flake.inputs.disko.nixosModules.disko
./nixos-container.nix
];
system.stateVersion = "22.11";
services.openssh.enable = true;

View file

@ -0,0 +1,30 @@
{ 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";
};
};
}