diff options
author | Marc Weber <marco-oweber@gmx.de> | 2009-09-26 23:33:11 +0000 |
---|---|---|
committer | Marc Weber <marco-oweber@gmx.de> | 2009-09-26 23:33:11 +0000 |
commit | 48865a4aa61fb2901a173463d64ee05533af119c (patch) | |
tree | af45eb1c5a214170aba414e1ec28cf8be5034ba7 /pkgs/applications/version-management | |
parent | afbb4d0b591e5f1065f54fb25a6febfd2d65c5ff (diff) |
symlink duplicate git executables to bring down $out to 13MB (was > 100MB)
svn path=/nixpkgs/trunk/; revision=17458
Diffstat (limited to 'pkgs/applications/version-management')
-rw-r--r-- | pkgs/applications/version-management/git-and-tools/git/default.nix | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pkgs/applications/version-management/git-and-tools/git/default.nix b/pkgs/applications/version-management/git-and-tools/git/default.nix index 6a2393f39497..b94868b14710 100644 --- a/pkgs/applications/version-management/git-and-tools/git/default.nix +++ b/pkgs/applications/version-management/git-and-tools/git/default.nix @@ -87,6 +87,23 @@ stdenv.mkDerivation rec { + ''# install bash completion script d="$out/etc/bash_completion.d" ensureDir $d; cp contrib/completion/git-completion.bash "$d" + '' + # Don't know why hardlinks aren't created. git installs the same executable multiple times into $out + # so replace duplicates by symlinks because I haven't tested whether the nix + # distribution system can handle hardlinks. This reduces the size of $out from 115MB down to 13MB on x86_64-linux! + + ''# + set -x + declare -A seen + find $out -type f | while read f; do + sum=$(md5sum "$f"); + sum=''\${sum/ */} + if [ -z "''\${seen["$sum"]}" ]; then + seen["$sum"]="$f" + else + rm "$f"; ln -s "''\${seen["$sum"]}" "$f" + fi + done + ''; meta = { |