psitransfer: use buildNpmPackage
This commit is contained in:
parent
5825210d3f
commit
4fb0a77d60
@ -1,44 +1,49 @@
|
||||
# To update package version:
|
||||
# 1. Change version string in node-package.json and this file
|
||||
# 2. Run `./generate.sh` to rebuild node dependencies with node2nix
|
||||
# 3. Build this package `nix-build -A psitransfer`
|
||||
# 4. Profit
|
||||
|
||||
{ stdenv
|
||||
, pkgs
|
||||
, lib
|
||||
, nodejs_18
|
||||
, fetchzip
|
||||
{ lib
|
||||
, buildNpmPackage
|
||||
, fetchFromGitHub
|
||||
}:
|
||||
|
||||
let
|
||||
nodejs = nodejs_18;
|
||||
|
||||
nodePackages = import ./node-composition.nix {
|
||||
inherit pkgs nodejs;
|
||||
inherit (stdenv.hostPlatform) system;
|
||||
pname = "psitransfer";
|
||||
version = "2.1.2";
|
||||
src = fetchFromGitHub {
|
||||
owner = "psi-4ward";
|
||||
repo = "psitransfer";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-dBAieXIwCEstR9m+6+2/OLPKo2qHynZ1t372Il0mkXk=";
|
||||
};
|
||||
app = buildNpmPackage {
|
||||
pname = "${pname}-app";
|
||||
inherit version src;
|
||||
|
||||
psitransfer = lib.head (lib.attrValues nodePackages);
|
||||
npmDepsHash = "sha256-iCd+I/aTMwQqAMRHan3T191XNz4S3Cy6CDxSLIYY7IA=";
|
||||
|
||||
combined = psitransfer.override rec {
|
||||
# version is not defined in source package.json
|
||||
# version must also be maintained in node-packages.json for node2nix
|
||||
version = "2.1.2";
|
||||
postPatch = ''
|
||||
# https://github.com/psi-4ward/psitransfer/pull/284
|
||||
touch public/app/.npmignore
|
||||
cd app
|
||||
'';
|
||||
|
||||
# override node2nix package src to pull pre-built release of same version
|
||||
src = fetchzip {
|
||||
url = "https://github.com/psi-4ward/psitransfer/releases/download/v${version}/psitransfer-v${version}.tar.gz";
|
||||
sha256 = "mfldWTVmfcIRa+1g8YDnQqem5YmrFRfCxJoitWcXvns=";
|
||||
stripRoot = false;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/psi-4ward/psitransfer";
|
||||
description = "Simple open source self-hosted file sharing solution";
|
||||
license = licenses.bsd2;
|
||||
maintainers = with maintainers; [ hyshka ];
|
||||
};
|
||||
installPhase = ''
|
||||
cp -r ../public/app $out
|
||||
'';
|
||||
};
|
||||
in
|
||||
combined
|
||||
in buildNpmPackage {
|
||||
inherit pname version src;
|
||||
|
||||
npmDepsHash = "sha256-H22T5IU8bjbsWhwhchDqppvYfcatbXSWqp6gdoek1Z8=";
|
||||
|
||||
postPatch = ''
|
||||
rm -r public/app
|
||||
cp -r ${app} public/app
|
||||
'';
|
||||
|
||||
dontBuild = true;
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/psi-4ward/psitransfer";
|
||||
description = "Simple open source self-hosted file sharing solution";
|
||||
license = lib.licenses.bsd2;
|
||||
maintainers = with lib.maintainers; [ hyshka ];
|
||||
};
|
||||
}
|
||||
|
@ -1,11 +0,0 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p nodePackages.node2nix
|
||||
set -euo pipefail
|
||||
|
||||
node2nix \
|
||||
--nodejs-18 \
|
||||
--input node-packages.json \
|
||||
--output node-packages.nix \
|
||||
--composition node-composition.nix \
|
||||
--node-env ../../development/node-packages/node-env.nix \
|
||||
;
|
@ -1,17 +0,0 @@
|
||||
# This file has been generated by node2nix 1.11.1. Do not edit!
|
||||
|
||||
{pkgs ? import <nixpkgs> {
|
||||
inherit system;
|
||||
}, system ? builtins.currentSystem, nodejs ? pkgs.nodejs_18}:
|
||||
|
||||
let
|
||||
nodeEnv = import ../../development/node-packages/node-env.nix {
|
||||
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
|
||||
inherit pkgs nodejs;
|
||||
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
|
||||
};
|
||||
in
|
||||
import ./node-packages.nix {
|
||||
inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit;
|
||||
inherit nodeEnv;
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
[
|
||||
{ "psitransfer": "git+https://github.com/psi-4ward/psitransfer#v2.1.2" }
|
||||
]
|
1781
pkgs/servers/psitransfer/node-packages.nix
generated
1781
pkgs/servers/psitransfer/node-packages.nix
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user