diff --git a/flake.lock b/flake.lock index 24ed65a..e05b88d 100644 --- a/flake.lock +++ b/flake.lock @@ -267,6 +267,30 @@ "type": "github" } }, + "microvm": { + "inputs": { + "flake-utils": [ + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ], + "spectrum": "spectrum" + }, + "locked": { + "lastModified": 1716382614, + "narHash": "sha256-dwUYl8jyMNKidPEM9gTafcRe+3pUh2rH3ZlBrUpsvnw=", + "owner": "astro", + "repo": "microvm.nix", + "rev": "a59c3167f673ce29b65c674deb2bee73d151a96c", + "type": "github" + }, + "original": { + "owner": "astro", + "repo": "microvm.nix", + "type": "github" + } + }, "nix": { "inputs": { "flake-compat": [ @@ -609,6 +633,7 @@ "flake-utils": "flake-utils_2", "home-manager": "home-manager", "hyprland-contrib": "hyprland-contrib", + "microvm": "microvm", "nix": "nix", "nix-index-database": "nix-index-database", "nixos-generators": "nixos-generators", @@ -733,6 +758,22 @@ "type": "github" } }, + "spectrum": { + "flake": false, + "locked": { + "lastModified": 1708358594, + "narHash": "sha256-e71YOotu2FYA67HoC/voJDTFsiPpZNRwmiQb4f94OxQ=", + "ref": "refs/heads/main", + "rev": "6d0e73864d28794cdbd26ab7b37259ab0e1e044c", + "revCount": 614, + "type": "git", + "url": "https://spectrum-os.org/git/spectrum" + }, + "original": { + "type": "git", + "url": "https://spectrum-os.org/git/spectrum" + } + }, "systems": { "locked": { "lastModified": 1681028828, diff --git a/flake.nix b/flake.nix index 933544a..b353a00 100644 --- a/flake.nix +++ b/flake.nix @@ -72,6 +72,14 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + microvm = { + url = "github:astro/microvm.nix"; + inputs = { + nixpkgs.follows = "nixpkgs"; + flake-utils.follows = "flake-utils"; + }; + }; + nix = { url = "github:NixOS/nix/latest-release"; inputs = { diff --git a/modules/microvm-host.nix b/modules/microvm-host.nix new file mode 100644 index 0000000..7e8aaed --- /dev/null +++ b/modules/microvm-host.nix @@ -0,0 +1,33 @@ +{ + config, + lib, + inputs, + ... +}: +let + cfg = config.rad-dev.microvm-host; + inherit (inputs.microvm.nixosModules) microvm; +in +{ + # imports = [microvm.host]; + options.rad-dev.microvm-host = { + enable = lib.mkEnableOption "microvm-host"; + }; + config = lib.mkIf cfg.enable { + networking.useNetworkd = true; + # microvm.shares = [ + # { + # tag = "ro-store"; + # source = "/nix/store"; + # mountPoint = "/nix/.ro-store"; + # } + # ]; + # systemd.tmpfiles.rules = map (vmHost: + # let + # machineId = lib.addresses.machineId.${vmHost}; + # in + # # creates a symlink of each MicroVM's journal under the host's /var/log/journal + # "L+ /var/log/journal/${machineId} - - - - /var/lib/microvms/${vmHost}/journal/${machineId}" + # ) (builtins.attrNames lib.addresses.machineId); + }; +} diff --git a/systems/palatine-hill/configuration.nix b/systems/palatine-hill/configuration.nix index 1c48d0a..ad7119d 100644 --- a/systems/palatine-hill/configuration.nix +++ b/systems/palatine-hill/configuration.nix @@ -9,11 +9,13 @@ ./attic.nix ./docker.nix ./hydra.nix + ./microvms.nix ./minio.nix ./networking.nix ./nextcloud.nix ./services.nix ./zfs.nix + ./networking.nix ]; programs.git.lfs.enable = false; diff --git a/systems/palatine-hill/default.nix b/systems/palatine-hill/default.nix index 94d5707..199a7c8 100644 --- a/systems/palatine-hill/default.nix +++ b/systems/palatine-hill/default.nix @@ -4,5 +4,8 @@ "alice" "richie" ]; - modules = [ inputs.attic.nixosModules.atticd ]; + modules = [ + inputs.attic.nixosModules.atticd + inputs.microvm.nixosModules.host + ]; } diff --git a/systems/palatine-hill/microvms.nix b/systems/palatine-hill/microvms.nix new file mode 100644 index 0000000..73fde98 --- /dev/null +++ b/systems/palatine-hill/microvms.nix @@ -0,0 +1,10 @@ +{ + config, + lib, + pkgs, + ... +}: + +{ + rad-dev.microvm-host.enable = true; +}