Skip to content

Various eval fixes with allowAliases = false#276112

Merged
infinisil merged 9 commits intoNixOS:masterfrom
tweag:some-eval-fixes
Dec 31, 2023
Merged

Various eval fixes with allowAliases = false#276112
infinisil merged 9 commits intoNixOS:masterfrom
tweag:some-eval-fixes

Conversation

@infinisil
Copy link
Member

Description of changes

This fixes evaluation of various attributes with allowAliases = false, sometimes by removing them if they shouldn't exist at all with allowAliases = false:

  • chia
  • chia-dev-tools
  • chia-plotter
  • dotnet-sdk_2
  • dotnet-sdk_3
  • dotnet-sdk_5
  • gofumpt
  • gruvbox-plus-icons
  • mod_wsgi
  • nextcloud25
  • nextcloud25Packages
  • nix-repl
  • teams
  • wtk

Things done

  • Tested evaluation of these attributes with nix-instantiate --eval --arg config '{ allowAliases = false; }' -A <attr>. They either don't exist or succeed

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added 8.has: clean-up This PR removes packages or removes other cruft 8.has: package (new) This PR adds a new package labels Dec 22, 2023
@ofborg ofborg bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Dec 22, 2023
Copy link
Contributor

@eureka-cpu eureka-cpu left a comment

Choose a reason for hiding this comment

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

It seems there are some changes here that can be viewed as unrelated, ie the changes to the icon package. If it's not too much trouble, can you group the commits separately and add closing keywords for corresponding issues?

I'm fairly new to the Nix language btw, so feel free to ignore my review if you don't find it helpful 🙂

Comment on lines -59 to -62
in
if stdenv.isDarwin
then darwin
else throw "Teams app for Linux has been removed as it is unmaintained by upstream. (2023-09-29)"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it unreasonable to still include this error message for Linux users?

Copy link
Member Author

@infinisil infinisil Dec 22, 2023

Choose a reason for hiding this comment

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

There's no good infrastructure to have that easily, and I think the default error for unsupported platforms is good enough:

error: Package ‘teams-1.6.00.4464’ in /home/tweagysil/src/nixpkgs/pr/pkgs/applications/networking/instant-messengers/teams/default.nix:18
  is not available on the requested hostPlatform:
    hostPlatform.config = "x86_64-unknown-linux-gnu"
    package.meta.platforms = [
      "x86_64-darwin"
      "aarch64-darwin"
    ]
    package.meta.badPlatforms = [ ]
  , refusing to evaluate.

Comment on lines -45 to -56
nextcloud25 = throw ''
Nextcloud v25 has been removed from `nixpkgs` as the support for is dropped
by upstream in 2023-10. Please upgrade to at least Nextcloud v26 by declaring

services.nextcloud.package = pkgs.nextcloud26;

in your NixOS config.

WARNING: if you were on Nextcloud 24 you have to upgrade to Nextcloud 25
first on 23.05 because Nextcloud doesn't support upgrades across multiple major versions!
'';

Copy link
Contributor

Choose a reason for hiding this comment

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

This is still fairly recent. Can we not remove this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure what you mean. I just moved this part around while keeping the same error message, since I know close to nothing about all of these packages 😆

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah just saw #276112 (comment) haha

nativeBuildInputs = [ gtk3 ];

propagatedBuildInputs = [ breeze-icons gnome-icon-theme hicolor-icon-theme ];
propagatedBuildInputs = [ plasma5Packages.breeze-icons gnome-icon-theme hicolor-icon-theme ];
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these changes necessary? They seem to bringing more than just the icons into scope for an icon package.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah this is necessary because on master, this fails:

$ nix-instantiate -A gruvbox-plus-icons --arg config '{ allowAliases = false; }'
error:
       … while calling the 'throw' builtin

         at /home/tweagysil/src/nixpkgs/pr/lib/customisation.nix:206:13:

          205|        then makeOverridable f allArgs
          206|        else throw "lib.customisation.callPackageWith: ${error}";
             |             ^
          207|

       error: lib.customisation.callPackageWith: Function called without required argument "breeze-icons" at /home/tweagysil/src/nixpkgs/pr/pkgs/by-name/gr/gruvbox-plus-icons/package.nix:6

