You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
nix build --show-trace
error:
… in the condition of the assert statement
at /nix/store/v99q15bqy6lrm4wiqjwsp0ig9vl1g949-source/mrchef/nix/flake.nix:9:7:
8|in
9| assert builtins.isPath absoluteNixpkgs;| ^
10| nixpkgs.legacyPackages.x86_64-linux.runCommandLocal "test"''
… while calling the 'isPath'builtin
at /nix/store/v99q15bqy6lrm4wiqjwsp0ig9vl1g949-source/mrchef/nix/flake.nix:9:14:
8|in
9| assert builtins.isPath absoluteNixpkgs;| ^
10| nixpkgs.legacyPackages.x86_64-linux.runCommandLocal "test"''
error: a string that refers to a store path cannot be appended to a path
at /nix/store/v99q15bqy6lrm4wiqjwsp0ig9vl1g949-source/mrchef/nix/flake.nix:7:28:
6| packages.x86_64-linux.default = let
7| absoluteNixpkgs = /. + nixpkgs;| ^
8|in
Expected behavior
I should be able to convert it to a path, and work with it from there onwards.
I'm trying to use paths because they react appropriately directory traversal when concatenating with ../../ or similar stuff. These are however prohibited in other library functions in nixpkgs.lib.path.subpath, so I cannot just use strings.
I'm trying to use paths because they react appropriately directory traversal when concatenating with ../../ or similar stuff. These are however prohibited in other library functions in nixpkgs.lib.path.subpath, so I cannot just use strings.
FWIW, the deprecated builtins.toPath function gets a String and returns it normalized:
nix-repl>builtins.toPath"/a/b/c/..///d""/a/b/d"
So, it works for me as a workaround of this issue. Hopefully it will never be removed: NixOS/nixpkgs#40937 (comment)
Indeed, the name is confusing and the operations it does are not easy to understand, but I found no substitute for this use case.
Describe the bug
When you have a string that contains nix store info, it's impossible to convert it to a Path.
Steps To Reproduce
Now build it:
Expected behavior
I should be able to convert it to a path, and work with it from there onwards.
However,
builtins.toPath
returns aString
, as shown in #1074. And the docs say to use this new method I'm using, but it also doesn't work as shown here.Metadata
nix-env (Nix) 2.24.12
Additional context
I'm trying to use paths because they react appropriately directory traversal when concatenating with
../../
or similar stuff. These are however prohibited in other library functions innixpkgs.lib.path.subpath
, so I cannot just use strings.Checklist
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: