Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 103 lines 2.4 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 fetchYarnDeps, 6 makeWrapper, 7 nix-update-script, 8 prefetch-yarn-deps, 9 fixup-yarn-lock, 10 nodejs, 11 yarn, 12 nixosTests, 13}: 14 15stdenv.mkDerivation rec { 16 pname = "outline"; 17 version = "0.85.1"; 18 19 src = fetchFromGitHub { 20 owner = "outline"; 21 repo = "outline"; 22 rev = "v${version}"; 23 hash = "sha256-lErNsYzxqZYVl1MAQdMk062nBORjQGd3C+UbGbZMzvA="; 24 }; 25 26 nativeBuildInputs = [ 27 makeWrapper 28 prefetch-yarn-deps 29 fixup-yarn-lock 30 ]; 31 buildInputs = [ 32 yarn 33 nodejs 34 ]; 35 36 yarnOfflineCache = fetchYarnDeps { 37 yarnLock = "${src}/yarn.lock"; 38 hash = "sha256-/CXIZKI8eeK21PRIVZnRMOkwNNbj0vC0PZuT6rZBwG4="; 39 }; 40 41 configurePhase = '' 42 export HOME=$(mktemp -d)/yarn_home 43 ''; 44 45 buildPhase = '' 46 runHook preBuild 47 export NODE_OPTIONS=--openssl-legacy-provider 48 49 yarn config --offline set yarn-offline-mirror $yarnOfflineCache 50 fixup-yarn-lock yarn.lock 51 52 yarn install --offline \ 53 --frozen-lockfile \ 54 --ignore-engines --ignore-scripts 55 patchShebangs node_modules/ 56 # apply upstream patches with `patch-package` 57 yarn run postinstall 58 yarn build 59 60 runHook postBuild 61 ''; 62 63 installPhase = '' 64 runHook preInstall 65 66 mkdir -p $out/bin $out/share/outline 67 mv build server public node_modules $out/share/outline/ 68 69 node_modules=$out/share/outline/node_modules 70 build=$out/share/outline/build 71 server=$out/share/outline/server 72 73 makeWrapper ${nodejs}/bin/node $out/bin/outline-server \ 74 --add-flags $build/server/index.js \ 75 --set NODE_ENV production \ 76 --set NODE_PATH $node_modules \ 77 --prefix PATH : ${lib.makeBinPath [ nodejs ]} # required to run migrations 78 79 runHook postInstall 80 ''; 81 82 passthru = { 83 tests = { 84 basic-functionality = nixosTests.outline; 85 }; 86 updateScript = nix-update-script { }; 87 # alias for nix-update to be able to find and update this attribute 88 offlineCache = yarnOfflineCache; 89 }; 90 91 meta = with lib; { 92 description = "Fastest wiki and knowledge base for growing teams. Beautiful, feature rich, and markdown compatible"; 93 homepage = "https://www.getoutline.com/"; 94 changelog = "https://github.com/outline/outline/releases"; 95 license = licenses.bsl11; 96 maintainers = with maintainers; [ 97 cab404 98 yrd 99 ]; 100 teams = [ teams.cyberus ]; 101 platforms = platforms.linux; 102 }; 103}