system/ccache: init and add to hyacinth

This commit is contained in:
LavaDesu 2023-08-24 20:18:35 +07:00
parent 9063ff9dda
commit d9e7668ff4
Signed by: cilly
GPG key ID: 6500251E087653C9
4 changed files with 33 additions and 2 deletions

30
modules/system/ccache.nix Normal file
View file

@ -0,0 +1,30 @@
{ config, ... }: {
programs.ccache.enable = true;
nixpkgs.overlays = [
(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
'';
};
})
];
}

View file

@ -3,6 +3,7 @@
package = pkgs.nixUnstable;
settings = rec {
extra-sandbox-paths = [ config.programs.ccache.cacheDir ];
substituters = [
"https://cache.nixos.org?priority=10"
"https://lava.cachix.org"