1 # taken from nixpkgs to upgrade to latest version
11 nodePackages = import ./node-packages.nix {
13 inherit (stdenv.hostPlatform) system;
16 bowerPackages = buildBowerComponents {
17 name = "${cryptpad.name}-bower-packages";
18 # this list had to be tweaked by hand:
19 # * add the second jquery ~2.1.0 entry
20 # * add the second bootstrap ~3.1.1 entry
21 generated = ./bower-packages.nix;
25 # find an element in an attribute set
26 findValue = pred: default: set:
31 let v = set.${name}; in
32 if pred name v then [v] else []
37 if list == [] then default
41 # The cryptpad package attribute key changes for each release. Get it out
42 # programatically instead.
44 (k: v: v.packageName == "cryptpad")
45 (throw "cryptpad not found")
49 combined = cryptpad.override {
51 out_cryptpad=$out/lib/node_modules/cryptpad
53 substituteInPlace $out_cryptpad/lib/workers/index.js --replace "lib/workers/db-worker" "$out_cryptpad/lib/workers/db-worker"
55 # add the bower components
57 ${bowerPackages}/bower_components \
58 $out_cryptpad/www/bower_components
62 cat <<EOF > $out/bin/cryptpad
64 exec ${nodejs}/bin/node $out_cryptpad/server.js
66 chmod +x $out/bin/cryptpad