depot/third_party/nixpkgs/pkgs/servers/photoprism/frontend.nix
Default email 1be0098156 Project import generated by Copybara.
GitOrigin-RevId: 667e5581d16745bcda791300ae7e2d73f49fff25
2022-11-04 13:27:35 +01:00

47 lines
1 KiB
Nix

{ lib, nodePackages, nodejs-14_x, stdenv, src, version, ... }:
let
nodeDependencies = nodePackages.photoprism-frontend.override {
inherit version;
name = "photoprism-frontend-dependencies";
# Workaround for lack of sourceRoot option in buildNodePackage.
src = "${src}/frontend";
meta.broken = false;
};
in
stdenv.mkDerivation {
inherit src version;
pname = "photoprism-frontend";
buildInputs = [ nodejs-14_x ];
buildPhase = ''
runHook preBuild
pushd frontend
ln -s ${nodeDependencies}/lib/node_modules/photoprism/node_modules ./node_modules
export PATH="${nodeDependencies}/lib/node_modules/photoprism/node_modules/.bin:$PATH"
NODE_ENV=production npm run build
popd
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir $out
cp -r assets $out/
runHook postInstall
'';
meta = with lib; {
homepage = "https://photoprism.app";
description = "Photoprism's frontend";
license = licenses.agpl3Only;
maintainers = with maintainers; [ benesim ];
};
}