summaryrefslogtreecommitdiff
path: root/pkgs/spliit/default.nix
blob: 3f05ad2ceb6ff0b84a1284f8ecc6fcddb2f88822 (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
{ buildNpmPackage
, fetchFromGitHub
, nodePackages
, lib
, writeShellScriptBin
}:
buildNpmPackage {
  pname = "spliit2";
  version = "master-20250420";

  src = fetchFromGitHub {
    repo = "spliit";
    owner = "spliit-app";

    rev = "a11efc79c13298c0d282e47496d132538752405f";
    hash = "sha256-v4gaPzLzBbbqw/LDYxe1fiyficcrqcGOop23YPiTrdc=";
  };

  npmDepsHash = "sha256-sd0/7ruNUFxUKTeTwx/v8Vc/G3llkXP6RSDE78h3qVU=";
  npmRebuildFlags = [ "--ignore-scripts" ];

  doCheck = false;

  postPatch = ''
    cp -v .env.example .env
  '';

  # nixpkgs/pkgs/applications/office/documenso/default.nix          (git)-[master]  05:36:05
  preBuild = ''
    # somehow for linux, npm is not finding the prisma package with the
    # packages installed with the lockfile.
    # This generates a prisma version incompatibility warning and is a kludge
    # until the upstream package-lock is modified.
    ${lib.getExe nodePackages.prisma} generate
  '';

  postInstall = ''
        install -Dvm755 -t $out/bin ${lib.getExe (writeShellScriptBin "spliit2" ''
          set -euxo pipefail
    	
          cd @out@/lib/node_modules/spliit2

          export PATH="$PWD/node_modules/.bin:$PATH"
          export NEXT_TELEMETRY_DISABLED=1

          prisma migrate deploy
          exec next start
        '')}

        #kk?
        #${lib.getExe nodePackages.prisma} migrate deploy

        substituteInPlace $out/bin/spliit2 \
          --replace @out@ $out
  '';

  meta = {
    description = "Free and Open Source Alternative to Splitwise. Share expenses with your friends and family.";
    homepage = "https://spliit.app";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ ];
  };
}