From da496c9fd55006a559b0540ddfeb28b161374b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Pastor=20P=C3=A9rez?= Date: Thu, 1 May 2025 13:03:27 +0200 Subject: [PATCH] nongnu: Add stremio. * nongnu/packages/video.scm (stremio): New variable. --- nongnu/packages/video.scm | 116 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/nongnu/packages/video.scm b/nongnu/packages/video.scm index aeb712fe..7397219e 100644 --- a/nongnu/packages/video.scm +++ b/nongnu/packages/video.scm @@ -5,11 +5,16 @@ (define-module (nongnu packages video) #:use-module (gnu packages gl) + #:use-module (gnu packages gnome) + #:use-module (gnu packages node) #:use-module (gnu packages pkg-config) + #:use-module (gnu packages qt) + #:use-module (gnu packages tls) #:use-module (gnu packages video) #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) #:use-module (guix build-system meson) + #:use-module (guix build-system qt) #:use-module (guix gexp) #:use-module (guix download) #:use-module (guix git-download) @@ -268,3 +273,114 @@ content.") (package-description obs) " This build of OBS includes embeded Chromium-based browser to enable Browser source.")))) + +(define-public stremio + (define server-js + (let ((version "4.20.8")) + (origin + (method url-fetch) + (uri (string-append "https://dl.strem.io/server/v" version + "/desktop/server.js")) + (file-name (string-append "stremio-server-" version ".js")) + (sha256 (base32 "0xmlbx6aib5h78ya369pnpxyn05b12l05i8v2kymijbmaw7j04vi"))))) + (package + (name "stremio") + (version "4.4.168") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/Stremio/stremio-shell") + (commit (string-append "v" version)) + ;; NOTE: submodules are embedded libraries so there is no reason + ;; to unbundle them. + (recursive? #t))) + (file-name (git-file-name name version)) + (sha256 + (base32 "14x9i8qvm19sijh7hqppbk8s14dvv7dqlck7x3s8n9i4xn4ncgd7")))) + (build-system qt-build-system) + (arguments + (list + #:tests? #f + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'setup-server + (lambda _ + (copy-file #$server-js "server.js"))) + (add-after 'unpack 'fix-paths + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "CMakeLists.txt" + (("opt/stremio") + "bin")) + (substitute* "release.makefile" + (("/opt/stremio") + "/bin")) + (substitute* "main.qml" + (("var node_executable =.*$") + (string-append "var node_executable =\"" + (search-input-file inputs "bin/node") "\"\n")) + (("applicationDirPath \\+\"/server\\.js\"") + (string-append "\"" + #$server-js "\""))) + (substitute* "smartcode-stremio.desktop" + (("Exec=stremio") + (string-append "Exec=" + #$output "/bin/stremio"))))) + (replace 'configure + (lambda _ + (invoke "qmake"))) + (replace 'build + (lambda _ + (invoke "make" "-f" "release.makefile" + (string-append "PREFIX=" + #$output)))) + (replace 'install + (lambda _ + (invoke "make" "-f" "release.makefile" "install" + (string-append "PREFIX=" + #$output)) + (with-directory-excursion #$output + ;; Setup desktop file. + (let ((dir "share/applications") + (desktop "smartcode-stremio.desktop")) + (mkdir-p "share/applications") + (copy-file (string-append "bin/" desktop) + (string-append dir "/" desktop)) + (delete-file (string-append "bin/" desktop))) + ;; Setup icon dir. + (for-each (lambda (size) + (let ((dir (string-append "share/icons/hicolor/" + size "x" size "/apps"))) + (mkdir-p dir) + (copy-file (string-append + "bin/icons/smartcode-stremio_" size + ".png") + (string-append dir + "/smartcode-stremio.png")) + (copy-file (string-append + "bin/icons/smartcode-stremio-tray_" + size ".png") + (string-append dir + "/smartcode-stremio-tray.png")))) + '("16" "22" "24" "32" "64" "128")) + ;; Remove unnecessary opt dir. + (delete-file-recursively "bin/icons"))))))) + (inputs (list librsvg + mpv + node + openssl + qtdeclarative-5 + qtquickcontrols-5 + qtwebchannel-5 + qtwebengine-5 + qtbase-5)) + (home-page "https://www.stremio.com") + (synopsis "Modern media center that gives you the freedom to watch +everything you want") + (description + "Stremio offers a secure, modern and seamless entertainment experience. +With its easy-to-use interface and diverse content library, including 4K HDR +support, users can enjoy their favorite movies and TV shows across all their +devices. And with its commitment to security, Stremio is the ultimate choice +for a worry-free, high-quality streaming experience.") + (license license:gpl3)))