Merge pull request #245489 from dotlambda/polaris-web-buildNpmPackage
polaris-web: use buildNpmPackage
This commit is contained in:
commit
e1d80a357d
|
@ -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_12"}:
|
||||
|
||||
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;
|
||||
}
|
4301
pkgs/servers/polaris/node-packages.nix
generated
4301
pkgs/servers/polaris/node-packages.nix
generated
File diff suppressed because it is too large
Load diff
|
@ -1,31 +0,0 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p common-updater-scripts nodePackages.node2nix curl jq gnused nix coreutils
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
pushd .
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"/../../..
|
||||
|
||||
latestVersion="$(curl -s "https://api.github.com/repos/agersant/polaris-web/releases?per_page=1" | jq -r ".[0].tag_name")"
|
||||
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; polaris-web.version or (lib.getVersion polaris-web)" | tr -d '"')
|
||||
|
||||
if [[ "$currentVersion" == "$latestVersion" ]]; then
|
||||
echo "polaris-web is up-to-date: $currentVersion"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
update-source-version polaris-web "$latestVersion"
|
||||
|
||||
store_src="$(nix-build . -A polaris-web.src --no-out-link)"
|
||||
|
||||
popd
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")"
|
||||
|
||||
node2nix \
|
||||
--nodejs-12 \
|
||||
--development \
|
||||
--node-env ../../development/node-packages/node-env.nix \
|
||||
--input "$store_src"/package.json \
|
||||
--lock "$store_src"/package-lock.json \
|
||||
--output ./node-packages.nix \
|
||||
--composition ./node-composition.nix
|
|
@ -1,65 +1,24 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, pkgs
|
||||
, buildNpmPackage
|
||||
, fetchFromGitHub
|
||||
, nodejs
|
||||
, cypress
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
buildNpmPackage rec {
|
||||
pname = "polaris-web";
|
||||
version = "build-55";
|
||||
version = "67";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "agersant";
|
||||
repo = "polaris-web";
|
||||
rev = version;
|
||||
sha256 = "2XqU4sExF7Or7RxpOK2XU9APtBujfPhM/VkOLKVDvF4=";
|
||||
rev = "build-${version}";
|
||||
hash = "sha256-mhrgHNbqxLhhLWP4eu1A3ytrx9Q3X0EESL2LuTfgsBE=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
nodejs
|
||||
];
|
||||
npmDepsHash = "sha256-lScXbxkJiRq5LLFkoz5oZsmKz8I/t1rZJVonfct9r+0=";
|
||||
|
||||
buildPhase =
|
||||
let
|
||||
nodeDependencies = (import ./node-composition.nix {
|
||||
inherit pkgs nodejs;
|
||||
inherit (stdenv.hostPlatform) system;
|
||||
}).nodeDependencies.override (old: {
|
||||
# access to path '/nix/store/...-source' is forbidden in restricted mode
|
||||
src = src;
|
||||
dontNpmInstall = true;
|
||||
|
||||
# ERROR: .../.bin/node-gyp-build: /usr/bin/env: bad interpreter: No such file or directory
|
||||
# https://github.com/svanderburg/node2nix/issues/275
|
||||
# There are multiple instances of it, hence the globstar
|
||||
preRebuild = ''
|
||||
shopt -s globstar
|
||||
sed -i -e "s|#!/usr/bin/env node|#! ${pkgs.nodejs}/bin/node|" \
|
||||
node_modules/**/node-gyp-build/bin.js \
|
||||
'';
|
||||
|
||||
buildInputs = [ cypress ];
|
||||
# prevent downloading cypress, use the executable in path instead
|
||||
CYPRESS_INSTALL_BINARY = "0";
|
||||
|
||||
});
|
||||
in
|
||||
''
|
||||
runHook preBuild
|
||||
|
||||
export PATH="${nodeDependencies}/bin:${nodejs}/bin:$PATH"
|
||||
|
||||
# https://github.com/parcel-bundler/parcel/issues/8005
|
||||
export NODE_OPTIONS=--no-experimental-fetch
|
||||
|
||||
ln -s ${nodeDependencies}/lib/node_modules .
|
||||
npm run production
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
env.CYPRESS_INSTALL_BINARY = "0";
|
||||
|
||||
npmBuildScript = "production";
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
@ -70,13 +29,10 @@ stdenv.mkDerivation rec {
|
|||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.updateScript = ./update-web.sh;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Web client for Polaris";
|
||||
homepage = "https://github.com/agersant/polaris-web";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ pbsds ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue