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

View file

@ -16,6 +16,7 @@
audio audio
base base
ccache
greetd greetd
gui gui
input input
@ -47,7 +48,6 @@
}; };
virtualisation = { virtualisation = {
lxd.enable = true; lxd.enable = true;
#waydroid.enable = true;
spiceUSBRedirection.enable = true; spiceUSBRedirection.enable = true;
libvirtd = { libvirtd = {
enable = true; enable = true;
@ -66,5 +66,4 @@
"python-2.7.18.6-env" "python-2.7.18.6-env"
"python-2.7.18.6" "python-2.7.18.6"
]; ];
} }

View file

@ -27,6 +27,7 @@ in {
system = mkAttrsFromPaths [ system = mkAttrsFromPaths [
./system/audio.nix ./system/audio.nix
./system/base.nix ./system/base.nix
./system/ccache.nix
./system/greetd.nix ./system/greetd.nix
./system/gui.nix ./system/gui.nix
./system/home-manager.nix ./system/home-manager.nix

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; package = pkgs.nixUnstable;
settings = rec { settings = rec {
extra-sandbox-paths = [ config.programs.ccache.cacheDir ];
substituters = [ substituters = [
"https://cache.nixos.org?priority=10" "https://cache.nixos.org?priority=10"
"https://lava.cachix.org" "https://lava.cachix.org"