Unverified Commit 7b553b67 authored by Anthony Roussel's avatar Anthony Roussel
Browse files

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.
parent c585eaf8
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
{ 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";