1# Do not use overrides in this file to add `meta.mainProgram` to packages. Use `./main-programs.nix` 2# instead. 3{ pkgs, nodejs }: 4 5let 6 inherit (pkgs) 7 stdenv 8 lib 9 callPackage 10 fetchFromGitHub 11 fetchurl 12 fetchpatch 13 nixosTests 14 ; 15 16 since = version: lib.versionAtLeast nodejs.version version; 17 before = version: lib.versionOlder nodejs.version version; 18in 19 20final: prev: { 21 inherit nodejs; 22 23 "@angular/cli" = prev."@angular/cli".override { 24 prePatch = '' 25 export NG_CLI_ANALYTICS=false 26 ''; 27 nativeBuildInputs = [ pkgs.installShellFiles ]; 28 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 29 for shell in bash zsh; do 30 installShellCompletion --cmd ng \ 31 --$shell <($out/bin/ng completion script) 32 done 33 ''; 34 }; 35 36 "@electron-forge/cli" = prev."@electron-forge/cli".override { 37 buildInputs = [ final.node-gyp-build ]; 38 }; 39 40 fast-cli = prev.fast-cli.override { 41 nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ]; 42 prePatch = '' 43 export PUPPETEER_SKIP_DOWNLOAD=1 44 ''; 45 postInstall = '' 46 wrapProgram $out/bin/fast \ 47 --set PUPPETEER_EXECUTABLE_PATH ${pkgs.chromium.outPath}/bin/chromium 48 ''; 49 }; 50 51 fauna-shell = prev.fauna-shell.override { 52 # printReleaseNotes just pulls them from GitHub which is not allowed in sandbox 53 preRebuild = '' 54 sed -i 's|"node ./tools/printReleaseNotes"|"true"|' node_modules/faunadb/package.json 55 ''; 56 }; 57 58 joplin = prev.joplin.override (oldAttrs: { 59 nativeBuildInputs = [ 60 pkgs.pkg-config 61 (pkgs.python3.withPackages (ps: [ ps.setuptools ])) 62 ] 63 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 64 pkgs.xcbuild 65 ]; 66 buildInputs = with pkgs; [ 67 # required by sharp 68 # https://sharp.pixelplumbing.com/install 69 vips 70 71 libsecret 72 final.node-gyp-build 73 node-pre-gyp 74 75 pixman 76 cairo 77 pango 78 ]; 79 80 # add newer node-addon-api to build sharp 81 # https://github.com/lovell/sharp/issues/3920 82 dependencies = [ 83 { 84 name = "node-addon-api"; 85 packageName = "node-addon-api"; 86 version = "7.1.0"; 87 src = fetchurl { 88 url = "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.0.tgz"; 89 sha512 = "mNcltoe1R8o7STTegSOHdnJNN7s5EUvhoS7ShnTHDyOSd+8H+UdWODq6qSv67PjC8Zc5JRT8+oLAMCr0SIXw7g=="; 90 }; 91 } 92 ] 93 ++ oldAttrs.dependencies; 94 95 meta = oldAttrs.meta // { 96 # ModuleNotFoundError: No module named 'distutils' 97 broken = stdenv.hostPlatform.isDarwin; # still broken on darwin 98 }; 99 }); 100 101 jsonplaceholder = prev.jsonplaceholder.override { 102 buildInputs = [ nodejs ]; 103 postInstall = '' 104 exe=$out/bin/jsonplaceholder 105 mkdir -p $out/bin 106 cat >$exe <<EOF 107 #!${pkgs.runtimeShell} 108 exec -a jsonplaceholder ${nodejs}/bin/node $out/lib/node_modules/jsonplaceholder/index.js 109 EOF 110 chmod a+x $exe 111 ''; 112 }; 113 114 keyoxide = prev.keyoxide.override { 115 nativeBuildInputs = [ pkgs.pkg-config ]; 116 buildInputs = with pkgs; [ 117 pixman 118 cairo 119 pango 120 ]; 121 }; 122 123 makam = prev.makam.override { 124 nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ]; 125 postFixup = '' 126 wrapProgram "$out/bin/makam" --prefix PATH : ${lib.makeBinPath [ nodejs ]} 127 ${lib.optionalString stdenv.hostPlatform.isLinux "patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux-x86-64.so.2 \"$out/lib/node_modules/makam/makam-bin-linux64\""} 128 ''; 129 }; 130 131 node2nix = prev.node2nix.override { 132 # Get latest commit for misc fixes 133 src = fetchFromGitHub { 134 owner = "svanderburg"; 135 repo = "node2nix"; 136 rev = "315e1b85a6761152f57a41ccea5e2570981ec670"; 137 sha256 = "sha256-8OxTOkwBPcnjyhXhxQEDd8tiaQoHt91zUJX5Ka+IXco="; 138 }; 139 nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ]; 140 postInstall = 141 let 142 patches = [ 143 # Needed to fix packages with DOS line-endings after above patch - PR svanderburg/node2nix#314 144 (fetchpatch { 145 name = "convert-crlf-for-script-bin-files.patch"; 146 url = "https://github.com/svanderburg/node2nix/commit/91aa511fe7107938b0409a02ab8c457a6de2d8ca.patch"; 147 hash = "sha256-ISiKYkur/o8enKDzJ8mQndkkSC4yrTNlheqyH+LiXlU="; 148 }) 149 # fix nodejs attr names 150 (fetchpatch { 151 url = "https://github.com/svanderburg/node2nix/commit/3b63e735458947ef39aca247923f8775633363e5.patch"; 152 hash = "sha256-pe8Xm4mjPh9oKXugoMY6pRl8YYgtdw0sRXN+TienalU="; 153 }) 154 # Use top-level cctools in generated files - PR svanderburg/node2nix#334 155 (fetchpatch { 156 url = "https://github.com/svanderburg/node2nix/commit/31c308bba5f39ea0105f66b9f40dbe57fed7a292.patch"; 157 hash = "sha256-DdNRteonMvyffPh0uo0lUbsohKYnyqv0QcD9vjN6aXE="; 158 }) 159 ]; 160 in 161 '' 162 ${lib.concatStringsSep "\n" ( 163 map (patch: "patch -d $out/lib/node_modules/node2nix -p1 < ${patch}") patches 164 )} 165 wrapProgram "$out/bin/node2nix" --prefix PATH : ${lib.makeBinPath [ pkgs.nix ]} 166 ''; 167 }; 168 169 pulp = prev.pulp.override { 170 # tries to install purescript 171 npmFlags = builtins.toString [ "--ignore-scripts" ]; 172 173 nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ]; 174 postInstall = '' 175 wrapProgram "$out/bin/pulp" --suffix PATH : ${ 176 lib.makeBinPath [ 177 pkgs.purescript 178 ] 179 } 180 ''; 181 }; 182 183 rush = prev."@microsoft/rush".override { 184 name = "rush"; 185 }; 186 187 ts-node = prev.ts-node.override { 188 nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ]; 189 postInstall = '' 190 wrapProgram "$out/bin/ts-node" \ 191 --prefix NODE_PATH : ${pkgs.typescript}/lib/node_modules 192 ''; 193 }; 194 195 tsun = prev.tsun.override { 196 nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ]; 197 postInstall = '' 198 wrapProgram "$out/bin/tsun" \ 199 --prefix NODE_PATH : ${pkgs.typescript}/lib/node_modules 200 ''; 201 }; 202 203 uppy-companion = prev."@uppy/companion".override { 204 name = "uppy-companion"; 205 }; 206 207 vega-cli = prev.vega-cli.override { 208 nativeBuildInputs = [ pkgs.pkg-config ]; 209 buildInputs = with pkgs; [ 210 node-pre-gyp 211 pixman 212 cairo 213 pango 214 libjpeg 215 ]; 216 }; 217 218 vega-lite = prev.vega-lite.override { 219 postInstall = '' 220 cd node_modules 221 for dep in ${final.vega-cli}/lib/node_modules/vega-cli/node_modules/*; do 222 if [[ ! -d ''${dep##*/} ]]; then 223 ln -s "${final.vega-cli}/lib/node_modules/vega-cli/node_modules/''${dep##*/}" 224 fi 225 done 226 ''; 227 passthru.tests = { 228 simple-execution = callPackage ./package-tests/vega-lite.nix { 229 inherit (final) vega-lite; 230 }; 231 }; 232 }; 233 234 wavedrom-cli = prev.wavedrom-cli.override { 235 nativeBuildInputs = [ 236 pkgs.pkg-config 237 pkgs.node-pre-gyp 238 ]; 239 # These dependencies are required by 240 # https://github.com/Automattic/node-canvas. 241 buildInputs = with pkgs; [ 242 giflib 243 pixman 244 cairo 245 pango 246 ]; 247 }; 248}