Open tejing1 opened 2 years ago
You can use builtins.path
to specify a custom name
to use. I think that's more efficient than builtins.toFile
+ builtins.readFile
.
Still a problem.
I think I'm having the same issue but it's fetchUrl
that's not sanitizing the file name
error: store path 'g179hjgfa2g6fji4s3gw1aq7hvxzkq1k-hugo,rust,linux,macos,direnv,python,windows,terraform,terragrunt,rust-analyzer,dotnetcore' contains illegal character ','
URL-encoding it still threw an error, just over the %
character
Just add a name
field to the fetchurl
args attrset. Should solve it. But yes, fetchurl should really sanitize the name as well.
Thanks! I was able to get it working. I can see the argument for not wanting to apply a lossy sanitizing algorithm by default. Have a great day!
Describe the bug
Attempting to implicitly copy files to the nix store fails when the file's basename does not conform the the sanity requirements imposed on nix store paths.
Steps To Reproduce
Expected behavior
Nix should sanitize the basename before constructing the store path, such that this operation always succeeds, just with a sanitized store path.
This shouldn't cause a reproducibility problem if implemented, since the behavior only differs in situations where there would have been a fatal error before. It's still fail-or-succeed-correctly.
nix-env --version
outputTried with 2.8.0, still a problem.
Additional context
I found this problem while trying to track down why a friend couldn't place his network manager connection files in
/etc
using theenvironment.etc
options inconfiguration.nix
. It was because the files were named after the SSIDs, and the SSIDs have unfortunate characters in their names. I was able to work around it withbuiltins.toFile
+builtins.readFile
+lib.strings.sanitizeDerivationName
, but this really should "just work".