2023-09-19 14:23:09 +00:00
|
|
|
|
{ bash
|
|
|
|
|
, buildGoModule
|
2023-09-04 10:32:09 +00:00
|
|
|
|
, fetchFromGitHub
|
2023-09-19 14:23:09 +00:00
|
|
|
|
, getent
|
2023-09-04 10:32:09 +00:00
|
|
|
|
, goss
|
|
|
|
|
, lib
|
2023-09-19 14:23:09 +00:00
|
|
|
|
, makeWrapper
|
|
|
|
|
, nix-update-script
|
|
|
|
|
, nixosTests
|
|
|
|
|
, stdenv
|
|
|
|
|
, systemd
|
2023-09-04 10:32:09 +00:00
|
|
|
|
, testers
|
|
|
|
|
}:
|
2021-05-02 17:53:38 +00:00
|
|
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
|
pname = "goss";
|
2023-09-04 10:27:46 +00:00
|
|
|
|
|
|
|
|
|
# Don't forget to update dgoss to the same version.
|
2023-11-19 16:29:27 +00:00
|
|
|
|
version = "0.4.4";
|
2021-05-02 17:53:38 +00:00
|
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2023-09-04 10:27:46 +00:00
|
|
|
|
owner = "goss-org";
|
2021-05-02 17:53:38 +00:00
|
|
|
|
repo = pname;
|
2023-09-04 10:27:46 +00:00
|
|
|
|
rev = "refs/tags/v${version}";
|
2023-11-19 16:29:27 +00:00
|
|
|
|
hash = "sha256-dH052t30unWmrFTZK5niXNvbg1nngzWY7mwuZr4ULbM=";
|
2021-05-02 17:53:38 +00:00
|
|
|
|
};
|
|
|
|
|
|
2023-11-19 16:29:27 +00:00
|
|
|
|
vendorHash = "sha256-4fEEz/c/xIeWxIzyyjwgSn2/2FWLA2tIedK65jGgYhY=";
|
2021-05-02 17:53:38 +00:00
|
|
|
|
|
|
|
|
|
CGO_ENABLED = 0;
|
2021-08-21 08:23:49 +00:00
|
|
|
|
ldflags = [
|
|
|
|
|
"-s" "-w" "-X main.version=v${version}"
|
|
|
|
|
];
|
2021-05-02 17:53:38 +00:00
|
|
|
|
|
2023-09-19 14:23:09 +00:00
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
2023-09-04 10:27:46 +00:00
|
|
|
|
checkFlags = [
|
|
|
|
|
# Prometheus tests are skipped upstream
|
|
|
|
|
# See https://github.com/goss-org/goss/blob/master/ci/go-test.sh
|
|
|
|
|
"-skip" "^TestPrometheus"
|
|
|
|
|
];
|
|
|
|
|
|
2023-09-19 14:23:09 +00:00
|
|
|
|
postInstall = let
|
|
|
|
|
runtimeDependencies = [ bash getent ]
|
|
|
|
|
++ lib.optionals stdenv.isLinux [ systemd ];
|
|
|
|
|
in ''
|
|
|
|
|
wrapProgram $out/bin/goss \
|
|
|
|
|
--prefix PATH : "${lib.makeBinPath runtimeDependencies}"
|
|
|
|
|
'';
|
|
|
|
|
|
2023-09-04 10:32:09 +00:00
|
|
|
|
passthru = {
|
2023-09-19 11:32:08 +00:00
|
|
|
|
tests = {
|
|
|
|
|
inherit (nixosTests) goss;
|
|
|
|
|
version = testers.testVersion {
|
|
|
|
|
command = "goss --version";
|
|
|
|
|
package = goss;
|
|
|
|
|
version = "v${version}";
|
|
|
|
|
};
|
2023-09-04 10:32:09 +00:00
|
|
|
|
};
|
|
|
|
|
updateScript = nix-update-script { };
|
|
|
|
|
};
|
|
|
|
|
|
2021-05-02 17:53:38 +00:00
|
|
|
|
meta = with lib; {
|
2023-09-04 10:27:46 +00:00
|
|
|
|
homepage = "https://github.com/goss-org/goss/";
|
|
|
|
|
changelog = "https://github.com/goss-org/goss/releases/tag/v${version}";
|
2021-05-02 17:53:38 +00:00
|
|
|
|
description = "Quick and easy server validation";
|
|
|
|
|
longDescription = ''
|
|
|
|
|
Goss is a YAML based serverspec alternative tool for validating a server’s configuration.
|
|
|
|
|
It eases the process of writing tests by allowing the user to generate tests from the current system state.
|
|
|
|
|
Once the test suite is written they can be executed, waited-on, or served as a health endpoint.
|
|
|
|
|
'';
|
|
|
|
|
license = licenses.asl20;
|
2023-09-19 11:32:08 +00:00
|
|
|
|
mainProgram = "goss";
|
2023-09-04 10:28:46 +00:00
|
|
|
|
maintainers = with maintainers; [ hyzual jk anthonyroussel ];
|
2023-09-19 11:32:08 +00:00
|
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2021-05-02 17:53:38 +00:00
|
|
|
|
};
|
|
|
|
|
}
|