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

metabase: init at 0.27.2 #33460

Merged
merged 3 commits into from Mar 19, 2018
Merged

Conversation

schneefux
Copy link
Contributor

Motivation for this change

Added the https://metabase.com "uberjar". Tested on NixOS, the only issue I found was a compatibility problem with MariaDB which has already been reported upstream.

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.

@@ -0,0 +1,28 @@
{ pkgs, stdenv, lib, fetchurl, makeWrapper, jre }:
Copy link
Contributor

Choose a reason for hiding this comment

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

The pkgs parameter looks unused. Note also that lib can be (and is typically) accessed via stdenv.lib.

sha256 = "1xsd6k362kajbf6sw0pb7zkd686i350fqqin858a5mmjlm5jkci7";
};

buildInputs = [ makeWrapper ];
Copy link
Contributor

Choose a reason for hiding this comment

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

makeWrapper can be treated as a nativeBuildInputs


buildInputs = [ makeWrapper ];

phases = "installPhase";
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not explicitly list phases, instead disable those that are causing problems. While it may not matter to this package in particular, it is a common source of bugs.

'';

meta = with lib; {
description = "Metabase is the easy, open source way for everyone in your company to ask questions and learn from data.";
Copy link
Contributor

Choose a reason for hiding this comment

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

Please simplify Foo is a ... to A ... and drop trailing punctuation.

Copy link
Contributor

@joachifm joachifm left a comment

Choose a reason for hiding this comment

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

I think the phases and description issues must be addressed before merging, otherwise LGTM at a surface level.

@schneefux
Copy link
Contributor Author

I think the phases and description issues must be addressed before merging, otherwise LGTM at a surface level.

I updated the package to 0.28.1, addressed your feedback and rebased on master.

Copy link
Contributor

@joachifm joachifm left a comment

Choose a reason for hiding this comment

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

A final nit.

@@ -0,0 +1,28 @@
{ pkgs, stdenv, fetchurl, makeWrapper, jre }:
Copy link
Contributor

Choose a reason for hiding this comment

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

pkgs seems to be unused

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

installPhase = ''
mkdir -p $out/share/java
ln -s $jar $out/share/java/metabase.jar
makeWrapper ${jre}/bin/java $out/bin/metabase --add-flags "-jar $out/share/java/metabase.jar"
Copy link
Contributor

Choose a reason for hiding this comment

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

Not important, but I wonder if creating the dir/symlink is necessary; what if you just pass -jar $jar?
In that case, the whole expression reduces to, basically

writeScriptBin "metabase" ''
  #! /bin/sh
  exec ${jre}/bin/java -jar ${jar} "$@"
''

Just something to consider.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is probably not necessary, I am only not very Nix experienced yet.
How does writeScriptBin work?
I tried

  installPhase = writeScriptBin "metabase" ''
    #!/bin/sh
    exec ${jre}/bin/java -jar ${jar} "$@"
  '';

But it fails with /nix/store/…/*-metabase: Is a directory. I grepped for usage examples but could only find packages where writeScriptBin is used in the let scope for dependencies.

Copy link
Contributor

@joachifm joachifm Mar 3, 2018

Choose a reason for hiding this comment

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

writeScriptBin is a function that given a name and text returns a derivation that produces an output comprising an executable script of that name containing that text under a bin/ directory.

In your case, installPhase is supposed to be a Nix string (which is then exported to the builder); you're instead setting it to be a Nix derivation (evaluating to a store path).

What I was suggesting was that the whole package expression would reduce, essentially, to writeScriptBin. That is, no installPhase or anything. I'm not suggesting you do literally that :)

In the context of your original expression, something like (untested)

installPhase = ''
  mkdir -p $out/bin
  cat >$out/bin/metabase <<EOF
  #! /bin/sh
  exec ${jre}/bin/java -jar ${jar} "$@"
  EOF
''

might work.

Anyway, this is not at all a blocker. Please just remove the redundant pkgs parameter and I'd be happy to merge as-is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks a lot for your explanation! ❤️ I decided to stick with the verbose approach because it is more common.

Not important, but I wonder if creating the dir/symlink is necessary; what if you just pass -jar $jar?

Fixed.

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