Files
haskell.nix/scripts/update-external.nix
T
d5d304d5b5 Flakify all inputs (#1180)
* Include dependencies of haskell.nix that were tracked in `nix/sources.json`
  as flake inputs (`flake.lock` replaces `nix/sources.json`).
* Use `flake-compat` to continue to provide a compatible interface for non
  flake projects.

Co-authored-by: Alexander Bantyev <balsoft@balsoft.ru>
Co-authored-by: Shea Levy <shea@shealevy.com>
2021-08-06 15:54:39 +12:00

40 lines
936 B
Nix

{ 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 = "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 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}
''