-
Notifications
You must be signed in to change notification settings - Fork 0
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
2 changed files
with
136 additions
and
6 deletions.
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
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,130 @@ | ||
{ | ||
stdenv, | ||
lib, | ||
nixosTests, | ||
fetchFromGitHub, | ||
nodejs, | ||
pnpm_9, | ||
makeWrapper, | ||
python3, | ||
bash, | ||
jemalloc, | ||
ffmpeg-headless, | ||
writeShellScript, | ||
xcbuild, | ||
... | ||
}: | ||
|
||
stdenv.mkDerivation (finalAttrs: { | ||
pname = "misskey"; | ||
|
||
version = "2025.2.0"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "misskey-dev"; | ||
repo = finalAttrs.pname; | ||
rev = finalAttrs.version; | ||
hash = "sha256-S6gBfGMBjom8nrqd5GR5Xt8tGpZ2zZDyyTBraS2dRpE="; | ||
fetchSubmodules = true; | ||
}; | ||
|
||
patches = [ | ||
../patch/0001-welcome-shape.patch | ||
../patch/0002-timeline-on-welcome-page.patch | ||
]; | ||
nativeBuildInputs = [ | ||
nodejs | ||
pnpm_9.configHook | ||
makeWrapper | ||
python3 | ||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ xcbuild.xcrun ]; | ||
|
||
# https://nixos.org/manual/nixpkgs/unstable/#javascript-pnpm | ||
pnpmDeps = pnpm_9.fetchDeps { | ||
inherit (finalAttrs) pname version src; | ||
hash = "sha256-BU+K4Boqa56hLfwCJ3I7YSlIrXYr8PJXdYK+8sAurxc="; | ||
}; | ||
|
||
buildPhase = '' | ||
runHook preBuild | ||
# https://github.com/NixOS/nixpkgs/pull/296697/files#r1617546739 | ||
( | ||
cd node_modules/.pnpm/node_modules/v-code-diff | ||
pnpm run postinstall | ||
) | ||
# https://github.com/NixOS/nixpkgs/pull/296697/files#r1617595593 | ||
export npm_config_nodedir=${nodejs} | ||
( | ||
cd node_modules/.pnpm/node_modules/re2 | ||
pnpm run rebuild | ||
) | ||
( | ||
cd node_modules/.pnpm/node_modules/sharp | ||
pnpm run install | ||
) | ||
pnpm build | ||
runHook postBuild | ||
''; | ||
|
||
installPhase = | ||
let | ||
checkEnvVarScript = writeShellScript "misskey-check-env-var" '' | ||
if [[ -z $MISSKEY_CONFIG_YML ]]; then | ||
echo "MISSKEY_CONFIG_YML must be set to the location of the Misskey config file." | ||
exit 1 | ||
fi | ||
''; | ||
in | ||
'' | ||
runHook preInstall | ||
mkdir -p $out/data | ||
cp -r . $out/data | ||
# Set up symlink for use at runtime | ||
# TODO: Find a better solution for this (potentially patch Misskey to make this configurable?) | ||
# Line that would need to be patched: https://github.com/misskey-dev/misskey/blob/9849aab40283cbde2184e74d4795aec8ef8ccba3/packages/backend/src/core/InternalStorageService.ts#L18 | ||
# Otherwise, maybe somehow bindmount a writable directory into <package>/data/files. | ||
ln -s /var/lib/misskey $out/data/files | ||
makeWrapper ${pnpm_9}/bin/pnpm $out/bin/misskey \ | ||
--run "${checkEnvVarScript} || exit" \ | ||
--chdir $out/data \ | ||
--add-flags run \ | ||
--set-default NODE_ENV production \ | ||
--prefix PATH : ${ | ||
lib.makeBinPath [ | ||
nodejs | ||
pnpm_9 | ||
bash | ||
] | ||
} \ | ||
--prefix LD_LIBRARY_PATH : ${ | ||
lib.makeLibraryPath [ | ||
jemalloc | ||
ffmpeg-headless | ||
stdenv.cc.cc | ||
] | ||
} | ||
runHook postInstall | ||
''; | ||
|
||
passthru = { | ||
inherit (finalAttrs) pnpmDeps; | ||
tests.misskey = nixosTests.misskey; | ||
}; | ||
|
||
meta = { | ||
description = "🌎 An interplanetary microblogging platform 🚀"; | ||
homepage = "https://misskey-hub.net/"; | ||
license = lib.licenses.agpl3Only; | ||
maintainers = [ lib.maintainers.feathecutie ]; | ||
platforms = lib.platforms.unix; | ||
mainProgram = "misskey"; | ||
}; | ||
}) |