summaryrefslogtreecommitdiff
path: root/derivations/gemini/default.nix
blob: c1034f4619e70849c6b2c418d183c5d34612c9e4 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# {
#   lib,
#   buildNpmPackage,
#   fetchFromGitHub,
#   fetchNpmDeps,
#   writeShellApplication,
#   cacert,
#   curl,
#   gnused,
#   jq,
#   nix-prefetch-github,
#   prefetch-npm-deps,
#   gitUpdater,
# }:
# buildNpmPackage (finalAttrs: {
#   pname = "superapp";
#   version = "0.4.2";
#   src = fetchFromGitHub {
#     owner = "sortugdev";
#     repo = "superapp";
#     tag = "v${finalAttrs.version}";
#     hash = "sha256-DAenod/w9BydYdYsOnuLj7kCQRcTnZ81tf4MhLUug6c=";
#   };
#   npmDeps = fetchNpmDeps {
#     inherit (finalAttrs) src;
#     hash = "sha256-otogkSsKJ5j1BY00y4SRhL9pm7CK9nmzVisvGCDIMlU=";
#   };
#   preConfigure = ''
#     mkdir -p packages/generated
#     echo "export const GIT_COMMIT_INFO = { commitHash: '${finalAttrs.src.rev}' };" > packages/generated/git-commit.ts
#   '';
#   installPhase = ''
#     runHook preInstall
#     mkdir -p $out/{bin,share/superapp-cli}
#     cp -r node_modules $out/share/superapp-cli/
#     rm -f $out/share/superapp-cli/node_modules/@sortug/superapp-cli
#     rm -f $out/share/superapp-cli/node_modules/@sortug/superapp-cli-core
#     cp -r packages/cli $out/share/superapp-cli/node_modules/@sortug/superapp-cli
#     cp -r packages/core $out/share/superapp-cli/node_modules/@sortug/superapp-cli-core
#     ln -s $out/share/superapp-cli/node_modules/@sortug/superapp-cli/dist/index.js $out/bin/superapp
#     runHook postInstall
#   '';
#   postInstall = ''
#     chmod +x "$out/bin/superapp"
#   '';
#   passthru.updateScript = gitUpdater {};
#   meta = {
#     description = "Super app that will save the world";
#     homepage = "https://github.com/sortugdev/superapp";
#     license = lib.licenses.asl20;
#     maintainers = with lib.maintainers; [pepe];
#     platforms = lib.platforms.all;
#     mainProgram = "superapp";
#   };
# })
{
  lib,
  buildNpmPackage,
  fetchFromGitHub,
  fetchNpmDeps,
  gitUpdater,
}:
buildNpmPackage (finalAttrs: {
  pname = "gemini-cli";
  version = "0.1.12";
  src = fetchFromGitHub {
    owner = "google-gemini";
    repo = "gemini-cli";
    rev = "cba272082d15a6b9fb4e21bc27ed1d56fa5b9a56";
    # tag = "v${finalAttrs.version}";
    sha256 = "DAenod/w9BydYdYsOnuLj7kCQRcTnZ81tf4MhLUug6c=";
  };
  npmDeps = fetchNpmDeps {
    inherit (finalAttrs) src;
    hash = "sha256-otogkSsKJ5j1BY00y4SRhL9pm7CK9nmzVisvGCDIMlU=";
  };
  preConfigure = ''
    mkdir -p packages/generated
    echo "export const GIT_COMMIT_INFO = { commitHash: '${finalAttrs.src.rev}' };" > packages/generated/git-commit.ts
  '';
  installPhase = ''
    runHook preInstall
    mkdir -p $out/{bin,share/gemini-cli}
    cp -r node_modules $out/share/gemini-cli/
    rm -f $out/share/gemini-cli/node_modules/@google/gemini-cli
    rm -f $out/share/gemini-cli/node_modules/@google/gemini-cli-core
    cp -r packages/cli $out/share/gemini-cli/node_modules/@google/gemini-cli
    cp -r packages/core $out/share/gemini-cli/node_modules/@google/gemini-cli-core
    ln -s $out/share/gemini-cli/node_modules/@google/gemini-cli/dist/index.js $out/bin/gemini
    runHook postInstall
  '';
  postInstall = ''
    chmod +x "$out/bin/gemini"
  '';
  passthru.updateScript = gitUpdater {};
  meta = {
    description = "AI agent that brings the power of Gemini directly into your terminal";
    homepage = "https://github.com/google-gemini/gemini-cli";
    license = lib.licenses.asl20;
    maintainers = with lib.maintainers; [donteatoreo];
    platforms = lib.platforms.all;
    mainProgram = "gemini";
  };
})