aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.nix22
-rw-r--r--guest.nix19
2 files changed, 35 insertions, 6 deletions
diff --git a/flake.nix b/flake.nix
index 866fbb5..5a40ece 100644
--- a/flake.nix
+++ b/flake.nix
@@ -29,6 +29,12 @@
(pkgs.lib.filterAttrs
(_: type: type == "directory")
(builtins.readDir ./zkvms));
+
+ guests = [ null ] ++ (builtins.attrNames
+ (pkgs.lib.filterAttrs
+ (_: type: type == "directory")
+ (builtins.readDir ./guests)));
+
foldr = pkgs.lib.foldr;
createPackages = guestName: let
@@ -46,14 +52,18 @@
{}
zkvms;
- guests = [ null ] ++ (builtins.attrNames
- (pkgs.lib.filterAttrs
- (_: type: type == "directory")
- (builtins.readDir ./guests)));
- in {
- packages.${system} = pkgs.lib.foldr
+ hostPackages = foldr
(guest: accum: accum // (createPackages guest))
{}
guests;
+
+ guestPackages = foldr
+ (guest: accum: accum // {
+ ${guest} = callPackage ./guest.nix { inherit guest; inherit zkvms; inherit hostPackages; };
+ })
+ {}
+ guests;
+ in {
+ packages.${system} = hostPackages // guestPackages;
};
}
diff --git a/guest.nix b/guest.nix
new file mode 100644
index 0000000..9dff41d
--- /dev/null
+++ b/guest.nix
@@ -0,0 +1,19 @@
+{ writeShellApplication,
+ guest,
+ zkvms,
+ hostPackages,
+ lib,
+}:
+writeShellApplication {
+ name = "${guest}";
+
+ runtimeInputs = lib.foldr
+ (zkvm: accum: accum ++ [ hostPackages."${zkvm}/${guest}" ])
+ []
+ zkvms;
+
+ text = lib.foldr
+ (zkvm: accum: accum + hostPackages."${zkvm}/${guest}" + "/bin/${zkvm}_${guest} \"$@\"\n")
+ ""
+ zkvms;
+}