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

SleepyHead: use qt5.makeDerivation and fix for Darwin #88806

Merged
merged 3 commits into from
May 24, 2020
Merged

SleepyHead: use qt5.makeDerivation and fix for Darwin #88806

merged 3 commits into from
May 24, 2020

Conversation

fiksn
Copy link
Contributor

@fiksn fiksn commented May 24, 2020

Motivation for this change

I wasn't able to install sleepyhead on my machines.

On NixOS I got:
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""

On Darwin I got:
qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in ""

Additionally package was marked as broken.

Read https://hydra.nixos.org/build/96804884/download/1/nixpkgs/manual.html#sec-language-qt and tinkered with the thing until it worked 😃

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-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)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added the 6.topic: darwin Running or building packages on Darwin label May 24, 2020
@fiksn
Copy link
Contributor Author

fiksn commented May 24, 2020

For reference I also tried with libsForQt5.callPackage and then wrapQtAppsHook as an input parameter (so it would work also in the sandbox case).

However I get:

dyld: Library not loaded: /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
  Referenced from: /nix/store/xkxq0dd7kfagz04gwbmvgjjbvf33bl4s-qtbase-5.12.7-dev/bin/qmake
  Reason: no suitable image found.  Did find:
        /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation: file system sandbox blocked stat()
        /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation: file system sandbox blocked stat()
./configure: line 26: 17806 Abort trap: 6           ${QMAKE} "${DIR}"

if anyone can shed some light I am more than happy to do it the "proper way".

@veprbl
Copy link
Member

veprbl commented May 24, 2020

For reference I also tried with libsForQt5.callPackage and then wrapQtAppsHook as an input parameter (so it would work also in the sandbox case).

Those have nothing to do with sandboxing. As far as I understand, you should be able to switch to libsForQt5.callPackage without even a rebuild.

@fiksn
Copy link
Contributor Author

fiksn commented May 24, 2020

Those have nothing to do with sandboxing. As far as I understand, you should be able to switch to libsForQt5.callPackage without even a rebuild.

Sandboxing was meant in the context that on Darwin I just use wrapQtApp without ever declaring where that comes from. If the build was done in a sandbox it would fail.

My understanding was that with
nativeBuildInputs = [ wrapQtAppsHook ];

this would become a proper build input but of course I might be totally wrong here. BTW, found a similar issue just regarding Emacs (#47413). I have the store on MacOS on a dedicated volume called /nix - if that causes the problems. That is some security sandbox, but I don't understand yet how to solve this (using my method the built application works perfectly).

@fiksn
Copy link
Contributor Author

fiksn commented May 24, 2020

Ah silly me. It was caused since I experimented with sandbox = true in /etc/nix/nix.conf

@veprbl
Copy link
Member

veprbl commented May 24, 2020

Sandboxing was meant in the context that on Darwin I just use wrapQtApp without ever declaring where that comes from. If the build was done in a sandbox it would fail.

The call to "wrapQtApp" from a shell script is resolved using the "PATH" environment variable, which is initialized by the stdenv and should not contain any impure paths unless it's somehow modified.

My understanding was that with
nativeBuildInputs = [ wrapQtAppsHook ];

this would become a proper build input but of course I might be totally wrong here.

If I'm not mistaken, mkDerivation provided by the libsForQt5.callPackage may implicitly include wrapQtAppsHook to nativeBuildInputs for you.

BTW, found a similar issue just regarding Emacs (#47413). I have the store on MacOS on a dedicated volume called /nix - if that causes the problems. That is some security sandbox, but I don't understand yet how to solve this (using my method the built application works perfectly).

Sandboxing on darwin is currently not properly supported by nixpkgs for the impure Apple frameworks (#67166 mentions a workaround).

@veprbl
Copy link
Member

veprbl commented May 24, 2020

@GrahamcOfBorg build sleepyhead

Copy link
Member

@veprbl veprbl left a comment

Choose a reason for hiding this comment

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

Works on x86_64-linux (NixOS)

@veprbl veprbl merged commit 4c1bab5 into NixOS:master May 24, 2020
@Janik-Haag Janik-Haag added the 12. first-time contribution This PR is the author's first one; please be gentle! label Jun 12, 2023
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.

3 participants