2

I've installed git and tk, and I'm able to run git citool to display the Git GUI and create a single commit, after which the application exits. Unfortunately the git gui command itself says

git: 'gui' is not a git command. See 'git --help'

and so I'm stuck. How do I

  1. enable git gui as a command to
  2. show the Git GUI until I want to exit it?
Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
l0b0
  • 51,350

2 Answers2

6

Installing git and tk won't work on NixOS because git won't be able to see tk. Unlike most Linux distributions, NixOS doesn't have a global location (such as /usr/lib) for libraries. Instead, executables are modified in such a way that they are able to locate the libraries they need in the Nix store (/nix/store).

To use git gui install gitFull instead of git.

Both packages actually come from the same Nix expression, but when using gitFull the expression is applied such that it includes support for git gui.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
1

In case one uses home-manager / home.nix, one needs to set package = pkgs.gitFull:

  programs.git = {
    enable = true;
    userName = "Firstname Lastname";
    userEmail = "email@example.com";
    package = pkgs.gitFull;
  };

Side note: One can also set more options if one wants to:

    extraConfig = {
      push = {
        # Source: https://stackoverflow.com/a/72401899/873282
        autoSetupRemote = true;
    # Always push to the branch we pulled from
    # See https://git-scm.com/docs/git-config#Documentation/git-config.txt-pushdefault for details
    default = "current";
  };

  # Use SVN's ||| also in git - and remove matching lines in the conflict region
  #  See https://git-scm.com/docs/git-config#Documentation/git-config.txt-mergeconflictStyle for details
  merge = { configStyle = "zdiff3"; };

  # Colors in output
  # Source: https://unix.stackexchange.com/a/44297/18033
  color = { ui = "auto"; };

  # Sort branches at "git branch -v" by committer date
  branch = { sort = "-committerdate"; };

  # tabs are 4 spaces wide
  gui = { tabsize = 4; };
};

koppor
  • 221