depot/web/lukegbcom/default.nix

51 lines
1.2 KiB
Nix
Raw Normal View History

{ depot, pkgs, ... }:
2022-04-03 23:32:57 +00:00
let
2022-04-05 02:18:57 +00:00
nodejs = pkgs.nodejs-16_x;
2022-04-03 23:32:57 +00:00
composition = pkgs.callPackage ./node-overrides.nix { inherit nodejs; };
inherit (composition.shell) nodeDependencies;
in
pkgs.stdenv.mkDerivation {
name = "lukegbcom-export";
src = pkgs.nix-gitignore.gitignoreSourcePure [
".next"
"out"
"build"
".pnp"
"node_modules"
".pnp.js"
2022-04-05 21:04:32 +00:00
"*.nix"
"*.sh"
"*.log"
"package.json"
"result*"
2022-04-03 23:32:57 +00:00
] ./.;
buildInputs = [ nodejs ];
postPatch = let
f0Firmware = depot.nix.pkgs.flipperzero-firmware;
in ''
sed -i \
-e 's/__FLIPPER_FIRMWARE_NAME__/${f0Firmware.name}/g' \
-e 's/__FLIPPER_FIRMWARE_VERSION__/${f0Firmware.version}/g' \
-e 's/__FLIPPER_UPSTREAM_VERSION__/${f0Firmware.upstreamVersion}/g' \
pages/tools.js
'';
2022-04-03 23:32:57 +00:00
buildPhase = ''
ln -s ${nodeDependencies}/lib/node_modules ./node_modules
export PATH="${nodeDependencies}/bin:$PATH"
echo Starting build
next build
echo Starting static export
next export
'';
installPhase = ''
echo Done - moving to output
2022-04-05 02:18:57 +00:00
mkdir $out
cp firebase.json $out/firebase.json
cp .firebaserc $out/.firebaserc
mv out $out/out
2022-04-03 23:32:57 +00:00
'';
}