Files
haskell.nix/scripts/update-stackage.nix
T
Jean-Baptiste Giraudeau 2a88d56aa4 update-stackage: update submodules on fresh checkout
otherwise we are missing out on new lts/nightlies.

 Also:
 - skip re-generation for existing resolver
 - better lts ordering in ltss.nix
2019-03-21 23:44:41 +01:00

40 lines
1.3 KiB
Nix

{ stdenv, writeScript, coreutils, glibc, git, openssh, nix-tools, cabal-install, nix-prefetch-git }@args:
import ./update-external.nix args {
name = "stackage";
script = ''
# Clone or update the main Stackage Nix expressions repo.
# The upstream LTS and Nightly package sets are in submodules, which
# should also be updated.
if [ -d stackage.nix ]; then
cd stackage.nix
git pull --ff-only
git submodule update --init
git submodule foreach git pull origin master
else
git clone git@github.com:input-output-hk/stackage.nix.git
cd stackage.nix
git submodule update --init
git submodule foreach git pull origin master
fi
echo "Running lts-to-nix for all snapshots..."
for lts in {lts-haskell,stackage-nightly}/*.yaml
do
if [[ ! -f $(basename ''${lts%.yaml}.nix) ]]; then
lts-to-nix $lts > $(basename ''${lts%.yaml}.nix)
fi
done
# update nightlies
echo "{" > nightlies.nix;
for a in nightly-*.nix; do echo " \"''${a%%.nix}\" = import ./$a;" >> nightlies.nix; done;
echo "}" >> nightlies.nix
# update lts
echo "{" > ltss.nix;
for a in $(ls lts-*.nix | sort -Vtx -k 1,1); do echo " \"''${a%%.nix}\" = import ./$a;" >> ltss.nix; done;
echo "}" >> ltss.nix
'';
}