on fa2fa13 help sign in
haskell.nix/scripts/update-external.nix
39 lines 936 B history raw
1{ stdenv, lib, writeScript, glibc, coreutils, git, openssh
2, nix-tools, cabal-install, nixFlakes
3, bash, curl, findutils, gawk }:
5{ name, script }:
7with 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 nixFlakes ] ++ 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 --experimental-features 'nix-command flakes' flake lock --update-input ${name}
39 ''