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

signal-desktop: init darwin at 7.5.1 #286188

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

juuyokka
Copy link

@juuyokka juuyokka commented Feb 4, 2024

Description of changes

Add support for x86_64-darwin and aarch64-darwin. I unfortunately could not figure out whether or not the update script works. I also could not figure out how to run the tests. If someone could tell me how to do both of those things I'd be happy to test those as well.

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.

@Mic92
Copy link
Member

Mic92 commented Feb 8, 2024

You can test the update script by first installing nix-update and than running this command from the root of the repository:

$ nix-update --use-update-script --build --commit signal-desktop

Let me know if this works for you and than I can merge this PR.

@juuyokka
Copy link
Author

Checking back in on this PR, I have rebased my changes onto master and did a small refactor. I have also tested the update script to ensure it works.

@DontEatOreo
Copy link
Member

Please rebase and reword your commit to signal-desktop: refactor file names and targetPlatform

@juuyokka
Copy link
Author

Ah, that's my bad. Nothing a good 'ol git commit --amend can't fix!

Copy link
Contributor

@RossComputerGuy RossComputerGuy left a comment

Choose a reason for hiding this comment

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

image0

else callPackage ./signal-desktop.nix { };
signal-desktop-beta = callPackage ./signal-desktop-beta.nix{ };
{ targetPlatform, callPackage }: {
signal-desktop = callPackage ./signal-desktop-${targetPlatform.system}.nix { };
Copy link
Member

@Mic92 Mic92 Apr 29, 2024

Choose a reason for hiding this comment

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

Mhm. This will cause eval errors in case we have a new unsupported platform.
This needs to be fixed. signal-desktop should always point to some derivation even if this derivation doesn't build on the current platform.

Copy link
Author

Choose a reason for hiding this comment

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

How do you suggest it to be fixed? Perhaps we could pick a default derivation to fall back onto if one doesn't exist for an unsupported platform.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe builtins.pathExists with a fallback to x86_64-linux? But otherwise the previous if statement was also good enough, easier to read than some other complex logic.

Copy link
Author

Choose a reason for hiding this comment

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

Perhaps we could do something like this?

Suggested change
signal-desktop = callPackage ./signal-desktop-${targetPlatform.system}.nix { };
signal-desktop =
let
default = callPackage ./signal-desktop-x86_64-linux.nix { };
supportedPlatforms = default.meta.platforms;
inherit (targetPlatform) system;
in
if builtins.elem system supportedPlatforms
then callPackage ./signal-desktop-${system}.nix { }
else default;

Or we could use builtins.pathExists like this

Suggested change
signal-desktop = callPackage ./signal-desktop-${targetPlatform.system}.nix { };
signal-desktop =
let
path = ./signal-desktop-${targetPlatform.system}.nix;
default = ./signal-desktop-x86_64-linux.nix;
in
if builtins.pathExists path
then callPackage path { }
else callPackage default { };

I think I prefer the latter. Evaluating meta in the first one would work but it's harder to follow.

Copy link
Member

Choose a reason for hiding this comment

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

@Mic92 Wouldn't it be better to just throw and say your platform is not supported? Since there isn't any guarantee the x86_64-linux will work properly on a new platform either?

Copy link
Member

Choose a reason for hiding this comment

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

We already have quite a few eval errors here and we should not keep adding to it: https://hydra.nixos.org/jobset/nixpkgs/trunk#tabs-errors

Copy link
Member

Choose a reason for hiding this comment

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

I think a throw statement is not quite same as saying that the platform is not supported in meta.platforms semantically speaking.

You're right, although what now? Do we default to building x86_64-linux? Wouldn't it be better to mark anything that isn't in meta.platforms as broken so we can entirely skip making a derivation and save resources?

Also, if we were to default to building for x86_64-linux, wouldn't it be an issue if we could build it on another platform but not run it?

Copy link
Member

Choose a reason for hiding this comment

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

According to @wegank, targePlatform is only required when building a compiler #310053 (comment), see https://nix.dev/tutorials/cross-compilation.html#platforms.

Copy link
Contributor

Choose a reason for hiding this comment

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

and run the final executable on the target platform.

If hostPlatform were used and you were to cross compile architectures, wouldn't you end up with a binary that's incompatible?

Copy link
Member

Choose a reason for hiding this comment

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

The cross-compiled program, in that example the compiler, still runs on the host platform (and produces executables that run on the target platform).

@DontEatOreo
Copy link
Member

Looking again at the commits, you're breaking the Commit Conventions.

If you have commits pkg-name: oh, forgot to insert whitespace: squash commits in this case. Use git rebase -i. See Squashing Commits for additional information.

Just squash everything into first commit (89b5d0b) and then reword it to signal-desktop: init darwin at 7.5.1

@ofborg ofborg bot requested a review from Mic92 April 29, 2024 15:04
@juuyokka juuyokka changed the title signal-desktop: init darwin at 6.45.0 signal-desktop: init darwin at 7.5.1 Apr 29, 2024
Copy link
Member

@teutat3s teutat3s left a comment

Choose a reason for hiding this comment

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

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

7 participants