mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
support updating arbitrary git repos via niv
This commit is contained in:
parent
d712176441
commit
2a6edb8656
2 changed files with 16 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -143,6 +143,7 @@
|
|||
"url_template": "<repo>/archive/<rev>.tar.gz"
|
||||
},
|
||||
"qyliss-nixlib": {
|
||||
"branch": "master",
|
||||
"builtin": false,
|
||||
"repo": "https://git.qyliss.net/nixlib",
|
||||
"rev": "e14330c5be9b005d4310cd4dc0d384cff882aedc",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue