Microvm experiments

This commit is contained in:
Erwin Boskma 2023-01-27 15:36:05 +01:00
parent 7c1a30edaf
commit 25f77884ec
Signed by: erwin
SSH key fingerprint: SHA256:Vw4O4qA0i5x65Y7yyjDpWDCSMSXAhqT4X7cJ3frdnLY
3 changed files with 71 additions and 1 deletions

View file

@ -233,6 +233,29 @@
"type": "github" "type": "github"
} }
}, },
"microvm": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1674747738,
"narHash": "sha256-FSaBkfXiKo6jdvjUx/SJhM/+h+QQIxFu7cCXs8uxZ6Q=",
"owner": "astro",
"repo": "microvm.nix",
"rev": "0a3d48e06b8c04beb3de0a3283bd1ef29fe4a47d",
"type": "github"
},
"original": {
"owner": "astro",
"repo": "microvm.nix",
"type": "github"
}
},
"naersk": { "naersk": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -420,6 +443,7 @@
"ha-now-playing": "ha-now-playing", "ha-now-playing": "ha-now-playing",
"home-manager": "home-manager", "home-manager": "home-manager",
"hyprland": "hyprland", "hyprland": "hyprland",
"microvm": "microvm",
"naersk": "naersk", "naersk": "naersk",
"nil": "nil", "nil": "nil",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",

View file

@ -36,6 +36,12 @@
inputs.flake-utils.follows = "flake-utils"; inputs.flake-utils.follows = "flake-utils";
}; };
microvm = {
url = "github:astro/microvm.nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
sops = { sops = {
url = "github:Mic92/sops-nix"; url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";

View file

@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ nixos-hardware, nomachine, ... }: { nixos-hardware, nomachine, microvm, ... }:
{ pkgs, ... }: { pkgs, ... }:
{ {
imports = imports =
@ -13,6 +13,8 @@
nixos-hardware.nixosModules.common-pc-ssd nixos-hardware.nixosModules.common-pc-ssd
"${nomachine}/nixos/modules/services/admin/nomachine.nix" "${nomachine}/nixos/modules/services/admin/nomachine.nix"
microvm.nixosModules.host
./hardware-configuration.nix ./hardware-configuration.nix
../../users/erwin ../../users/erwin
@ -94,13 +96,32 @@
7000 7000
]; ];
}; };
nat = {
enable = true;
internalInterfaces = [ "microvm" ];
externalInterface = "enp4s0";
}; };
};
microvm.autostart = [
"miniflux"
];
systemd.network = { systemd.network = {
enable = true; enable = true;
wait-online.extraArgs = [ "--interface=enp4s0" ]; wait-online.extraArgs = [ "--interface=enp4s0" ];
netdevs = {
"10-microvm" = {
netdevConfig = {
Kind = "bridge";
Name = "microvm";
};
};
};
networks = { networks = {
"40-enp4s0" = { "40-enp4s0" = {
enable = true; enable = true;
@ -120,6 +141,25 @@
Name = "enp5s0f1"; Name = "enp5s0f1";
}; };
}; };
"10-microvm" = {
matchConfig = {
Name = "microvm";
};
addresses = [
{ addressConfig.Address = "172.16.0.1/24"; }
];
};
"11-microvm" = {
matchConfig = {
Name = "vm-*";
};
networkConfig = {
Bridge = "microvm";
};
};
}; };
}; };