about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2022-11-22 18:33:09 +0200
committerArtturin <Artturin@artturin.com>2022-11-22 18:33:09 +0200
commitf0e298c00272d745fba42be2c6e782cd2aa64444 (patch)
treeb5fa8ea27842ee485e558c3bfd70fa761b2d3936 /lib
parent671732feca9a8a11645f1bfca8a34c777e3a6c7f (diff)
Revert "lib/trivial: fix 'error: cannot decode virtual path '/nix/store/virtual0000000000000000000000005-source''"
This reverts commit b67ee6e861903abb04e9024d605dfc7b00922633.

https://github.com/NixOS/nixpkgs/issues/202244

error: a string that refers to a store path cannot be appended to a path, at /etc/nixos/nix/nixos-unstable/lib/sources.nix:193:30

appears to happen when there's a nixpkgs git submodule

> So one of the things that is different for a git submodule is that the .git folder isn't a folder, it's a textfile that contains (in my case) this:

> $ cat nix/nixos-unstable/.git
> gitdir: ../../.git/modules/nixpkgs
Diffstat (limited to 'lib')
-rw-r--r--lib/trivial.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/trivial.nix b/lib/trivial.nix
index 142ed32c9e5a6..0e02660d6b35a 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -213,8 +213,8 @@ rec {
     # Default value to return if revision can not be determined
     default:
     let
-      revisionFile = ./.. + "/.git-revision";
-      gitRepo      = ./.. + "/.git";
+      revisionFile = "${toString ./..}/.git-revision";
+      gitRepo      = "${toString ./..}/.git";
     in if lib.pathIsGitRepo gitRepo
        then lib.commitIdFromGitRepo gitRepo
        else if lib.pathExists revisionFile then lib.fileContents revisionFile