nixpkgs/pkgs/applications/misc/tandoor-recipes/frontend.nix
Theodore Ni aab2097d2d
tandoor-recipes, tandoor-recipes.frontend: adapt update script to new nix-prefetch-github
We also take the opportunity also to migrate from "sha256" and
"yarnSha256" attributes to "hash" and "yarnHash" attributes.
2023-07-18 16:55:34 -07:00

57 lines
1.1 KiB
Nix

{ stdenv, fetchYarnDeps, fixup_yarn_lock, callPackage, nodejs }:
let
common = callPackage ./common.nix { };
in
stdenv.mkDerivation {
pname = "tandoor-recipes-frontend";
inherit (common) version;
src = "${common.src}/vue";
yarnOfflineCache = fetchYarnDeps {
yarnLock = "${common.src}/vue/yarn.lock";
hash = common.yarnHash;
};
nativeBuildInputs = [
fixup_yarn_lock
nodejs
nodejs.pkgs.yarn
];
configurePhase = ''
runHook preConfigure
export HOME=$(mktemp -d)
yarn config --offline set yarn-offline-mirror "$yarnOfflineCache"
fixup_yarn_lock yarn.lock
command -v yarn
yarn install --frozen-lockfile --offline --no-progress --non-interactive
patchShebangs node_modules/
runHook postConfigure
'';
buildPhase = ''
runHook preBuild
yarn --offline run build
runHook postBuild
'';
installPhase = ''
runHook preInstall
cp -R ../cookbook/static/vue/ $out
cp webpack-stats.json $out
echo "${common.version}" > "$out/version"
runHook postInstall
'';
meta = common.meta // {
description = "Tandoor Recipes frontend";
};
}