@philiptaron's lix workspace
Find a file
Qyriad 6881476232 libfetchers: fallback to memory SQLite if fs IO fails
nix::fetchers::CacheImpl uses $XDG_CACHE_HOME, or its default based on
$HOME, to store its SQLite database. If the current process can't write
to that directory for whatever reason, though, any eval-time fetching
would fail just initializing the cache.

With this change, IO errors initializing the fetcher cache are logged
but ignored, and nix::fetchers::CacheImpl falls back to an in-memory¹
database instead.

Notably, this will fix any uses eval fetching while Lix itself is being
run in a derivation builder (such as during tests), as the derivation
builder does not set $XDG_CACHE_HOME, and sets $HOME to the non-existent
directory /homeless-shelter.

Before:

$ env -u XDG_CACHE_HOME HOME=/homeless-shelter nix -Lv eval --impure -E 'fetchTarball "https://git.lix.systems/lix-project/lix/archive/main.tar.gz"'
error:
       … while calling the 'fetchTarball' builtin
         at «string»:1:1:
            1| fetchTarball "https://git.lix.systems/lix-project/lix/archive/main.tar.gz"
             | ^

       error: creating directory '/homeless-shelter': Permission denied

After:

$ env -u XDG_CACHE_HOME HOME=/homeless-shelter nix -Lv eval --impure -E 'fetchTarball "https://git.lix.systems/lix-project/lix/archive/main.tar.gz"'
warning: ignoring error initializing Lix fetcher cache: error: creating directory '/homeless-shelter': Permission denied
"/nix/store/s9lxdnn0awp37n560bg4fgr497ah4hvw-source"

¹: https://www.sqlite.org/inmemorydb.html

Change-Id: I15c38c9baaf215fc6e192b8a4c70b9692a69bc22
2024-05-21 09:30:25 -06:00
.github
bench
clang-tidy
contrib
doc print type and value in "flake attr is not a derivation" errors 2024-05-21 05:55:13 -06:00
lix-doc lix-doc: don't chomp bold headings off 2024-05-15 15:24:03 -07:00
maintainers Merge "chore: remove incorrect maintainers/*.md documentation" into main 2024-05-20 12:35:20 +00:00
meson
misc Deprecate the online flake registries and vendor the default registry 2024-05-18 12:27:23 +10:00
nix-support
perl remove the autoconf+Make buildsystem 2024-05-07 17:04:30 -06:00
scripts remove the autoconf+Make buildsystem 2024-05-07 17:04:30 -06:00
src libfetchers: fallback to memory SQLite if fs IO fails 2024-05-21 09:30:25 -06:00
tests Merge "derived-path: refuse built derived path with a non-derivation base" into main 2024-05-18 07:26:26 +00:00
.clang-format
.clang-tidy
.dir-locals.el
.editorconfig
.envrc
.gitignore
.version
boehmgc-coroutine-sp-fallback.diff
boehmgc-traceable_allocator-public.diff
CONTRIBUTING.md
COPYING
default.nix
docker.nix
flake.lock flake: update nixpkgs input to latest nixos-23.11 2024-05-08 23:03:28 +02:00
flake.nix release-notes: build unreleased release notes by default 2024-05-15 15:01:38 -07:00
justfile Improve the justfile 2024-05-08 08:19:37 -07:00
meson.build add and fix -Wignored-qualifiers 2024-05-09 07:08:44 -06:00
meson.options
package.nix Deprecate the online flake registries and vendor the default registry 2024-05-18 12:27:23 +10:00
precompiled-headers.h
README.md
shell.nix
treefmt.toml

Lix

Lix is an implementation of Nix, a powerful package management system for Linux and other Unix systems that makes package management reliable and reproducible.

Read more about us at https://lix.systems.

Installation

On Linux and macOS the easiest way to install Nix is to run the following shell command (as a user other than root):

$ curl -sSf -L https://install.lix.systems/lix | sh -s -- install

For systems that already have Nix installed, such as NixOS systems, read our install page

Building And Developing

See our Hacking guide in our manual for instruction on how to to set up a development environment and build Lix from source.

Additional Resources

License

Lix is released under the LGPL v2.1.