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

unison: fix building on macOS with enableX11 = false #61483

Merged
merged 1 commit into from May 16, 2019

Conversation

lilyball
Copy link
Member

Motivation for this change

If UISTYLE is not specified, Unison tries to auto-detect the UI style based on the available environment. On macOS this apparently means using UISTYLE=mac, it can't actually build this way in Nix. On other platforms this change shouldn't affect anything as it should be detecting text if lablgtk2 isn't available.

Without this change, unison fails to build on macOS when config.unison.enableX11 = false.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

CC @viric

@ofborg ofborg bot added 6.topic: darwin Running or building packages on Darwin 10.rebuild-darwin: 0 10.rebuild-linux: 0 labels May 14, 2019
@@ -20,7 +20,7 @@ stdenv.mkDerivation (rec {
echo -e '\ninstall:\n\tcp $(FSMONITOR)$(EXEC_EXT) $(INSTALLDIR)' >> src/fsmonitor/linux/Makefile
'';

makeFlags = "INSTALLDIR=$(out)/bin/" + (if enableX11 then " UISTYLE=gtk2" else "")
makeFlags = "INSTALLDIR=$(out)/bin/ UISTYLE=" + (if enableX11 then "gtk2" else "text")
+ (if ! ocaml.nativeCompilers then " NATIVE=false" else "");
Copy link
Member

Choose a reason for hiding this comment

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

Since you're already touching this code, I suggest this cleanup (untested):

{
  makeFlags = [
    "INSTALLDIR=$(out)/bin/"
    "UISTYLE=${if enableX11 then "gtk2" else "text"}"
  ] ++ lib.optional ocaml.nativeCompilers "NATIVE=false";
}

Copy link
Member Author

@lilyball lilyball May 14, 2019

Choose a reason for hiding this comment

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

That looks good to me. I'll test it out this evening.

Edit: Well, it should be lib.optional (!ocaml.nativeCompilers) "NATIVE=false" but otherwise it looks good.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. I tested (on macOS) and the resulting derivation is identical to the previous version (both with and without enableX11).

If `UISTYLE` is not specified, Unison tries to auto-detect the UI style
based on the available environment. On macOS this apparently means using
`UISTYLE=mac`, it can't actually build this way in Nix.
@infinisil infinisil merged commit 23f8de0 into NixOS:master May 16, 2019
@lilyball lilyball deleted the unison branch May 16, 2019 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants