-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
224 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
set -eu -o pipefail | ||
HOARDER_LIB_PATH= | ||
NODEJS= | ||
exec "$NODEJS/bin/node" "$HOARDER_LIB_PATH/apps/cli/dist/index.mjs" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
set -eu -o pipefail | ||
HOARDER_LIB_PATH= | ||
RELEASE= | ||
NODE_ENV=production | ||
|
||
[[ -d "$DATA_DIR" ]] # Ensure DATA_DIR is defined and exists | ||
|
||
export RELEASE NODE_ENV | ||
exec "$HOARDER_LIB_PATH/node_modules/.bin/tsx" "$HOARDER_LIB_PATH/packages/db/migrate.ts" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
set -eu -o pipefail | ||
HOARDER_LIB_PATH= | ||
RELEASE= | ||
NODEJS= | ||
NODE_ENV=production | ||
|
||
[[ -d "$DATA_DIR" ]] # Ensure DATA_DIR is defined and exists | ||
|
||
export RELEASE NODE_ENV | ||
exec "$NODEJS/bin/node" "$HOARDER_LIB_PATH/apps/web/.next/standalone/apps/web/server.js" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
set -eu -o pipefail | ||
HOARDER_LIB_PATH= | ||
RELEASE= | ||
NODE_ENV=production | ||
NODE_PATH="$HOARDER_LIB_PATH/apps/workers" | ||
|
||
[[ -d "$DATA_DIR" ]] # Ensure DATA_DIR is defined and exists | ||
|
||
export RELEASE NODE_ENV NODE_PATH | ||
exec "$HOARDER_LIB_PATH/node_modules/.bin/tsx" "$HOARDER_LIB_PATH/apps/workers/index.ts" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
{ | ||
lib, | ||
callPackage, | ||
stdenv, | ||
fetchFromGitHub, | ||
nodejs, | ||
node-gyp, | ||
inter, | ||
python3, | ||
bash, | ||
coreutils, | ||
writeShellScript, | ||
srcOnly, | ||
removeReferencesTo, | ||
pnpm_9_0_0_alpha_8, | ||
}: | ||
let | ||
version = "0.21.0"; | ||
pnpm = pnpm_9_0_0_alpha_8; | ||
in | ||
stdenv.mkDerivation (finalAttrs: { | ||
pname = "hoarder"; | ||
inherit version; | ||
|
||
src = fetchFromGitHub { | ||
owner = "hoarder-app"; | ||
repo = "hoarder"; | ||
tag = "v${finalAttrs.version}"; | ||
hash = "sha256-3xgpiqq+BV0a/OlcQiGDt59fYNF+zP0+HPeBCRiZj48="; | ||
}; | ||
|
||
patches = [ | ||
./patches/use-local-font.patch | ||
./patches/fix-migrations-path.patch | ||
]; | ||
postPatch = '' | ||
ln -s ${inter}/share/fonts/truetype ./apps/landing/app/fonts | ||
ln -s ${inter}/share/fonts/truetype ./apps/web/app/fonts | ||
''; | ||
|
||
nativeBuildInputs = [ | ||
python3 | ||
nodejs | ||
node-gyp | ||
pnpm.configHook | ||
]; | ||
pnpmDeps = pnpm.fetchDeps { | ||
inherit (finalAttrs) pname version src; | ||
hash = "sha256-F6iW0rjcD2RUfWptMLpDw1Gfa2mbbzxqY2Ey1lYZTU4="; | ||
}; | ||
buildPhase = '' | ||
runHook preBuild | ||
# Based on matrix-appservice-discord | ||
pushd node_modules/better-sqlite3 | ||
npm run build-release --offline "--nodedir=${srcOnly nodejs}" | ||
find build -type f -exec ${removeReferencesTo}/bin/remove-references-to -t "${srcOnly nodejs}" {} \; | ||
popd | ||
export CI=true | ||
echo "Compiling apps/web..." | ||
pushd apps/web | ||
pnpm run build | ||
popd | ||
echo "Building apps/cli" | ||
pushd apps/cli | ||
pnpm run build | ||
popd | ||
runHook postBuild | ||
''; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/share/doc/hoarder | ||
cp README.md LICENSE $out/share/doc/hoarder | ||
# Copy necessary files into lib/hoarder while keeping the directory structure | ||
LIB_TO_COPY="node_modules apps/web/.next/standalone apps/cli/dist apps/workers packages/db packages/shared packages/trpc" | ||
HOARDER_LIB_PATH="$out/lib/hoarder" | ||
for DIR in $LIB_TO_COPY; do | ||
mkdir -p "$HOARDER_LIB_PATH/$DIR" | ||
cp -a $DIR/{.,}* "$HOARDER_LIB_PATH/$DIR" | ||
chmod -R u+w "$HOARDER_LIB_PATH/$DIR" | ||
done | ||
# NextJS requires static files are copied in a specific way | ||
# https://nextjs.org/docs/pages/api-reference/config/next-config-js/output#automatically-copying-traced-files | ||
cp -r ./apps/web/public "$HOARDER_LIB_PATH/apps/web/.next/standalone/apps/web/" | ||
cp -r ./apps/web/.next/static "$HOARDER_LIB_PATH/apps/web/.next/standalone/apps/web/.next/" | ||
# Copy and patch helper scripts | ||
for HELPER_SCRIPT in ${./helpers}/*; do | ||
HELPER_SCRIPT_NAME="$(basename "$HELPER_SCRIPT")" | ||
cp "$HELPER_SCRIPT" "$HOARDER_LIB_PATH/" | ||
substituteInPlace "$HOARDER_LIB_PATH/$HELPER_SCRIPT_NAME" \ | ||
--replace-warn "HOARDER_LIB_PATH=" "HOARDER_LIB_PATH=$HOARDER_LIB_PATH" \ | ||
--replace-warn "RELEASE=" "RELEASE=${version}" \ | ||
--replace-warn "NODEJS=" "NODEJS=${nodejs}" | ||
chmod +x "$HOARDER_LIB_PATH/$HELPER_SCRIPT_NAME" | ||
patchShebangs "$HOARDER_LIB_PATH/$HELPER_SCRIPT_NAME" | ||
done | ||
# The cli should be in bin/ | ||
mkdir -p $out/bin | ||
mv "$HOARDER_LIB_PATH/hoarder-cli" $out/bin/ | ||
runHook postInstall | ||
''; | ||
|
||
fixupPhase = '' | ||
runHook preFixup | ||
# Remove large dependencies that are not necessary during runtime | ||
rm -rf $out/lib/hoarder/node_modules/{@next,next,@swc,react-native,monaco-editor,faker,@typescript-eslint,@microsoft,@typescript-eslint,pdfjs-dist} | ||
# Remove broken symlinks | ||
find $out -type l ! -exec test -e {} \; -delete | ||
runHook postFixup | ||
''; | ||
|
||
meta = { | ||
homepage = "https://github.com/hoarder-app/hoarder"; | ||
description = "A self-hostable bookmark-everything app with a touch of AI for the data hoarders out there"; | ||
license = lib.licenses.agpl3Only; | ||
maintainers = [ lib.maintainers.three ]; | ||
platforms = lib.platforms.linux; | ||
}; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
--- a/packages/db/migrate.ts 2025-01-05 14:34:28.535360000 +0000 | ||
+++ b/packages/db/migrate.ts 2025-01-05 16:01:08.950580861 +0000 | ||
@@ -1,4 +1,5 @@ | ||
import { db } from "./drizzle"; | ||
import { migrate } from "drizzle-orm/better-sqlite3/migrator"; | ||
+import path from "path"; | ||
|
||
-migrate(db, { migrationsFolder: "./drizzle" }); | ||
+migrate(db, { migrationsFolder: path.join(__dirname, "./drizzle") }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
--- a/apps/landing/app/layout.tsx 2025-01-05 14:34:28.404363512 +0000 | ||
+++ b/apps/landing/app/layout.tsx 2025-01-03 19:48:04.929242480 +0000 | ||
@@ -1,11 +1,14 @@ | ||
import type { Metadata } from "next"; | ||
-import { Inter } from "next/font/google"; | ||
+import localFont from 'next/font/local'; | ||
|
||
import "@hoarder/tailwind-config/globals.css"; | ||
|
||
import React from "react"; | ||
|
||
-const inter = Inter({ subsets: ["latin"] }); | ||
+const inter = localFont({ | ||
+ subsets: ["latin"], | ||
+ src: "./fonts/InterVariable.ttf", | ||
+}); | ||
|
||
export const metadata: Metadata = { | ||
title: "Hoarder", | ||
--- a/apps/web/app/layout.tsx 2025-01-05 14:34:28.461361984 +0000 | ||
+++ b/apps/web/app/layout.tsx 2025-01-03 19:48:27.408659348 +0000 | ||
@@ -1,5 +1,5 @@ | ||
import type { Metadata } from "next"; | ||
-import { Inter } from "next/font/google"; | ||
+import localFont from 'next/font/local'; | ||
|
||
import "@hoarder/tailwind-config/globals.css"; | ||
|
||
@@ -13,7 +13,8 @@ | ||
|
||
import { clientConfig } from "@hoarder/shared/config"; | ||
|
||
-const inter = Inter({ | ||
+const inter = localFont({ | ||
+ src: "./fonts/InterVariable.ttf", | ||
subsets: ["latin"], | ||
fallback: ["sans-serif"], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters