depot/nix/pkgs/baserow/default.nix

59 lines
1.5 KiB
Nix
Raw Normal View History

2021-12-20 21:05:51 +00:00
{ fetchFromGitHub
, pkgs
, stdenv
, makeWrapper
}:
let
nodejs = pkgs.nodejs-12_x;
in
rec {
src = fetchFromGitHub {
owner = "bram2w";
repo = "baserow";
rev = "f61132a0fcb7e5620571155f7622766574ed52fd";
sha256 = "0jcisfhksrins33whwq46zg4r1101xvs2r0kcf1552x39r911gdg";
};
web-frontend-deps = import ./web-frontend {
inherit pkgs nodejs;
inherit (pkgs) system;
src = "${src}/web-frontend";
};
web-frontend = stdenv.mkDerivation {
name = "baserow-web-frontend";
inherit src;
buildInputs = [ nodejs ];
nativeBuildInputs = [ makeWrapper ];
nodeDependencies = web-frontend-deps.shell.nodeDependencies;
buildPhase = ''
runHook preBuild
outpath="$out/share/baserow"
mkdir -p $outpath $outpath/premium
cp -R web-frontend $outpath/web-frontend
cp -R premium/web-frontend $outpath/premium/web-frontend
# Disable prompts
export MINIMAL=true
pushd $outpath/web-frontend
mkdir node_modules
for f in $nodeDependencies/lib/node_modules/*; do
ln -s "$f" ./node_modules
done
export PATH="$nodeDependencies/bin:$PATH"
./node_modules/nuxt/bin/nuxt.js build --config-file config/nuxt.config.local.js
popd
mkdir $out/bin
makeWrapper $nodeDependencies/lib/node_modules/nuxt/bin/nuxt.js $out/bin/baserow-web-frontend \
--run "cd $outpath/web-frontend" \
--add-flags "start --config-file config/nuxt.config.local.js"
runHook postBuild
'';
dontInstall = true;
};
}