nix-darwin icon indicating copy to clipboard operation
nix-darwin copied to clipboard

`nixpkgs.constructedByUs` assertion message references variable that doesn't exist

Open lilyball opened this issue 10 months ago • 0 comments

The nixpkgs module has an assertion for nixpkgs.constructedByUs whose message references a variable darwinExpectedSystem that does not exist. This does not cause an issue under normal evaluation, but if the message is ever evaluated, it will throw an error.

https://github.com/LnL7/nix-darwin/blob/8b6ea26d5d2e8359d06278364f41fbc4b903b28a/modules/nix/nixpkgs.nix#L326-L333

This was introduced in PR #723. I noticed this when I decided to print the assertions config.

> nix eval .#darwinConfigurations.$(hostname).config.assertions
error:
       … while evaluating the attribute 'message'

         at /nix/store/5gybvvfjyd29q9n4grrm7165vznl739b-source/modules/nix/nixpkgs.nix:331:11:

          330|           assertion = cfg.constructedByUs -> !hasPlatform -> cfg.system == pkgsSystem;
          331|           message = "The nix-darwin nixpkgs.pkgs option was set to a Nixpkgs invocation that compiles to target system ${pkgsSystem} but nix-darwin was configured for system ${darwinExpectedSystem} via nix-darwin option nixpkgs.system. The nix-darwin system settings must match the Nixpkgs target system.";
             |           ^
          332|         }

       error: undefined variable 'darwinExpectedSystem'

       at /nix/store/5gybvvfjyd29q9n4grrm7165vznl739b-source/modules/nix/nixpkgs.nix:331:177:

          330|           assertion = cfg.constructedByUs -> !hasPlatform -> cfg.system == pkgsSystem;
          331|           message = "The nix-darwin nixpkgs.pkgs option was set to a Nixpkgs invocation that compiles to target system ${pkgsSystem} but nix-darwin was configured for system ${darwinExpectedSystem} via nix-darwin option nixpkgs.system. The nix-darwin system settings must match the Nixpkgs target system.";
             |                                                                                                                                                                                 ^
          332|         }

lilyball avatar Oct 13 '23 21:10 lilyball