on 935cdcd help sign in
haskell.nix/scripts/update-stackage.nix
39 lines 1.3 kB history raw
1{ stdenv, writeScript, coreutils, glibc, git, openssh, nix-tools, cabal-install, nix-prefetch-git }@args:
3import ./update-external.nix args {
4 name = "stackage";
5 script = ''
6 # Clone or update the main Stackage Nix expressions repo.
7 # The upstream LTS and Nightly package sets are in submodules, which
8 # should also be updated.
9 if [ -d stackage.nix ]; then
10 cd stackage.nix
11 git pull --ff-only
12 git submodule update --init
13 git submodule foreach git pull origin master
14 else
15 git clone git@github.com:input-output-hk/stackage.nix.git
16 cd stackage.nix
17 git submodule update --init
18 git submodule foreach git pull origin master
19 fi
21 echo "Running lts-to-nix for all snapshots..."
23 for lts in {lts-haskell,stackage-nightly}/*.yaml
24 do
25 if [[ ! -f $(basename ''${lts%.yaml}.nix) ]]; then
26 lts-to-nix $lts > $(basename ''${lts%.yaml}.nix)
27 fi
28 done
30 # update nightlies
31 echo "{" > nightlies.nix;
32 for a in nightly-*.nix; do echo " \"''${a%%.nix}\" = import ./$a;" >> nightlies.nix; done;
33 echo "}" >> nightlies.nix
34 # update lts
35 echo "{" > ltss.nix;
36 for a in $(ls lts-*.nix | sort -Vtx -k 1,1); do echo " \"''${a%%.nix}\" = import ./$a;" >> ltss.nix; done;
37 echo "}" >> ltss.nix
38 '';