summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/it/iterm2/package.nix
blob: 346b13595625678d364c44959ae3a719dbd8a933 (plain)
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
51
52
53
54
55
56
57
58
59
{
  fetchzip,
  lib,
  stdenvNoCC,
}:

/*
  This cannot be built from source as it requires entitlements and
  for that it needs to be code signed. Automatic updates will have
  to be disabled via preferences instead of at build time. To do
  that edit $HOME/Library/Preferences/com.googlecode.iterm2.plist
  and add:
  SUEnableAutomaticChecks = 0;
*/

stdenvNoCC.mkDerivation rec {
  pname = "iterm2";
  version = "3.6.10";

  src = fetchzip {
    url = "https://iterm2.com/downloads/stable/iTerm2-${
      lib.replaceStrings [ "." ] [ "_" ] version
    }.zip";
    hash = "sha256-igdExoh3d8EZBuKkqyNqF087jUISax07rSWG3eenUbw=";
  };

  dontFixup = true;

  installPhase = ''
    runHook preInstall
    APP_DIR="$out/Applications/iTerm2.app"
    mkdir -p "$APP_DIR"
    cp -r . "$APP_DIR"
    mkdir -p "$out/bin"
    cat << EOF > "$out/bin/iterm2"
    #!${stdenvNoCC.shell}
    open -na "$APP_DIR" --args "\$@"
    EOF
    chmod +x "$out/bin/iterm2"
    runHook postInstall
  '';

  passthru.updateScript = ./update.sh;

  meta = {
    description = "Replacement for Terminal and the successor to iTerm";
    homepage = "https://www.iterm2.com/";
    hydraPlatforms = [ ]; # The build is little more than copying the binary
    license = lib.licenses.gpl2;
    maintainers = with lib.maintainers; [
      tricktron
      emaiax
    ];
    platforms = [
      "aarch64-darwin"
    ];
    sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
  };
}