~kaction/config

ref: bd83900251b2478f4863aa288b5c68d655e63eba config/universe/git/default.nix -rw-r--r-- 1.6 KiB
bd839002 — Dmitry Bogatov Recover git-logp script 4 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{ git, writeScript, blurdate, perl, busybox, execline, runCommand, substituteAll, githooks }:
let
  stage1 = git.override {
    sendEmailSupport = true;
    coreutils = busybox;
    perlPackages = perl.pkgs;

    # Pure violence. git maintainer did not though about overrides hard
    # enough.
    #
    # Copied from pkgs/applications/version-management/git-and-tools.nix
    perlLibs = with perl.pkgs; [ LWP URI TermReadKey ];
    smtpPerlLibs = with perl.pkgs; [
      libnet
      NetSMTPSSL
      IOSocketSSL
      NetSSLeay
      AuthenSASL
      DigestHMAC
    ];
  };
  stage2 = stage1.overrideAttrs (old: {
    makeFlags = old.makeFlags ++ [ "SHELL_PATH=${busybox}/bin/sh" ];
    doInstallCheck = false;
  });
  stage3 = let
    env = {
      gitconfig = substituteAll {
        # This is tricky. Hooks scripts need git, and git includes
        # config which refers to hooks directory. Recursion.
        #
        # Here I break the loop by providing scripts with git that do
        # not have configuration embedded. This construction will
        # collapse when hook will need git for write operation and will
        # start complaining that user.name is not available.
        githooks = githooks.override { git = stage2; };
        logp = writeScript "logp" ''
          #!${execline}/bin/execlineb -WS0
          pipeline
            { git log -p --color=always --decorate=short $@ }
              less -R -p"^commit [0-9a-f]{40}"
        '';
        src = ./gitconfig.in;
      };
      gitignore = ./gitignore;
      git = stage2;
      inherit execline perl blurdate;
    };
  in runCommand git.name env "source ${./builder.bash}";
in stage3