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`.

+20 -2
+7 -2
pkgs/applications/networking/novnc/default.nix
··· 1 - { lib, stdenv, fetchFromGitHub }: 1 + { lib, python3, stdenv, substituteAll, fetchFromGitHub }: 2 2 3 3 stdenv.mkDerivation rec { 4 4 pname = "novnc"; ··· 11 11 sha256 = "sha256-Z+bks7kcwj+Z3uf/t0u25DnGOM60QhSH6uuoIi59jqU="; 12 12 }; 13 13 14 - patches = [ ./fix-paths.patch ]; 14 + patches = with python3.pkgs; [ 15 + (substituteAll { 16 + src = ./websockify.patch; 17 + inherit websockify; 18 + }) 19 + ] ++ [ ./fix-paths.patch ]; 15 20 16 21 postPatch = '' 17 22 substituteAllInPlace utils/novnc_proxy
+13
pkgs/applications/networking/novnc/websockify.patch
··· 1 + diff --git a/utils/novnc_proxy b/utils/novnc_proxy 2 + index 0365c1e..7eba2db 100755 3 + --- a/utils/novnc_proxy 4 + +++ b/utils/novnc_proxy 5 + @@ -167,7 +167,7 @@ if [[ -d ${HERE}/websockify ]]; then 6 + 7 + echo "Using local websockify at $WEBSOCKIFY" 8 + else 9 + - WEBSOCKIFY_FROMSYSTEM=$(which websockify 2>/dev/null) 10 + + WEBSOCKIFY_FROMSYSTEM="@websockify@/bin/websockify" 11 + WEBSOCKIFY_FROMSNAP=${HERE}/../usr/bin/python2-websockify 12 + [ -f $WEBSOCKIFY_FROMSYSTEM ] && WEBSOCKIFY=$WEBSOCKIFY_FROMSYSTEM 13 + [ -f $WEBSOCKIFY_FROMSNAP ] && WEBSOCKIFY=$WEBSOCKIFY_FROMSNAP