aboutsummaryrefslogtreecommitdiff
path: root/pkgs/nodejs-sass/default.nix
blob: 499ad1aa097504c62d6730f1129b0ca6414ede84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{ pkgs }:

let

  inherit (builtins)
    attrNames fromJSON head readFile ;

  packages = fromJSON (readFile ./main.json);
  package = head packages;

  name = head (attrNames package);
  version = package.${name};

  main =
    let m = (import ./main.nix {
      inherit pkgs;
      inherit (pkgs) nodejs;
      inherit (pkgs.stdenv) system;
    });
    in m // {
      "${name}-${version}" = m."${name}-${version}".override (super: {
        # XXX: build bundled libsassl, DO NOT DOWNLOAD binaries!
        # XXX --nodedir is to prevent gyp from downloading nodejs headers
        # XXX: ref. https://github.com/nodejs/node-gyp/issues/1133
        preRebuild = ''
          npm run build --nodedir=${pkgs.nodejs}
        '';
      });
    };


in
pkgs.runCommand "nodejs-sass-${version}" {}
''
  mkdir -p $out/bin
  ln -s ${main."${name}-${version}"}/lib/node_modules/node-sass/bin/node-sass \
    $out/bin/node-sass
  test -x $out/bin/node-sass
''