-
Notifications
You must be signed in to change notification settings - Fork 244
/
Copy pathupdate-external.nix
40 lines (27 loc) · 978 Bytes
/
update-external.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{ stdenv, lib, writeScript, glibc, coreutils, git, openssh
, nix-tools, nixVersions
, bash, curl, findutils, gawk, cabal-issue-8352-workaround }:
{ name, script }:
with lib;
let
repoSSH = "git@github.com:input-output-hk/${name}.nix.git";
sshKey = "/run/keys/buildkite-${name}-ssh-private";
in
writeScript "update-${name}-nix.sh" ''
#!${stdenv.shell}
set -euo pipefail
export PATH="${makeBinPath ([ coreutils curl findutils gawk bash git openssh nix-tools nixVersions.stable ] ++ cabal-issue-8352-workaround ++ optional stdenv.isLinux glibc)}"
${script}
source ${./git.env}
echo "Committing changes..."
git add .
check_staged
git commit --message "Automatic update for $(date)"
use_ssh_key ${sshKey}
git push ${repoSSH}
rev=$(git rev-parse HEAD)
cd ..
nix flake lock --accept-flake-config \
--experimental-features 'nix-command flakes' \
--update-input ${name}
''