From d9e7668ff4ab7a56b0f45475ef6e8daf22d2c7c8 Mon Sep 17 00:00:00 2001 From: LavaDesu Date: Thu, 24 Aug 2023 20:18:35 +0700 Subject: [PATCH] system/ccache: init and add to hyacinth --- hosts/hyacinth/default.nix | 3 +-- modules/default.nix | 1 + modules/system/ccache.nix | 30 ++++++++++++++++++++++++++++++ modules/system/nix.nix | 1 + 4 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 modules/system/ccache.nix diff --git a/hosts/hyacinth/default.nix b/hosts/hyacinth/default.nix index 4fe6c33..d4aa308 100644 --- a/hosts/hyacinth/default.nix +++ b/hosts/hyacinth/default.nix @@ -16,6 +16,7 @@ audio base + ccache greetd gui input @@ -47,7 +48,6 @@ }; virtualisation = { lxd.enable = true; - #waydroid.enable = true; spiceUSBRedirection.enable = true; libvirtd = { enable = true; @@ -66,5 +66,4 @@ "python-2.7.18.6-env" "python-2.7.18.6" ]; - } diff --git a/modules/default.nix b/modules/default.nix index 205afc2..bba3698 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -27,6 +27,7 @@ in { system = mkAttrsFromPaths [ ./system/audio.nix ./system/base.nix + ./system/ccache.nix ./system/greetd.nix ./system/gui.nix ./system/home-manager.nix diff --git a/modules/system/ccache.nix b/modules/system/ccache.nix new file mode 100644 index 0000000..814c857 --- /dev/null +++ b/modules/system/ccache.nix @@ -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 + ''; + }; + }) + ]; +} diff --git a/modules/system/nix.nix b/modules/system/nix.nix index 3152bb9..dc16ed4 100644 --- a/modules/system/nix.nix +++ b/modules/system/nix.nix @@ -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"