on stack-cache-native help sign in
haskell.nix/scripts/update-external.nix
39 lines 935 B history raw
1{ stdenv, writeScript, glibc, coreutils, git, openssh
2, nix-tools, cabal-install, nix-prefetch-git
3, bash, curl, findutils, gawk }:
5{ name, script }:
7with stdenv.lib;
9let
10 repoHTTPS = "https://github.com/input-output-hk/${name}.nix";
11 repoSSH = "git@github.com:input-output-hk/${name}.nix.git";
12 sshKey = "/run/keys/buildkite-${name}-ssh-private";
13in
14 writeScript "update-${name}-nix.sh" ''
15 #!${stdenv.shell}
17 set -euo pipefail
19 export PATH="${makeBinPath ([ coreutils curl findutils gawk bash git openssh nix-tools cabal-install nix-prefetch-git ] ++ optional stdenv.isLinux glibc)}"
21 ${script}
23 source ${./git.env}
25 echo "Committing changes..."
26 git add .
27 check_staged
28 git commit --message "Automatic update for $(date)"
30 use_ssh_key ${sshKey}
32 git push ${repoSSH}
34 rev=$(git rev-parse HEAD)
36 cd ..
38 nix-prefetch-git ${repoHTTPS} --rev "$rev" | tee ${name}-src.json
39 ''