video download helper, fooyin, etc

This commit is contained in:
2024-05-25 20:40:21 -06:00
parent f71472a1ff
commit d3c7401438
10 changed files with 239 additions and 19 deletions

45
pkgs/fooyin/default.nix Normal file
View File

@@ -0,0 +1,45 @@
{ stdenv, lib, fetchFromGitHub, cmake, pkg-config, alsa-lib, ffmpeg, kdePackages
, kdsingleapplication, openssl, pipewire, taglib, zlib }:
stdenv.mkDerivation (finalAttrs: {
pname = "fooyin";
version = "0.4.2";
src = fetchFromGitHub {
owner = "ludouzi";
repo = "fooyin";
rev = "v" + finalAttrs.version;
hash = "sha256-1U7eqXVcp0lO/X92oNQ3mWdozgJ1eroQPojscSWH6+I=";
};
buildInputs = [
alsa-lib
ffmpeg
kdsingleapplication
pipewire
kdePackages.qcoro
kdePackages.qtbase
kdePackages.qtsvg
taglib
];
nativeBuildInputs =
[ cmake pkg-config kdePackages.qttools kdePackages.wrapQtAppsHook ];
cmakeFlags = [
(lib.cmakeBool "BUILD_TESTING" (finalAttrs.doCheck or false))
# we need INSTALL_FHS to be true as the various artifacts are otherwise just dumped in the root
# of $out and the fixupPhase cleans things up anyway
(lib.cmakeBool "INSTALL_FHS" true)
];
env.LANG = "C.UTF-8";
meta = with lib; {
description = "A customisable music player";
mainProgram = "fooyin";
license = licenses.gpl3Only;
maintainers = with maintainers; [ peterhoeg ];
platforms = platforms.all;
};
})

46
pkgs/vdhcoapp/code.patch Normal file
View File

@@ -0,0 +1,46 @@
diff --git a/src/converter.js b/src/converter.js
index af7b4c3..20da407 100644
--- a/src/converter.js
+++ b/src/converter.js
@@ -1,4 +1,4 @@
-import open from 'open';
+function open() {}
const os = require("os");
const path = require('path');
@@ -9,9 +9,9 @@ const rpc = require('./weh-rpc');
const exec_dir = path.dirname(process.execPath);
-const ffmpeg = findExecutableFullPath("ffmpeg", exec_dir);
-const ffprobe = findExecutableFullPath("ffprobe", exec_dir);
-const filepicker = findExecutableFullPath("filepicker", exec_dir);
+const ffmpeg = "@ffmpeg@/bin/ffmpeg";
+const ffprobe = "@ffmpeg@/bin/ffprobe";
+const filepicker = "@filepicker@";
if (!fileExistsSync(ffmpeg)) {
logger.error("ffmpeg not found. Install ffmpeg and make sure it's in your path.");
diff --git a/src/main.js b/src/main.js
index 47b92de..e2e9402 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,4 +1,4 @@
-const config = require('config.json');
+const config = require('./config.json');
const converter = require('./converter');
const os = require("os");
diff --git a/src/native-autoinstall.js b/src/native-autoinstall.js
index 556a22b..c729568 100644
--- a/src/native-autoinstall.js
+++ b/src/native-autoinstall.js
@@ -1,7 +1,7 @@
const os = require("os");
const path = require("path");
const { spawn, exec } = require('child_process');
-const config = require('config.json');
+const config = require('./config.json');
let fs;
if (process.versions.node.startsWith("10")) {

60
pkgs/vdhcoapp/default.nix Normal file
View File

@@ -0,0 +1,60 @@
{ lib, fetchFromGitHub, buildNpmPackage, toml2json, nodejs, ffmpeg
, substituteAll, makeWrapper, callPackage }:
# This is an adaptation with buildNpmPackage based on https://github.com/milahu/nur-packages/commit/3022ffb3619182ffcd579194e1202e3978e4d55b
let filepicker = callPackage ./filepicker.nix { };
in buildNpmPackage rec {
pname = "vdhcoapp";
version = "2.0.19";
src = fetchFromGitHub {
owner = "aclap-dev";
repo = "vdhcoapp";
rev = "v${version}";
hash = "sha256-8xeZvqpRq71aShVogiwlVD3gQoPGseNOmz5E3KbsZxU=";
};
sourceRoot = "${src.name}/app";
npmDepsHash = "sha256-E032U2XZdyTER6ROkBosOTn7bweDXHl8voC3BQEz8Wg=";
dontNpmBuild = true;
nativeBuildInputs = [ toml2json makeWrapper ];
patches = [
(substituteAll {
src = ./code.patch;
inherit ffmpeg;
filepicker = lib.getExe filepicker;
})
];
postPatch = ''
# Cannot use patch, setting placeholder here
substituteInPlace src/native-autoinstall.js \
--replace process.execPath "\"${placeholder "out"}/bin/vdhcoapp\""
'';
preBuild = ''
toml2json --pretty ../config.toml > src/config.json
'';
installPhase = ''
mkdir -p $out/opt/vdhcoapp
cp -r . "$out/opt/vdhcoapp"
makeWrapper ${nodejs}/bin/node $out/bin/vdhcoapp \
--add-flags $out/opt/vdhcoapp/src/main.js
'';
meta = with lib; {
description =
"Companion application for the Video DownloadHelper browser add-on";
homepage = "https://www.downloadhelper.net/";
license = licenses.gpl2;
maintainers = with maintainers; [ wolfangaukang ];
mainProgram = "vdhcoapp";
};
}

View File

@@ -0,0 +1,27 @@
{ lib, rustPlatform, fetchFromGitHub, pkg-config, atk, gtk3, glib }:
rustPlatform.buildRustPackage rec {
pname = "filepicker";
version = "1.0.1";
src = fetchFromGitHub {
owner = "paulrouget";
repo = "static-filepicker";
rev = "v${version}";
hash = "sha256-7sRzf3SA9RSBf4O36olXgka8c6Bufdb0qsuTofVe55s=";
};
cargoHash = "sha256-aal7ppFkCpNc+QTS4Qklsb9WfJ65QqG6p1eOskiX+/Q=";
buildInputs = [ atk gtk3 glib ];
nativeBuildInputs = [ pkg-config ];
meta = with lib; {
description = "File picker used by VDHCoApp";
homepage = "https://github.com/paulrouget/static-filepicker";
license = licenses.gpl2;
mainProgram = "filepicker";
maintainers = with maintainers; [ hannesgith ];
};
}