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

ride: add darwin support #313397

Merged
merged 1 commit into from
Jul 2, 2024
Merged

ride: add darwin support #313397

merged 1 commit into from
Jul 2, 2024

Conversation

TomaSajt
Copy link
Contributor

@TomaSajt TomaSajt commented May 21, 2024

Description of changes

This PR adds darwin support to the ride package.

I was working on supporting darwin in #250627, but I gave up since I didn't have a darwin machine to do debugging.

I have finally set up a macos-ventura VM so I can test on Darwin now.

Turns out I was very very close, the only thing missing was that I accidentally removed some of the execute permissions from the electron directory, which made it not be able to launch.

Now, instead of doing cp -r --no-preserve=all I do cp -r with chmod -R u+w, this way the directory becomes writable without messing up the other permissions.


Note: since dyalog is not packaged for Darwin, you'll have to connect to a dyalog instance remotely if you want to test it out. (Or just run the non-nix package)

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/)
  • 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.

Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

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

already looking good

--add-flags $out/share/ride/resources/app.asar \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}" \
--inherit-argv0
${lib.optionalString (!stdenv.isDarwin) ''
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
${lib.optionalString (!stdenv.isDarwin) ''
'' + lib.optionalString (!stdenv.isDarwin) ''

that's easier than string interpolation inside strings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't really agree with this. This is very similar to how bash's if statements look. I'm not using if then else because that would add extra levels of indentation and it doesn't really look much more readable.

pkgs/by-name/ri/ride/package.nix Show resolved Hide resolved
--inherit-argv0
''}

${lib.optionalString (stdenv.isDarwin) ''
Copy link
Member

Choose a reason for hiding this comment

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

We could probably work with if then else here, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +91 to +95
nativeBuildInputs =
[
zip
makeWrapper
]
++ lib.optionals (!stdenv.isDarwin) [ copyDesktopItems ]
++ lib.optionals stdenv.isDarwin [ darwin.cctools ];
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
nativeBuildInputs =
[
zip
makeWrapper
]
++ lib.optionals (!stdenv.isDarwin) [ copyDesktopItems ]
++ lib.optionals stdenv.isDarwin [ darwin.cctools ];
nativeBuildInputs = [
zip
makeWrapper
] ++ lib.optionals stdenv.isLinux [ copyDesktopItems ]
++ lib.optionals stdenv.isDarwin [ darwin.cctools ];

Copy link
Contributor Author

@TomaSajt TomaSajt May 21, 2024

Choose a reason for hiding this comment

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

The formatting is done by nixfmt-rfc-style, so I won't change that.

I think I'll stay consistent with using stdenv.isDarwin everywhere.

pkgs/by-name/ri/ride/package.nix Outdated Show resolved Hide resolved
Comment on lines +94 to +103
# Fix error: no member named 'aligned_alloc' in the global namespace
env.NIX_CFLAGS_COMPILE = lib.optionalString (
stdenv.isDarwin && lib.versionOlder stdenv.hostPlatform.darwinSdkVersion "11.0"
) "-D_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION=1";

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added this instead of doing overrideSDK since this requires less overriding.

@TomaSajt TomaSajt force-pushed the ride-darwin branch 3 times, most recently from 017bb18 to b2cd0fe Compare June 14, 2024 17:40
@SuperSandro2000 SuperSandro2000 merged commit 0088f20 into NixOS:master Jul 2, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants