diff --git a/pkgs/by-name/cr/crowdsec/package.nix b/pkgs/by-name/cr/crowdsec/package.nix index 6dd3b25da063..6a466fa686f8 100644 --- a/pkgs/by-name/cr/crowdsec/package.nix +++ b/pkgs/by-name/cr/crowdsec/package.nix @@ -30,7 +30,7 @@ buildGoModule rec { "-w" "-X github.com/crowdsecurity/go-cs-lib/version.Version=v${version}" "-X github.com/crowdsecurity/go-cs-lib/version.BuildDate=1970-01-01_00:00:00" - "-X github.com/crowdsecurity/go-cs-lib/version.Tag=${src.rev}" + "-X github.com/crowdsecurity/go-cs-lib/version.Tag=v${version}" "-X github.com/crowdsecurity/crowdsec/pkg/cwversion.Codename=alphaga" "-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultConfigDir=/etc/crowdsec" "-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultDataDir=/var/lib/crowdsec/data" @@ -53,8 +53,13 @@ buildGoModule rec { ''; # It's important that the version is correctly set as it also determines feature capabilities - checkPhase = '' - $GOPATH/bin/cscli version 2>&1 | grep -q "version: v${version}" + preCheck = '' + version=$($GOPATH/bin/cscli version 2>&1 | sed -nE 's/^version: (.*)/\1/p') + + if [ "$version" != "v${version}" ]; then + echo "Invalid version string: '$version'" + exit 1 + fi ''; meta = with lib; {