Skip to content

Commit 0dd14b1

Browse files
committed
pkgs/stremio-linux-shell-rewrite-git: init
contains my fork with scaling and cursor fixes
1 parent 481669b commit 0dd14b1

3 files changed

Lines changed: 124 additions & 2 deletions

File tree

home/programs/media/default.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ pkgs, ... }:
1+
{ pkgs, self, ... }:
22
# media - control and enjoy audio/video
33
{
44
imports = [
@@ -20,6 +20,7 @@
2020

2121
# videos
2222
celluloid
23+
self.packages.${pkgs.stdenv.hostPlatform.system}.stremio-linux-shell-rewrite-git
2324

2425
# torrents
2526
transmission_4-gtk

pkgs/default.nix

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
1+
{ inputs, ... }:
12
{
23
systems = [ "x86_64-linux" ];
34

45
perSystem =
5-
{ pkgs, ... }:
6+
{ pkgs, system, ... }:
67
{
8+
_module.args.pkgs = import inputs.nixpkgs {
9+
inherit system;
10+
config.allowUnfree = true;
11+
};
12+
713
packages = {
814
# instant repl with automatic flake loading
915
repl = pkgs.callPackage ./repl { };
1016

1117
bibata-hyprcursor = pkgs.callPackage ./bibata-hyprcursor { };
1218

19+
stremio-linux-shell-rewrite-git = pkgs.callPackage ./stremio-linux-shell-rewrite-git { };
1320
wl-ocr = pkgs.callPackage ./wl-ocr { };
1421
};
1522
};
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Borrowed from https://gitlab.com/fazzi/azzipkgs/-/blob/main/pkgs/stremio-linux-shell-rewrite-git.nix?ref_type=heads
2+
{
3+
lib,
4+
fetchFromGitHub,
5+
symlinkJoin,
6+
rustPlatform,
7+
openssl,
8+
pkg-config,
9+
mpv,
10+
makeWrapper,
11+
nodejs,
12+
libadwaita,
13+
libepoxy,
14+
wrapGAppsHook4,
15+
cef-binary,
16+
libGL,
17+
addDriverRunpath,
18+
windowDecor ? false,
19+
...
20+
}:
21+
let
22+
# Follow upstream
23+
# https://github.com/Stremio/stremio-linux-shell/blob/f2499ad63f28858d913e2776befbcd029900fd5f/flatpak/com.stremio.Stremio.Devel.json#L143
24+
cefPinned = cef-binary.override {
25+
version = "145.0.22";
26+
gitRevision = "0fa8d1b";
27+
chromiumVersion = "145.0.7632.45";
28+
29+
srcHashes = {
30+
aarch64-linux = "";
31+
x86_64-linux = "sha256-2c8RdAsv8Uag/+06sxldd5oCFHqUJUb0kCFB44PxMwY=";
32+
};
33+
};
34+
# cef-rs expects the files in a specific layout
35+
cefPath = symlinkJoin {
36+
name = "stremio-cef-target";
37+
paths = [
38+
"${cefPinned}/Resources"
39+
"${cefPinned}/Release"
40+
];
41+
};
42+
in
43+
rustPlatform.buildRustPackage (finalAttrs: {
44+
pname = "stremio-linux-shell-rewrite-git";
45+
src = fetchFromGitHub {
46+
owner = "fufexan";
47+
repo = "stremio-linux-shell";
48+
rev = "00c1e04d87d00e106d6e295776e6f72083649fa4";
49+
hash = "sha256-FF7l+PbXVMNdNn7Klt0Pgkr6MqSdc+n3BPoP1g8sb1Y=";
50+
};
51+
version = "0-unstable-${builtins.substring 0 8 finalAttrs.src.rev}";
52+
53+
cargoLock = {
54+
lockFile = "${finalAttrs.src}/Cargo.lock";
55+
outputHashes = {
56+
# cef hash is missing because it's fetched at build time. We don't actually
57+
# use this because we use cefPath above. It annoyingly still needs the hash.
58+
"cef-145.0.0+145.0.22" = "sha256-ShWwn8BRFckk3CJuHWiOTMAuhizI6V17st+yqDwR2tM=";
59+
};
60+
};
61+
62+
buildInputs = [
63+
libadwaita
64+
libepoxy
65+
openssl
66+
mpv
67+
];
68+
69+
nativeBuildInputs = [
70+
wrapGAppsHook4
71+
makeWrapper
72+
pkg-config
73+
];
74+
75+
# Don't download CEF during build
76+
buildFeatures = [ "offline-build" ];
77+
# use packaged CEF
78+
env.CEF_PATH = cefPath;
79+
80+
postInstall = ''
81+
mkdir -p $out/share/applications
82+
cp data/com.stremio.Stremio.desktop $out/share/applications/com.stremio.Stremio.desktop
83+
84+
mkdir -p $out/share/icons/hicolor/scalable/apps
85+
cp data/icons/com.stremio.Stremio.svg $out/share/icons/hicolor/scalable/apps/com.stremio.Stremio.svg
86+
87+
mv $out/bin/stremio-linux-shell $out/bin/stremio
88+
'';
89+
90+
# Node.js is required to run `server.js`
91+
# Add to `gappsWrapperArgs` to avoid two layers of wrapping.
92+
preFixup = ''
93+
gappsWrapperArgs+=(
94+
--prefix LD_LIBRARY_PATH : "${addDriverRunpath.driverLink}/lib" \
95+
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ libGL ]}" \
96+
--prefix PATH : "${lib.makeBinPath [ nodejs ]}" \
97+
--set SERVER_PATH "$src/data/server.js" \
98+
${lib.optionalString (!windowDecor) "--add-flags '--no-window-decorations'"}
99+
)
100+
'';
101+
102+
meta = {
103+
mainProgram = "stremio";
104+
description = "Modern media center that gives you the freedom to watch everything you want";
105+
homepage = "https://github.com/Stremio/stremio-linux-shell";
106+
license = with lib.licenses; [
107+
gpl3Only
108+
# server.js is unfree
109+
unfree
110+
];
111+
maintainers = lib.maintainers.fazzi;
112+
platforms = lib.platforms.linux;
113+
};
114+
})

0 commit comments

Comments
 (0)