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

otter-browser: init at 0.9.94 #34275

Merged
merged 2 commits into from Feb 10, 2018
Merged

otter-browser: init at 0.9.94 #34275

merged 2 commits into from Feb 10, 2018

Conversation

lheckemann
Copy link
Member

Motivation for this change
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
    • 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/)
  • Fits CONTRIBUTING.md.

@lheckemann
Copy link
Member Author

@GrahamcOfBorg build otter-browser

@@ -4780,6 +4780,8 @@ with pkgs;

staruml = callPackage ../tools/misc/staruml { inherit (gnome2) GConf; libgcrypt = libgcrypt_1_5; };

otter-browser = callPackage ../applications/networking/browsers/otter {};
Copy link
Member

Choose a reason for hiding this comment

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

Better use qt5.callPackage and specify the dependencies as arguments of your derivation.

@@ -0,0 +1,24 @@
{ stdenv, qt5, cmake, openssl, gst_all_1, fetchFromGitHub
, version ? "0.9.94"
, sourceSha ? "19mfm0f6qqkd78aa6q4nq1y9gnlasqiyk68zgqjp1i03g70h08k5"
Copy link
Member

Choose a reason for hiding this comment

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

Any particular reason for this?
A different version is usually specified using packageOverrides, so no need to have version as an argument.

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 guessing you mean overrideAttrs; the thing with that approach is that it doesn't make overriding it to be a different version as clean, since you don't have the advantage of being able to modify the version inside the recursion which results in a lot more redundancy.

Consider:

otter-browser.override {
  version = "0.9.93";
  sourceSha = "1qlxpkga7whpkhczzqjs0b0ngih7vzi5q3gqr2nlpi2y2x539d0h";
}

vs

otter-browser.overrideAttrs (o: {
  name = "otter-browser-0.9.93";
  src = fetchFromGitHub {
    owner = "otterbrowser";
    repo = "otter";
    rev = "0.9.93";
    sha256 = "1qlxpkga7whpkhczzqjs0b0ngih7vzi5q3gqr2nlpi2y2x539d0h";
  };
})

(only marginally better with a let to set the version).

The approach I've taken here allows reusing the existing code.

Copy link
Member Author

Choose a reason for hiding this comment

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

Discussed briefly with @tilpner and @cleverca22:

sphalerite	I've submitted a PR for a new package where I used a way of specifying the version which isn't used widely in nixpkgs AFAIK and which I suspected might raise some eyebrows but I think it has some concrete advantages and would like some more input on the idea in general.
sphalerite	The idea is that rather than having a let binding or passing a rec set to stdenv.mkDerivation, we make the version string and source hash arguments to the function to make overriding the version a lot simpler. See https://github.com/NixOS/nixpkgs/pull/34275#discussion_r164206558
sphalerite	Any feedback would be very welcome!
tilpner	sphalerite - I'm generally against putting non-dependency arguments there, it can cause hard-to-debug issues with callPackage. And it should probably be sourceSha256
sphalerite	tilpner: hard-to-debug issues with callPackage? Can you elaborate on that? And yes I suppose you're right with the name, that's of course just a minor detail independent of the concept.
sphalerite	tilpner: do you have an idea for how the redundancy might be avoided more nicely?
tilpner	sphalerite - It's fairly innocuous in your case, but it's dangerous if it becomes convention. ncurses takes an argument "unicdoe", and if you happen to overlay that onto your local nixpkgs, it will break with unhelpful errors. It will supply whatever you overlayed as unicode to ncurses, which expects a bool there
tilpner	sphalerite_ - The same happens when you overlay "vanilla", though I forgot which package caused that
sphalerite	tilpner: right, fair enough. And do you have a potential better idea for how to do this?
tilpner	sphalerite - A while ago I proposed fixing this issue gradually, converting every package into two stages of loading, one for dependencies, the next set for configuration. It's a lot of effort though, and nobody wanted to discuss it further
tilpner	sphalerite - A workaround would be to clearly mark them as configuration arguments. unicode -> supportUnicode, vanilla -> useVanilla
tilpner	sphalerite - In your case, srcVersion and srcSha256 maybe? Kind of ugly, yes...
sphalerite	tilpner: that's a shame. Seems like something that might fit with nbp's SOS as well
sphalerite	I think
sphalerite	tilpner: so you think the idea is ok in general, just the names need to be specific enough to avoid a collision?
tilpner	sphalerite - I'm not sold on it. I think I'd rather have otter-browser.overrideAttrs (o: { src = o.src.override { rev = ...; sha256 = ...; }; }) (requires makeOverridable fetchFromGitHub)
sphalerite	tilpner: but then the version bit is still redundant and you're likely to get a derivation with the wrong name resulting from it — because you forget to include it in the override like you did right there
tilpner	sphalerite - Good point :/
sphalerite	tilpner: I find that a lot of the time there are `let`s in nixpkgs which introduce abstractions that can't be used from outside. Arguably allowing them to be used from the outside encourages more tight coupling, but at the same time I don't think there's much in nixpkgs that isn't tightly coupled. Between tight coupling and better potential for reuse (=> less code) and tight coupling and lots of copying and pasting…
sphalerite	`let`s and `rec`s even
clever	sphalerite: what would you say about code like this? https://github.com/NixOS/nixpkgs/blob/8080285966835c202ed426a6f573fe1f53aa0d08/pkgs/games/zandronum/default.nix#L8
tilpner	Why is fmod not a global package there?
clever	tilpner: exactly
tilpner	I guess it's fine if they require custom (old) or patched versions of their libs
tilpner	Don't really want those in global scope
clever	tilpner: there is no other version of fmod available in nixpkgs
tilpner	clever - That's a mistake then :/
clever	yeah
tilpner	sphalerite_ - Most of the time, I think it's okay. Using callPackage to supply args instead of pkgs.foo already decouples
tilpner	sphalerite_ - Of course nixpkgs is still pretty messy, but big overhauls are probably unrealistic

buildInputs = with qt5; [ qtbase qtmultimedia qtwebengine ];

meta = with stdenv.lib; {
license = licenses.gpl3;
Copy link
Member

Choose a reason for hiding this comment

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

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

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

Success for system: x86_64-linux

shrinking RPATHs of ELF executables and libraries in /nix/store/kiqrim8yck98l7x8y9mgkzm0cvkzwfnx-otter-browser-0.9.94
shrinking /nix/store/kiqrim8yck98l7x8y9mgkzm0cvkzwfnx-otter-browser-0.9.94/bin/otter-browser
gzipping man pages under /nix/store/kiqrim8yck98l7x8y9mgkzm0cvkzwfnx-otter-browser-0.9.94/share/man/
strip is /nix/store/mdyy001q67hiks0g24ra53z7ckm4jfr4-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/kiqrim8yck98l7x8y9mgkzm0cvkzwfnx-otter-browser-0.9.94/bin 
patching script interpreter paths in /nix/store/kiqrim8yck98l7x8y9mgkzm0cvkzwfnx-otter-browser-0.9.94
checking for references to /tmp/nix-build-otter-browser-0.9.94.drv-0 in /nix/store/kiqrim8yck98l7x8y9mgkzm0cvkzwfnx-otter-browser-0.9.94...
postPatchMkspecs
postPatchMkspecs
/nix/store/kiqrim8yck98l7x8y9mgkzm0cvkzwfnx-otter-browser-0.9.94

Copy link

@GrahamcOfBorg GrahamcOfBorg left a comment

Choose a reason for hiding this comment

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

Success for system: aarch64-linux

shrinking RPATHs of ELF executables and libraries in /nix/store/wb1xrvhcrka4wpxq8ai0sphmxaa9f5lw-otter-browser-0.9.94
shrinking /nix/store/wb1xrvhcrka4wpxq8ai0sphmxaa9f5lw-otter-browser-0.9.94/bin/otter-browser
gzipping man pages under /nix/store/wb1xrvhcrka4wpxq8ai0sphmxaa9f5lw-otter-browser-0.9.94/share/man/
strip is /nix/store/jwz859pxqj7sl2dbwvmxkx68jp774izb-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/wb1xrvhcrka4wpxq8ai0sphmxaa9f5lw-otter-browser-0.9.94/bin
patching script interpreter paths in /nix/store/wb1xrvhcrka4wpxq8ai0sphmxaa9f5lw-otter-browser-0.9.94
checking for references to /build in /nix/store/wb1xrvhcrka4wpxq8ai0sphmxaa9f5lw-otter-browser-0.9.94...
postPatchMkspecs
postPatchMkspecs
/nix/store/wb1xrvhcrka4wpxq8ai0sphmxaa9f5lw-otter-browser-0.9.94

@Mic92 Mic92 merged commit 3f2b626 into NixOS:master Feb 10, 2018
@lheckemann lheckemann deleted the otter branch February 10, 2018 13:19
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

4 participants