nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 node2nix = prev.node2nix.override {
37 # Get latest commit for misc fixes
38 src = fetchFromGitHub {
39 owner = "svanderburg";
40 repo = "node2nix";
41 rev = "315e1b85a6761152f57a41ccea5e2570981ec670";
42 sha256 = "sha256-8OxTOkwBPcnjyhXhxQEDd8tiaQoHt91zUJX5Ka+IXco=";
43 };
44 nativeBuildInputs = [ pkgs.buildPackages.makeWrapper ];
45 postInstall =
46 let
47 patches = [
48 # Needed to fix packages with DOS line-endings after above patch - PR svanderburg/node2nix#314
49 (fetchpatch {
50 name = "convert-crlf-for-script-bin-files.patch";
51 url = "https://github.com/svanderburg/node2nix/commit/91aa511fe7107938b0409a02ab8c457a6de2d8ca.patch";
52 hash = "sha256-ISiKYkur/o8enKDzJ8mQndkkSC4yrTNlheqyH+LiXlU=";
53 })
54 # fix nodejs attr names
55 (fetchpatch {
56 url = "https://github.com/svanderburg/node2nix/commit/3b63e735458947ef39aca247923f8775633363e5.patch";
57 hash = "sha256-pe8Xm4mjPh9oKXugoMY6pRl8YYgtdw0sRXN+TienalU=";
58 })
59 # Use top-level cctools in generated files - PR svanderburg/node2nix#334
60 (fetchpatch {
61 url = "https://github.com/svanderburg/node2nix/commit/31c308bba5f39ea0105f66b9f40dbe57fed7a292.patch";
62 hash = "sha256-DdNRteonMvyffPh0uo0lUbsohKYnyqv0QcD9vjN6aXE=";
63 })
64 # Prefer util-linux over removed utillinux alias - PR svanderburg/node2nix#336
65 (fetchpatch {
66 url = "https://github.com/svanderburg/node2nix/commit/ef5dc43e15d13129a9ddf6164c7bc2800a25792e.patch";
67 hash = "sha256-ByIA0oQmEfb4PyVwGEtrR3NzWiy1YCn1FPdSKNDkNCw=";
68 })
69 ];
70 in
71 ''
72 ${lib.concatStringsSep "\n" (
73 map (patch: "patch -d $out/lib/node_modules/node2nix -p1 < ${patch}") patches
74 )}
75 wrapProgram "$out/bin/node2nix" --prefix PATH : ${lib.makeBinPath [ pkgs.nix ]}
76 '';
77 };
78
79 rush = prev."@microsoft/rush".override {
80 name = "rush";
81 };
82}