From b333f3a0153e12908c61155022f15e3658f36568 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Thu, 25 Jul 2024 15:10:15 +0200 Subject: [PATCH 1/3] phoebus-client: hardcode Python path for the console view Upstream defaults to /usr/bin/python3, which doesn't exist on NixOS Fixes #100 --- pkgs/epnix/tools/phoebus/client/default.nix | 17 +++++++++++++++++ .../tools/phoebus/client/fix-python-path.patch | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 pkgs/epnix/tools/phoebus/client/fix-python-path.patch diff --git a/pkgs/epnix/tools/phoebus/client/default.nix b/pkgs/epnix/tools/phoebus/client/default.nix index 44c58ad1..e40263e6 100644 --- a/pkgs/epnix/tools/phoebus/client/default.nix +++ b/pkgs/epnix/tools/phoebus/client/default.nix @@ -2,6 +2,7 @@ lib, epnixLib, stdenv, + substituteAll, maven, makeWrapper, makeDesktopItem, @@ -9,6 +10,7 @@ epnix, jdk, openjfx, + python3, }: let buildDate = "2022-02-24T07:56:00Z"; in @@ -16,6 +18,13 @@ in pname = "phoebus"; inherit (epnix.phoebus-deps) version src; + patches = [ + (substituteAll { + src = ./fix-python-path.patch; + python = lib.getExe python3; + }) + ]; + # TODO: make a scope, so that we don't pass around the whole `epnix` nativeBuildInputs = [ maven @@ -32,6 +41,14 @@ in }) ]; + # Put runtime dependencies in propagated + # because references get thrown into a jar + # which is compressed, + # so the Nix scanner won't always be able to see them + propagatedBuildInputs = [ + python3 + ]; + desktopItems = [ (makeDesktopItem { name = "phoebus"; diff --git a/pkgs/epnix/tools/phoebus/client/fix-python-path.patch b/pkgs/epnix/tools/phoebus/client/fix-python-path.patch new file mode 100644 index 00000000..f9e2e8f9 --- /dev/null +++ b/pkgs/epnix/tools/phoebus/client/fix-python-path.patch @@ -0,0 +1,17 @@ +diff --git a/app/console/src/main/resources/console_preferences.properties b/app/console/src/main/resources/console_preferences.properties +index e00d6f8ec..e3bc52f3e 100644 +--- a/app/console/src/main/resources/console_preferences.properties ++++ b/app/console/src/main/resources/console_preferences.properties +@@ -28,9 +28,9 @@ prompt_info=Enter console command + # /bin/bash + # + # Value may include properties. +-shell=/usr/bin/python -i ++shell=@python@ -i + + # Folder where the shell process should be started + # + # Value may include properties. +-directory=$(user.home) +\ No newline at end of file ++directory=$(user.home) From d90443fecce486ab4e773d336e6e55069d744ef4 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Thu, 25 Jul 2024 15:11:38 +0200 Subject: [PATCH 2/3] phoebus-client: remove outdated comment --- pkgs/default.nix | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkgs/default.nix b/pkgs/default.nix index 7ca5282a..c7260268 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -67,11 +67,7 @@ in pcas = callPackage ./epnix/tools/pcas {}; - phoebus = callPackage ./epnix/tools/phoebus/client { - # TODO: uncomment when this works: - # TODO: add libjfxwebkit.so into openjfx - # jdk = final.openjdk17.override {enableJavaFX = true;}; - }; + phoebus = callPackage ./epnix/tools/phoebus/client {}; phoebus-alarm-server = callPackage ./epnix/tools/phoebus/alarm-server {}; phoebus-alarm-logger = callPackage ./epnix/tools/phoebus/alarm-logger {}; phoebus-archive-engine = callPackage ./epnix/tools/phoebus/archive-engine {}; From 8562a1402d38825ddf3eb214abc9270ce922862e Mon Sep 17 00:00:00 2001 From: Minijackson Date: Thu, 25 Jul 2024 15:11:59 +0200 Subject: [PATCH 3/3] phoebus-client: fix .desktop file categories Reading through the spec[1] and the warnings, it says that an application should have only one "Main Category" to prevent the application to be displayed in multiple places in the menu. Apparently, "Additional Categories" also automatically inherits from their "Main Category", so I had to remove a bunch. [1]: https://specifications.freedesktop.org/menu-spec/menu-spec-1.0.html#category-registry --- pkgs/epnix/tools/phoebus/client/default.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkgs/epnix/tools/phoebus/client/default.nix b/pkgs/epnix/tools/phoebus/client/default.nix index e40263e6..631362df 100644 --- a/pkgs/epnix/tools/phoebus/client/default.nix +++ b/pkgs/epnix/tools/phoebus/client/default.nix @@ -55,15 +55,14 @@ in exec = "phoebus -server 4918 -resource %f"; desktopName = "Phoebus"; keywords = ["epics" "css"]; + # https://specifications.freedesktop.org/menu-spec/menu-spec-1.0.html#category-registry categories = [ + # Main "Office" - "Graphics" - "GUIDesigner" - "Viewer" - "Science" - "Physics" - "Monitor" + + # Additional "Java" + "Viewer" ]; }) ];