server-configuration/lib/default.nix

30 lines
661 B
Nix

{
self,
nixpkgs,
...
}:
nixpkgs.lib.extend (
_final: prev: let
inherit (prev) mkIf;
in {
extensions = {
createvm = {
name,
system ? nixpkgs.system,
config,
}: {microvm, ...}: {
imports = [microvm.host];
microvm.vms.${name} = {
pkgs = import nixpkgs {inherit system;};
inherit config;
# Host build-time reference to where the MicroVM NixOS is defined
# under nixosConfigurations
flake = self;
# Specify from where to let `microvm -u` update later on
updateFlake = "git+file:///etc/nixos";
};
};
};
}
)