This is because breeze-icons is an alias. We can look into aliases.nix to see where it comes from:

inherit (plasma5Packages)
akonadi akregator arianna ark bluedevil bomber bovo breeze-grub breeze-gtk
breeze-icons breeze-plymouth breeze-qt5 colord-kde discover dolphin dragon elisa falkon

So the change here just inlines the alias, therefore not using the alias anymore

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see

Comment on lines +650 to +660
nextcloud25 = throw ''
Nextcloud v25 has been removed from `nixpkgs` as the support for is dropped
by upstream in 2023-10. Please upgrade to at least Nextcloud v26 by declaring

services.nextcloud.package = pkgs.nextcloud26;

in your NixOS config.

WARNING: if you were on Nextcloud 24 you have to upgrade to Nextcloud 25
first on 23.05 because Nextcloud doesn't support upgrades across multiple major versions!
''; # Added 2023-10-13
Copy link
Contributor

Choose a reason for hiding this comment

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

Disregard my previous comment about the message being removed.

Copy link
Contributor

@katexochen katexochen left a comment

Choose a reason for hiding this comment

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

Changes lgtm, thanks. :)
I guess it's to expensive to check this on every PR?

@infinisil
Copy link
Member Author

I guess it's to expensive to check this on every PR?

It's actually very cheap, under 10 seconds on my machine! Here's how to see all failing attributes on x86_64-linux:

❯ nix repl lib
warning: future versions of Nix will require using `--file` to load a file
Welcome to Nix 2.18.1. Type :? for help.

Loading installable ''...
Added 422 variables.
nix-repl> attrNames (filterAttrs (name: value: ! (builtins.tryEval value).success) (import ./. { config.allowAliases = false; system = "x86_64-linux"; }))
[ "AAAAAASomeThingsFailToEvaluate" "androidsdk_9_0" "gams" "gccWithoutTargetLibc" "libcCross" "mathematica10" "mathematica11" "mathematica9" "neoload" "pkgsx86_64Darwin" "sc2-headless" "yabai" ]

There's not a lot left, and a bunch will also be fixed with #276120.

However, having taken a look at the rest of these, there are some kind of tricky cases which I'm not sure yet how to handle. Furthermore, the list is much longer if you use e.g. x86_64-darwin instead, or even some obscure platform. Then the question is whether this should be checked for all platforms somehow. And then there's also cross compilation, which probably has a ton more failures.

So overall, this PR is just a small step in the bigger picture :)

@delroth delroth added 12.approvals: 2 This PR was reviewed and approved by two persons. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Dec 22, 2023
@katexochen
Copy link
Contributor

Thanks for the nice explanations (also on the review comments) @infinisil. It's great to get such background, I learned a lot reviewing this PR! 😊

@RGBCube
Copy link
Contributor

RGBCube commented Dec 24, 2023

LGTM as well

@delroth delroth added 12.approvals: 3+ This PR was reviewed and approved by three or more persons. and removed 12.approvals: 2 This PR was reviewed and approved by two persons. labels Dec 28, 2023
@infinisil infinisil merged commit c98d1bd into NixOS:master Dec 31, 2023
@infinisil infinisil deleted the some-eval-fixes branch December 31, 2023 21:07
mkchromecast = libsForQt5.callPackage ../applications/networking/mkchromecast { };

# Backwards compatibility.
mod_dnssd = apacheHttpdPackages.mod_dnssd;
Copy link
Member

Choose a reason for hiding this comment

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

This broke building GNOME with aliases disabled, fixed in #278744

Copy link
Member

Choose a reason for hiding this comment

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

Ofborg didn't catch it when calculating outpaths because of #271123 (comment) as well, by the way (I've been investigating this)

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm working on a fix

Copy link
Member Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

8.has: clean-up This PR removes packages or removes other cruft 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 12.approvals: 3+ This PR was reviewed and approved by three or more persons. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants