2023-02-19 19:09:38 +07:00
|
|
|
{ config, lib, ... }:
|
|
|
|
{
|
|
|
|
nix.settings.extra-sandbox-paths = lib.mkIf config.programs.ccache.enable [
|
|
|
|
config.programs.ccache.cacheDir
|
|
|
|
"/var/cache/sccache"
|
|
|
|
];
|
2023-05-11 05:33:08 +07:00
|
|
|
impermanence.directories = lib.mkIf config.programs.ccache.enable [
|
2023-02-19 19:09:38 +07:00
|
|
|
config.programs.ccache.cacheDir
|
|
|
|
"/var/cache/sccache"
|
|
|
|
];
|
|
|
|
nixpkgs.overlays = lib.mkIf (config.programs.ccache.enable && config.programs.ccache.packageNames == []) [
|
|
|
|
(self: super: {
|
|
|
|
ccacheWrapper = super.ccacheWrapper.override {
|
|
|
|
extraConfig = ''
|
|
|
|
export CCACHE_COMPRESS=1
|
|
|
|
export CCACHE_DIR="${config.programs.ccache.cacheDir}"
|
|
|
|
export CCACHE_UMASK=007
|
2023-06-12 20:12:15 +07:00
|
|
|
export CCACHE_SLOPPINESS=include_file_mtime,time_macros
|
|
|
|
export CCACHE_NODIRECT=1
|
2023-02-19 19:09:38 +07:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
}
|