summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2014-07-16 18:05:56 -0400
committerShea Levy <shea@shealevy.com>2014-07-16 18:05:56 -0400
commitb969e9340b01fd401bb3e01eb0d6d9cf8ded8691 (patch)
treeae7e5df3250781835111d096f7fe2a5a89e3d09f /pkgs/build-support
parentf12633c628c9f148762533ccd2084a01e540c4d5 (diff)
downloadnixlib-b969e9340b01fd401bb3e01eb0d6d9cf8ded8691.tar
nixlib-b969e9340b01fd401bb3e01eb0d6d9cf8ded8691.tar.gz
nixlib-b969e9340b01fd401bb3e01eb0d6d9cf8ded8691.tar.bz2
nixlib-b969e9340b01fd401bb3e01eb0d6d9cf8ded8691.tar.lz
nixlib-b969e9340b01fd401bb3e01eb0d6d9cf8ded8691.tar.xz
nixlib-b969e9340b01fd401bb3e01eb0d6d9cf8ded8691.tar.zst
nixlib-b969e9340b01fd401bb3e01eb0d6d9cf8ded8691.zip
Separate fetchgitPrivate into a separate file
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/fetchgit/private.nix19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkgs/build-support/fetchgit/private.nix b/pkgs/build-support/fetchgit/private.nix
new file mode 100644
index 000000000000..dd3a8c1cb417
--- /dev/null
+++ b/pkgs/build-support/fetchgit/private.nix
@@ -0,0 +1,19 @@
+{ fetchgit, writeScript, openssh, stdenv }: args: derivation ((fetchgit args).drvAttrs // {
+  SSH_AUTH_SOCK = if (builtins.tryEval <ssh-auth-sock>).success
+    then builtins.toString <ssh-auth-sock>
+    else null;
+  GIT_SSH = writeScript "fetchgit-ssh" ''
+    #! ${stdenv.shell}
+    exec -a ssh ${openssh}/bin/ssh -F ${let
+      sshConfigFile = if (builtins.tryEval <ssh-config-file>).success
+        then <ssh-config-file>
+        else builtins.trace ''
+          Please set your nix-path such that ssh-config-file points to a file that will allow ssh to access private repositories. The builder will not be able to see any running ssh agent sessions unless ssh-auth-sock is also set in the nix-path.
+
+          Note that the config file and any keys it points to must be readable by the build user, which depending on your nix configuration means making it readable by the build-users-group, the user of the running nix-daemon, or the user calling the nix command which started the build. Similarly, if using an ssh agent ssh-auth-sock must point to a socket the build user can access.
+
+          You may need StrictHostKeyChecking=no in the config file. Since ssh will refuse to use a group-readable private key, if using build-users you will likely want to use something like IdentityFile /some/directory/%u/key and have a directory for each build user accessible to that user.
+        '' "/var/lib/empty/config";
+    in builtins.toString sshConfigFile} "$@"
+  '';
+})