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

Make it possible to override VSCode version #44897

Closed
wants to merge 1 commit into from

Conversation

matklad
Copy link
Member

@matklad matklad commented Aug 11, 2018

Motivation for this change

Make version, channel and hash of VS Code derivation overrideable, so that it's easier to use the nightly versions. See https://discourse.nixos.org/t/best-way-to-install-pre-release-versions-of-software/651

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • 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/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

@eadwu
Copy link
Member

eadwu commented Aug 11, 2018

Isn't this possible through overrideAttrs against src?

@matklad
Copy link
Member Author

matklad commented Aug 11, 2018

It is possible, but the user will then need to hard-code the url from fetchUrl and otherwise to peek inside the derivation to understand what needs to be done.

@srhb
Copy link
Contributor

srhb commented Aug 12, 2018

Sorry, I don't understand the motivation here. The normal way to override a version in nixpkgs is exactly

drv.overrideAttrs(oa : {
  src = ...
};

If this is also possible in this package, why do we need to make it possible using override instead of overrideAttrs?

@srhb srhb self-assigned this Aug 12, 2018
@matklad
Copy link
Member Author

matklad commented Aug 12, 2018

Sure, let me expand on this a bit! It's true that it is possible to override everything, including the source code, using overrideAttrs. However, this is not a convenient for particular use case of "I want to install a specific version of this package using nix-shell". It's not convenient, b/c you'll need to figure out not only the version and hash of the package (which are usually published by vendors in some easily human-readable form), but the download url as well, and that might be tricky: usually its a template string, constructed from version, platform and other bits, and reconstructing it by hand is not really fun and requires peeking into the derivation source. Moreover, version in particular also often ends up in various attrs, most notably name, and hunting that down also requires some work.

What I am getting at is that it would be really convenient, for one off overrides, to be able to say pkgs.myApp.override { version = "0.92.1"; sha256 ="..."; }, without really picking into derivation's internals. However I see now that, presumably, none of the packages make version/hash overridable, so looks like this is a more general question than just changing this single pattern. I'll rise the more general discussion in the forum.

@srhb
Copy link
Contributor

srhb commented Aug 12, 2018

@matklad I understand your reasoning and motivation now. Here's my concern, which you already summarized (and maybe you can reuse that or link the discussion and I'll add it myself:)

If we were to add a section on overriding package versions in the nixpkgs manual (which we really ought to,) your changes would imply that it would sound like the following:

"Check if the package accepts version and sha256 attributes. If so, use pkg.override. Otherwise, use pkg.overrideAttrs and override the src attribute"

I'm not a fan of this conditional. I think it should be a uniform process.

@matklad
Copy link
Member Author

matklad commented Aug 12, 2018

Started a thread: https://discourse.nixos.org/t/should-version-and-sha256-attributes-of-packages-be-easily-overridable/658

Closing this as it's clear that it's more of a global policy question rather than a particular single package issue.

@matklad matklad closed this Aug 12, 2018
@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixosstag.fcio.net/t/should-version-and-sha256-attributes-of-packages-be-easily-overridable/658/1

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