diff --git a/pkgs/tools/misc/goss/default.nix b/pkgs/tools/misc/goss/default.nix index 55fafb1059be..e0e3467c4042 100644 --- a/pkgs/tools/misc/goss/default.nix +++ b/pkgs/tools/misc/goss/default.nix @@ -1,8 +1,14 @@ -{ buildGoModule +{ bash +, buildGoModule , fetchFromGitHub +, getent , goss -, nix-update-script , lib +, makeWrapper +, nix-update-script +, nixosTests +, stdenv +, systemd , testers }: @@ -26,12 +32,22 @@ buildGoModule rec { "-s" "-w" "-X main.version=v${version}" ]; + nativeBuildInputs = [ makeWrapper ]; + checkFlags = [ # Prometheus tests are skipped upstream # See https://github.com/goss-org/goss/blob/master/ci/go-test.sh "-skip" "^TestPrometheus" ]; + postInstall = let + runtimeDependencies = [ bash getent ] + ++ lib.optionals stdenv.isLinux [ systemd ]; + in '' + wrapProgram $out/bin/goss \ + --prefix PATH : "${lib.makeBinPath runtimeDependencies}" + ''; + passthru = { tests.version = testers.testVersion { command = "goss --version";