mirror of
https://github.com/infinisil/all-hies.git
synced 2024-11-26 08:19:34 +03:00
2.6 KiB
2.6 KiB
Assumption: The stack build does not depend on which nixpkgs version it uses, it only needs a matching ghc version
~/.cache/all-hies/ layout:
- history-nixpkgs-unstable
- nixpkgs
- haskell-ide-engine
-
per-nixpkgs
- <nixpkgsrev-ghcVersions>: File with a list of ghc versions this nixpkgs rev has
-
per-haskell-ide-engine
-
<hie-rev>
- <ghcVersion-stack2nix>.nix: File generated by stack2nix for hie-rev and ghcVersion
-
./generated/ layout:
-
nixpkgsForGhc
- <ghcVersion>: File containing the nixpkgsrev to use for that ghc
-
stable
- <ghcVersion>.nix: File copied from the cache
- revision: File with the git revision of current stable hie
-
unstable
- <ghcVersion>.nix: File copied from the cache
- revision: File with the git revision of current unstable hie
Flags:
- Whether master should be regenerated
- Whether to build the generated versions with Nix
Process:
- Update/initialize hie repo
-
Regenerate ./generated/stable by
- Removing ./generated/stable/*
- Getting the latest tag (~=stable)
- Write stable tag to ./generated/stable/revision
- Determining the stable hie sha1 hash from the tag
- Checking out that hie revision
-
For each stack file for a ghc version
-
If $CACHE/per-hie/<rev>/<ghcVersion>.nix is present
- copy it to ./generated/stable/<ghcVersion>.nix
-
else generate that file by
-
Find a suitable nixpkgs revision for that ghc version
- If ./generated/nixpkgsForGhc/<ghcVersion> present, use that version
-
else
- fetch channel history (or use cached version if <15 minutes ago)
-
for each channel nixpkgs revision (from newest to oldest)
-
Get ghc versions
- If $CACHE/per-nixpkgs/<revision> exists use that
-
Otherwise
- Check out that nixpkgs version (and maybe update/initialize the repo first)
- Run nix evaluation to determine available compilers
- Save result in $CACHE/per-nixpkgs/<revision>
-
If it has the ghc version we need
- Save that revision in ./generated/nixpkgsForGhc/<ghcVersion>
- revision found, exit channel history loop
- Otherwise continue
-
- If no fitting ghc version was found, log error
- Checking out that nixpkgs revision
- Invoke stack2nix to generate $CACHE/per-hie/<rev>/<ghcVersion>.nix
- If nix build flag is enabled, build it
- Copy $CACHE/per-hie/<rev>/<ghcVersion>.nix to ./generated/stable/<ghcVersion>.nix
-
-
-
If master flag is enabled, regenerate ./generated/unstable by
- (same process as above, only difference is first step)