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

duti: update to new darwin SDK pattern #357745

Merged
merged 1 commit into from
Nov 23, 2024

Conversation

n-hass
Copy link
Contributor

@n-hass n-hass commented Nov 21, 2024

Uses apple-sdk_11, sets host configuration flag based on host architecture, and nixfmt the package file.

Part of #354146.

Things done

  • 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/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 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.

@n-hass
Copy link
Contributor Author

n-hass commented Nov 21, 2024

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

1 package built:
  • duti

@ofborg ofborg bot added 6.topic: darwin Running or building packages on Darwin 2.status: merge conflict This PR has merge conflicts with the target branch labels Nov 21, 2024
configureFlags = [
"--with-macosx-sdk=/homeless-shelter"
nativeBuildInputs = [ autoreconfHook ];
buildInputs = lib.optional stdenv.hostPlatform.isDarwin apple-sdk_11;
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure this is necessary? It does not look like it uses any macOS 11 APIs, so buildInputs should be able to be omitted entirely.

Comment on lines 22 to 26
# needed to prevent duti from trying to guess our sdk
# NOTE: this is different than stdenv.hostPlatform.config!
configureFlags =
lib.optionals stdenv.hostPlatform.isAarch64 [ "--host=aarch64-apple-darwin18" ]
++ lib.optionals stdenv.hostPlatform.isx86_64 [ "--host=x86_64-apple-darwin18" ];
Copy link
Member

Choose a reason for hiding this comment

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

Looking at https://github.com/moretension/duti/blob/8b5b9a08702d5de6a5bce57fade593fca46e126e/aclocal.m4, we do actually still need to work around their outdated SDK checks, but we should do it a little differently.

I suggest:

  preConfigure = ''
    configureFlagsArray+=(
      "--with-macosx-sdk=$SDKROOT"
      "--with-macosx-deployment-target=$MACOSX_DEPLOYMENT_TARGET"
    )
  '';

This should also obviate the need for --host.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, changed. But I can’t see how to remove the host flag - you still end up with failure on newer systems as host will be set to an unhandled version (eg darwin24 on latest macOS). Any suggestions, or are you happy with the latest commit?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, that’s very unfortunate, it’s doing some strange and unnecessary stuff. I see two options:

  • Pass --host=${stdenv.hostPlatform.parsed.cpu.name}-apple-darwin20 and put substituteInPlace Makefile.in --replace-fail '@macosx_arches@' "" in a postPatch phase to work around its suboptimal architecture selection (might be able to get away without the latter part, not sure).

  • Add a patch that comments out DUTI_CHECK_SDK and DUTI_CHECK_DEPLOYMENT_TARGET in configure.ac and replaces all this with just OPTOPTS= @OPTOPTS@. Then we don’t need any configure flags at all and it should just work indefinitely. This is probably the cleaner approach.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great, thanks. I’ve added the patch

@emilazy emilazy added the backport release-24.11 Backport PR automatically label Nov 22, 2024
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 22, 2024
@ofborg ofborg bot requested a review from matthewbauer November 22, 2024 20:02
@ofborg ofborg bot added 11.by: package-maintainer This PR was created by the maintainer of the package it changes 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 Nov 22, 2024
@n-hass n-hass force-pushed the update-duti-applesdk branch 2 times, most recently from 07a5f39 to 928f763 Compare November 23, 2024 02:29
remove old SDK, patch build configure checks

Signed-off-by: Nicholas Hassan <[email protected]>
Copy link
Member

@emilazy emilazy left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 357745


aarch64-darwin

✅ 1 package built:
  • duti

@emilazy emilazy merged commit d92e4e2 into NixOS:master Nov 23, 2024
16 of 17 checks passed
Copy link
Contributor

Backport failed for release-24.11, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release-24.11
git worktree add -d .worktree/backport-357745-to-release-24.11 origin/release-24.11
cd .worktree/backport-357745-to-release-24.11
git switch --create backport-357745-to-release-24.11
git cherry-pick -x ed8e72640cb29a8792e99b7aabc740ccd7ebb7fb

@emilazy
Copy link
Member

emilazy commented Nov 23, 2024

Could you handle the backport?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 11.by: package-maintainer This PR was created by the maintainer of the package it changes backport release-24.11 Backport PR automatically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants