-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release disk and validation test fixes #218
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Similarly to testing/disk/default.nix, this builds a disk image containing | ||
# a full PlayOS installation, with these differences: | ||
# - It uses default system and boot partition sizes. Total disk size is ~20 GiB | ||
# - It produces a (sparsified) qcow2 image rather than a raw one. This reduces | ||
# the image size to ~8GiB | ||
# - It compresses the final image using zstd to reduce disk usage. | ||
# Final compressed file size is around ~4GiB. | ||
{ pkgs | ||
, lib | ||
, install-playos | ||
}: | ||
with pkgs; | ||
with lib; | ||
let | ||
# all sizes in MiB | ||
partSizes = { | ||
boot = 525; # 525 MiB (matches install-playos default) | ||
system = 1024 * 9; # 9 GiB (install-playos default - 1GiB) | ||
data = 400; # 400 MiB (same as testing/disk/default.nix) | ||
}; | ||
diskSizeMiB = 8 + partSizes."boot" + partSizes."data" + (partSizes."system" * 2) + 1; | ||
in | ||
vmTools.runInLinuxVM ( | ||
runCommand "build-playos-release-disk" | ||
{ | ||
buildInputs = [install-playos]; | ||
|
||
preVM = '' | ||
diskImage=nixos.raw | ||
truncate -s ${toString diskSizeMiB}MiB $diskImage | ||
''; | ||
|
||
postVM = '' | ||
mkdir -p $out | ||
${pkgs.qemu}/bin/qemu-img convert -f raw -O qcow2 $diskImage $out/playos-disk.img | ||
rm $diskImage | ||
${pkgs.zstd}/bin/zstd --rm -f $out/playos-disk.img -o $out/playos-disk.img.zst | ||
diskImage=$out/playos-disk.img.zst | ||
''; | ||
memSize = 1024; | ||
} | ||
'' | ||
# machine-id of development image is hardcoded. | ||
install-playos \ | ||
--device /dev/vda \ | ||
--machine-id "f414cca8312548d29689ebf287fb67e0" \ | ||
--partition-size-boot ${toString partSizes."boot"} \ | ||
--partition-size-system ${toString partSizes."system"} \ | ||
--partition-size-data ${toString partSizes."data"} \ | ||
--no-confirm | ||
'' | ||
) + "/playos-disk.img.zst" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In
testing/disk/default.nix
, diskSizeMiB is:Is there a reason to have 9 additional MiB here, and 10 in the other file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I am not sure why I set it to
10
intesting/disk/default.nix
- probably did it without much thought.Here the
+8MiB
and+1MiB
match the initial disk alignment sector size and extra space requirements as defined in install-playos.py.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update
testing/disk/default.nix
and use the same logic, using8 + … + 1
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do it in a separate PR, it is not related to these changes.