nixpkgs-suyu/pkgs/servers/web-apps/lemmy/ui.nix

78 lines
1.6 KiB
Nix
Raw Normal View History

2021-09-09 16:28:32 +02:00
{ lib
, mkYarnPackage
, libsass
, nodejs
, python3
, pkg-config
, fetchFromGitHub
, fetchYarnDeps
2021-09-09 16:28:32 +02:00
}:
let
pkgConfig = {
node-sass = {
nativeBuildInputs = [ ];
buildInputs = [ libsass pkg-config python3 ];
postInstall = ''
LIBSASS_EXT=auto yarn --offline run build
rm build/config.gypi
'';
};
};
name = "lemmy-ui";
version = "0.12.2";
src = fetchFromGitHub {
owner = "LemmyNet";
repo = name;
rev = version;
fetchSubmodules = true;
sha256 = "sha256-iFLJqUnz4m9/JTSaJSUugzY5KkiKtH0sMYY4ALm2Ebk=";
};
in
mkYarnPackage {
2021-09-09 16:28:32 +02:00
inherit src pkgConfig name version;
2021-09-09 16:28:32 +02:00
extraBuildInputs = [ libsass ];
2021-09-09 16:28:32 +02:00
offlineCache = fetchYarnDeps {
yarnLock = src + "/yarn.lock";
sha256 = "sha256-i12J+Qi7Nsjr5JipeRXdkFkh+I/ROsgRw4Vty2cMNyU=";
};
2021-09-09 16:28:32 +02:00
# Fails mysteriously on source/package.json
# Upstream package.json is missing a newline at the end
packageJSON = ./package.json;
2021-09-09 16:28:32 +02:00
yarnPreBuild = ''
export npm_config_nodedir=${nodejs}
'';
2021-09-09 16:28:32 +02:00
buildPhase = ''
# Yarn writes cache directories etc to $HOME.
export HOME=$PWD/yarn_home
2021-09-09 16:28:32 +02:00
ln -sf $PWD/node_modules $PWD/deps/lemmy-ui/
2021-09-09 16:28:32 +02:00
yarn --offline build:prod
'';
2021-09-09 16:28:32 +02:00
preInstall = ''
mkdir $out
cp -R ./deps/lemmy-ui/dist $out
cp -R ./node_modules $out
'';
2021-09-09 16:28:32 +02:00
distPhase = "true";
meta = with lib; {
description = "Building a federated alternative to reddit in rust";
homepage = "https://join-lemmy.org/";
license = licenses.agpl3Only;
maintainers = with maintainers; [ happysalada billewanick ];
platforms = platforms.linux;
2021-09-09 16:28:32 +02:00
};
}