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

lib.systems.inspect: deprecate isEfi #264297

Closed
wants to merge 1 commit into from
Closed

lib.systems.inspect: deprecate isEfi #264297

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Oct 30, 2023

Description of changes

This predicate never did what it claimed.

(U)EFI support is a property of a specific motherboard, not of a platform or an entire architecture. This predicate was used only by two packages. This commit relocates the data previously held by inspect.isEfi to the meta.platforms of gnu-efi and the withEfi default value of systemd.

We need to make room for isEfi (or perhaps isUefi) in preparation for #231951 so we should start the deprecation process sooner rather than later.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

This predicate never did what it claimed.

(U)EFI support is a property of a specific motherboard, not of a
platform or an entire architecture.  This predicate was used only by
two packages.  This commit relocates the data previously held by
`inspect.isEfi` to the `meta.platforms` of `gnu-efi` and the
`withEfi` default value of `systemd`.

We need to make room for `isEfi` (or perhaps `isUefi`) in
preparation for #231951 so we
should start the deprecation process sooner rather than later.
@ghost ghost mentioned this pull request Oct 30, 2023
13 tasks
@github-actions github-actions bot added 6.topic: systemd 6.topic: lib The Nixpkgs function library labels Oct 30, 2023
Comment on lines +129 to +136
# Unfortunately a strictness bug in lib.systems.equals means that
# we can't lib.warn on accesses to boolean values. If
# https://github.com/NixOS/nixpkgs/pull/238331 is merged we can go
# back to using Nix `==` and this warning can be enabled.
#
#predicates = result.predicates // {
# isEfi = argument: warnEfiDeprecated (result.predicates.isEfi argument);
#};
Copy link
Author

Choose a reason for hiding this comment

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

This problem was introduced by

After that PR, we are no longer able to deprecate boolean-valued attributes of platform objects because lib.systems.equals is too strict.

We could get back to using ==, which is lazy enough to handle this correctly, by merging

@ghost ghost marked this pull request as ready for review October 30, 2023 05:26
@ghost ghost requested review from a team, alyssais and Ericson2314 as code owners October 30, 2023 05:26
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 1-10 labels Oct 30, 2023
@ghost ghost requested a review from RaitoBezarius October 30, 2023 07:29
Copy link
Member

@alyssais alyssais left a comment

Choose a reason for hiding this comment

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

Either this approach or what's in #263711 are fine with me.

platforms = platforms.linux;
platforms = with lib.systems.inspect.patterns; map (pat: pat // isLinux) ([
isArmv6 ] ++ isArmv7 ++ [ isArmv8 isRiscV isx86
]);
Copy link
Member

Choose a reason for hiding this comment

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

Using doubles strings rather than patterns would make the code here less complicated, and have the same effect, right?

Copy link
Member

Choose a reason for hiding this comment

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

I thought @Ericson2314 wanted to get rid of double strings but maybe I misinterpreted him.

Copy link
Member

Choose a reason for hiding this comment

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

It's not something we're going to move away from one package at a time regardless…

Copy link
Author

@ghost ghost Nov 1, 2023

Choose a reason for hiding this comment

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

Using doubles strings rather than patterns would make the code here less complicated, and have the same effect, right?

Not exactly.

The isEfi predicate that I removed uses a pattern, so to get precisely the same effect I used a pattern here. The main issue is that the { cpu = { family = "arm"; version = 6,7; }; } patterns will match any string with the prefix armv6/armv7, and likewise for version = 8 with aarch64. There are quite a lot of these, with more being added all the time apparently (aarch64ec!?)

Also double-strings are icky gross.

It's not something we're going to move away from one package at a time regardless…

I dunno, isn't incremental migration the easy way to do it?

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: lib The Nixpkgs function library 6.topic: systemd 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants