summary refs log tree commit diff
path: root/pkgs/common-updater/unstable-updater.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/common-updater/unstable-updater.nix')
-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')"