forked from influxdata/telegraf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d5f0a12
commit d1b1c2f
Showing
8 changed files
with
1,170 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then | ||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4=" | ||
fi | ||
|
||
watch_file flake.nix | ||
watch_file devshell.nix | ||
|
||
use flake | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
/telegraf.gz | ||
/vendor | ||
.DS_Store | ||
result* |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
description = "The plugin-driven server agent for collecting & reporting metrics"; | ||
|
||
# Add all your dependencies here | ||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable"; | ||
blueprint = { | ||
url = "github:numtide/blueprint"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
devshell = { | ||
url = "github:numtide/devshell"; | ||
inputs.nixpkgs.follows = "nixpkgs"; | ||
}; | ||
}; | ||
|
||
# Keep the magic invocations to minimum. | ||
outputs = | ||
inputs: | ||
inputs.blueprint { | ||
inherit inputs; | ||
prefix = "nix/"; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
inputs, | ||
pkgs, | ||
system, | ||
perSystem, | ||
... | ||
}: | ||
let | ||
inherit (pkgs) lib; | ||
# we can't use perSystem.devshell.mkShell because it prefers ".packages" over ".legacyPackages" and the devshell | ||
# flake doesn't expose these utils, only the legacy compat stuff does | ||
inherit (inputs.devshell.legacyPackages.${system}) mkShell; | ||
in | ||
mkShell { | ||
|
||
env = [ | ||
{ | ||
name = "DEVSHELL_NO_MOTD"; | ||
value = 1; | ||
} | ||
{ | ||
name = "GOROOT"; | ||
value = pkgs.go + "/share/go"; | ||
} | ||
]; | ||
|
||
packages = lib.mkMerge [ | ||
(with pkgs; [ | ||
go | ||
delve | ||
pprof | ||
graphviz | ||
]) | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
args@{ | ||
flake, | ||
inputs, | ||
system, | ||
pkgs, | ||
... | ||
}: | ||
let | ||
inherit (pkgs) go lib; | ||
in | ||
pkgs.buildGoModule rec { | ||
pname = "telegraf"; | ||
# there's no good way of tying in the version to a git tag or branch | ||
# so for simplicity's sake we set the version as the commit revision hash | ||
# we remove the `-dirty` suffix to avoid a lot of unnecessary rebuilds in local dev | ||
version = lib.removeSuffix "-dirty" (flake.shortRev or flake.dirtyShortRev); | ||
|
||
subPackages = [ "cmd/telegraf" ]; | ||
|
||
# ensure we are using the same version of go to build with | ||
inherit go; | ||
|
||
src = pkgs.lib.cleanSource ../../../.; | ||
vendorHash = "sha256-rItG0x0FWc3CGzueEx2lIVcVYRD9SSsDLYJtaU9Aodk="; | ||
proxyVendor = true; | ||
|
||
ldflags = [ | ||
"-s" | ||
"-w" | ||
"-X github.com/omc/telegraf/internal.Commit=${flake.shortRev or flake.dirtyShortRev}" | ||
"-X github.com/omc/telegraf/internal.Version=${version}" | ||
]; | ||
|
||
meta = with lib; { | ||
description = "The plugin-driven server agent for collecting & reporting metrics"; | ||
mainProgram = "telegraf"; | ||
license = licenses.mit; | ||
}; | ||
} |
Oops, something went wrong.