diff options
author | Shea Levy <shea@shealevy.com> | 2014-05-14 13:35:31 -0400 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2014-05-14 14:47:42 -0400 |
commit | 2baeefee2744e1d3df82ba8292c76997a3172015 (patch) | |
tree | fffa97beaf127cfbbf803dfef6026b31717831ed /pkgs/top-level | |
parent | 3c656b702c77d8d7c54f0459ceb89ecc16633f9d (diff) | |
download | nixlib-2baeefee2744e1d3df82ba8292c76997a3172015.tar nixlib-2baeefee2744e1d3df82ba8292c76997a3172015.tar.gz nixlib-2baeefee2744e1d3df82ba8292c76997a3172015.tar.bz2 nixlib-2baeefee2744e1d3df82ba8292c76997a3172015.tar.lz nixlib-2baeefee2744e1d3df82ba8292c76997a3172015.tar.xz nixlib-2baeefee2744e1d3df82ba8292c76997a3172015.tar.zst nixlib-2baeefee2744e1d3df82ba8292c76997a3172015.zip |
Add function for fetching from a private git repo
Diffstat (limited to 'pkgs/top-level')
-rw-r--r-- | pkgs/top-level/all-packages.nix | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 88cbb2b3f978..d0b3a67a625c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -303,6 +303,26 @@ let inherit stdenv git cacert; }; + fetchgitPrivate = 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 = pkgs.writeScript "fetchgit-ssh" '' + #! ${pkgs.stdenv.shell} + exec -a ssh ${pkgs.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} "$@" + ''; + }); + fetchgitrevision = import ../build-support/fetchgitrevision runCommand git; fetchmtn = callPackage ../build-support/fetchmtn (config.fetchmtn or {}); |