fixed the hang due to alsa device weirdness

This commit is contained in:
2026-09-25 15:12:34 +01:00
parent c9859df9bd
commit 0eaed342d8
2 changed files with 119 additions and 133 deletions

6
flake.lock generated
View File

@@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1782233679,
"narHash": "sha256-QyuGP5+QOtmXpy4i2X4DhBVBaySBdDKQEhqKcphcp34=",
"lastModified": 1790113641,
"narHash": "sha256-D2aaQetafdpHxbwA4ldAxs51UX0b11pXL+JL/5L8VrM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "667d5cf1c59585031d743c78b394b0a647537c35",
"rev": "1bc55b9def8165e82073919945c3239903fe4dc2",
"type": "github"
},
"original": {

View File

@@ -2,43 +2,29 @@
description = "A flake for DaVinci Resolve Studio with FFmpeg encoder plugin and patches";
inputs = {
# Main nixpkgs input (NixOS 26.05)
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
# Pinned nixpkgs input exclusively for the raw DaVinci Resolve Studio binary
nixpkgs-pinned.url = "github:NixOS/nixpkgs/e4ec59bc1152b09a4843702e4a49381194f065a2";
# Custom mesa input
# mesa-davinci.url = "github:nixos/nixpkgs?ref=599ddd2b79331c1e6153e1659bdaab65d62c4c82";
};
outputs =
{
outputs = {
self,
nixpkgs,
nixpkgs-pinned,
# mesa-davinci,
...
}@inputs:
let
}: let
system = "x86_64-linux";
lib = nixpkgs.lib;
# Import main pkgs (NixOS 26.05)
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
# Import pinned pkgs (Used *only* to fetch the unpatched binary)
pkgs-pinned = import nixpkgs-pinned {
inherit system;
config.allowUnfree = true;
};
# mesa-good-pkg = mesa-davinci.legacyPackages.${system}.mesa;
# Built using NixOS 26.05
ffmpeg-encoder-plugin = pkgs.stdenv.mkDerivation (finalAttrs: {
pname = "ffmpeg-encoder-plugin";
version = "1.2.1";
@@ -59,11 +45,9 @@
'';
});
davinci-resolve-studio-cracked =
let
davinci-patched =
let
# ONLY this specific line touches the pinned repository
davinci-resolve-studio-cracked = let
davinci-patched = let
# Should prevent useless rebuilds of the actual binary
davinci-locked = pkgs-pinned.davinci-resolve-studio;
in
davinci-locked.davinci.overrideAttrs (old: {
@@ -82,13 +66,18 @@
cp ${ffmpeg-encoder-plugin}/ffmpeg_encoder_plugin.dvcp $out/IOPlugins/ffmpeg_encoder_plugin.dvcp.bundle/Contents/Linux-x86-64/
'';
});
# Make Davinci use the generic alsa device so it doesn't hang when there isn't one available
davinciAlsaConfig = pkgs.writeText "davinci-alsa.conf" ''
pcm.!default {
type plug
slave.pcm "hw:CARD=Generic,DEV=0"
}
'';
in
# Sandbox framework evaluated entirely against NixOS 26.05
pkgs.buildFHSEnv {
inherit (davinci-patched) pname version;
targetPkgs =
inner-pkgs:
targetPkgs = inner-pkgs:
with inner-pkgs;
[
alsa-lib
@@ -151,17 +140,15 @@
'';
extraBwrapArgs = [
# 1. Mount the Extras folder cleanly to the user's home directory
''--bind "$HOME"/.local/share/DaVinciResolve/Extras /Extras''
# 2. Let bubblewrap safely create the required bundle subdirectory inside the existing structure
"--dir /IOPlugins/ffmpeg_encoder_plugin.dvcp.bundle/Contents/Linux-x86-64"
# 3. Mount the built plugin file directly into its bundle location
"--ro-bind ${ffmpeg-encoder-plugin}/ffmpeg_encoder_plugin.dvcp /IOPlugins/ffmpeg_encoder_plugin.dvcp.bundle/Contents/Linux-x86-64/ffmpeg_encoder_plugin.dvcp"
];
runScript = "${lib.getExe pkgs.bash} ${pkgs.writeText "davinci-wrapper" ''
export ALSA_CONFIG_PATH="${davinciAlsaConfig}"
export QT_XKB_CONFIG_ROOT="${pkgs.xkeyboard_config}/share/X11/xkb"
export QT_PLUGIN_PATH="${davinci-patched}/libs/plugins:$QT_PLUGIN_PATH"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/lib32:${davinci-patched}/libs
@@ -204,8 +191,7 @@
);
};
};
in
{
in {
packages.${system} = {
davinci-resolve-studio-cracked = davinci-resolve-studio-cracked;
default = davinci-resolve-studio-cracked;