From 2a6edb865607958d21b46f26fe9f419b8b48165a Mon Sep 17 00:00:00 2001 From: arcnmx Date: Wed, 19 May 2021 09:48:24 -0700 Subject: [PATCH] support updating arbitrary git repos via niv --- ci/niv-cron.nix | 18 +++++++++++++++--- nix/sources.json | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ci/niv-cron.nix b/ci/niv-cron.nix index 47c389aa..4491fce3 100644 --- a/ci/niv-cron.nix +++ b/ci/niv-cron.nix @@ -50,9 +50,21 @@ with lib; { chmod 0600 ~/.ssh/id_rsa fi - for source in ${toString (attrNames channels.nixfiles.sources)}; do - niv update $source || true - done + ${concatStringsSep "\n" (mapAttrsToList (source: spec: let + update = "niv update ${source}"; + fetch = "timeout 30 git fetch -q --depth 1 ${spec.repo} ${spec.branch}:source-${source}"; + revision = "$(git show-ref -s source-${source})"; + isGit = hasPrefix "https://" spec.repo or ""; + git = '' + if ${fetch}; then + echo "${source}:${spec.branch} HEAD at ${revision}" >&2 + ${update} -r ${revision} || true + else + echo "failed to fetch latest revision from ${spec.repo}" >&2 + fi + ''; + auto = "${update} || true"; + in if isGit then git else auto) channels.nixfiles.sources)} if git status --porcelain | grep -qF nix/sources.json; then git -P diff nix/sources.json diff --git a/nix/sources.json b/nix/sources.json index da388678..78498004 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -143,6 +143,7 @@ "url_template": "/archive/.tar.gz" }, "qyliss-nixlib": { + "branch": "master", "builtin": false, "repo": "https://git.qyliss.net/nixlib", "rev": "e14330c5be9b005d4310cd4dc0d384cff882aedc",