From 3aeae4e33f413219e81c3201341f8090559302ad Mon Sep 17 00:00:00 2001 From: Ryan Lahfa Date: Tue, 8 Oct 2024 13:37:39 +0200 Subject: [PATCH] feat(krz01): add basic microvm exprs For a router01. Signed-off-by: Ryan Lahfa --- machines/krz01/_configuration.nix | 2 ++ machines/krz01/microvm-router01.nix | 16 ++++++++++++++++ modules/default.nix | 1 + modules/dgn-hardware.nix | 1 + npins/sources.json | 12 ++++++++++++ 5 files changed, 32 insertions(+) create mode 100644 machines/krz01/microvm-router01.nix diff --git a/machines/krz01/_configuration.nix b/machines/krz01/_configuration.nix index 754085c..11f4527 100644 --- a/machines/krz01/_configuration.nix +++ b/machines/krz01/_configuration.nix @@ -9,9 +9,11 @@ lib.extra.mkConfig { # INFO: This list needs to stay sorted alphabetically # TODO: re-enable me when #139 is merged. "proxmox" "nvidia-tesla-k80" + "microvm-router01" ]; extraConfig = { + microvm.host.enable = true; dgn-hardware = { useZfs = true; zfsPools = [ diff --git a/machines/krz01/microvm-router01.nix b/machines/krz01/microvm-router01.nix new file mode 100644 index 0000000..9af9bdf --- /dev/null +++ b/machines/krz01/microvm-router01.nix @@ -0,0 +1,16 @@ +_: { + microvm.autostart = [ "router01" ]; + microvm.vms.router01 = { + config = { + networking.hostName = "router01"; + microvm.shares = [ + { + source = "/nix/store"; + mountPoint = "/nix/.ro-store"; + tag = "ro-store"; + proto = "virtiofs"; + } + ]; + }; + }; +} diff --git a/modules/default.nix b/modules/default.nix index bf1552c..684fc66 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -62,6 +62,7 @@ ++ [ "${sources.agenix}/modules/age.nix" "${sources.arkheon}/module.nix" + "${sources."microvm.nix"}/nixos-modules/host" ] ++ ((import sources.nix-modules { inherit lib; }).importModules ( [ diff --git a/modules/dgn-hardware.nix b/modules/dgn-hardware.nix index a36dfd7..41960b6 100644 --- a/modules/dgn-hardware.nix +++ b/modules/dgn-hardware.nix @@ -43,6 +43,7 @@ in config = mkIf cfg.enable (mkMerge [ { + microvm.host.enable = lib.mkDefault false; hardware.enableRedistributableFirmware = true; hardware.cpu.intel.updateMicrocode = true; diff --git a/npins/sources.json b/npins/sources.json index 6ad46d4..c3fc32e 100644 --- a/npins/sources.json +++ b/npins/sources.json @@ -182,6 +182,18 @@ "url": null, "hash": "0m9il1lllw59a6l9vwfi1bika7g4pxs20clc48kklpflnk0scb1f" }, + "microvm.nix": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "RaitoBezarius", + "repo": "microvm.nix" + }, + "branch": "main", + "revision": "49899c9a4fdf75320785e79709bf1608c34caeb8", + "url": "https://github.com/RaitoBezarius/microvm.nix/archive/49899c9a4fdf75320785e79709bf1608c34caeb8.tar.gz", + "hash": "0sz6azdpiz4bd36x23bcdhx6mwyqj8zl5cczjgv48xqfmysy8zwy" + }, "nix-lib": { "type": "GitRelease", "repository": { -- 2.47.0