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

oscar: add Darwin support #361956

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 35 additions & 19 deletions pkgs/by-name/os/oscar/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,48 @@ stdenv.mkDerivation rec {

qmakeFlags = [ "OSCAR_QT.pro" ];

installPhase = ''
runHook preInstall
install -d $out/bin
install -d $out/share/OSCAR/Help
install -d $out/share/OSCAR/Html
install -d $out/share/OSCAR/Translations
install -d $out/share/icons/OSCAR
install -d $out/share/applications
install -T oscar/OSCAR $out/bin/OSCAR
# help browser was removed 'temporarily' in https://gitlab.com/pholy/OSCAR-code/-/commit/57c3e4c33ccdd2d0eddedbc24c0e4f2969da3841
# install oscar/Help/* $out/share/OSCAR/Help
install oscar/Html/* $out/share/OSCAR/Html
install oscar/Translations/* $out/share/OSCAR/Translations
install -T Building/Linux/OSCAR.png $out/share/icons/OSCAR/OSCAR.png
install -T Building/Linux/OSCAR.desktop $out/share/applications/OSCAR.desktop
runHook postInstall
'';
# Graphs/gGraphView.cpp:1416:9: error: variable 'pinned_graphs' set but not used [-Werror,-Wunused-but-set-variable]
NIX_CFLAGS_COMPILE = lib.optionals stdenv.cc.isClang [ "-Wno-error=unused-but-set-variable" ];

installPhase =
''
runHook preInstall
''
+ (
if stdenv.isDarwin then
''
install -d $out/Applications
mv oscar/OSCAR.app $out/Applications
Copy link
Member

@Aleksanaa Aleksanaa Dec 5, 2024

Choose a reason for hiding this comment

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

Also link executable to $out/bin and test if it works. (otherwise mainProgram becomes invalid)

Copy link
Member Author

Choose a reason for hiding this comment

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

From a macOS perspective this seems like an unusual thing to do, and it would make more sense to me to remove the mainProgram attribute on Darwin. I haven't really been keeping up with nixpkgs lately, so if that's the convention then I don't mind doing so. The one thing I found when searching (mainProgram for Mac OS Apps) made it seem like macOS wasn't really considered when implementing the mainProgram feature, and also didn't arrive at a conclusion for what to do in this case.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not very sure about that, but I got a request at #360354 (comment). As it doesn't hurt anything and it ease test when reviewing new versions, I'd suggest to add it as well.

''
else
''
install -d $out/bin
install -d $out/share/OSCAR/Help
install -d $out/share/OSCAR/Html
install -d $out/share/OSCAR/Translations
install -d $out/share/icons/OSCAR
install -d $out/share/applications
install -T oscar/OSCAR $out/bin/OSCAR
# help browser was removed 'temporarily' in https://gitlab.com/pholy/OSCAR-code/-/commit/57c3e4c33ccdd2d0eddedbc24c0e4f2969da3841
# install oscar/Help/* $out/share/OSCAR/Help
install oscar/Html/* $out/share/OSCAR/Html
install oscar/Translations/* $out/share/OSCAR/Translations
install -T Building/Linux/OSCAR.png $out/share/icons/OSCAR/OSCAR.png
install -T Building/Linux/OSCAR.desktop $out/share/applications/OSCAR.desktop
''
)
+ ''
runHook postInstall
'';

meta = with lib; {
homepage = "https://www.sleepfiles.com/OSCAR/";
description = "Software for reviewing and exploring data produced by CPAP and related machines used in the treatment of sleep apnea";
mainProgram = "OSCAR";
license = licenses.gpl3Only;
maintainers = [ maintainers.roconnor ];
# Someone needs to create a suitable installPhase for Darwin and Windows.
# Someone needs to create a suitable installPhase for Windows.
# See https://gitlab.com/pholy/OSCAR-code/-/tree/master/Building.
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
};
}
Loading