about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <git@emile.space>2024-09-28 23:59:52 +0200
committerEmile <git@emile.space>2024-09-28 23:59:52 +0200
commit884cc9b71c7b9ced458867972c68490ddbb5852e (patch)
tree8e64bc7d82609857f27278bb9d17eacdfba3d9fd
parentc0e63070eb11a5308b0870f94eeee56b1fe96dcb (diff)
microvm test stuff
-rw-r--r--flake.nix7
-rw-r--r--nix/lib/flake-helper.nix19
2 files changed, 20 insertions, 6 deletions
diff --git a/flake.nix b/flake.nix
index 16ab234..ec99444 100644
--- a/flake.nix
+++ b/flake.nix
@@ -19,6 +19,10 @@
     naersk.url = "git+https://github.com/nix-community/naersk";
     naersk.inputs.nixpkgs.follows = "nixpkgs";
 
+    microvm.url = "git+https://github.com/astro/microvm.nix";
+    microvm.inputs.nixpkgs.follows = "nixpkgs";
+
+
     # hefe-internal.url = "git+ssh://gitea@git.emile.space/hanemile/hefe-internal.git?ref=main";
 
     # nix registry add flake:mylocalrepo git+file:///path/to/local/repo
@@ -39,6 +43,7 @@
       home-manager, # manage my home envs
       naersk, # build rust stuff
       hefe-internal, # internal tooling
+      microvm, # microvms
       ...
     }@inputs:
     let
@@ -60,6 +65,8 @@
           ip = "corrino";
           description = "Hetzner AX41 dual 512GB NVME";
           modules = [ hefe-internal.nixosModules.corrino ];
+          microvms = true;
+          # unstable = true;
         };
         chusuk = {
           # ip = "chusuk.pinto-pike.ts.net";
diff --git a/nix/lib/flake-helper.nix b/nix/lib/flake-helper.nix
index ed5e9ba..dde9256 100644
--- a/nix/lib/flake-helper.nix
+++ b/nix/lib/flake-helper.nix
@@ -3,9 +3,11 @@
   agenix,
   nixpkgs,
   nixpkgs-unstable,
+  nixpkgs-master,
   deploy-rs,
   home-manager,
   darwin,
+  microvm,
   ...
 }@inputs:
 
@@ -20,12 +22,19 @@ rec {
       homeManagerEnable ? false,
       group ? null,
       modules ? [ ],
+      unstable ? false,
+      master ? false,
+      microvms ? false,
       ...
     }:
     let
 
-      # inputs.nixpkgs-${name}, if that doesn't exist, just use nixpkgs
-      localNixpkgs =
+      localNixpkgs = if unstable == true then
+        nixpkgs-unstable
+        else if master == true then
+        nixpkgs-master
+        else
+        # inputs.nixpkgs-${name}, if that doesn't exist, just use nixpkgs
         nixpkgs.lib.attrByPath [ "nixpkgs-${name}" ] # path
           nixpkgs # default
           inputs; # base
@@ -52,14 +61,12 @@ rec {
         modules
         ++ [
 
-          (
-            if system == "x86_64-linux" then
+          (if system == "x86_64-linux" then
               self.nixosModules.x86_64-linux
             else if system == "aarch64-darwin" then
               ({ })
             else
-              null
-          )
+              null)
 
           # a module so that we can access the flake output from inside the
           # flake (yes, I need this for fetching the system type while building the hosts for deploy-rs)