Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changeset/fix-nix-flake-darwin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

fix: remove legacy darwin.apple_sdk reference in flake.nix
5 changes: 2 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

darwinDeps = with pkgs; [
libiconv
darwin.apple_sdk.frameworks.Security
];
Comment on lines 25 to 27
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this works, it's a good practice in Nix to avoid using with as it can sometimes make it harder to track where attributes are coming from. Since darwinDeps now only contains one package, you can define it more directly.

        darwinDeps = [ pkgs.libiconv ];
References
  1. In Nix, it is generally discouraged to use the with keyword as it can obscure the origin of variables, making the code harder to read and maintain. It's better to explicitly qualify attributes (e.g., pkgs.libiconv).


gws = pkgs.rustPlatform.buildRustPackage {
Expand All @@ -38,8 +37,8 @@
};

nativeBuildInputs = [ pkgs.pkg-config ];
buildInputs = pkgs.lib.optionals pkgs.stdenv.isLinux linuxDeps
++ pkgs.lib.optionals pkgs.stdenv.isDarwin darwinDeps;
buildInputs = pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux linuxDeps
++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isDarwin darwinDeps;

# Tests are disabled by default in buildRustPackage if not specified,
# but we'll be explicit. Some tests might require network.
Expand Down