Skip to content

Commit 144501f

Browse files
committed
switch to the overrideAttrs approach
1 parent 517c51e commit 144501f

File tree

3 files changed

+31
-60
lines changed

3 files changed

+31
-60
lines changed

flake.nix

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,15 @@
2727
];
2828

2929
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
30-
mkCargoAbout = pkgs: pkgs.callPackage ./nix/cargo-about.nix { };
3130
mkZed =
3231
pkgs:
3332
let
34-
lib = pkgs.lib;
3533
rustBin = rust-overlay.lib.mkRustBin { } pkgs;
3634
in
37-
pkgs.callPackage ./nix/build.nix (
38-
{
39-
crane = crane.mkLib pkgs;
40-
rustToolchain = rustBin.fromRustupToolchainFile ./rust-toolchain.toml;
41-
}
42-
// (lib.optionalAttrs (pkgs.cargo-about.version != "0.8.2") {
43-
# Only vendor the build of cargo-about if the input nixpkgs has the wrong version.
44-
cargo-about = mkCargoAbout pkgs;
45-
})
46-
);
35+
pkgs.callPackage ./nix/build.nix {
36+
crane = crane.mkLib pkgs;
37+
rustToolchain = rustBin.fromRustupToolchainFile ./rust-toolchain.toml;
38+
};
4739
in
4840
rec {
4941
packages = forAllSystems (pkgs: rec {

nix/build.nix

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,33 @@ let
9090
perl
9191
pkg-config
9292
protobuf
93-
cargo-about
93+
# Pin cargo-about to 0.8.2. Newer versions don't work with the current license identifiers
94+
# See https://github.com/zed-industries/zed/pull/44012
95+
(cargo-about.overrideAttrs (
96+
new: old: rec {
97+
version = "0.8.2";
98+
99+
src = fetchFromGitHub {
100+
owner = "EmbarkStudios";
101+
repo = "cargo-about";
102+
tag = version;
103+
sha256 = "sha256-cNKZpDlfqEXeOE5lmu79AcKOawkPpk4PQCsBzNtIEbs=";
104+
};
105+
106+
cargoHash = "sha256-NnocSs6UkuF/mCM3lIdFk+r51Iz2bHuYzMT/gEbT/nk=";
107+
108+
# NOTE: can drop once upstream uses `finalAttrs` here:
109+
# https://github.com/NixOS/nixpkgs/blob/10214747f5e6e7cb5b9bdf9e018a3c7b3032f5af/pkgs/build-support/rust/build-rust-package/default.nix#L104
110+
#
111+
# See (for context): https://github.com/NixOS/nixpkgs/pull/382550
112+
cargoDeps = rustPlatform.fetchCargoVendor {
113+
inherit (new) src;
114+
hash = new.cargoHash;
115+
patches = new.cargoPatches or [ ];
116+
name = new.cargoDepsName or new.finalPackage.name;
117+
};
118+
}
119+
))
94120
rustPlatform.bindgenHook
95121
]
96122
++ lib.optionals stdenv'.hostPlatform.isLinux [ makeWrapper ]

nix/cargo-about.nix

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)