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

cli: Fix "attribute missing" error when using flake #877

Merged
merged 3 commits into from
Nov 16, 2024

Conversation

iFreilicht
Copy link
Contributor

@iFreilicht iFreilicht commented Nov 13, 2024

Fixes #871

Previously, if a user used v2.10.0 (currently unreleased master), an
error like this would be displayed:

error: attribute '_cliDestroyFormatMount' missing
   at /nix/store/fbqgaij9d3b373rq1iav5glzr4dy77qf-disko/share/disko/cli.nix:73:7:
       72|     else if (lib.traceValSeq hasDiskoModuleFlake) then
       73|       (builtins.getFlake flake).nixosConfigurations.${flakeAttr}.config.system.build.${diskoAttr}
         |       ^
       74|     else

This situation now produces a more helpful error:

Error: Attribute `nixosConfigurations.testmachine.config.system.build._cliDestroyFormatMount`
       not found in flake `/home/felix/repos-new/disko`!
       This is probably caused by the locked version of disko in the flake
       being different from the version of disko you executed.
EITHER set the `disko` input of your flake to `github:nix-community/disko/latest`,
       run `nix flake update disko` in the flake directory and then try again,
OR run `nix run github:nix-community/disko/v1.9.0 -- --help` and use one of its modes.

Also, the final config's attributes have different names than those defined in ./default.nix, so even when updating the input on master did not fix this issue previously.

Fixes #871

Previously, if a user used v2.10.0 (currently unreleased master), an
error like this would be displayed:

    error: attribute '_cliDestroyFormatMount' missing
       at /nix/store/fbqgaij9d3b373rq1iav5glzr4dy77qf-disko/share/disko/cli.nix:73:7:
           72|     else if (lib.traceValSeq hasDiskoModuleFlake) then
           73|       (builtins.getFlake flake).nixosConfigurations.${flakeAttr}.config.system.build.${diskoAttr}
             |       ^
           74|     else

This situation now produces a more helpful error:

    Error: Attribute `nixosConfigurations.testmachine.config.system.build._cliDestroyFormatMount`
           not found in flake `/home/felix/repos-new/disko`!
           This is probably caused by the locked version of disko in the flake
           being different from the version of disko you executed.
    EITHER set the `disko` input of your flake to `github:nix-community/disko/latest`,
           run `nix flake update disko` in the flake directory and then try again,
    OR run `nix run github:nix-community/disko/v1.9.0 -- --help` and use one of its modes.
The final config's attributes have different names than those defined in
./default.nix, so this failed previously.
@iFreilicht iFreilicht force-pushed the fix-disko-flake-compat-errr branch from fb4b5de to f4feab3 Compare November 14, 2024 18:19
@Mic92
Copy link
Member

Mic92 commented Nov 16, 2024

@mergify queue

Copy link
Contributor

mergify bot commented Nov 16, 2024

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at cb64993

@mergify mergify bot merged commit cb64993 into master Nov 16, 2024
4 checks passed
@mergify mergify bot deleted the fix-disko-flake-compat-errr branch November 16, 2024 08:40
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

Successfully merging this pull request may close these issues.

possible breakage when using flakes as input
2 participants