My Nix Configuration

[pkgs] planka: init at 2.0.0-rc.4

Changed files
+135
packages
planka
+135
packages/planka/package.nix
···
···
+
{
+
lib,
+
stdenv,
+
fetchFromGitHub,
+
fetchNpmDeps,
+
nix-update-script,
+
npmHooks,
+
dart-sass,
+
nodejs,
+
python3,
+
}:
+
let
+
version = "2.0.0-rc.4";
+
src = fetchFromGitHub {
+
owner = "plankanban";
+
repo = "planka";
+
tag = "v${version}";
+
hash = "sha256-RUOIOXrpoNGxoKwUlgkPsk4kTnA95E+iwYIjBzSBoTA=";
+
};
+
meta = {
+
description = "Kanban-style project mastering tool for everyone";
+
homepage = "https://docs.planka.cloud/";
+
license = {
+
fullName = "Planka Community License";
+
url = "https://github.com/plankanban/planka/blob/master/LICENSE.md";
+
free = false;
+
redistributable = true;
+
};
+
maintainers = with lib.maintainers; [ pyrox0 ];
+
};
+
+
frontend = stdenv.mkDerivation (finalAttrs: {
+
pname = "planka-frontend";
+
inherit version src meta;
+
+
sourceRoot = "${finalAttrs.src.name}/client";
+
+
npmDeps = fetchNpmDeps {
+
inherit (finalAttrs) src sourceRoot;
+
hash = "sha256-XtVwO8253XBVtG0jrikeVr1yaS1PpphCbN5B6jz54qc=";
+
};
+
+
npmFlags = [
+
"--ignore-scripts"
+
];
+
+
nativeBuildInputs = [
+
npmHooks.npmConfigHook
+
nodejs
+
dart-sass
+
];
+
+
buildPhase = ''
+
runHook preBuild
+
+
npx patch-package
+
+
# Replace dart path in sass-embedded since node_modules doesn't have the native binary
+
substituteInPlace node_modules/sass-embedded/dist/lib/src/compiler-path.js \
+
--replace-fail 'compilerCommand = (() => {' 'compilerCommand = (() => { return ["${lib.getExe dart-sass}"];'
+
+
npm run build
+
+
runHook postBuild
+
'';
+
+
installPhase = ''
+
runHook preInstall
+
+
mkdir $out/
+
mv dist $out/dist
+
+
runHook postInstall
+
'';
+
});
+
+
serverPython = python3.withPackages (ps: [ ps.apprise ]);
+
in
+
stdenv.mkDerivation (finalAttrs: {
+
pname = "planka";
+
inherit version src meta;
+
+
sourceRoot = "${finalAttrs.src.name}/server";
+
+
npmDeps = fetchNpmDeps {
+
inherit (finalAttrs) src sourceRoot;
+
hash = "sha256-yW9uzPALGdPrrUV129ToXayLyeLbAK9mCl2emCPYUdc=";
+
};
+
+
npmFlags = [ "--ignore-scripts" ];
+
+
nativeBuildInputs = [
+
npmHooks.npmConfigHook
+
nodejs
+
];
+
+
buildInputs = [
+
serverPython
+
nodejs
+
];
+
+
preBuild = ''
+
# Patch notifs helper to use nixpkgs' python
+
substituteInPlace api/helpers/utils/send-notifications.js \
+
--replace-fail '(`$' '(`' \
+
--replace-fail "{sails.config.appPath}/.venv/bin/python3" "${lib.getExe serverPython}"
+
'';
+
+
buildPhase = ''
+
runHook preBuild
+
+
npx patch-package
+
+
runHook postBuild
+
'';
+
+
installPhase = ''
+
runHook preInstall
+
+
npm prune --omit=dev --no-save $npmFlags "$${npmFlagsArray[@]}"
+
find node_modules -maxdepth 1 -type d -empty -delete
+
+
mkdir -p $out/lib/node_modules/planka
+
mkdir $out/bin
+
mv * $out/lib/node_modules/planka
+
cp -t $out/lib/node_modules/planka/public -r ${frontend}/dist/*
+
cp ${frontend}/dist/index.html $out/lib/node_modules/planka/views/index.html
+
+
ln -s $out/lib/node_modules/planka/start.sh $out/bin/planka
+
+
runHook postInstall
+
'';
+
+
passthru.updateScript = nix-update-script { extraArgs = [ "--version=unstable" ]; };
+
})