pkgs: add spliit

This commit is contained in:
Alejandro Soto 2025-06-05 19:46:06 -06:00
parent 1c2b67ba0c
commit 12cd697209
No known key found for this signature in database
GPG key ID: A2C4C79764EE8F16
2 changed files with 66 additions and 0 deletions

View file

@ -5,4 +5,6 @@ in {
lib = callPackage ./lib {}; lib = callPackage ./lib {};
override = {}; override = {};
spliit = callPackage ./spliit {};
} }

64
pkgs/spliit/default.nix Normal file
View file

@ -0,0 +1,64 @@
{
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; [];
};
}