Skip to content

Instantly share code, notes, and snippets.

@adamcstephens
Created December 17, 2023 19:57
Show Gist options
  • Save adamcstephens/4e3e397ab8f562210caeea44789255ad to your computer and use it in GitHub Desktop.
Save adamcstephens/4e3e397ab8f562210caeea44789255ad to your computer and use it in GitHub Desktop.
#!/usr/bin/env nu
def main [--vm: bool = true, --container: bool = true] {
if ($vm) {
print ":: [virtual-machine] building image"
let paths = nix-build -A lxdVirtualMachineImageMeta.x86_64-linux -A lxdVirtualMachineImage.x86_64-linux ./nixos/release.nix | lines
print ":: [virtual-machine] importing image"
incus image import --alias nixos/unstable/virtual-machine ($paths.0 + /tarball/nixos-system-x86_64-linux.tar.xz) ($paths.1 + /nixos.qcow2)
}
if ($container) {
print ":: [container] building image"
let paths = nix-build -A lxdContainerMeta.x86_64-linux -A lxdContainerImageSquashfs.x86_64-linux ./nixos/release.nix | lines
print ":: [container] importing image"
incus image import --alias nixos/unstable/container ($paths.0 + /tarball/nixos-system-x86_64-linux.tar.xz) $paths.1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment