diff --git a/fake_flake.nix b/fake_flake.nix index 0358f01..b60af68 100644 --- a/fake_flake.nix +++ b/fake_flake.nix @@ -59,6 +59,9 @@ in distro = "${distroName} ${version} (${codeName}) ${system}"; }; + nix.settings.extra-sandbox-paths = [ config.programs.ccache.cacheDir ]; + programs.ccache.enable = true; + environment.systemPackages = with pkgs; with lib; diff --git a/overlays/ccache-wrapper.nix b/overlays/ccache-wrapper.nix new file mode 100644 index 0000000..d9a9a49 --- /dev/null +++ b/overlays/ccache-wrapper.nix @@ -0,0 +1,31 @@ +{ + final, + prev, + config, + ... +}: +{ + ccacheWrapper = prev.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/overlays/default.nix b/overlays/default.nix index 7a1b523..bf3b844 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -21,5 +21,6 @@ ./deskwhich.nix ./mcontrolcenter.nix ./the-powder-toy.nix + ./ccache-wrapper.nix ]; } diff --git a/overlays/matrix-appservice-discord.nix b/overlays/matrix-appservice-discord.nix index 57d59f8..77e3ef7 100644 --- a/overlays/matrix-appservice-discord.nix +++ b/overlays/matrix-appservice-discord.nix @@ -1,20 +1,20 @@ { final, prev, ... }: { matrix-appservice-discord = prev.matrix-appservice-discord.overrideAttrs (old: { - src = prev.fetchFromGitHub { - owner = "t2bot"; - repo = "matrix-appservice-discord"; - rev = "8361ca6121bf1f0902154baa538cb6d5766e477f"; - hash = "sha256-oXon6pFJgqQ1uBLtsSVNH7XSOpxxJYqpW2n9cFrs3sU="; - }; - patches = - ( - let - oldPatches = old.patches or [ ]; - in - if oldPatches == null then [ ] else oldPatches - ) - ++ [ ./patches/bridge_perms.patch ]; - doCheck = false; - }); + src = prev.fetchFromGitHub { + owner = "t2bot"; + repo = "matrix-appservice-discord"; + rev = "8361ca6121bf1f0902154baa538cb6d5766e477f"; + hash = "sha256-oXon6pFJgqQ1uBLtsSVNH7XSOpxxJYqpW2n9cFrs3sU="; + }; + patches = + ( + let + oldPatches = old.patches or [ ]; + in + if oldPatches == null then [ ] else oldPatches + ) + ++ [ ../patches/bridge_perms.patch ]; + doCheck = false; + }); } diff --git a/overlays/patches/bridge_perms.patch b/patches/bridge_perms.patch similarity index 100% rename from overlays/patches/bridge_perms.patch rename to patches/bridge_perms.patch diff --git a/patches/lix-ccache.patch b/patches/lix-ccache.patch new file mode 100644 index 0000000..6072e0c --- /dev/null +++ b/patches/lix-ccache.patch @@ -0,0 +1,22 @@ +diff --git a/package.nix b/package.nix +index 0186b7472..da783e152 100644 +--- a/package.nix ++++ b/package.nix +@@ -1,7 +1,7 @@ + { + pkgs, + lib, +- stdenv, ++ ccacheStdenv, + aws-sdk-cpp, + # If the patched version of Boehm isn't passed, then patch it based off of + # pkgs.boehmgc. This allows `callPackage`ing this file without needing to +@@ -81,6 +81,8 @@ let + inherit (__forDefaults) canRunInstalled; + inherit (lib) fileset; + ++ stdenv = ccacheStdenv; ++ + version = lib.fileContents ./.version + versionSuffix; + + aws-sdk-cpp-nix = aws-sdk-cpp.override {