about summary refs log tree commit diff
path: root/pkgs/tools/package-management/nix/common.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/package-management/nix/common.nix')
-rw-r--r--pkgs/tools/package-management/nix/common.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkgs/tools/package-management/nix/common.nix b/pkgs/tools/package-management/nix/common.nix
index f7b0dff33472d..e98371a1e757e 100644
--- a/pkgs/tools/package-management/nix/common.nix
+++ b/pkgs/tools/package-management/nix/common.nix
@@ -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
+      '';
     };
   };