Skip to content

Commit

Permalink
try VHD file
Browse files Browse the repository at this point in the history
  • Loading branch information
arianvp committed Nov 27, 2023
1 parent 29537b5 commit b0dd5b6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/upload-ami.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ jobs:
aws-region: eu-central-1
- name: Build AMI
run: |
nix build .#nixosConfigurations.amazonImage-x64_64-linux.config.system.build.imageInfo
nix build .#nixosConfigurations.amazonImage-x64_64-linux.config.system.build.amazonImage
- name: Upload AMIs
run: |
# nix develop --command python3 ./upload_ami/cli.py --image-info ./result/nix-support/image-info.json --s3-bucket images20231124161256194400000001
nix develop --command python3 ./upload_ami/cli.py --image-info ./result --s3-bucket images20231124161256194400000001
nix develop --command python3 ./upload_ami/cli.py --image-info ./result/nix-support/image-info.json --s3-bucket images20231124161256194400000001
15 changes: 15 additions & 0 deletions modules/amazon-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@ in
boot_mode = "uefi";
};

system.build.amazonImage =
# For some reason amazon doesn't like RAW files???
pkgs.runCommand "amazon-image" { } ''
mkdir -p $out
mkdir -p $out/nix-support
${pkgs.qemu-utils}/bin/qemu-img convert -f raw -O vpc ${config.system.build.image}/image.raw $out/image.vhd
cat <<EOF > $out/nix-support/image-info.json
{
"label": "${config.system.nixos.label}",
"system": "${pkgs.stdenv.hostPlatform.system}",
"file": "$out/image.vhd"
}
EOF
'';

image.repart.name = "${config.system.nixos.distroId}-${config.system.nixos.label}-${pkgs.stdenv.hostPlatform.system}";
image.repart.partitions = {
"00-esp" = {
Expand Down

0 comments on commit b0dd5b6

Please sign in to comment.