on 147cf21 help sign in
haskell.nix/scripts/update-external.nix
38 lines 851 B history raw
1{ stdenv, writeScript, glibc, coreutils, git, openssh
2, nix-tools, cabal-install, nix-prefetch-git }:
4{ name, script }:
6with stdenv.lib;
8let
9 repoHTTPS = "https://github.com/input-output-hk/${name}.nix";
10 repoSSH = "git@github.com:input-output-hk/${name}.nix.git";
11 sshKey = "/run/keys/buildkite-${name}-ssh-private";
12in
13 writeScript "update-${name}-nix.sh" ''
14 #!${stdenv.shell}
16 set -euo pipefail
18 export PATH="${makeBinPath [ coreutils glibc git openssh nix-tools cabal-install nix-prefetch-git ]}"
20 ${script}
22 source ${./git.env}
24 echo "Committing changes..."
25 git add .
26 check_staged
27 git commit --message "Automatic update for $(date)"
29 use_ssh_key ${sshKey}
31 git push ${repoSSH}
33 rev=$(git rev-parse HEAD)
35 cd ..
37 nix-prefetch-git ${repoHTTPS} --rev "$rev" | tee ${name}-src.json
38 ''