{ lib , buildNpmPackage , fetchFromGitHub , yarn , nodejs_20 , inter # icons # , prisma-old ? null , oldpkgs ? (import (builtins.fetchTarball { url = "https://github.com/NixOS/nixpkgs/archive/ab7b6889ae9d484eed2876868209e33eb262511d.tar.gz"; }) {}) , rallly-prisma ? oldpkgs.prisma , rallly-prisma-engines ? oldpkgs.prisma-engines }: buildNpmPackage rec { pname = "rallly"; version = "3.11.2"; src = fetchFromGitHub { owner = "lukevella"; repo = "rallly"; rev = "v${version}"; hash = "sha256-ej6Y0ouiheoH6dSBWsSIW6qt9UvsLh9ODDQA5Fqt3zs="; }; nodejs = nodejs_20; npmDepsHash = "sha256-sAs1DhegfI1YbE/Xy2Jzjx1RKYOUgc1Ww7hLL7+f8ZU="; patches = [ ./font.patch ]; postPatch = '' cp ${./package-lock.json} package-lock.json ''; SKIP_ENV_VALIDATION = 1; NEXT_PUBLIC_SELF_HOSTED = "true"; NEXT_PUBLIC_APP_VERSION = version; preBuild = '' # We have to pass and bake in the Ollama URL into the package # Replace the googleapis.com Inter font with a local copy from nixpkgs cp "${inter}/share/fonts/truetype/InterVariable.ttf" apps/web/Inter.ttf cp -a packages/database/prisma . ${rallly-prisma}/bin/prisma generate ''; postBuild = '' # Add a shebang to the server js file, then patch the shebang to use a nixpkgs nodejs binary. sed -i '1s|^|#!/usr/bin/env node\n|' apps/web/.next/standalone/apps/web/server.js patchShebangs ./apps/web/.next/standalone/apps/web/server.js ''; installPhase = '' runHook preInstall cd apps/web mkdir -p $out/{share,bin} cp -r .next/standalone $out/share/rallly cp -a public/. $out/share/rallly/apps/web/public mkdir -p $out/share/rallly/.next cp -r .next/static $out/share/rallly/apps/web/.next/static cp -r ../../prisma $out/share/rallly/apps/web chmod +x $out/share/rallly/apps/web/server.js # This patch must be applied here, as it's patching the `dist` directory # of NextJS. Without this, homepage-dashboard errors when trying to # write its prerender cache. # # This patch ensures that the cache implementation respects the env # variable `NIXPKGS_HOMEPAGE_CACHE_DIR`, which is set by default in the # wrapper below. (cd "$out" && patch -p1 <${./prerender_cache_path.patch}) # we set a default port to support "nix run ..." makeWrapper $out/share/rallly/apps/web/server.js $out/bin/rallly \ --set-default NIXPKGS_RALLLY_CACHE_DIR /var/cache/rallly makeWrapper ${rallly-prisma}/bin/prisma $out/bin/rallly-prisma \ --chdir $out/share/rallly/apps/web/prisma \ --append-flags --schema=./schema.prisma runHook postInstall ''; nativeBuildInputs = [ (yarn.override {nodejs = nodejs_20; }) rallly-prisma ]; passthru = { inherit rallly-prisma rallly-prisma-engines; }; meta = with lib; { homepage = "https://rallly.co/"; changelog = "https://github.com/lukevella/rallly/releases/tag/v${version}"; description = "Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier"; longDescription = '' Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier. Schedule group meetings with friends, colleagues and teams. Create meeting polls to find the best date and time to organize an event based on your participants' availability. Save time and avoid back-and-forth emails. ''; license = licenses.agpl3Plus; maintainers = with maintainers; [ eyjhb ]; mainProgram = "rallly"; }; }