Skip to content

Commit 76bdb3e

Browse files
authored
Use hackage.nix/index-state.nix (#2392)
Since this file is updated every 5 minutes (if hackage has changed), we can get the latest hackage packages by waiting 5 minutes and running: ``` nix flake update haskellNix/hackage ```
1 parent b83fd1d commit 76bdb3e

File tree

3 files changed

+33
-6
lines changed

3 files changed

+33
-6
lines changed

flake.lock

Lines changed: 20 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
url = "github:input-output-hk/hackage.nix/for-stackage";
3232
flake = false;
3333
};
34+
hackage-internal = {
35+
url = "github:input-output-hk/hackage.nix";
36+
flake = false;
37+
};
3438
stackage = {
3539
url = "github:input-output-hk/stackage.nix";
3640
flake = false;

overlays/haskell.nix

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,8 @@ final: prev: {
437437
# If you want to update this value it important to check the
438438
# materializations. Turn `checkMaterialization` on below and
439439
# check the CI results before turning it off again.
440-
internalHackageIndexState = "2024-10-17T00:00:00Z"; # Remember to also update ../nix-tools/cabal.project and ../nix-tools/flake.lock
441-
440+
internalHackageIndexState = builtins.head (builtins.attrNames (
441+
import (sources.hackage-internal + "/index-state.nix")));
442442
checkMaterialization = false; # This is the default. Use an overlay to set it to true and test all the materialized files
443443

444444
# Helps materialize the output of derivations
@@ -601,7 +601,13 @@ final: prev: {
601601
# Takes a haskell src directory runs cabal new-configure and plan-to-nix.
602602
# Resulting nix files are added to nix-plan subdirectory.
603603
callCabalProjectToNix = import ../lib/call-cabal-project-to-nix.nix {
604-
index-state-hashes = import indexStateHashesPath;
604+
index-state-hashes =
605+
(
606+
if builtins.pathExists (hackageSrc + "/index-state.nix")
607+
then import (hackageSrc + "/index-state.nix")
608+
else import (hackageSrc + "/index-state-hashes.nix")
609+
)
610+
// import (sources.hackage-internal + "/index-state.nix");
605611
inherit (final.buildPackages.haskell-nix) haskellLib;
606612
pkgs = final.buildPackages.pkgs;
607613
inherit (final.buildPackages.pkgs) cacert;

0 commit comments

Comments
 (0)