Skip to content
This repository was archived by the owner on Jun 16, 2024. It is now read-only.

Commit f5e1a94

Browse files
feat(packages/nix): add allow failing substituters patch
1 parent 725d6f2 commit f5e1a94

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
diff --git a/src/libstore/http-binary-cache-store.cc b/src/libstore/http-binary-cache-store.cc
2+
index 5da87e935..605771ecb 100644
3+
--- a/src/libstore/http-binary-cache-store.cc
4+
+++ b/src/libstore/http-binary-cache-store.cc
5+
@@ -89,7 +89,7 @@ protected:
6+
void maybeDisable()
7+
{
8+
auto state(_state.lock());
9+
- if (state->enabled && settings.tryFallback) {
10+
+ if (state->enabled) {
11+
int t = 60;
12+
printError("disabling binary cache '%s' for %s seconds", getUri(), t);
13+
state->enabled = false;
14+
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
15+
index 118e5de9f..ecfb696b6 100644
16+
--- a/src/libstore/store-api.cc
17+
+++ b/src/libstore/store-api.cc
18+
@@ -555,10 +555,7 @@ void Store::querySubstitutablePathInfos(const StorePathCAMap & paths, Substituta
19+
} catch (InvalidPath &) {
20+
} catch (SubstituterDisabled &) {
21+
} catch (Error & e) {
22+
- if (settings.tryFallback)
23+
- logError(e.info());
24+
- else
25+
- throw;
26+
+ logError(e.info());
27+
}
28+
}
29+
}
30+
diff --git a/src/libstore/unix/build/substitution-goal.cc b/src/libstore/unix/build/substitution-goal.cc
31+
index c7e8e2825..55f7edc70 100644
32+
--- a/src/libstore/unix/build/substitution-goal.cc
33+
+++ b/src/libstore/unix/build/substitution-goal.cc
34+
@@ -113,18 +113,12 @@ void PathSubstitutionGoal::tryNext()
35+
tryNext();
36+
return;
37+
} catch (SubstituterDisabled &) {
38+
- if (settings.tryFallback) {
39+
- tryNext();
40+
- return;
41+
- }
42+
- throw;
43+
+ tryNext();
44+
+ return;
45+
} catch (Error & e) {
46+
- if (settings.tryFallback) {
47+
- logError(e.info());
48+
- tryNext();
49+
- return;
50+
- }
51+
- throw;
52+
+ logError(e.info());
53+
+ tryNext();
54+
+ return;
55+
}
56+
57+
if (info->path != storePath) {

packages/nix/default.nix

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66
}:
77
self.lib.derivations.c.optimizeAll host
88
(inputs'.nix-super.packages.default.overrideAttrs (old: {
9-
patches = (old.patches or []) ++ [./fix-eval-cache.patch];
9+
patches =
10+
(old.patches or [])
11+
++ [
12+
./allow-failing-substituters.patch
13+
./fix-eval-cache.patch
14+
];
1015

1116
doCheck = false;
1217
doInstallCheck = false;

0 commit comments

Comments
 (0)