Skip to content
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

packages/nixos: minimize image size #1066

Merged
merged 2 commits into from
Dec 12, 2024
Merged

packages/nixos: minimize image size #1066

merged 2 commits into from
Dec 12, 2024

Conversation

msanft
Copy link
Contributor

@msanft msanft commented Dec 12, 2024

Previously, our bare-metal Kata image weighed in at around 838MB. This PR reduces its size to about 561MB. It does so by incorporating the following changes:

  • Remove Nix (CLI, daemon and store database) from the image closure. Since our image is immutable anyways, we do not need to include this anyways. Removing this saves around 188MB in image size.
  • Remove Perl and Python interpreters from the image closure. These are only required for parts Nix' traditional "activation" mechanism, all of which have non-interpreter alternatives available. A tangible example for this is the population of /etc, which traditionally was implemented in Perl, but now has an overlayfs-based alternative for available. This saves around 90MB in image size.

Minimizations for the GPU-enabled image are intentionally deferred to be implemented in a follow-up PR.

Our images are immutable and thus don't need the Nix CLI and daemon, which - by design - can only work in a mutable system. This saves 188MB in image size
This removes Perl and Python dependencies from our NixOS images. These are used throughout scripts for user generation and setup of volatile directories at boot (like `/etc`). However, this functionality can also be implemented without those interpreters, allowing us to remove them from the system closure. This saves around 168MB in image size.
@msanft msanft requested a review from burgerdev December 12, 2024 13:20
@msanft msanft requested a review from katexochen as a code owner December 12, 2024 13:20
@msanft msanft added the no changelog PRs not listed in the release notes label Dec 12, 2024
Copy link
Contributor

@burgerdev burgerdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, thanks!

@msanft msanft merged commit c3db10a into main Dec 12, 2024
13 checks passed
@msanft msanft deleted the msanft/minimal-iumage branch December 12, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog PRs not listed in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants