fix segfault in cachix

This commit is contained in:
Dmitriy Kholkin 2024-09-14 18:49:24 +03:00
parent eb19dbbb52
commit b65e8fee7e
Signed by: AtaraxiaDev
GPG Key ID: FD266B810DF48DF2
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,13 @@
diff --git a/src/libutil/current-process.cc b/src/libutil/current-process.cc
index 352a6a0..7435f58 100644
--- a/src/libutil/current-process.cc
+++ b/src/libutil/current-process.cc
@@ -35,6 +35,8 @@ unsigned int getMaxCPU()
auto cpuMax = readFile(cpuFile);
auto cpuMaxParts = tokenizeString<std::vector<std::string>>(cpuMax, " \n");
+ if (cpuMaxParts.size() != 2)
+ return 0;
auto quota = cpuMaxParts[0];
auto period = cpuMaxParts[1];
if (quota != "max")

View File

@ -38,6 +38,17 @@ with lib; {
wine = prev.wineWow64Packages.stagingFull;
intel-vaapi-driver = prev.intel-vaapi-driver.override { enableHybridCodec = true; };
haskellPackages = prev.haskellPackages.override {
overrides = _hFinal: hPrev: {
# TODO: remove after cachix starts to use nix > v2.21
cachix = let
nix-fixed = prev.nixVersions.nix_2_19.overrideAttrs (oldAttrs: {
patches = oldAttrs.patches ++ [ ../patches/fix-nix-2.19.patch ];
});
in hPrev.cachix.override { nix = nix-fixed; };
};
};
modprobed-db = prev.modprobed-db.overrideAttrs (oa: {
postPatch = (oa.postPatch or "") + ''
substituteInPlace ./common/modprobed-db.in \