about summary refs log tree commit diff
path: root/pkgs/applications/networking/novnc
diff options
context:
space:
mode:
authorDavid Warde-Farley <dwf@google.com>2022-08-30 02:38:37 +0100
committerDavid Warde-Farley <dwf@google.com>2022-09-30 01:27:27 +0100
commit13cc17cc53eab4a59fe5530a53faef1eabaafc0f (patch)
tree5aa54c0e939008e553a34c3319d9641b9f918b7a /pkgs/applications/networking/novnc
parent671fabc93b4d1a3b38499c7b20776477c91b2b15 (diff)
novnc: correctly install and point to `websockify`
`utils/novnc_proxy` tries to download and run the `websockify` package
in the directory where the script is located, which doesn't work because
the nix store is read-only. This patches the script to point to
nix-installed `websockify`.
Diffstat (limited to 'pkgs/applications/networking/novnc')
-rw-r--r--pkgs/applications/networking/novnc/default.nix9
-rw-r--r--pkgs/applications/networking/novnc/websockify.patch13
2 files changed, 20 insertions, 2 deletions
diff --git a/pkgs/applications/networking/novnc/default.nix b/pkgs/applications/networking/novnc/default.nix
index a4efc6889ad46..818e8764dd99f 100644
--- a/pkgs/applications/networking/novnc/default.nix
+++ b/pkgs/applications/networking/novnc/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchFromGitHub }:
+{ lib, python3, stdenv, substituteAll, fetchFromGitHub }:
 
 stdenv.mkDerivation rec {
   pname = "novnc";
@@ -11,7 +11,12 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-Z+bks7kcwj+Z3uf/t0u25DnGOM60QhSH6uuoIi59jqU=";
   };
 
-  patches = [ ./fix-paths.patch ];
+  patches = with python3.pkgs; [
+    (substituteAll {
+      src = ./websockify.patch;
+      inherit websockify;
+    })
+  ] ++ [ ./fix-paths.patch ];
 
   postPatch = ''
     substituteAllInPlace utils/novnc_proxy
diff --git a/pkgs/applications/networking/novnc/websockify.patch b/pkgs/applications/networking/novnc/websockify.patch
new file mode 100644
index 0000000000000..dd335cdbfc6c4
--- /dev/null
+++ b/pkgs/applications/networking/novnc/websockify.patch
@@ -0,0 +1,13 @@
+diff --git a/utils/novnc_proxy b/utils/novnc_proxy
+index 0365c1e..7eba2db 100755
+--- a/utils/novnc_proxy
++++ b/utils/novnc_proxy
+@@ -167,7 +167,7 @@ if [[ -d ${HERE}/websockify ]]; then
+ 
+     echo "Using local websockify at $WEBSOCKIFY"
+ else
+-    WEBSOCKIFY_FROMSYSTEM=$(which websockify 2>/dev/null)
++    WEBSOCKIFY_FROMSYSTEM="@websockify@/bin/websockify"
+     WEBSOCKIFY_FROMSNAP=${HERE}/../usr/bin/python2-websockify
+     [ -f $WEBSOCKIFY_FROMSYSTEM ] && WEBSOCKIFY=$WEBSOCKIFY_FROMSYSTEM
+     [ -f $WEBSOCKIFY_FROMSNAP ] && WEBSOCKIFY=$WEBSOCKIFY_FROMSNAP