Open damhiya opened 2 years ago
I used nix-diff
to compare two of these and the difference between them is the GHC version used to build cabal-install
and nix-tools
(haskell.nix defaults to using the project's GHC version to build these tools).
One solution might be to have a fixed GHC version and use only that for building these. That has two drawbacks:
cabal-install
and nix-tools
include dependencies on the GHC derivation they are built with.Every dot-cabal-hackage.haskell.org
is 800MB.
In the short term nix store optimise
from time to time might help free up some disk space. It won't help the download time and won't help disk space on filesystems with automatic deduplication.
I used
nix-diff
to compare two of these and the difference between them is the GHC version used to buildcabal-install
andnix-tools
(haskell.nix defaults to using the project's GHC version to build these tools).One solution might be to have a fixed GHC version and use only that for building these. That has two drawbacks:
- If the user is not using a nix binary cache and the GHC version they want is not the one we choose they will have to wait for it to build.
- On macOS
cabal-install
andnix-tools
include dependencies on the GHC derivation they are built with.Every
dot-cabal-hackage.haskell.org
is 800MB.In the short term
nix store optimise
from time to time might help free up some disk space. It won't help the download time and won't help disk space on filesystems with automatic deduplication.
I thought downloading specific index file is just sufficient for building dot-cabal-hackage.haskell.org
, since hackage.nix
repo manages fixed hackage index of every dates. Why do we need cabal-install
or nix-tools
to build dot-cabal-hackage.haskell.org
?
nix-tools
to truncate the index https://github.com/input-output-hk/haskell.nix/blob/62a4287cac70bd06827844f9470da4eab01719f1/overlays/haskell.nix#L198
cabal-install
to build a suitable .cabal
directory using cabal new-update
https://github.com/input-output-hk/haskell.nix/blob/62a4287cac70bd06827844f9470da4eab01719f1/overlays/haskell.nix#L283
We could delay these steps and run them on demand. If we changed the derivations into a buildDotCabalHome
script then we could have the derivations that need the cabal home dir run something like:
HOME=$(mktemp -d)
${buildDotCabalHome ...}
cabal configure ...
That might just trade the storage issue for a performance one though.
What if we store index files as a pure file somewhere (e.g. hackage.nix) and make a nix derivation referring that files? I think there should be no duplication due to different tool chain versions in that case. Since hydra.iohk.io
already caches hackage index derivations, this seems as a reasonable approach to me.
Also, If we split the hackage index into fragments and reassemble them when we build a hackage index derivation, there might be further saving.
It seems haskell.nix rebuilds same package when I modified unrelated options.
For example, I have duplicated hackage state files at my
/nix/store
I don't get why state files of the same date may have different hash value. These files are pretty big, so downloading it serveral times is really annoying.
nix-tools
is another example.I observed nix rebuilding
nix-tools
when I copy and paste exisiting haskell project setting and modified some options (project name, haskell library list, ...), but did not changed compiler andhaskell.nix
versions.It is possible to make nix to not duplicate such packages?