Hi! I have a package that I’ve overridden to build from a local source tree. I’ve gotten it to build, and now I’m trying to speed up recompilation for small changes to the code, using CCache.
The build is indeed using CCache, but the hit rate is 0.35% in my tests which just change a string literal in one file. Can this be improved?
For context this is the kdeconnect-kde package that I’m overriding, from kdePackages. It’s a CMake project, written in C++ and using Qt.
Also nix-ccache --show-stats
says that ~70% of all calls were cacheable, so it’s not that most calls are uncacheable. They’re just missing. The cache isn’t full or anything either. This makes me think maybe I’m doing it wrong.
The overlays I’m using:
nixpkgs.overlays = [
# from https://nixos.wiki/wiki/CCache
(self: super: {
ccacheWrapper = super.ccacheWrapper.override {
extraConfig = ''
export CCACHE_COMPRESS=1
export CCACHE_DIR="${config.programs.ccache.cacheDir}"
export CCACHE_UMASK=007
if [ ! -d "$CCACHE_DIR" ]; then
echo "====="
echo "Directory '$CCACHE_DIR' does not exist"
echo "Please create it with:"
echo " sudo mkdir -m0770 '$CCACHE_DIR'"
echo " sudo chown root:nixbld '$CCACHE_DIR'"
echo "====="
exit 1
fi
if [ ! -w "$CCACHE_DIR" ]; then
echo "====="
echo "Directory '$CCACHE_DIR' is not accessible for user $(whoami)"
echo "Please verify its access permissions"
echo "====="
exit 1
fi
'';
};
})
(final: prev: {
kdePackages = prev.kdePackages.overrideScope (kfinal: kprev: {
kdeconnect-kde = kprev.kdeconnect-kde.overrideAttrs (oldAttrs: {
src = builtins.fetchGit /home/bharadwaj/dev/kde/kdeconnect-kde;
});
});
})
(final: prev: {
kdePackages = prev.kdePackages.overrideScope (kfinal: kprev: {
kdeconnect-kde = kprev.kdeconnect-kde.override { mkKdeDerivation = kprev.mkKdeDerivation.override { stdenv = prev.ccacheStdenv; }; };
});
})
];