forked from input-output-hk/haskell.nix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-external.nix
39 lines (26 loc) · 936 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
{ stdenv, lib, writeScript, glibc, coreutils, git, openssh
, nix-tools, cabal-install, nixFlakes
, bash, curl, findutils, gawk }:
{ name, script }:
with lib;
let
repoHTTPS = "https://github.com/input-output-hk/${name}.nix";
repoSSH = "[email protected]: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 cabal-install nixFlakes ] ++ 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 --experimental-features 'nix-command flakes' flake lock --update-input ${name}
''