1{ pkgs, nodejs, stdenv }:
2
3let
4 since = (version: pkgs.lib.versionAtLeast nodejs.version version);
5 before = (version: pkgs.lib.versionOlder nodejs.version version);
6 super = import ./composition.nix {
7 inherit pkgs nodejs;
8 inherit (stdenv.hostPlatform) system;
9 };
10 self = super // {
11 "@angular/cli" = super."@angular/cli".override {
12 prePatch = ''
13 export NG_CLI_ANALYTICS=false
14 '';
15 };
16 bower2nix = super.bower2nix.override {
17 buildInputs = [ pkgs.makeWrapper ];
18 postInstall = ''
19 for prog in bower2nix fetch-bower; do
20 wrapProgram "$out/bin/$prog" --prefix PATH : ${stdenv.lib.makeBinPath [ pkgs.git pkgs.nix ]}
21 done
22 '';
23 };
24
25 coc-imselect = super.coc-imselect.override {
26 meta.broken = since "10";
27 };
28
29 "fast-cli-1.x" = super."fast-cli-1.x".override {
30 meta.broken = since "10";
31 };
32
33 jshint = super.jshint.override {
34 buildInputs = [ pkgs.phantomjs2 ];
35 };
36
37 dat = super.dat.override {
38 buildInputs = [ self.node-gyp-build pkgs.libtool pkgs.autoconf pkgs.automake ];
39 meta.broken = since "12";
40 };
41
42 bitwarden-cli = pkgs.lib.overrideDerivation super."@bitwarden/cli" (drv: {
43 name = "bitwarden-cli-${drv.version}";
44 });
45
46 fast-cli = super."fast-cli-1.x".override {
47 preRebuild = ''
48 # Simply ignore the phantomjs --version check. It seems to need a display but it is safe to ignore
49 sed -i -e "s|console.error('Error verifying phantomjs, continuing', err)|console.error('Error verifying phantomjs, continuing', err); return true;|" node_modules/phantomjs-prebuilt/lib/util.js
50 '';
51 buildInputs = [ pkgs.phantomjs2 ];
52 };
53
54 git-ssb = super.git-ssb.override {
55 buildInputs = [ self.node-gyp-build ];
56 meta.broken = since "10";
57 };
58
59 insect = super.insect.override (drv: {
60 nativeBuildInputs = drv.nativeBuildInputs or [] ++ [ pkgs.psc-package self.pulp ];
61 });
62
63 mirakurun = super.mirakurun.override rec {
64 nativeBuildInputs = with pkgs; [ makeWrapper ];
65 postInstall = let
66 runtimeDeps = [ nodejs ] ++ (with pkgs; [ bash which v4l_utils ]);
67 in
68 ''
69 substituteInPlace $out/lib/node_modules/mirakurun/processes.json \
70 --replace "/usr/local" ""
71
72 # XXX: Files copied from the Nix store are non-writable, so they need
73 # to be given explicit write permissions
74 substituteInPlace $out/lib/node_modules/mirakurun/lib/Mirakurun/config.js \
75 --replace 'fs.copyFileSync("config/server.yml", path);' \
76 'fs.copyFileSync("config/server.yml", path); fs.chmodSync(path, 0o644);' \
77 --replace 'fs.copyFileSync("config/tuners.yml", path);' \
78 'fs.copyFileSync("config/tuners.yml", path); fs.chmodSync(path, 0o644);' \
79 --replace 'fs.copyFileSync("config/channels.yml", path);' \
80 'fs.copyFileSync("config/channels.yml", path); fs.chmodSync(path, 0o644);'
81
82 # XXX: The original mirakurun command uses PM2 to manage the Mirakurun
83 # server. However, we invoke the server directly and let systemd
84 # manage it to avoid complication. This is okay since no features
85 # unique to PM2 is currently being used.
86 makeWrapper ${nodejs}/bin/npm $out/bin/mirakurun \
87 --add-flags "start" \
88 --run "cd $out/lib/node_modules/mirakurun" \
89 --prefix PATH : ${pkgs.lib.makeBinPath runtimeDeps}
90 '';
91 };
92
93 node-inspector = super.node-inspector.override {
94 buildInputs = [ self.node-pre-gyp ];
95 meta.broken = since "10";
96 };
97
98 node2nix = super.node2nix.override {
99 buildInputs = [ pkgs.makeWrapper ];
100 postInstall = ''
101 wrapProgram "$out/bin/node2nix" --prefix PATH : ${stdenv.lib.makeBinPath [ pkgs.nix ]}
102 '';
103 };
104
105 node-red = super.node-red.override {
106 buildInputs = [ self.node-pre-gyp ];
107 };
108
109 pnpm = super.pnpm.override {
110 nativeBuildInputs = [ pkgs.makeWrapper ];
111
112 preRebuild = ''
113 sed 's/"link:/"file:/g' --in-place package.json
114 '';
115
116 postInstall = let
117 pnpmLibPath = stdenv.lib.makeBinPath [
118 nodejs.passthru.python
119 nodejs
120 ];
121 in ''
122 for prog in $out/bin/*; do
123 wrapProgram "$prog" --prefix PATH : ${pnpmLibPath}
124 done
125 '';
126 };
127
128 pulp = super.pulp.override {
129 # tries to install purescript
130 npmFlags = "--ignore-scripts";
131
132 nativeBuildInputs = [ pkgs.makeWrapper ];
133 postInstall = ''
134 wrapProgram "$out/bin/pulp" --suffix PATH : ${stdenv.lib.makeBinPath [
135 pkgs.purescript
136 ]}
137 '';
138 };
139
140 ssb-server = super.ssb-server.override {
141 buildInputs = [ pkgs.automake pkgs.autoconf self.node-gyp-build ];
142 meta.broken = since "10";
143 };
144
145 tedicross = super."tedicross-git+https://github.com/TediCross/TediCross.git#v0.8.7".override {
146 nativeBuildInputs = [ pkgs.makeWrapper ];
147 postInstall = ''
148 makeWrapper '${nodejs}/bin/node' "$out/bin/tedicross" \
149 --add-flags "$out/lib/node_modules/tedicross/main.js"
150 '';
151 };
152
153 tsun = super.tsun.overrideAttrs (oldAttrs: {
154 buildInputs = oldAttrs.buildInputs ++ [ pkgs.makeWrapper ];
155 postInstall = ''
156 wrapProgram "$out/bin/tsun" \
157 --prefix NODE_PATH : ${self.typescript}/lib/node_modules
158 '';
159 });
160
161 stf = super.stf.override {
162 meta.broken = since "10";
163 };
164
165 webtorrent-cli = super.webtorrent-cli.override {
166 buildInputs = [ self.node-gyp-build ];
167 };
168
169 joplin = super.joplin.override {
170 nativeBuildInputs = [ pkgs.pkg-config ];
171 buildInputs = with pkgs; [
172 # required by sharp
173 # https://sharp.pixelplumbing.com/install
174 vips
175
176 self.node-pre-gyp
177 ];
178 };
179
180 thelounge = super.thelounge.override {
181 buildInputs = [ self.node-pre-gyp ];
182 postInstall = ''
183 echo /var/lib/thelounge > $out/lib/node_modules/thelounge/.thelounge_home
184 '';
185 };
186 };
187in self