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

diskoLib.vmToolsSupportsCustomQemu might test incorrect field #904

Closed
RadxaYuntian opened this issue Nov 29, 2024 · 2 comments · Fixed by #906
Closed

diskoLib.vmToolsSupportsCustomQemu might test incorrect field #904

RadxaYuntian opened this issue Nov 29, 2024 · 2 comments · Fixed by #906
Labels
bug Something isn't working confirmed Issue has been confirmed/reproduced

Comments

@RadxaYuntian
Copy link

RadxaYuntian commented Nov 29, 2024

Introduced in #851, diskoLib.vmToolsSupportsCustomQemu is used to check if the current nixpkgs supports overriding QEMU package.

While disko in general should be used with nixos-unstable, due to #900 I'm current targetting nixos-24.11. With the following test project I got the following error:

       error:
       Failed assertions:
       - You have set config.disko.imageBuild.qemu, but vmTools in your nixpkgs version "24.11.20241123.0c58267"
       does not support overriding the qemu package with the customQemu option yet.
       Please upgrade nixpkgs so that `lib.version` is at least "24.11.20240709".

Here is the table for the tested combinations:

nixos-24.11 nixos-unstable
diskoImages This issue OK
diskoImagesScript This issue #900

Checking lib.versionAtLeast "24.11.20241123.0c58267" "24.11.20240709" in nix repl got the expected True. After checking the source I found out that the assert is printing lib.version but vmToolsSupportsCustomQemu is checking pkgs.lib.version. I updated the assert message and the error now makes more sense:

       error:
       Failed assertions:
       - You have set config.disko.imageBuild.qemu, but vmTools in your nixpkgs version "24.11pre-git"
       does not support overriding the qemu package with the customQemu option yet.
       Please upgrade nixpkgs so that `lib.version` is at least "24.11.20240709".

I think we should change vmToolsSupportsCustomQemu to check lib.version as well, because that value looks to be more correct, but I know little between the difference of those 2 fields and how they actually should be used.

@RadxaYuntian
Copy link
Author

Ping @iFreilicht who is the author of the original check.

@iFreilicht iFreilicht added bug Something isn't working confirmed Issue has been confirmed/reproduced labels Nov 29, 2024
@iFreilicht
Copy link
Contributor

Can confirm. I looked into what could be causing the issue, and encountered something weird. I've downloaded your example flake, and it seems the pkgs that arrives in the configuration is different from the flake's input:

$ nix repl 
Lix 2.91.1
Type :? for help.
nix-repl> :lf .
Added 9 variables.

nix-repl> inputs.nixpkgs.lib.version
"24.11.20241123.0c58267"

nix-repl> inputs.nixpkgs.legacyPackages.x86_64-linux.lib.version
"24.11.20241123.0c58267"

nix-repl> inputs.disko.inputs.nixpkgs.lib.version
"24.11.20241123.0c58267"

nix-repl> nixosConfigurations.test.pkgs.lib.version
"24.11pre-git"

nix-repl> nixosConfigurations.test.config.disko.imageBuilder.pkgs.lib.version
"24.11pre-git

Either way, the solution is as you say, just use lib instead of pkgs.lib. Fix is in #906

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed Issue has been confirmed/reproduced
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants