about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorRobert Hensing <roberth@users.noreply.github.com>2024-03-03 18:19:00 +0100
committerGitHub <noreply@github.com>2024-03-03 18:19:00 +0100
commit39327e4cf24d63fd4d5c170b959d1640a55a83f9 (patch)
treedcc6d4fb5ea23c8882fa60251b1be77cb758f946 /lib
parent62e1690736227004529407dc22b61cfe60719cdf (diff)
parent324a7aa90ee02f5401adcf5f4f859f50972feaf1 (diff)
Merge pull request #288812 from hercules-ci/lib-flake-version
`lib/` flake: fix `lib.version`
Diffstat (limited to 'lib')
-rw-r--r--lib/.version1
-rw-r--r--lib/tests/test-with-nix.nix6
-rw-r--r--lib/trivial.nix2
3 files changed, 8 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..9d66b91cab428 100644
--- a/lib/tests/test-with-nix.nix
+++ b/lib/tests/test-with-nix.nix
@@ -53,6 +53,12 @@ pkgs.runCommand "nixpkgs-lib-tests-nix-${nix.version}" {
   echo "Running lib/tests/modules.sh"
   bash lib/tests/modules.sh
 
+  echo "Checking lib.version"
+  nix-instantiate lib -A version --eval || {
+    echo "lib.version does not evaluate when lib is isolated from the rest of the nixpkgs tree"
+    exit 1
+  }
+
   echo "Running lib/tests/filesystem.sh"
   TEST_LIB=$PWD/lib bash lib/tests/filesystem.sh
 
diff --git a/lib/trivial.nix b/lib/trivial.nix
index fa499cbbf0285..c197822a4f8e5 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -159,7 +159,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.