Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv 2, lib 3, fetchFromGitHub 4, makeWrapper 5, nodejs 6, yarn 7, yarn2nix-moretea 8, nixosTests 9}: 10 11stdenv.mkDerivation rec { 12 pname = "outline"; 13 version = "0.69.2"; 14 15 src = fetchFromGitHub { 16 owner = "outline"; 17 repo = "outline"; 18 rev = "v${version}"; 19 hash = "sha256-XevrCUvPmAbPTysJ/o7i2xAZTQ+UFYtVal/aZKvt+Ls="; 20 }; 21 22 nativeBuildInputs = [ makeWrapper yarn2nix-moretea.fixup_yarn_lock ]; 23 buildInputs = [ yarn nodejs ]; 24 25 # Replace the inline calls to yarn with our sequalize wrapper. These should be 26 # the two occurrences: 27 # https://github.com/outline/outline/search?l=TypeScript&q=yarn 28 patches = [ ./sequelize-command.patch ]; 29 30 yarnOfflineCache = yarn2nix-moretea.importOfflineCache ./yarn.nix; 31 32 configurePhase = '' 33 export HOME=$(mktemp -d)/yarn_home 34 ''; 35 36 buildPhase = '' 37 runHook preBuild 38 export NODE_OPTIONS=--openssl-legacy-provider 39 40 yarn config --offline set yarn-offline-mirror $yarnOfflineCache 41 fixup_yarn_lock yarn.lock 42 43 yarn install --offline \ 44 --frozen-lockfile \ 45 --ignore-engines --ignore-scripts 46 patchShebangs node_modules/ 47 # apply upstream patches with `patch-package` 48 yarn run postinstall 49 yarn build 50 51 runHook postBuild 52 ''; 53 54 installPhase = '' 55 runHook preInstall 56 57 mkdir -p $out/bin $out/share/outline 58 mv build server public node_modules $out/share/outline/ 59 60 node_modules=$out/share/outline/node_modules 61 build=$out/share/outline/build 62 server=$out/share/outline/server 63 64 makeWrapper ${nodejs}/bin/node $out/bin/outline-server \ 65 --add-flags $build/server/index.js \ 66 --set NODE_ENV production \ 67 --set NODE_PATH $node_modules 68 69 makeWrapper ${nodejs}/bin/node $out/bin/outline-sequelize \ 70 --add-flags $node_modules/.bin/sequelize \ 71 --add-flags "--migrations-path $server/migrations" \ 72 --add-flags "--models-path $server/models" \ 73 --add-flags "--seeders-path $server/models/fixtures" \ 74 --set NODE_ENV production \ 75 --set NODE_PATH $node_modules 76 77 runHook postInstall 78 ''; 79 80 passthru.tests = { 81 basic-functionality = nixosTests.outline; 82 }; 83 84 meta = with lib; { 85 description = "The fastest wiki and knowledge base for growing teams. Beautiful, feature rich, and markdown compatible"; 86 homepage = "https://www.getoutline.com/"; 87 changelog = "https://github.com/outline/outline/releases"; 88 license = licenses.bsl11; 89 maintainers = with maintainers; [ cab404 yrd xanderio ]; 90 platforms = platforms.linux; 91 }; 92}