mirror of
https://github.com/srid/nixos-config.git
synced 2026-05-11 17:36:07 +08:00
container proof of concept
This commit is contained in:
parent
a445d52819
commit
c04849f9f1
2 changed files with 31 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
30
systems/hetzner/nixos-container.nix
Normal file
30
systems/hetzner/nixos-container.nix
Normal 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";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue