1{
2 lib,
3 buildNpmPackage,
4 fetchFromGitHub,
5 makeBinaryWrapper,
6 nodejs_20,
7 nixosTests,
8}:
9buildNpmPackage rec {
10 pname = "send";
11 version = "3.4.27";
12
13 src = fetchFromGitHub {
14 owner = "timvisee";
15 repo = "send";
16 tag = "v${version}";
17 hash = "sha256-tfntox8Sw3xzlCOJgY/LThThm+mptYY5BquYDjzHonQ=";
18 };
19
20 npmDepsHash = "sha256-ZVegUECrwkn/DlAwqx5VDmcwEIJV/jAAV99Dq29Tm2w=";
21
22 nativeBuildInputs = [
23 makeBinaryWrapper
24 ];
25
26 env = {
27 PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = "true";
28 };
29
30 makeCacheWritable = true;
31
32 npmPackFlags = [ "--ignore-scripts" ];
33
34 NODE_OPTIONS = "--openssl-legacy-provider";
35
36 postInstall = ''
37 cp -r dist $out/lib/node_modules/send/
38 ln -s $out/lib/node_modules/send/dist/version.json $out/lib/node_modules/send/version.json
39
40 makeWrapper ${lib.getExe nodejs_20} $out/bin/send \
41 --add-flags $out/lib/node_modules/send/server/bin/prod.js \
42 --set "NODE_ENV" "production"
43 '';
44
45 passthru.tests = {
46 inherit (nixosTests) send;
47 };
48
49 meta = {
50 description = "File Sharing Experiment";
51 changelog = "https://github.com/timvisee/send/releases/tag/v${version}";
52 homepage = "https://github.com/timvisee/send";
53 license = lib.licenses.mpl20;
54 maintainers = with lib.maintainers; [
55 moraxyc
56 MrSom3body
57 ];
58 mainProgram = "send";
59 };
60}