Closed MagnusS closed 2 months ago
What's the reason behind having to run sudo to interact with ccache here? It hasn't been required for my own projects.
What's the reason behind having to run sudo to interact with ccache here? It hasn't been required for my own projects.
It's only required when nix is installed in multiuser mode. Then the cache directory will be owned by the nix user.
I've used this for a few days now and it saves a lot of time, so I'll merge this
Adds a new attribute
withCcache
that defaults to false. When enabled, a wrapper around clang/clang++ will be added to the IncludeOS build environment.With an existing cache, this reduces the service build time to about 1/5 on my server when the kernel also has to be rebuilt.
The directory used for caching is /nix/var/cache/ccache and it has to exist with the right permissions. See overlay.nix for additional details.
To enable ccache, pass "--arg withCcache true" to either nix-build or nix-shell.
To manage the ccache, install "ccache" locally. Then "sudo ccache --dir /nix/var/cache/ccache --show-stats" will show cache statistics and "sudo ccache --dir /nix/var/cache/ccache --clear" will clear the cache.
Ccache is currently disabled on unittests and integration tests to make sure that these are built from a clean environment.