summary refs log tree commit diff
path: root/pkgs/common-updater
diff options
context:
space:
mode:
authorAttila Lendvai <attila@lendvai.name>2021-04-16 14:22:13 +0200
committerAttila Lendvai <attila@lendvai.name>2021-06-17 16:54:46 +0200
commit6c876bac617bc8bfda67891d320d8e34d24a2a7e (patch)
treebb7575a3cf19c4a7c308d17d299dbab1abb26ce2 /pkgs/common-updater
parent068b26fa111f9f1d1312167b338cf5f8a223acd9 (diff)
downloadnixpkgs-6c876bac617bc8bfda67891d320d8e34d24a2a7e.tar
nixpkgs-6c876bac617bc8bfda67891d320d8e34d24a2a7e.tar.gz
nixpkgs-6c876bac617bc8bfda67891d320d8e34d24a2a7e.tar.bz2
nixpkgs-6c876bac617bc8bfda67891d320d8e34d24a2a7e.tar.lz
nixpkgs-6c876bac617bc8bfda67891d320d8e34d24a2a7e.tar.xz
nixpkgs-6c876bac617bc8bfda67891d320d8e34d24a2a7e.tar.zst
nixpkgs-6c876bac617bc8bfda67891d320d8e34d24a2a7e.zip
unstable-updater.nix now understands a branch argument
Diffstat (limited to 'pkgs/common-updater')
-rw-r--r--pkgs/common-updater/unstable-updater.nix8
1 files changed, 6 insertions, 2 deletions
diff --git a/pkgs/common-updater/unstable-updater.nix b/pkgs/common-updater/unstable-updater.nix
index d315c1027ab..01f8ae2533e 100644
--- a/pkgs/common-updater/unstable-updater.nix
+++ b/pkgs/common-updater/unstable-updater.nix
@@ -1,4 +1,5 @@
-{ writeShellScript
+{ lib
+, writeShellScript
 , coreutils
 , git
 , nix
@@ -8,6 +9,7 @@
 # This is an updater for unstable packages that should always use the latest
 # commit.
 { url ? null # The git url, if empty it will be set to src.url
+, branch ? null
 }:
 
 let
@@ -25,7 +27,9 @@ let
 
     # Get info about HEAD from a shallow git clone
     tmpdir="$(${coreutils}/bin/mktemp -d)"
-    ${git}/bin/git clone --bare --depth=1 "$url" "$tmpdir"
+    ${git}/bin/git clone --bare --depth=1 \
+      ${lib.optionalString (branch != null) "--branch ${branch}"} \
+      "$url" "$tmpdir"
     pushd "$tmpdir"
     commit_date="$(${git}/bin/git show -s --pretty='format:%cs')"
     commit_sha="$(${git}/bin/git show -s --pretty='format:%H')"