Skip to content

Commit

Permalink
Use top-level cctools when available
Browse files Browse the repository at this point in the history
cctools was updated and migrated to the `by-name` hierarchy in nixpkgs,
which moves it to the top-level. It is also being added to
`darwin-aliases.nix`, which will make the old name unavailable for use
in nixpkgs. This change preferentially uses the new name while falling
back to the old one for out-of-tree users.

Relevant nixpkgs PRs:
- NixOS/nixpkgs#307880
- NixOS/nixpkgs#328077
  • Loading branch information
reckenrode committed Jul 18, 2024
1 parent 315e1b8 commit 31c308b
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
nodeEnv = import ./nix/node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
libtool = if pkgs.stdenv.isDarwin then pkgs.cctools or pkgs.darwin.cctools else null;
};
in
import ./node-packages.nix {
Expand Down
10 changes: 7 additions & 3 deletions lib/expressions/CompositionExpression.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,13 @@ CompositionExpression.prototype.toNixAST = function() {
}),
thenExpr: new nijs.NixAttrReference({
attrSetExpr: new nijs.NixExpression("pkgs"),
refExpr: new nijs.NixAttrReference({
attrSetExpr: new nijs.NixExpression("darwin"),
refExpr: new nijs.NixExpression("cctools")
refExpr: new nijs.NixExpression("cctools"),
orExpr: new nijs.NixAttrReference({
attrSetExpr: new nijs.NixExpression("pkgs"),
refExpr: new nijs.NixAttrReference({
attrSetExpr: new nijs.NixExpression("darwin"),
refExpr: new nijs.NixExpression("cctools")
}),
}),
}),
elseExpr: null
Expand Down
2 changes: 1 addition & 1 deletion tests/default-v14.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
nodeEnv = import ../nix/node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
libtool = if pkgs.stdenv.isDarwin then pkgs.cctools or pkgs.darwin.cctools else null;
};
in
import ./node-packages-v14.nix {
Expand Down
2 changes: 1 addition & 1 deletion tests/default-v16.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
nodeEnv = import ../nix/node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
libtool = if pkgs.stdenv.isDarwin then pkgs.cctools or pkgs.darwin.cctools else null;
};
in
import ./node-packages-v16.nix {
Expand Down
2 changes: 1 addition & 1 deletion tests/grunt/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let
nodeEnv = import ../../nix/node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
libtool = if pkgs.stdenv.isDarwin then pkgs.cctools or pkgs.darwin.cctools else null;
};
in
import ./node-packages.nix {
Expand Down
2 changes: 1 addition & 1 deletion tests/lockfile-v2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
nodeEnv = import ../../nix/node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
libtool = if pkgs.stdenv.isDarwin then pkgs.cctools or pkgs.darwin.cctools else null;
};
in
import ./node-packages.nix {
Expand Down
2 changes: 1 addition & 1 deletion tests/lockfile/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
nodeEnv = import ../../nix/node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
libtool = if pkgs.stdenv.isDarwin then pkgs.cctools or pkgs.darwin.cctools else null;
};
in
import ./node-packages.nix {
Expand Down
2 changes: 1 addition & 1 deletion tests/scoped/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
nodeEnv = import ../../nix/node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
libtool = if pkgs.stdenv.isDarwin then pkgs.cctools or pkgs.darwin.cctools else null;
};
in
import ./node-packages.nix {
Expand Down
2 changes: 1 addition & 1 deletion tests/versionless/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let
nodeEnv = import ../../nix/node-env.nix {
inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
libtool = if pkgs.stdenv.isDarwin then pkgs.cctools or pkgs.darwin.cctools else null;
};
in
import ./node-packages.nix {
Expand Down

0 comments on commit 31c308b

Please sign in to comment.