From d3c740143881542d22672da937764eb9c39c4a95 Mon Sep 17 00:00:00 2001 From: Danilo Reyes Date: Sat, 25 May 2024 20:40:21 -0600 Subject: [PATCH] video download helper, fooyin, etc --- flake.lock | 17 ++++++ flake.nix | 14 +++-- gnome.nix | 6 +- hosts/workstation/configuration.nix | 19 ++++++- hosts/workstation/hardware-configuration.nix | 22 +++---- modules/apps/gaming.nix | 2 +- pkgs/fooyin/default.nix | 45 +++++++++++++++ pkgs/vdhcoapp/code.patch | 46 +++++++++++++++ pkgs/vdhcoapp/default.nix | 60 ++++++++++++++++++++ pkgs/vdhcoapp/filepicker.nix | 27 +++++++++ 10 files changed, 239 insertions(+), 19 deletions(-) create mode 100644 pkgs/fooyin/default.nix create mode 100644 pkgs/vdhcoapp/code.patch create mode 100644 pkgs/vdhcoapp/default.nix create mode 100644 pkgs/vdhcoapp/filepicker.nix diff --git a/flake.lock b/flake.lock index ce3ba0f..34afed2 100644 --- a/flake.lock +++ b/flake.lock @@ -37,6 +37,22 @@ "type": "github" } }, + "nixpkgs-master": { + "locked": { + "lastModified": 1715996989, + "narHash": "sha256-ObD9YSelkwCAylEXJHcNjrn3hLOfIVScB1tPz9zeDN8=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "63d3e5d82edf5a138e7d0872231cc23ed4e740fd", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "master", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1714253743, @@ -57,6 +73,7 @@ "inputs": { "home-manager": "home-manager", "nixpkgs": "nixpkgs", + "nixpkgs-master": "nixpkgs-master", "nixpkgs-unstable": "nixpkgs-unstable" } } diff --git a/flake.nix b/flake.nix index 7a88974..d9a13fb 100644 --- a/flake.nix +++ b/flake.nix @@ -4,11 +4,13 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-23.11"; nixpkgs-unstable.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + nixpkgs-master.url = "github:nixos/nixpkgs?ref=master"; home-manager.url = "github:nix-community/home-manager/release-23.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; }; - outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, ... }@inputs: + outputs = { self, nixpkgs, nixpkgs-unstable, nixpkgs-master, home-manager, ... + }@inputs: let inherit (self) outputs; lib = nixpkgs.lib // home-manager.lib; @@ -20,6 +22,7 @@ }; pkgs = makePkgs nixpkgs; pkgsU = makePkgs nixpkgs-unstable; + pkgsM = makePkgs nixpkgs-master; in { inherit lib pkgs; formatter = pkgs.alejandra; @@ -36,6 +39,7 @@ nautilus = gPrev.nautilus.overrideAttrs (nsuper: { buildInputs = nsuper.buildInputs ++ (with pkgs.gst_all_1; [ + gst-libav gst-plugins-good gst-plugins-bad gst-plugins-ugly @@ -52,9 +56,6 @@ }; }); }); - planify = pkgsU.planify; - gdtoolkit = pkgsU.gdtoolkit; - gallery-dl = pkgsU.gallery-dl; lutris = super.lutris.override { extraPkgs = pkgs: [ pkgs.winetricks @@ -65,6 +66,11 @@ nerdfonts = super.nerdfonts.override { fonts = [ "CascadiaCode" "ComicShannsMono" "Iosevka" ]; }; + fooyin = pkgsM.fooyin; + planify = pkgsU.planify; + gdtoolkit = pkgsU.gdtoolkit; + gallery-dl = pkgsU.gallery-dl; + ns-usbloader = pkgsU.ns-usbloader; handbrake = super.handbrake.override { useGtk = true; }; discord = super.discord.override { withOpenASAR = true; }; ripgrep = super.ripgrep.override { withPCRE2 = true; }; diff --git a/gnome.nix b/gnome.nix index 193f808..fc8086a 100644 --- a/gnome.nix +++ b/gnome.nix @@ -2,7 +2,6 @@ { services = { - tumbler.enable = true; gvfs.enable = true; xserver = { enable = true; @@ -26,7 +25,7 @@ # gnome-shell-extensions baobab ]) ++ (with pkgs.gnome; [ - totem + # totem gnome-music epiphany gnome-characters @@ -40,7 +39,8 @@ }; users.users.jawz.packages = with pkgs; ([ - adw-gtk3 + # ffmpegthumbnailer # generate thumbnails + adw-gtk3 # theme legacy applications gnome.gnome-tweaks # tweaks for the gnome desktop environment (papirus-icon-theme.override { color = "adwaita"; }) # gradience # theme customizer, allows you to modify adw-gtk3 themes diff --git a/hosts/workstation/configuration.nix b/hosts/workstation/configuration.nix index da665f4..feb5c89 100644 --- a/hosts/workstation/configuration.nix +++ b/hosts/workstation/configuration.nix @@ -4,6 +4,7 @@ let (builtins.fetchTarball "https://github.com/nixos/nixpkgs/tarball/master") { config = config.nixpkgs.config; }; + vdhcoapp = pkgs.callPackage ../../pkgs/vdhcoapp/default.nix { }; in { imports = [ # @@ -12,7 +13,10 @@ in { ../../gnome.nix ./obs-studio.nix ]; - programs.obs-studio = { enable = true; }; + programs.obs-studio = { + enable = true; + enableVirtualCamera = true; + }; my = { emacs.enable = true; apps = { @@ -99,6 +103,8 @@ in { groups.nixremote.gid = 555; users = { jawz.packages = (with pkgs; [ + fooyin + vdhcoapp gocryptfs # encrypted filesystem! shhh!!! torrenttools # create torrent files from the terminal! vcsi # video thumbnails for torrents, can I replace it with ^? @@ -150,4 +156,15 @@ in { httpListenAddr = "0.0.0.0"; directoryRoot = "/resilio"; }; + virtualisation = { + podman = { + enable = true; + + # Create a `docker` alias for podman, to use it as a drop-in replacement + dockerCompat = true; + + # Required for containers under podman-compose to be able to talk to each other. + defaultNetwork.settings.dns_enabled = true; + }; + }; } diff --git a/hosts/workstation/hardware-configuration.nix b/hosts/workstation/hardware-configuration.nix index 8e5c19e..e699e2c 100644 --- a/hosts/workstation/hardware-configuration.nix +++ b/hosts/workstation/hardware-configuration.nix @@ -48,10 +48,10 @@ device = "/dev/disk/by-uuid/e9618e85-a631-4374-b2a4-22c376d6e41b"; preLVM = true; }; - extraModulePackages = [ config.boot.kernelPackages.v4l2loopback ]; - extraModprobeConfig = '' - options v4l2loopback devices=1 video_nr=1 card_label="OBS Cam" exclusive_caps=1 - ''; + # extraModulePackages = [ config.boot.kernelPackages.v4l2loopback ]; + # extraModprobeConfig = '' + # options v4l2loopback devices=1 video_nr=1 card_label="OBS Cam" exclusive_caps=1 + # ''; initrd = { availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "nvme" "usb_storage" "sd_mod" ]; @@ -60,11 +60,11 @@ }; fileSystems = let - nfsMount = nfsDisk: { - device = "miniserver:/${nfsDisk}"; + nfsMount = (server: nfsDisk: { + device = "${server}:/${nfsDisk}"; fsType = "nfs"; options = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=600" ]; - }; + }); btrfsMount = subvol: { device = "/dev/mapper/nvme"; fsType = "btrfs"; @@ -82,9 +82,11 @@ "/" = btrfsMount "nixos" // { }; "/home" = btrfsMount "home" // { }; "/mnt/games" = btrfsMount "games" // { }; - "/mnt/pool" = nfsMount "pool" // { }; - "/mnt/jawz" = nfsMount "jawz" // { }; - # "/mnt/btrfs" = nfsMount "btrfs" // { }; + "/mnt/miniserver/pool" = nfsMount "miniserver" "pool" // { }; + "/mnt/miniserver/jawz" = nfsMount "miniserver" "jawz" // { }; + # "/mnt/server/pool" = nfsMount "server" "pool" // { }; + # "/mnt/server/jawz" = nfsMount "server" "jawz" // { }; + # "/mnt/miniserver/btrfs" = nfsMount "btrfs" // { }; "/boot" = { device = "/dev/disk/by-uuid/ac6d349a-96b9-499e-9009-229efd7743a5"; fsType = "ext4"; diff --git a/modules/apps/gaming.nix b/modules/apps/gaming.nix index bbe550f..95bb6df 100644 --- a/modules/apps/gaming.nix +++ b/modules/apps/gaming.nix @@ -19,7 +19,7 @@ protonup-qt # update proton-ge # grapejuice # roblox manager # minecraft # minecraft official launcher - # ns-usbloader # load games into my switch + ns-usbloader # load games into my switch # emulators rpcs3 # ps3 emulator diff --git a/pkgs/fooyin/default.nix b/pkgs/fooyin/default.nix new file mode 100644 index 0000000..f0edd31 --- /dev/null +++ b/pkgs/fooyin/default.nix @@ -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; + }; +}) diff --git a/pkgs/vdhcoapp/code.patch b/pkgs/vdhcoapp/code.patch new file mode 100644 index 0000000..68e8ab7 --- /dev/null +++ b/pkgs/vdhcoapp/code.patch @@ -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")) { diff --git a/pkgs/vdhcoapp/default.nix b/pkgs/vdhcoapp/default.nix new file mode 100644 index 0000000..27e4a19 --- /dev/null +++ b/pkgs/vdhcoapp/default.nix @@ -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"; + }; +} diff --git a/pkgs/vdhcoapp/filepicker.nix b/pkgs/vdhcoapp/filepicker.nix new file mode 100644 index 0000000..16ca495 --- /dev/null +++ b/pkgs/vdhcoapp/filepicker.nix @@ -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 ]; + }; +}