ripasso-cursive: cosmetic changes (#361736)
[NixPkgs.git] / pkgs / by-name / di / dim / package.nix
blob53ab3a0ed685c5c6fe8f7be133c73cf540e44813
2   lib,
3   stdenv,
4   rustPlatform,
5   fetchFromGitHub,
6   buildNpmPackage,
7   darwin,
8   makeWrapper,
9   ffmpeg,
10   git,
11   pkg-config,
12   sqlite,
13   libvaSupport ? stdenv.hostPlatform.isLinux,
14   libva,
15   fetchpatch,
17 rustPlatform.buildRustPackage rec {
18   pname = "dim";
19   version = "0-unstable-2023-12-29";
20   src = fetchFromGitHub {
21     owner = "Dusk-Labs";
22     repo = "dim";
23     rev = "3ccb4ab05fc1d7dbd4ebbba9ff2de0ecc9139b27";
24     hash = "sha256-1mgbrDnIkIdWy78uj4EjjgwBQxw/rIS1LCFNscXXPbk=";
25   };
27   frontend = buildNpmPackage {
28     pname = "dim-ui";
29     inherit version;
30     src = "${src}/ui";
32     postPatch = ''
33       ln -s ${./package-lock.json} package-lock.json
34     '';
36     npmDepsHash = "sha256-6oSm3H6RItHOrBIvP6uvR7sBboBRWFuP3VwU38GMfgQ=";
38     installPhase = ''
39       runHook preInstall
40       cp -r build $out
41       runHook postInstall
42     '';
43   };
45   patches = [
46     # Upstream uses a 'ffpath' function to look for config directory and
47     # (ffmpeg) binaries in the same directory as the binary. Patch it to use
48     # the working dir and PATH instead.
49     ./relative-paths.diff
51     # Bump the first‐party nightfall dependency to the latest Git
52     # revision for FFmpeg >= 6 support.
53     ./bump-nightfall.patch
55     # Upstream has some unused imports that prevent things from compiling...
56     # Remove for next release.
57     (fetchpatch {
58       name = "remove-unused-imports.patch";
59       url = "https://github.com/Dusk-Labs/dim/commit/f62de1d38e6e52f27b1176f0dabbbc51622274cb.patch";
60       hash = "sha256-Gk+RHWtCKN7McfFB3siIOOhwi3+k17MCQr4Ya4RCKjc=";
61     })
62   ];
64   postPatch = ''
65     ln -sf ${./Cargo.lock} Cargo.lock
66   '';
68   postConfigure = ''
69     ln -ns $frontend ui/build
70   '';
72   nativeBuildInputs = [
73     makeWrapper
74     pkg-config
75     git
76   ];
78   buildInputs =
79     [ sqlite ]
80     ++ lib.optional stdenv.hostPlatform.isDarwin [
81       darwin.apple_sdk.frameworks.Security
82       darwin.apple_sdk.frameworks.CoreServices
83       darwin.apple_sdk.frameworks.SystemConfiguration
84     ]
85     ++ lib.optional libvaSupport libva;
87   buildFeatures = lib.optional libvaSupport "vaapi";
89   cargoLock = {
90     lockFile = ./Cargo.lock;
91     outputHashes = {
92       "mp4-0.8.2" = "sha256-OtVRtOTU/yoxxoRukpUghpfiEgkKoJZNflMQ3L26Cno=";
93       "nightfall-0.3.12-rc4" = "sha256-AbSuLe3ySOla3NB+mlfHRHqHuMqQbrThAaUZ747GErE=";
94     };
95   };
97   checkFlags = [
98     # Requires network
99     "--skip=tmdb::tests::johhny_test_seasons"
100     "--skip=tmdb::tests::once_upon_get_year"
101     "--skip=tmdb::tests::tmdb_get_cast"
102     "--skip=tmdb::tests::tmdb_get_details"
103     "--skip=tmdb::tests::tmdb_get_episodes"
104     "--skip=tmdb::tests::tmdb_get_seasons"
105     "--skip=tmdb::tests::tmdb_search"
106     # Broken doctest
107     "--skip=dim-utils/src/lib.rs"
108   ];
110   postInstall = ''
111     wrapProgram $out/bin/dim \
112       --prefix PATH : ${lib.makeBinPath [ ffmpeg ]}
113   '';
115   meta = {
116     homepage = "https://github.com/Dusk-Labs/dim";
117     description = "Self-hosted media manager";
118     license = lib.licenses.agpl3Only;
119     mainProgram = "dim";
120     maintainers = [ lib.maintainers.misterio77 ];
121     platforms = lib.platforms.unix;
122   };