add ccache

This commit is contained in:
Grimmauld 2024-05-09 20:36:33 +02:00
parent 058265c410
commit 9f14173c43
Signed by: Grimmauld
GPG Key ID: C2946668769F91FB
6 changed files with 73 additions and 16 deletions

View File

@ -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;

View File

@ -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
'';
};
}

View File

@ -21,5 +21,6 @@
./deskwhich.nix
./mcontrolcenter.nix
./the-powder-toy.nix
./ccache-wrapper.nix
];
}

View File

@ -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;
});
}

22
patches/lix-ccache.patch Normal file
View File

@ -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 {