about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--lib/.version1
-rw-r--r--lib/tests/test-with-nix.nix9
-rw-r--r--lib/trivial.nix2
3 files changed, 11 insertions, 1 deletions
diff --git a/lib/.version b/lib/.version
new file mode 100644
index 0000000000000..420f61e8c7f66
--- /dev/null
+++ b/lib/.version
@@ -0,0 +1 @@
+24.05
\ No newline at end of file
diff --git a/lib/tests/test-with-nix.nix b/lib/tests/test-with-nix.nix
index fd2e7532e697c..9bc160a4682ad 100644
--- a/lib/tests/test-with-nix.nix
+++ b/lib/tests/test-with-nix.nix
@@ -49,6 +49,15 @@ pkgs.runCommand "nixpkgs-lib-tests-nix-${nix.version}" {
 
   nix-store --init
 
+  # nixpkgs/lib/.version is a copy of nixpkgs/.version, so that the lib
+  # subtree is valid in isolation (except for the tests, but that's ok)
+  cp ${../../.version} nixpkgs-.version
+  cp ${../.version} nixpkgs-lib-.version
+  diff -U3 nixpkgs-.version nixpkgs-lib-.version || {
+    echo '<nixpkgs/.version> and <nixpkgs/lib/.version> must match.'
+    exit 1
+  }
+
   cp -r ${../.} lib
   echo "Running lib/tests/modules.sh"
   bash lib/tests/modules.sh
diff --git a/lib/trivial.nix b/lib/trivial.nix
index 58620006de151..d88f41f4123ac 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -174,7 +174,7 @@ in {
   version = release + versionSuffix;
 
   /* Returns the current nixpkgs release number as string. */
-  release = lib.strings.fileContents ../.version;
+  release = lib.strings.fileContents ./.version;
 
   /* The latest release that is supported, at the time of release branch-off,
      if applicable.