From 9c9de33ff23253d192ced20e0d3ea3dc43c72631 Mon Sep 17 00:00:00 2001 From: sbatial Date: Fri, 16 Feb 2024 17:11:28 +0100 Subject: [PATCH 1/2] gitoxide: Install shell completions. --- .../version-management/gitoxide/default.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/version-management/gitoxide/default.nix b/pkgs/applications/version-management/gitoxide/default.nix index ed3f3c8764f4..725106552b4b 100644 --- a/pkgs/applications/version-management/gitoxide/default.nix +++ b/pkgs/applications/version-management/gitoxide/default.nix @@ -9,9 +9,14 @@ , SystemConfiguration , curl , openssl +, buildPackages +, installShellFiles }: -rustPlatform.buildRustPackage rec { +let + canRunCmd = stdenv.hostPlatform.emulatorAvailable buildPackages; + gix = "${stdenv.hostPlatform.emulator buildPackages} $out/bin/gix"; +in rustPlatform.buildRustPackage rec { pname = "gitoxide"; version = "0.33.0"; @@ -26,10 +31,17 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ cmake pkg-config ]; - buildInputs = [ curl ] ++ (if stdenv.isDarwin + buildInputs = [ curl installShellFiles ] ++ (if stdenv.isDarwin then [ libiconv Security SystemConfiguration ] else [ openssl ]); + preFixup = lib.optionalString canRunCmd '' + installShellCompletion --cmd gix \ + --bash <(${gix} completions --shell bash) \ + --fish <(${gix} completions --shell fish) \ + --zsh <(${gix} completions --shell zsh) + ''; + # Needed to get openssl-sys to use pkg-config. env.OPENSSL_NO_VENDOR = 1; From 9f94cdd5f6ad0db714b84095e28027588edfb3b8 Mon Sep 17 00:00:00 2001 From: sbatial Date: Tue, 20 Feb 2024 18:42:11 +0100 Subject: [PATCH 2/2] gix: Move build time input to nativeBuildInputs --- pkgs/applications/version-management/gitoxide/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/version-management/gitoxide/default.nix b/pkgs/applications/version-management/gitoxide/default.nix index 725106552b4b..eb3ee122bf51 100644 --- a/pkgs/applications/version-management/gitoxide/default.nix +++ b/pkgs/applications/version-management/gitoxide/default.nix @@ -29,9 +29,9 @@ in rustPlatform.buildRustPackage rec { cargoHash = "sha256-JOl/hhyuc6vqeK6/oXXMB3fGRapBsuOTaUG+BQ9QSnk="; - nativeBuildInputs = [ cmake pkg-config ]; + nativeBuildInputs = [ cmake pkg-config installShellFiles ]; - buildInputs = [ curl installShellFiles ] ++ (if stdenv.isDarwin + buildInputs = [ curl ] ++ (if stdenv.isDarwin then [ libiconv Security SystemConfiguration ] else [ openssl ]);