diff --git a/flake.lock b/flake.lock index 6f1bfcb..1bd96c3 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ ] }, "locked": { - "lastModified": 1674615852, - "narHash": "sha256-FcZ42T0m+CVbNyqHsmjixlFzuCevZXsbPBG/3JtoBak=", + "lastModified": 1674727661, + "narHash": "sha256-yiT8F+VrFS5xnDwfb6kLYitAztXuxiblhz8+AP6T28g=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "53018b60fc15aaac1722031e50b043883b74fcd0", + "rev": "6b44cc8a441bed3796e6ddc984745fcdeaba8aa4", "type": "github" }, "original": { @@ -199,11 +199,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1674604320, - "narHash": "sha256-yhSiPmT3fmOaV2dLBNCsGGpN4t2Ucs6Q3dGygBH34sc=", + "lastModified": 1674661101, + "narHash": "sha256-iFFUngau5KHjsKScLhovpb7kCMjJvw/mXXOj6I62sVM=", "owner": "Hyprwm", "repo": "Hyprland", - "rev": "12e293e3092b03dbb9d82e7a749f482ef2b7ea6e", + "rev": "fc89e70a1fb74429ad0f772d399325f69e65b357", "type": "github" }, "original": { @@ -233,6 +233,29 @@ "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": { "inputs": { "nixpkgs": [ @@ -420,6 +443,7 @@ "ha-now-playing": "ha-now-playing", "home-manager": "home-manager", "hyprland": "hyprland", + "microvm": "microvm", "naersk": "naersk", "nil": "nil", "nixos-hardware": "nixos-hardware", @@ -442,11 +466,11 @@ ] }, "locked": { - "lastModified": 1674527079, - "narHash": "sha256-WqehnSvo9YYfAoh7HMTxp6YVwq5eyLz663vPufeSsQs=", + "lastModified": 1674699969, + "narHash": "sha256-gkhhGV7zBVoEIl1sFSz67r0d8fTeY57coY/+zDzxrbk=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "187b7835d59b9c040e0782b5b129de113207c2d5", + "rev": "480f9cc37db841d1fd3ac0b0c059d48e5eb6946c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index a7cc79c..28caef6 100644 --- a/flake.nix +++ b/flake.nix @@ -36,6 +36,12 @@ inputs.flake-utils.follows = "flake-utils"; }; + microvm = { + url = "github:astro/microvm.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-utils.follows = "flake-utils"; + }; + sops = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/machines/mimir/configuration.nix b/machines/mimir/configuration.nix index 12c24f7..4adbdbb 100644 --- a/machines/mimir/configuration.nix +++ b/machines/mimir/configuration.nix @@ -2,7 +2,7 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ nixos-hardware, nomachine, ... }: +{ nixos-hardware, nomachine, microvm, ... }: { pkgs, ... }: { imports = @@ -13,6 +13,8 @@ nixos-hardware.nixosModules.common-pc-ssd "${nomachine}/nixos/modules/services/admin/nomachine.nix" + microvm.nixosModules.host + ./hardware-configuration.nix ../../users/erwin @@ -94,13 +96,32 @@ 7000 ]; }; + + nat = { + enable = true; + internalInterfaces = [ "microvm" ]; + externalInterface = "enp4s0"; + }; }; + microvm.autostart = [ + "miniflux" + ]; + systemd.network = { enable = true; wait-online.extraArgs = [ "--interface=enp4s0" ]; + netdevs = { + "10-microvm" = { + netdevConfig = { + Kind = "bridge"; + Name = "microvm"; + }; + }; + }; + networks = { "40-enp4s0" = { enable = true; @@ -120,12 +141,33 @@ Name = "enp5s0f1"; }; }; + + "10-microvm" = { + matchConfig = { + Name = "microvm"; + }; + + addresses = [ + { addressConfig.Address = "172.16.0.1/24"; } + ]; + }; + + "11-microvm" = { + matchConfig = { + Name = "vm-*"; + }; + networkConfig = { + Bridge = "microvm"; + }; + }; }; }; services.openssh.enable = true; programs.ssh.startAgent = true; + services.envfs.enable = true; + services.xserver.libinput = { enable = true; mouse = {