goss: ensure bash, getent and systemd are in the PATH

This will fix the failing `command` rule of `goss`
which requires the sh binary and use a hardcoded path upstream.
This commit is contained in:
Anthony Roussel
2023-10-27 07:59:47 +02:00
parent c585eaf8d8
commit 7b553b67cf
+18 -2
View File
@@ -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";