mirror of
https://github.com/srid/nixos-config.git
synced 2026-05-11 00:55:58 +08:00
Add incus container
This commit is contained in:
parent
11dc14ddfe
commit
a95f675a1f
3 changed files with 68 additions and 12 deletions
|
|
@ -1,18 +1,35 @@
|
|||
{ inputs, ... }: {
|
||||
perSystem = { pkgs, ... }: {
|
||||
apps.incus-image-import.program = pkgs.writeShellApplication {
|
||||
name = "incus-image-import";
|
||||
text = ''
|
||||
NAME=$1
|
||||
perSystem = { pkgs, system, ... }: {
|
||||
apps = {
|
||||
incus-image-vm-import.program = pkgs.writeShellApplication {
|
||||
name = "incus-image-vm-import";
|
||||
text = ''
|
||||
NAME=$1
|
||||
|
||||
echo "Building image ... "
|
||||
METADATA=$(nix build --no-link --print-out-paths ${inputs.self}#nixosConfigurations."$NAME".config.system.build.metadata)/tarball/
|
||||
IMG=$(nix build --no-link --print-out-paths ${inputs.self}#nixosConfigurations."$NAME".config.system.build.qemuImage)/nixos.qcow2
|
||||
echo "Building image ... "
|
||||
METADATA=$(nix build --no-link --print-out-paths ${inputs.self}#nixosConfigurations."$NAME".config.system.build.metadata)/tarball/
|
||||
IMG=$(nix build --no-link --print-out-paths ${inputs.self}#nixosConfigurations."$NAME".config.system.build.qemuImage)/nixos.qcow2
|
||||
|
||||
echo "Importing ... "
|
||||
set -x
|
||||
sudo incus image import --alias srid/"$NAME" "$METADATA"/*.tar.xz "$IMG"
|
||||
'';
|
||||
echo "Importing ... "
|
||||
set -x
|
||||
sudo incus image import --alias srid/"$NAME" "$METADATA"/*.tar.xz "$IMG"
|
||||
'';
|
||||
};
|
||||
|
||||
incus-image-container-import.program = pkgs.writeShellApplication {
|
||||
name = "incus-image-container-import";
|
||||
text = ''
|
||||
NAME=$1
|
||||
|
||||
echo "Building image ... "
|
||||
METADATA=$(nix build --no-link --print-out-paths ${inputs.self}#nixosConfigurations."$NAME".config.system.build.metadata)/tarball/
|
||||
IMG=$(nix build --no-link --print-out-paths ${inputs.self}#nixosConfigurations."$NAME".config.system.build.squashfs)/nixos-lxc-image-${system}.squashfs
|
||||
|
||||
echo "Importing ... "
|
||||
set -x
|
||||
sudo incus image import --alias srid/"$NAME" "$METADATA"/*.tar.xz "$IMG"
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue