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

nixos: use pkgsi686Linux for pkgs_i686 #24772

Merged
merged 1 commit into from Apr 26, 2017
Merged

Conversation

corngood
Copy link
Contributor

@corngood corngood commented Apr 9, 2017

Motivation for this change

I found that my packageOverrides for e.g. mesa_drivers weren't being respected in pkgs_i686, so my override was having an effect in /run/opengl-drivers/ but not /run/opengl-drivers32/.

This is what I came up with, but it's a pretty fundamental change, and I'm not totally sure of the consequences. It does seem to behave more intuitively though. Presumably overlays would be affected in a similar way.

Thoughts?

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@mention-bot
Copy link

@corngood, thanks for your PR! By analyzing the history of the files in this pull request, we identified @nckx, @nbp and @edolstra to be potential reviewers.

@nbp
Copy link
Member

nbp commented Apr 10, 2017

If so, we should probably just remove the pkgs_i686 module argument, and add a release note with an example which highlight how to replace pkgs_i686 by pkgs.pkgsi686Linux.

@corngood
Copy link
Contributor Author

@nbp That seems reasonable to me. What about then renaming pkgsi686Linux to pkgs_i686? It's mostly used like:

androidenv = callPackage ../development/mobile/androidenv {
    pkgs_i686 = pkgsi686Linux;
};

I'm not sure what we gain from having the kernel in the name, when it's not there for callPackage_i686, stdenv_32bit etc. It should probably also have a similar predicate to stdenv_32bit. Perhaps we should even rename stdenv_32bit to match as well, and stick to a common suffix (_i686, -i686, _32bit, -32bit)?

@nbp
Copy link
Member

nbp commented Apr 10, 2017

Both names are coming from 2010. I think having Linux made sense because the system string is i686-linux. As you pointed out, this is not respected by other functions, so we might as well convert it to pkgs_i686, but I am afraid this might break more users than the NixOS argument. In which case we should probably have both aliases for a while and remove the old one after X releases.

@corngood
Copy link
Contributor Author

I did a bit of renaming and removed the uses of the module param. I left the old names deprecated for the module param and stuff in all-packages, but the changes to the package params named pkgs_i686 would be breaking for overrides.

I went with lisp-case names since that seems to be the general trend.

  pkgs-i686 =
    if system == "x86_64-linux" then
      forceSystem "i686-linux" "i386"
    else
      self;

I based this on stdenv_32bit, but it seems a bit dirty. Maybe it should have a case for i686-linux -> self, and error otherwise? Is self even correct here?

Copy link
Member

@nbp nbp left a comment

Choose a reason for hiding this comment

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

These changes deserve an entry in the release notes, as well as trace messages to suggest users to follow the renaming which happens in these patches.

if system == "x86_64-linux" then
forceSystem "i686-linux" "i386"
else
self;
Copy link
Member

Choose a reason for hiding this comment

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

I would just throw for cases which are not supported.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've left i686-linux to point at itself, and made it throw otherwise.


# DEPRECATED
pkgsi686Linux = pkgs-i686;
callPackage_i686 = callPackage-i686;
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure about this naming convention, do we have any precedent / coding style suggesting we should go one way or the other? Any reason to rename it at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have a particular desire to do these renames. I'm mostly worried about the packageOverrides fix.

I'm happy to remove the uses of the pkgs_i686 module argument, and add a trace warning for it as well, and we can leave it at that for now?

Copy link
Member

Choose a reason for hiding this comment

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

I'm happy to remove the uses of the pkgs_i686 module argument, and add a trace warning for it as well, and we can leave it at that for now?

Yes, with a release-note entry.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The nixpkgs release notes haven't been touched in a few years. Do you mean the nixos release notes for 17.09?

_module.args.pkgs = import ../../.. config.nixpkgs;
_module.args.pkgs = _pkgs;
# DEPRECATED
_module.args.pkgs-i686 = _pkgs.pkgs-i686;
Copy link
Member

Choose a reason for hiding this comment

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

Most people don't read the code, they copy working examples. I think this deserve a proper builtins.trace message when used, to at least warn the user that uses of this argument are deprecated.

I will also note that using a new name for a deprecated feature is weird. Rename it to pkgs_i686.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I dropped the change that deprecated this argument. It wasn't as simple as putting a trace here, because the attribute set seems to be evaluated and merged even if it's not used in any modules.

@@ -498,7 +507,7 @@ with pkgs;
});

androidenv = callPackage ../development/mobile/androidenv {
pkgs_i686 = pkgsi686Linux;
pkgs-i686 = pkgs-i686;
Copy link
Member

Choose a reason for hiding this comment

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

Knowing that callPackage is used, this attribute can be removed, as it would be inherited from self anyway.

@@ -552,7 +561,7 @@ with pkgs;
xcodeenv = callPackage ../development/mobile/xcodeenv { };

titaniumenv = callPackage ../development/mobile/titaniumenv {
pkgs_i686 = pkgsi686Linux;
pkgs-i686 = pkgs-i686;
Copy link
Member

Choose a reason for hiding this comment

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

Same here, remove this line.

@corngood
Copy link
Contributor Author

I went back to the original change. The rename trace was getting fired of from various nix-env operations, and I think it was distracting from the purpose of this change anyway.

@corngood corngood changed the title WIP: nixos: use pkgsi686Linux for pkgs_i686 nixos: use pkgsi686Linux for pkgs_i686 Apr 22, 2017
@corngood
Copy link
Contributor Author

@vcunat @abbradar I'm interested in your feedback on this, since we've talked about gfx drivers in the past.

Copy link
Member

@vcunat vcunat 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 OK. I certainly agree with the spirit of the change. I didn't know this part was ignoring nixpkgs.config.

@vcunat
Copy link
Member

vcunat commented Apr 26, 2017

Deprecation traces always had the problem with inability to differentiate between nix-env -qa and direct reference. There's still no way around that AFAIK; nix-env would probably have to get modified.

I think in this state it can go without an entry in release notes, as pkgs_i686 is only used on a few places and even there it would mean a change only in rather special circumstances (i.e. when you hit this bug).

Copy link
Member

@abbradar abbradar left a comment

Choose a reason for hiding this comment

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

Seems a right thing to do for me. I agree with @vcunat in that perhaps we don't even need a release notes entry for this.

@corngood
Copy link
Contributor Author

I'm happy to add a release note. Without any of the renaming it would just be something like "packageOverrides now applies to packages in pkgsLinuxi686 on 64-bit linux (pkgs_i686 in nixos modules)". I'll do that later today, but if you'd rather not have the note you can use what's here.

I could also open an issue to document the problem I was trying to fix, if that's preferable.

@vcunat vcunat merged commit 7deb425 into NixOS:master Apr 26, 2017
@vcunat
Copy link
Member

vcunat commented Apr 26, 2017

I don't have any preference whether or not to add a release-note entry. I actually wonder whether to pick this to 17.03; I would personally be inclined to do so.

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

Successfully merging this pull request may close these issues.

None yet

5 participants