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

fileExtension is wrong when setting sdImage.compressImage = false #379

Open
DerRockWolf opened this issue Sep 13, 2024 · 0 comments
Open

Comments

@DerRockWolf
Copy link

I'm not sure it this would be considered a bug.

If one adjust an existing format using formatConfigs and changes something that affects the resulting file extension, e.g.,:

{
  formatConfigs = {
    sd-aarch64 = {lib, ...}: {
      sdImage.compressImage = false;
    };
  };
}

and execute nix build .#nixosConfigurations.HOST.config.formats.sd-aarch64 the following error is thrown:

No target file found for sdImage format
Check the content of this build path: /nix/store/5dy36v03np7kwf58vdpciwmz3n4lwc61-nixos-sd-image-24.11.20240906.574d1ea-aarch64-linux.img

This can be fixed by overriding fileExtension with ".img*" (instead of ".img.*").

{
  formatConfigs = {
    sd-aarch64 = {lib, ...}: {
      sdImage.compressImage = false;
      fileExtension = lib.mkForce ".img*";
    };
  };
}

It took me quite some time to find what was wrong.
Should we adjust the fileExtension default and maybe provide a few more details in the error message?

Code:

target=$(find '${conf.config.system.build.${conf.config.formatAttr}}' -name '*${conf.config.fileExtension}' -xtype f -print -quit)
if [ -z "$target" ]; then
echo "No target file found for ${conf.config.formatAttr} format"
echo "Check the content of this build path: ${conf.config.system.build.${conf.config.formatAttr}}"
exit 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant