get moby packages to selectively use ccache
this is a liiittle bit weird: we might want to just apply it to everything.
This commit is contained in:
parent
df9716e244
commit
a56b31cdac
|
@ -95,7 +95,7 @@
|
|||
self.overlays.default
|
||||
self.overlays.passthru
|
||||
self.overlays.pins
|
||||
self.overlays.optimizations
|
||||
# self.overlays.optimizations
|
||||
];
|
||||
nixpkgs.hostPlatform = target;
|
||||
# nixpkgs.buildPlatform = local; # set by instantiate.nix instead
|
||||
|
|
|
@ -101,7 +101,7 @@ let
|
|||
# because they don't affect the result -- only the build process -- so we can disable them as an optimization.
|
||||
crossOnlyUniversalOverlays = [
|
||||
(import ./../../../overlays/disable-flakey-tests.nix)
|
||||
# (import ./../../../overlays/optimizations.nix)
|
||||
(import ./../../../overlays/optimizations.nix)
|
||||
];
|
||||
universalOverlays = [
|
||||
(import ./../../../overlays/pkgs.nix)
|
||||
|
|
|
@ -12,7 +12,23 @@ in
|
|||
|
||||
config = mkMerge [
|
||||
{
|
||||
nix.settings.extra-sandbox-paths = [ cacheDir ];
|
||||
# programs.ccache.cacheDir = "/var/cache/ccache"; # nixos default
|
||||
# programs.ccache.cacheDir = "/homeless-shelter/.ccache"; # ccache default (~/.ccache)
|
||||
|
||||
# if the cache doesn't reside at ~/.ccache, then CCACHE_DIR has to be set.
|
||||
# we can do that manually as commented out below, or let nixos do it for us by telling it to use ccache on a dummy package:
|
||||
programs.ccache.packageNames = [ "dummy-pkg-to-force-ccache-config" ];
|
||||
# nixpkgs.overlays = [
|
||||
# (self: super: {
|
||||
# # XXX: if the cache resides not at ~/.ccache (i.e. /homeless-shelter/.ccache)
|
||||
# # then we need to explicitly tell ccache where that is.
|
||||
# ccacheWrapper = super.ccacheWrapper.override {
|
||||
# extraConfig = ''
|
||||
# export CCACHE_DIR="${cacheDir}"
|
||||
# '';
|
||||
# };
|
||||
# })
|
||||
# ];
|
||||
}
|
||||
(mkIf config.sane.roles.build-machine {
|
||||
# serve packages to other machines that ask for them
|
||||
|
@ -31,35 +47,13 @@ in
|
|||
# TODO: whitelist `--verbose` in <nixpkgs:nixos/modules/programs/ccache.nix>
|
||||
# TODO: configure without compression (leverage fs-level compression), and enable file-clone (i.e. hardlinks)
|
||||
programs.ccache.enable = true;
|
||||
programs.ccache.cacheDir = "/homeless-shelter/.ccache";
|
||||
nix.settings.extra-sandbox-paths = [ cacheDir ];
|
||||
sane.persist.sys.plaintext = [
|
||||
{ group = "nixbld"; mode = "0775"; directory = config.programs.ccache.cacheDir; }
|
||||
];
|
||||
sane.fs."${cacheDir}/ccache.conf" = sane-lib.fs.wantedText ''
|
||||
max_size = 50G
|
||||
'';
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
# TODO: if we link /homeless-shelter/.ccache into the nix environment,
|
||||
# then maybe we get better use of upstream caches?
|
||||
ccacheWrapper = super.ccacheWrapper.override {
|
||||
extraConfig = ''
|
||||
export CCACHE_DIR="${cacheDir}"
|
||||
'';
|
||||
};
|
||||
})
|
||||
];
|
||||
# programs.ccache.packageNames = [
|
||||
# # these have to exist in toplevel package set:
|
||||
# # nixpkgs config creates an overlay which overrides each of these packages to build with ccache
|
||||
# # note a potential bootstrapping problem: if the cache directory above hasn't yet been created, then this blocks deployment.
|
||||
# # solution is to manually disable all these entries on the first deployment
|
||||
# # TODO: distribute these elsewhere; make sure it works on cross-compiled builds
|
||||
# "firefox-esr"
|
||||
# # "qtwebengine"
|
||||
# "webkitgtk"
|
||||
# ];
|
||||
})
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
diff --git a/pkgs/development/tools/misc/ccache/default.nix b/pkgs/development/tools/misc/ccache/default.nix
|
||||
index cad25a942d6..d02d212cec0 100644
|
||||
index cad25a942d6..9130097ab07 100644
|
||||
--- a/pkgs/development/tools/misc/ccache/default.nix
|
||||
+++ b/pkgs/development/tools/misc/ccache/default.nix
|
||||
@@ -2,7 +2,7 @@
|
||||
|
@ -20,3 +20,41 @@ index cad25a942d6..d02d212cec0 100644
|
|||
})
|
||||
];
|
||||
|
||||
@@ -71,7 +71,7 @@ let ccache = stdenv.mkDerivation rec {
|
||||
passthru = {
|
||||
# A derivation that provides gcc and g++ commands, but that
|
||||
# will end up calling ccache for the given cacheDir
|
||||
- links = {unwrappedCC, extraConfig}: stdenv.mkDerivation {
|
||||
+ links = {unwrappedCC, extraConfig, targetPrefix ? ""}: stdenv.mkDerivation {
|
||||
name = "ccache-links";
|
||||
passthru = {
|
||||
isClang = unwrappedCC.isClang or false;
|
||||
@@ -83,7 +83,7 @@ let ccache = stdenv.mkDerivation rec {
|
||||
mkdir -p $out/bin
|
||||
|
||||
wrap() {
|
||||
- local cname="$1"
|
||||
+ local cname="${targetPrefix}$1"
|
||||
if [ -x "${unwrappedCC}/bin/$cname" ]; then
|
||||
makeWrapper ${ccache}/bin/ccache $out/bin/$cname \
|
||||
--run ${lib.escapeShellArg extraConfig} \
|
||||
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
|
||||
index cb6fd2f0c4d..da4aadff3cb 100644
|
||||
--- a/pkgs/top-level/all-packages.nix
|
||||
+++ b/pkgs/top-level/all-packages.nix
|
||||
@@ -17383,10 +17383,12 @@ with pkgs;
|
||||
# should be owned by user root, group nixbld with permissions 0770.
|
||||
ccacheWrapper = makeOverridable ({ extraConfig, cc }:
|
||||
cc.override {
|
||||
- cc = ccache.links {
|
||||
+ cc = ccache.links ({
|
||||
inherit extraConfig;
|
||||
unwrappedCC = cc.cc;
|
||||
- };
|
||||
+ } // lib.optionalAttrs (cc ? targetPrefix) {
|
||||
+ inherit (cc) targetPrefix;
|
||||
+ });
|
||||
}) {
|
||||
extraConfig = "";
|
||||
inherit (stdenv) cc;
|
||||
|
||||
|
|
|
@ -16,7 +16,9 @@ in {
|
|||
# export CCACHE_DIR="/homeless-shelter/.ccache"
|
||||
# '';
|
||||
# };
|
||||
firefox-esr = ccache-able super.firefox-esr;
|
||||
# firefox-esr = ccache-able super.firefox-esr;
|
||||
# firefox/librewolf distribution is wacky: it grabs the stdenv off of `rustc.llvmPackages`, and really wants those to match.
|
||||
# buildMozillaMach = opts: ccache-able (super.buildMozillaMach opts);
|
||||
webkitgtk = ccache-able super.webkitgtk;
|
||||
mesa = ccache-able super.mesa;
|
||||
# webkitgtk = (ccache-able super.webkitgtk).overrideAttrs (_upstream: {
|
||||
|
|
Loading…
Reference in New Issue
Block a user