Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rattler-build: 0.33.1 -> 0.34.1 #373448

Merged
merged 1 commit into from
Jan 14, 2025
Merged
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
46 changes: 34 additions & 12 deletions pkgs/by-name/ra/rattler-build/package.nix
Original file line number Diff line number Diff line change
@@ -1,51 +1,73 @@
{
lib,
stdenv,
fetchFromGitHub,
rustPlatform,
versionCheckHook,

openssl,
pkg-config,
installShellFiles,
buildPackages,
versionCheckHook,
nix-update-script,
}:

rustPlatform.buildRustPackage rec {
pname = "rattler-build";
version = "0.33.1";
version = "0.34.1";

src = fetchFromGitHub {
owner = "prefix-dev";
repo = "rattler-build";
rev = "refs/tags/v${version}";
hash = "sha256-yceScRfZuMVnNVNVg3Xs+jU3spdFn0hPMmwMLaYzkNE=";
tag = "v${version}";
hash = "sha256-HDRQveWOJKGBWxN7ZyIECo1HBfz+vSaLW7ueSok+d64=";
};

useFetchCargoVendor = true;
cargoHash = "sha256-eJH7a+9asSPDv0gBwvLc4zssJGCY2jAfVKKOWb3oQ/Q=";
cargoHash = "sha256-b44bL/xVUwBdqwr/jawZbyV+yHsGR3hREm4nvHDMCWA=";

doCheck = false; # test requires network access

buildInputs = [
openssl
];

nativeBuildInputs = [
pkg-config
installShellFiles
];

buildInputs = [
openssl
];
cargoBuildFlags = [ "--bin rattler-build" ]; # other bin like `generate-cli-docs` shouldn't be distributed.

doInstallCheck = true;
postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (
Copy link
Contributor

Choose a reason for hiding this comment

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

postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
    # using named fd
    installShellCompletion --cmd foobar \
      --bash <($out/bin/foobar --bash-completion) \
      --fish <($out/bin/foobar --fish-completion) \
      --zsh <($out/bin/foobar --zsh-completion)
  '';

Won't this look like a cleaner way of installing shell completions, according to the docs

Copy link
Contributor Author

@xiaoxiangmoe xiaoxiangmoe Jan 14, 2025

Choose a reason for hiding this comment

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

No, this is a legacy doc which is outdated for not supporting cross platform build. We need to use stdenv.hostPlatform.emulatorAvailable instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't dealt with shell completions much so maybe I'll ask someone else, any reference to the new docs?

let
emulator = stdenv.hostPlatform.emulator buildPackages;
in
''
installShellCompletion --cmd rattler-build \
--bash <(${emulator} $out/bin/rattler-build completion --shell bash) \
--fish <(${emulator} $out/bin/rattler-build completion --shell fish) \
--zsh <(${emulator} $out/bin/rattler-build completion --shell zsh)
''
);

doInstallCheck = true;
nativeInstallCheckInputs = [
versionCheckHook
];
versionCheckProgramArg = [ "--version" ];

versionCheckProgramArg = [ "-V" ];
passthru.updateScript = nix-update-script { };

meta = {
description = "Universal package builder for Windows, macOS and Linux";
homepage = "https://github.com/prefix-dev/rattler-build";
homepage = "https://rattler.build/";
changelog = "https://github.com/prefix-dev/rattler-build/releases/tag/v${version}";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ genga898 ];
maintainers = with lib.maintainers; [
genga898
xiaoxiangmoe
];
mainProgram = "rattler-build";
};
}