Skip to content

Commit

Permalink
Make all node-env functions entirely overridable, not mkDerivation
Browse files Browse the repository at this point in the history
  • Loading branch information
svanderburg committed Jun 25, 2018
1 parent 9284da3 commit 475247f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 21 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,9 @@ let
};
in
nodePackages // {
floomatic = nodePackages.floomatic.override (oldAttrs: {
buildInputs = oldAttrs.buildInputs ++ [ pkgs.pkgconfig pkgs.qt4 ];
});
floomatic = nodePackages.floomatic.override {
buildInputs = [ pkgs.pkgconfig pkgs.qt4 ];
};
}
```

Expand Down Expand Up @@ -428,11 +428,11 @@ let
};
in
nodePackages // {
dnschain = nodePackages.floomatic.override (oldAttrs: {
dnschain = nodePackages.floomatic.override {
preRebuild = ''
wrapProgram $out/bin/dnschain --suffix PATH : ${pkgs.openssl.bin}/bin
'';
});
};
}
```

Expand Down Expand Up @@ -644,9 +644,9 @@ let
};
in
nodePackages // {
express = nodePackages.express.override (oldAttrs: {
express = nodePackages.express.override {
dontNpmInstall = true;
});
};
}
```

Expand Down
10 changes: 7 additions & 3 deletions nix/node-env.nix
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ let
forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com";
extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" ];
in
stdenv.lib.makeOverridable stdenv.mkDerivation ({
stdenv.mkDerivation ({
name = "node-${name}-${version}";
buildInputs = [ tarWrapper python nodejs ]
++ stdenv.lib.optional (stdenv.isLinux) utillinux
Expand Down Expand Up @@ -514,7 +514,7 @@ let
'';
} // extraArgs);
in
stdenv.lib.makeOverridable stdenv.mkDerivation {
stdenv.mkDerivation {
name = "node-shell-${name}-${version}";

buildInputs = [ python nodejs ] ++ stdenv.lib.optional (stdenv.isLinux) utillinux ++ buildInputs;
Expand All @@ -535,4 +535,8 @@ let
'';
};
in
{ inherit buildNodeSourceDist buildNodePackage buildNodeShell; }
{
buildNodeSourceDist = stdenv.lib.makeOverridable buildNodeSourceDist;
buildNodePackage = stdenv.lib.makeOverridable buildNodePackage;
buildNodeShell = stdenv.lib.makeOverridable buildNodeShell;
}
6 changes: 3 additions & 3 deletions tests/override-v10.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
};
in
nodePackages // {
floomatic = nodePackages.floomatic.override (oldAttrs: {
buildInputs = oldAttrs.buildInputs ++ [ pkgs.pkgconfig pkgs.qt4 ];
});
floomatic = nodePackages.floomatic.override {
buildInputs = [ pkgs.pkgconfig pkgs.qt4 ];
};
}
4 changes: 2 additions & 2 deletions tests/override-v4.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
};
in
nodePackages // {
floomatic = nodePackages.floomatic.override (oldAttrs: {
floomatic = nodePackages.floomatic.override {
buildInputs = oldAttrs.buildInputs ++ [ pkgs.pkgconfig pkgs.qt4 ];
});
};
}
6 changes: 3 additions & 3 deletions tests/override-v6.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
};
in
nodePackages // {
floomatic = nodePackages.floomatic.override (oldAttrs: {
buildInputs = oldAttrs.buildInputs ++ [ pkgs.pkgconfig pkgs.qt4 ];
});
floomatic = nodePackages.floomatic.override {
buildInputs = [ pkgs.pkgconfig pkgs.qt4 ];
};
}
6 changes: 3 additions & 3 deletions tests/override-v8.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
};
in
nodePackages // {
floomatic = nodePackages.floomatic.override (oldAttrs: {
buildInputs = oldAttrs.buildInputs ++ [ pkgs.pkgconfig pkgs.qt4 ];
});
floomatic = nodePackages.floomatic.override {
buildInputs = [ pkgs.pkgconfig pkgs.qt4 ];
};
}

0 comments on commit 475247f

Please sign in to comment.