nixVersions.*.tests.srcVersion: Test that version is ${src}/.version

This commit is contained in:
Robert Hensing 2024-06-28 14:41:48 +02:00
parent 5660f47241
commit 42877a5b2c

View File

@ -85,6 +85,7 @@ in
# passthru tests
, pkgsi686Linux
, runCommand
}: let
self = stdenv.mkDerivation {
pname = "nix";
@ -259,6 +260,21 @@ self = stdenv.mkDerivation {
# Basic smoke test that needs to pass when upgrading nix.
# Note that this test does only test the nixVersions.stable attribute.
misc = nixosTests.nix-misc.default;
srcVersion = runCommand "nix-src-version" {
inherit version;
} ''
# This file is an implementation detail, but it's a good sanity check
# If upstream changes that, we'll have to adapt.
srcVersion=$(cat ${src}/.version)
echo "Version in nix nix expression: $version"
echo "Version in nix.src: $srcVersion"
if [ "$version" != "$srcVersion" ]; then
echo "Version mismatch!"
exit 1
fi
touch $out
'';
};
};