From 31c308bba5f39ea0105f66b9f40dbe57fed7a292 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Thu, 18 Jul 2024 08:34:49 -0400 Subject: [PATCH] Use top-level cctools when available 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: - https://github.com/NixOS/nixpkgs/pull/307880 - https://github.com/NixOS/nixpkgs/pull/328077 --- default.nix | 2 +- lib/expressions/CompositionExpression.js | 10 +++++++--- tests/default-v14.nix | 2 +- tests/default-v16.nix | 2 +- tests/grunt/default.nix | 2 +- tests/lockfile-v2/default.nix | 2 +- tests/lockfile/default.nix | 2 +- tests/scoped/default.nix | 2 +- tests/versionless/default.nix | 2 +- 9 files changed, 15 insertions(+), 11 deletions(-) diff --git a/default.nix b/default.nix index e4fb6a9..339f658 100644 --- a/default.nix +++ b/default.nix @@ -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 { diff --git a/lib/expressions/CompositionExpression.js b/lib/expressions/CompositionExpression.js index 474ff0d..526f6c8 100644 --- a/lib/expressions/CompositionExpression.js +++ b/lib/expressions/CompositionExpression.js @@ -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 diff --git a/tests/default-v14.nix b/tests/default-v14.nix index e528025..b57d26b 100644 --- a/tests/default-v14.nix +++ b/tests/default-v14.nix @@ -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 { diff --git a/tests/default-v16.nix b/tests/default-v16.nix index 8c1f04a..c266bb9 100644 --- a/tests/default-v16.nix +++ b/tests/default-v16.nix @@ -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 { diff --git a/tests/grunt/default.nix b/tests/grunt/default.nix index e82a458..4c821b6 100644 --- a/tests/grunt/default.nix +++ b/tests/grunt/default.nix @@ -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 { diff --git a/tests/lockfile-v2/default.nix b/tests/lockfile-v2/default.nix index 23b68b9..dad5a7c 100644 --- a/tests/lockfile-v2/default.nix +++ b/tests/lockfile-v2/default.nix @@ -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 { diff --git a/tests/lockfile/default.nix b/tests/lockfile/default.nix index 23b68b9..dad5a7c 100644 --- a/tests/lockfile/default.nix +++ b/tests/lockfile/default.nix @@ -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 { diff --git a/tests/scoped/default.nix b/tests/scoped/default.nix index 23b68b9..dad5a7c 100644 --- a/tests/scoped/default.nix +++ b/tests/scoped/default.nix @@ -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 { diff --git a/tests/versionless/default.nix b/tests/versionless/default.nix index 23b68b9..dad5a7c 100644 --- a/tests/versionless/default.nix +++ b/tests/versionless/default.nix @@ -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 {