52 lines
1.3 KiB
Nix
52 lines
1.3 KiB
Nix
{ pkgs, ... }:
|
|
# AUTO-UPDATE: nix-update --flake prometheus-podman-exporter
|
|
pkgs.buildGoModule (finalAttrs: {
|
|
pname = "prometheus-podman-exporter";
|
|
version = "1.18.0";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
owner = "containers";
|
|
repo = "prometheus-podman-exporter";
|
|
rev = "v${finalAttrs.version}";
|
|
hash = "sha256-hrecxJp78c8LruXTGRDU6zNWnyh+vwgCpVJsm026NYw=";
|
|
};
|
|
|
|
vendorHash = null;
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
makeWrapper
|
|
pkg-config
|
|
];
|
|
|
|
buildInputs = with pkgs; [
|
|
btrfs-progs
|
|
gpgme
|
|
];
|
|
|
|
tags = [
|
|
"containers_image_openpgp"
|
|
"remote"
|
|
];
|
|
|
|
ldflags = [
|
|
"-s"
|
|
"-w"
|
|
"-X github.com/containers/prometheus-podman-exporter/cmd.buildVersion=${finalAttrs.version}"
|
|
"-X github.com/containers/prometheus-podman-exporter/cmd.buildRevision=${builtins.head (pkgs.lib.strings.splitString "." finalAttrs.version)}"
|
|
"-X github.com/containers/prometheus-podman-exporter/cmd.buildBranch=HEAD"
|
|
];
|
|
|
|
# Don't run tests because they require a running podman daemon
|
|
doCheck = false;
|
|
|
|
postInstall = ''
|
|
wrapProgram $out/bin/prometheus-podman-exporter \
|
|
--run '
|
|
: "''${CONTAINER_HOST:=}"
|
|
if [ -z "$CONTAINER_HOST" ]; then
|
|
export CONTAINER_HOST=$([ "$UID" -eq 0 ] && echo "unix:///run/podman/podman.sock" || echo "unix://''${XDG_RUNTIME_DIR:-/run/user/$UID}/podman/podman.sock")
|
|
fi
|
|
'
|
|
'';
|
|
})
|