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

git-credential-keepassxc: fix build on darwin #312508

Closed

Conversation

eliandoran
Copy link
Contributor

Description of changes

Things done

Changed SDK version as per #215782 .

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@eliandoran eliandoran added the 0.kind: ZHF Fixes Fixes during the Zero Hydra Failures (ZHF) campaign label May 17, 2024
@ofborg ofborg bot added 6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux labels May 17, 2024
@RaghavSood
Copy link
Member

Result of nixpkgs-review pr 312508 run on x86_64-linux 1

@RaghavSood
Copy link
Member

Result of nixpkgs-review pr 312508 run on aarch64-darwin 1

@RaghavSood
Copy link
Member

@GrahamcOfBorg build git-credential-keepassxc

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

i believe that using overrideSDK is the preferred method rather than trying to pin to some version.

eg:

ovrdsdk.diff
diff --git a/pkgs/applications/version-management/git-credential-keepassxc/default.nix b/pkgs/applications/version-management/git-credential-keepassxc/default.nix
index 2d3e511fcbfd..b75f025d6141 100644
--- a/pkgs/applications/version-management/git-credential-keepassxc/default.nix
+++ b/pkgs/applications/version-management/git-credential-keepassxc/default.nix
@@ -10,7 +10,11 @@
 , withAll ? false
 }:

-rustPlatform.buildRustPackage rec {
+let
+  # apply the possibly modified stdenv from all-packages.nix
+  buildRustPackage = rustPlatform.buildRustPackage.override { inherit stdenv; };
+in
+buildRustPackage rec {
   pname = "git-credential-keepassxc";
   version = "0.14.0";

diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 1f6c9407956f..8bf0e4ee4e7e 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -2335,6 +2335,10 @@ with pkgs;
   git-credential-1password = callPackage ../applications/version-management/git-credential-1password { };

   git-credential-keepassxc = callPackage ../applications/version-management/git-credential-keepassxc {
+    stdenv =
+      if stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinSdkVersion "11"
+      then overrideSDK stdenv "11.0"
+      else stdenv;
     inherit (darwin.apple_sdk.frameworks) DiskArbitration Foundation;
   };

or

ovrdsdk-alt.diff
diff --git a/pkgs/applications/version-management/git-credential-keepassxc/default.nix b/pkgs/applications/version-management/git-credential-keepassxc/default.nix
index 2d3e511fcbfd..1c75d64d39a2 100644
--- a/pkgs/applications/version-management/git-credential-keepassxc/default.nix
+++ b/pkgs/applications/version-management/git-credential-keepassxc/default.nix
@@ -1,5 +1,6 @@
 { lib
 , stdenv
+, overrideSDK
 , rustPlatform
 , fetchFromGitHub
 , DiskArbitration
@@ -10,7 +11,14 @@
 , withAll ? false
 }:
 
-rustPlatform.buildRustPackage rec {
+let
+  stdenv' =
+    if stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinSdkVersion "11"
+    then overrideSDK stdenv "11.0"
+    else stdenv;
+  buildRustPackage = rustPlatform.buildRustPackage.override { stdenv = stdenv'; };
+in
+buildRustPackage rec {
   pname = "git-credential-keepassxc";
   version = "0.14.0";
 
@@ -23,7 +31,7 @@ rustPlatform.buildRustPackage rec {
 
   cargoHash = "sha256-c2YucWs0UzyWDKWS5KebT3ps+XvWzlI0+ziJ8JX6oiQ=";
 
-  buildInputs = lib.optionals stdenv.isDarwin [ DiskArbitration Foundation ];
+  buildInputs = lib.optionals stdenv'.isDarwin [ DiskArbitration Foundation ];
 
   buildFeatures = []
     ++ lib.optional withNotification "notification"

@eliandoran
Copy link
Contributor Author

eliandoran commented May 18, 2024

i believe that using overrideSDK is the preferred method rather than trying to pin to some version.

@annaleeleaves , thank you for the feedback, I'll look into it.
@wegank , what is your opinion?

@wegank
Copy link
Member

wegank commented May 18, 2024

I still prefer darwin.apple_sdk_11_0.callPackage to overrideSDK, if possible, when it comes to Rust packages, as there's a systematic override of rustPlatform (and was implemented as follows because rustPlatform.buildRustPackage.override didn't work), but my preference will probably change one day.

rustPlatform = pkgs.makeRustPlatform {
inherit (pkgs.darwin.apple_sdk_11_0) stdenv;
inherit (pkgs) rustc cargo;
} // {
inherit (pkgs.callPackage ../../../build-support/rust/hooks {
inherit (pkgs.darwin.apple_sdk_11_0) stdenv;
inherit (pkgs) cargo rustc;
clang = mkCc pkgs.clang;
}) bindgenHook;
};

@eliandoran
Copy link
Contributor Author

Closing in favor of #312711.

@eliandoran eliandoran closed this May 18, 2024
@eliandoran eliandoran deleted the darwin/git-credential-keepassxc branch May 18, 2024 18:06
@ghost
Copy link

ghost commented May 18, 2024

hmm, i thought that the overrideSDK rewrite #287609 fixed it but from looking at the PR comment it states that rustPlatform still needs some attention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: ZHF Fixes Fixes during the Zero Hydra Failures (ZHF) campaign 6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants