Skip to content

Commit c1d4e42

Browse files
committed
provide information about current ccache status
1 parent 9d3ac26 commit c1d4e42

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

overlay.nix

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,20 @@ final: prev: {
5656
};
5757
});
5858

59-
pkgsIncludeOS = prev.pkgsStatic.lib.makeScope prev.pkgsStatic.newScope (self: {
59+
pkgsIncludeOS = prev.pkgsStatic.lib.makeScope prev.pkgsStatic.newScope (self:
60+
let
61+
ccacheNoticeHook = prev.writeTextFile {
62+
name = "ccache-notice-hook";
63+
destination = "/nix-support/setup-hook";
64+
text = ''
65+
echo "====="
66+
echo "ccache is enabled!"
67+
echo "If you run into any issues, try: --arg withCcache false"
68+
echo "It's recommended to run tests with ccache disabled to avoid cache incoherencies."
69+
echo "====="
70+
'';
71+
};
72+
in {
6073
# self.callPackage will use this stdenv.
6174
stdenv = final.stdenvIncludeOS.includeos_stdenv;
6275

@@ -70,26 +83,30 @@ final: prev: {
7083
ccacheWrapper = prev.ccacheWrapper.override {
7184
inherit (self.stdenv) cc;
7285
extraConfig = ''
73-
export CCACHE_COMPRESS=1
7486
export CCACHE_DIR="/nix/var/cache/ccache"
75-
export CCACHE_UMASK=007
76-
export CCACHE_SLOPPINESS=random_seed
7787
if [ ! -d "$CCACHE_DIR" ]; then
7888
echo "====="
7989
echo "Directory '$CCACHE_DIR' does not exist"
8090
echo "Please create it with:"
8191
echo " sudo mkdir -m0770 '$CCACHE_DIR'"
8292
echo " sudo chown root:nixbld '$CCACHE_DIR'"
93+
echo ""
94+
echo 'Alternatively, disable ccache with `--arg withCcache false`'
8395
echo "====="
8496
exit 1
8597
fi
8698
if [ ! -w "$CCACHE_DIR" ]; then
8799
echo "====="
88-
echo "Directory '$CCACHE_DIR' is not accessible for user $(whoami)"
100+
echo "Directory '$CCACHE_DIR' exists, but is not accessible for user $(whoami)"
89101
echo "Please verify its access permissions"
102+
echo 'Alternatively, disable ccache with `--arg withCcache false`'
90103
echo "====="
91104
exit 1
92105
fi
106+
107+
export CCACHE_COMPRESS=1
108+
export CCACHE_UMASK=007
109+
export CCACHE_SLOPPINESS=random_seed
93110
'';
94111
};
95112

@@ -123,7 +140,7 @@ final: prev: {
123140
nativeBuildInputs = [
124141
prev.buildPackages.cmake
125142
prev.buildPackages.nasm
126-
] ++ prev.lib.optionals withCcache [self.ccacheWrapper];
143+
] ++ prev.lib.optionals withCcache [self.ccacheWrapper ccacheNoticeHook];
127144

128145
buildInputs = [
129146
self.botan2
@@ -145,7 +162,7 @@ final: prev: {
145162
cp -r -v ${final.stdenvIncludeOS.libraries.libcxx.include} $out/libcxx/include
146163
cp -r -v ${final.stdenvIncludeOS.libraries.libunwind} $out/libunwind
147164
cp -r -v ${final.stdenvIncludeOS.libraries.libgcc} $out/libgcc
148-
'';
165+
'';
149166

150167
archFlags = if self.stdenv.targetPlatform.system == "i686-linux" then
151168
[

0 commit comments

Comments
 (0)