fix(linkwarden): fix prisma to stable nixpkgs, update package build
This commit is contained in:
parent
5599934936
commit
7522ff67d8
3 changed files with 95 additions and 21 deletions
|
@ -5,9 +5,5 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
final: prev: {
|
final: prev: {
|
||||||
prisma = prev.prisma.overrideAttrs (_old: rec {
|
inherit (channels.stable) prisma;
|
||||||
pname = "prisma";
|
|
||||||
|
|
||||||
meta.mainProgram = "prisma";
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
42
packages/linkwarden/01-localfont.patch
Normal file
42
packages/linkwarden/01-localfont.patch
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
diff --git i/apps/web/components/Preservation/ReadableView.tsx w/apps/web/components/Preservation/ReadableView.tsx
|
||||||
|
index 64f14186..daff3636 100644
|
||||||
|
--- i/apps/web/components/Preservation/ReadableView.tsx
|
||||||
|
+++ w/apps/web/components/Preservation/ReadableView.tsx
|
||||||
|
@@ -20,13 +20,13 @@ import {
|
||||||
|
} from "@linkwarden/router/highlights";
|
||||||
|
import { Highlight } from "@linkwarden/prisma/client";
|
||||||
|
import { useUser } from "@linkwarden/router/user";
|
||||||
|
-import { Caveat } from "next/font/google";
|
||||||
|
-import { Bentham } from "next/font/google";
|
||||||
|
+import localFont from "next/font/local";
|
||||||
|
import { Separator } from "../ui/separator";
|
||||||
|
import { Button } from "../ui/button";
|
||||||
|
|
||||||
|
-const caveat = Caveat({ subsets: ["latin"] });
|
||||||
|
-const bentham = Bentham({ subsets: ["latin"], weight: "400" });
|
||||||
|
+
|
||||||
|
+const caveat = localFont({ src: "../../public/caveat.ttf" });
|
||||||
|
+const bentham = localFont({ src: "../../public/bentham.ttf" });
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
link: LinkIncludingShortenedCollectionAndTags;
|
||||||
|
diff --git i/apps/web/components/TextStyleDropdown.tsx w/apps/web/components/TextStyleDropdown.tsx
|
||||||
|
index a84587d9..59a291e4 100644
|
||||||
|
--- i/apps/web/components/TextStyleDropdown.tsx
|
||||||
|
+++ w/apps/web/components/TextStyleDropdown.tsx
|
||||||
|
@@ -13,12 +13,11 @@ import {
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { FitWidth, FormatLineSpacing, FormatSize } from "@/components/ui/icons";
|
||||||
|
import { useUpdateUserPreference, useUser } from "@linkwarden/router/user";
|
||||||
|
-import { Caveat } from "next/font/google";
|
||||||
|
-import { Bentham } from "next/font/google";
|
||||||
|
+import localFont from "next/font/local";
|
||||||
|
import { useTranslation } from "next-i18next";
|
||||||
|
|
||||||
|
-const caveat = Caveat({ subsets: ["latin"] });
|
||||||
|
-const bentham = Bentham({ subsets: ["latin"], weight: "400" });
|
||||||
|
+const caveat = localFont({ src: "../public/caveat.ttf" });
|
||||||
|
+const bentham = localFont({ src: "../public/bentham.ttf" });
|
||||||
|
|
||||||
|
const fontSizes = [
|
||||||
|
"12px",
|
|
@ -6,13 +6,14 @@
|
||||||
fetchYarnDeps,
|
fetchYarnDeps,
|
||||||
makeWrapper,
|
makeWrapper,
|
||||||
nixosTests,
|
nixosTests,
|
||||||
yarnBuildHook,
|
|
||||||
yarnConfigHook,
|
yarnConfigHook,
|
||||||
|
fetchpatch,
|
||||||
# dependencies
|
# dependencies
|
||||||
bash,
|
bash,
|
||||||
monolith,
|
monolith,
|
||||||
nodejs,
|
nodejs,
|
||||||
openssl,
|
openssl,
|
||||||
|
google-fonts,
|
||||||
playwright-driver,
|
playwright-driver,
|
||||||
prisma,
|
prisma,
|
||||||
prisma-engines,
|
prisma-engines,
|
||||||
|
@ -38,28 +39,42 @@ let
|
||||||
cp -r lib $out/lib/node_modules/bcrypt/
|
cp -r lib $out/lib/node_modules/bcrypt/
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
google-fonts' = google-fonts.override {
|
||||||
|
fonts = [
|
||||||
|
"Caveat"
|
||||||
|
"Bentham"
|
||||||
|
];
|
||||||
|
};
|
||||||
in
|
in
|
||||||
stdenvNoCC.mkDerivation rec {
|
stdenvNoCC.mkDerivation rec {
|
||||||
pname = "linkwarden";
|
pname = "linkwarden";
|
||||||
version = "2.10.0";
|
version = "2.11.3";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "linkwarden";
|
owner = "linkwarden";
|
||||||
repo = "linkwarden";
|
repo = "linkwarden";
|
||||||
tag = "v${version}";
|
tag = "v${version}";
|
||||||
hash = "sha256-mtygHx09VqrVq5eiCm8UbVM+bjA6n4MbRRT1HcWnUAo=";
|
hash = "sha256-/ktAfloJBmXKAn7/Er7rloF5bWuKl/DnofRqHcIrHkg=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
./01-localfont.patch
|
||||||
|
(fetchpatch {
|
||||||
|
url = "https://github.com/linkwarden/linkwarden/pull/1290.patch";
|
||||||
|
hash = "sha256-kq1GIEW0chnPmzvg4eDSS/5WtRyWlrHlk41h4pSCMzg=";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
yarnOfflineCache = fetchYarnDeps {
|
yarnOfflineCache = fetchYarnDeps {
|
||||||
yarnLock = src + "/yarn.lock";
|
yarnLock = src + "/yarn.lock";
|
||||||
hash = "sha256-D6iZp7O90ZwxyiwRZ1H67eUphh3kRplu3ucOEJIRR/w=";
|
hash = "sha256-dqkaTMQYufUjENteOeS82B+/vZxbvCMOcmaP6IODm1w=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
makeWrapper
|
makeWrapper
|
||||||
nodejs
|
nodejs
|
||||||
prisma
|
prisma
|
||||||
yarnBuildHook
|
|
||||||
yarnConfigHook
|
yarnConfigHook
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -70,12 +85,10 @@ stdenvNoCC.mkDerivation rec {
|
||||||
NODE_ENV = "production";
|
NODE_ENV = "production";
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace package.json \
|
for f in packages/filesystem/*Folder.ts packages/filesystem/*File.ts; do
|
||||||
--replace-fail "yarn worker:prod" "ts-node --transpile-only --skip-project scripts/worker.ts"
|
|
||||||
|
|
||||||
for f in lib/api/storage/*Folder.ts lib/api/storage/*File.ts; do
|
|
||||||
substituteInPlace $f \
|
substituteInPlace $f \
|
||||||
--replace-fail 'path.join(process.cwd(), storagePath + "/" + file' 'path.join(storagePath, file'
|
--replace-fail 'process.cwd(),' "" \
|
||||||
|
--replace-fail '"../..",' ""
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -84,7 +97,18 @@ stdenvNoCC.mkDerivation rec {
|
||||||
export PRISMA_QUERY_ENGINE_LIBRARY="${prisma-engines}/lib/libquery_engine.node"
|
export PRISMA_QUERY_ENGINE_LIBRARY="${prisma-engines}/lib/libquery_engine.node"
|
||||||
export PRISMA_QUERY_ENGINE_BINARY="${prisma-engines}/bin/query-engine"
|
export PRISMA_QUERY_ENGINE_BINARY="${prisma-engines}/bin/query-engine"
|
||||||
export PRISMA_SCHEMA_ENGINE_BINARY="${prisma-engines}/bin/schema-engine"
|
export PRISMA_SCHEMA_ENGINE_BINARY="${prisma-engines}/bin/schema-engine"
|
||||||
prisma generate
|
'';
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
|
||||||
|
cp ${google-fonts'}/share/fonts/truetype/Bentham-* ./apps/web/public/bentham.ttf
|
||||||
|
cp ${google-fonts'}/share/fonts/truetype/Caveat* ./apps/web/public/caveat.ttf
|
||||||
|
|
||||||
|
yarn prisma:generate
|
||||||
|
yarn web:build
|
||||||
|
|
||||||
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
|
@ -97,14 +121,25 @@ stdenvNoCC.mkDerivation rec {
|
||||||
|
|
||||||
rm -r node_modules/bcrypt node_modules/@next/swc-*
|
rm -r node_modules/bcrypt node_modules/@next/swc-*
|
||||||
ln -s ${bcrypt}/lib/node_modules/bcrypt node_modules/
|
ln -s ${bcrypt}/lib/node_modules/bcrypt node_modules/
|
||||||
mkdir -p $out/share/linkwarden/.next $out/bin
|
mkdir -p $out/share/linkwarden/apps/web/.next $out/bin
|
||||||
cp -r * .next $out/share/linkwarden/
|
cp -r apps/web/.next apps/web/* $out/share/linkwarden/apps/web
|
||||||
|
cp -r apps/worker $out/share/linkwarden/apps/worker
|
||||||
|
cp -r packages $out/share/linkwarden/
|
||||||
|
cp -r node_modules $out/share/linkwarden/
|
||||||
|
rm -r $out/share/linkwarden/node_modules/mobile-app
|
||||||
|
|
||||||
echo "#!${lib.getExe bash} -e
|
echo "#!${lib.getExe bash} -e
|
||||||
export DATABASE_URL=\''${DATABASE_URL-"postgresql://\$DATABASE_USER:\$POSTGRES_PASSWORD@\$DATABASE_HOST:\$DATABASE_PORT/\$DATABASE_NAME"}
|
export DATABASE_URL=\''${DATABASE_URL-"postgresql://\$DATABASE_USER:\$POSTGRES_PASSWORD@\$DATABASE_HOST:\$DATABASE_PORT/\$DATABASE_NAME"}
|
||||||
export npm_config_cache="\$LINKWARDEN_CACHE_DIR/npm"
|
export npm_config_cache="\$LINKWARDEN_CACHE_DIR/npm"
|
||||||
${lib.getExe prisma} migrate deploy --schema $out/share/linkwarden/prisma/schema.prisma \
|
|
||||||
&& ${lib.getExe' nodejs "npm"} start --prefix $out/share/linkwarden -- -H \$LINKWARDEN_HOST -p \$LINKWARDEN_PORT
|
if [ \"\$1\" == \"worker\" ]; then
|
||||||
|
echo "Starting worker"
|
||||||
|
${lib.getExe' nodejs "npm"} start --prefix $out/share/linkwarden/apps/worker
|
||||||
|
else
|
||||||
|
echo "Starting server"
|
||||||
|
${lib.getExe prisma} migrate deploy --schema $out/share/linkwarden/packages/prisma/schema.prisma \
|
||||||
|
&& ${lib.getExe' nodejs "npm"} start --prefix $out/share/linkwarden/apps/web -- -H \$LINKWARDEN_HOST -p \$LINKWARDEN_PORT
|
||||||
|
fi
|
||||||
" > $out/bin/start.sh
|
" > $out/bin/start.sh
|
||||||
chmod +x $out/bin/start.sh
|
chmod +x $out/bin/start.sh
|
||||||
|
|
||||||
|
@ -124,7 +159,8 @@ stdenvNoCC.mkDerivation rec {
|
||||||
--set-default LINKWARDEN_CACHE_DIR /var/cache/linkwarden \
|
--set-default LINKWARDEN_CACHE_DIR /var/cache/linkwarden \
|
||||||
--set-default LINKWARDEN_HOST localhost \
|
--set-default LINKWARDEN_HOST localhost \
|
||||||
--set-default LINKWARDEN_PORT 3000 \
|
--set-default LINKWARDEN_PORT 3000 \
|
||||||
--set-default STORAGE_FOLDER /var/lib/linkwarden
|
--set-default STORAGE_FOLDER /var/lib/linkwarden \
|
||||||
|
--set-default NEXT_TELEMETRY_DISABLED 1
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue