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

Add elastic beat shippers #23227

Merged
merged 8 commits into from Mar 20, 2017
Merged

Add elastic beat shippers #23227

merged 8 commits into from Mar 20, 2017

Conversation

fadenb
Copy link
Contributor

@fadenb fadenb commented Feb 26, 2017

Motivation for this change

Packages 4 of the Elastic Beats shippers
https://www.elastic.co/products/beats

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.

Copy link
Member

@fpletz fpletz left a comment

Choose a reason for hiding this comment

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

I'm wondering if we can just compile these packages? They're open source after all. 😄

homepage = https://www.elastic.co/products/beats;
license = stdenv.lib.licenses.asl20;
maintainers = [ stdenv.lib.maintainers.fadenb ];
platforms = stdenv.lib.platforms.all;
Copy link
Member

Choose a reason for hiding this comment

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

Only "linux-x86_64" is supported.

homepage = https://www.elastic.co/products/beats;
license = stdenv.lib.licenses.asl20;
maintainers = [ stdenv.lib.maintainers.fadenb ];
platforms = stdenv.lib.platforms.all;
Copy link
Member

Choose a reason for hiding this comment

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

Only "linux-x86_64" is supported.

homepage = https://www.elastic.co/products/beats;
license = stdenv.lib.licenses.asl20;
maintainers = [ stdenv.lib.maintainers.fadenb ];
platforms = stdenv.lib.platforms.all;
Copy link
Member

Choose a reason for hiding this comment

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

Only "linux-x86_64" is supported.

homepage = https://www.elastic.co/products/beats;
license = stdenv.lib.licenses.asl20;
maintainers = [ stdenv.lib.maintainers.fadenb ];
platforms = stdenv.lib.platforms.all;
Copy link
Member

Choose a reason for hiding this comment

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

Only "linux-x86_64" is supported.

# need to patch interpreter to be able to run on NixOS
patchPhase = ''
patchelf --interpreter $(cat $NIX_CC/nix-support/dynamic-linker) metricbeat
'';
Copy link
Member

Choose a reason for hiding this comment

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

Why does this package need this but not the others? Shouldn't the default fixupPhase take care of that?

@fadenb
Copy link
Contributor Author

fadenb commented Feb 26, 2017

Last time I tried building the beats from source I failed so this was the next best thing to get them working on NixOS ;)

Regarding the patchelf command:
Two of the four beats require patchelf to be run on them in order to work on NixOS. Seems like it is not done by default.

@danbst
Copy link
Contributor

danbst commented Feb 27, 2017

Last time I tried Filebeat, this compiled and was runnable:

{ fetchurl, buildGoPackage }:

buildGoPackage rec {
  name = "filebeat-${version}";
  goPackagePath = "github.com/elastic/beats";
  version = "5.1.2";
  src = fetchurl {
    url = "https://${goPackagePath}/archive/v${version}.tar.gz";
    sha256 = "1ki37sm6yj7m1ixfsb37128wagfymhh9hz61pc72j0kbpvw59mbw";
  };

  subPackages = [ "filebeat" ];
}

Unfortunately it propagates src into derivation, so requires polishing.

@fpletz fpletz added this to the 17.03 milestone Feb 28, 2017
@fpletz fpletz self-assigned this Feb 28, 2017
@teh
Copy link
Contributor

teh commented Mar 1, 2017

Though I can't offer much help I'm a light -1 on introducing more binary installs, even if that's a bit more effort. Source installs allow us to track the real build dependencies, and to apply patches or overrides later. It's also useful for reproducible builds.

For some packages we don't have a functioning build tool yet, e.g. bazel & tensorflow, or some maven packages. In this specific instance though I think all that's needed is a bit of fiddling.

E.g. I run a go project with a custom Makefile and my installer looks like this:

  buildPhase = ''
    shopt -s extglob
    mkdir -p ./src/github.com/coreos/dex
    mv !(src) ./src/github.com/coreos/dex
    GOPATH=$PWD
    cd ./src/github.com/coreos/dex
    make
  '';
  installPhase = ''
    mkdir -p $out/bin
    cp bin/dex $out/bin
  '';

@fpletz fpletz merged commit b748669 into NixOS:master Mar 20, 2017
@fpletz fpletz deleted the elastic_beats branch March 20, 2017 22:03
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