-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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/elastic-apm-server: init #57995
Conversation
shas should be changed when #57992 gets merged. |
2a21f3e
to
775f0b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will probably review more after feedback
sha256 = shas."${stdenv.hostPlatform.system}" or (throw "Unknown architecture"); | ||
}; | ||
|
||
buildInputs = [ makeWrapper ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makeWrapper
isn't used as far as I can see.
meta = { | ||
description = "Open Source Application Performance Monitoring"; | ||
license = if enableUnfree then licenses.elastic else licenses.asl20; | ||
platforms = platforms.unix; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
homepage
missing
installPhase = '' | ||
mkdir -p $out/{bin,share} | ||
cp apm-server $out/bin | ||
cp -r apm-server.yml fields.yml kibana $out/share |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These should be put into $out/share/apm-server
instead
|
||
src = fetchurl { | ||
url = "https://artifacts.elastic.co/downloads/apm-server/${name}-${plat}-${arch}.tar.gz"; | ||
sha256 = shas."${stdenv.hostPlatform.system}" or (throw "Unknown architecture"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error should also include the package name, something like "apm-server is not available on ${stdenv.hostPlatform.system}"
inherit (builtins) elemAt; | ||
info = splitString "-" stdenv.hostPlatform.system; | ||
arch = elemAt info 0; | ||
plat = elemAt info 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be about
arch = stdenv.hostPlatform.cpu.name;
plat = stdenv.hostPlatform.kernel.name;
|
||
beatslib = import ./lib.nix { inherit lib pkgs; }; | ||
|
||
mkApmServerConfig = cfg: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to define functions when you only use them for one argument, just define the result directly.
beatConfig = foldl' recursiveUpdate {} [ | ||
(mkCommonBeatConfig cfg) | ||
(mkBeatConfig cfg) | ||
cfg.extraConfig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you're already doing something like that, I really suggest you do this instead: https://github.com/Infinisil/rfcs/blob/nixos-config/rfcs/0000-nixos-config.md#detailed-design, which will have a bunch of advantages
(ping @aanderse)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have opened an RFC since then for that: NixOS/rfcs#42
|
||
preStart = '' | ||
mkdir -p ${beatConfig.path.data} | ||
mkdir -p ${beatConfig.path.logs} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use systemd.tmpfiles
for this instead
|
||
{ | ||
|
||
mkCommonOptions = { name, defaults }: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm missing something here, you don't need to abstract this with a library file. Just write an option that you can set multiple times wherever you need it. Something like
{
options.services.beats = mkOption {
type = types.attrsOf (types.submodule ({ name, ... }: {
options = {
enable = true;
# ...
};
}));
};
}
And then set services.beats.apm-server.enable = true;
and such where you need an instance. This way you also won't duplicate all these options.
Thank you for your contributions.
|
I marked this as stale due to inactivity. → More info |
Closing due to inactivity from author. |
Motivation for this change
I wanted to use elastic-apm-server together with a language-dependant agent.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)