My Nix Configuration

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

Changed files
+135
packages
planka
+135
packages/planka/package.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + fetchFromGitHub, 5 + fetchNpmDeps, 6 + nix-update-script, 7 + npmHooks, 8 + dart-sass, 9 + nodejs, 10 + python3, 11 + }: 12 + let 13 + version = "2.0.0-rc.4"; 14 + src = fetchFromGitHub { 15 + owner = "plankanban"; 16 + repo = "planka"; 17 + tag = "v${version}"; 18 + hash = "sha256-RUOIOXrpoNGxoKwUlgkPsk4kTnA95E+iwYIjBzSBoTA="; 19 + }; 20 + meta = { 21 + description = "Kanban-style project mastering tool for everyone"; 22 + homepage = "https://docs.planka.cloud/"; 23 + license = { 24 + fullName = "Planka Community License"; 25 + url = "https://github.com/plankanban/planka/blob/master/LICENSE.md"; 26 + free = false; 27 + redistributable = true; 28 + }; 29 + maintainers = with lib.maintainers; [ pyrox0 ]; 30 + }; 31 + 32 + frontend = stdenv.mkDerivation (finalAttrs: { 33 + pname = "planka-frontend"; 34 + inherit version src meta; 35 + 36 + sourceRoot = "${finalAttrs.src.name}/client"; 37 + 38 + npmDeps = fetchNpmDeps { 39 + inherit (finalAttrs) src sourceRoot; 40 + hash = "sha256-XtVwO8253XBVtG0jrikeVr1yaS1PpphCbN5B6jz54qc="; 41 + }; 42 + 43 + npmFlags = [ 44 + "--ignore-scripts" 45 + ]; 46 + 47 + nativeBuildInputs = [ 48 + npmHooks.npmConfigHook 49 + nodejs 50 + dart-sass 51 + ]; 52 + 53 + buildPhase = '' 54 + runHook preBuild 55 + 56 + npx patch-package 57 + 58 + # Replace dart path in sass-embedded since node_modules doesn't have the native binary 59 + substituteInPlace node_modules/sass-embedded/dist/lib/src/compiler-path.js \ 60 + --replace-fail 'compilerCommand = (() => {' 'compilerCommand = (() => { return ["${lib.getExe dart-sass}"];' 61 + 62 + npm run build 63 + 64 + runHook postBuild 65 + ''; 66 + 67 + installPhase = '' 68 + runHook preInstall 69 + 70 + mkdir $out/ 71 + mv dist $out/dist 72 + 73 + runHook postInstall 74 + ''; 75 + }); 76 + 77 + serverPython = python3.withPackages (ps: [ ps.apprise ]); 78 + in 79 + stdenv.mkDerivation (finalAttrs: { 80 + pname = "planka"; 81 + inherit version src meta; 82 + 83 + sourceRoot = "${finalAttrs.src.name}/server"; 84 + 85 + npmDeps = fetchNpmDeps { 86 + inherit (finalAttrs) src sourceRoot; 87 + hash = "sha256-yW9uzPALGdPrrUV129ToXayLyeLbAK9mCl2emCPYUdc="; 88 + }; 89 + 90 + npmFlags = [ "--ignore-scripts" ]; 91 + 92 + nativeBuildInputs = [ 93 + npmHooks.npmConfigHook 94 + nodejs 95 + ]; 96 + 97 + buildInputs = [ 98 + serverPython 99 + nodejs 100 + ]; 101 + 102 + preBuild = '' 103 + # Patch notifs helper to use nixpkgs' python 104 + substituteInPlace api/helpers/utils/send-notifications.js \ 105 + --replace-fail '(`$' '(`' \ 106 + --replace-fail "{sails.config.appPath}/.venv/bin/python3" "${lib.getExe serverPython}" 107 + ''; 108 + 109 + buildPhase = '' 110 + runHook preBuild 111 + 112 + npx patch-package 113 + 114 + runHook postBuild 115 + ''; 116 + 117 + installPhase = '' 118 + runHook preInstall 119 + 120 + npm prune --omit=dev --no-save $npmFlags "$${npmFlagsArray[@]}" 121 + find node_modules -maxdepth 1 -type d -empty -delete 122 + 123 + mkdir -p $out/lib/node_modules/planka 124 + mkdir $out/bin 125 + mv * $out/lib/node_modules/planka 126 + cp -t $out/lib/node_modules/planka/public -r ${frontend}/dist/* 127 + cp ${frontend}/dist/index.html $out/lib/node_modules/planka/views/index.html 128 + 129 + ln -s $out/lib/node_modules/planka/start.sh $out/bin/planka 130 + 131 + runHook postInstall 132 + ''; 133 + 134 + passthru.updateScript = nix-update-script { extraArgs = [ "--version=unstable" ]; }; 135 + })