restructure
This commit is contained in:
BIN
modules/chataigne/Chataigne-linux-x64-bleedingedge.AppImage
Executable file
BIN
modules/chataigne/Chataigne-linux-x64-bleedingedge.AppImage
Executable file
Binary file not shown.
125
modules/chataigne/chataigne.nix
Normal file
125
modules/chataigne/chataigne.nix
Normal file
@@ -0,0 +1,125 @@
|
||||
{ pkgs, pinnedPkgs, ... }:
|
||||
|
||||
let
|
||||
# 1. Define the AppImage source.
|
||||
appImageSrc = ./Chataigne-linux-x64-bleedingedge.AppImage;
|
||||
|
||||
# 2a. Libraries pulled from the modern, current Nixpkgs (for small size).
|
||||
modernLibs = with pkgs; [
|
||||
alsa-lib
|
||||
freetype
|
||||
libglvnd
|
||||
curl
|
||||
SDL2
|
||||
hidapi
|
||||
xorg.libXrandr
|
||||
];
|
||||
|
||||
# 2b. Libraries pulled from the older, pinned package set (ONLY the ones that failed).
|
||||
pinnedCurlLibs = with pinnedPkgs; [
|
||||
curlWithGnuTls # This is the critical component for the CURL_GNUTLS_3 symbol.
|
||||
gnutls
|
||||
];
|
||||
|
||||
# 3. Combine the modern runtime dependencies with the pinned compatibility libraries.
|
||||
appImageDeps = [
|
||||
pkgs.steam-run
|
||||
pkgs.stdenv.cc.cc.lib # Ensures the modern C++ runtime is available
|
||||
] ++ modernLibs ++ pinnedCurlLibs;
|
||||
|
||||
chataigneDesktopItem = {
|
||||
desktopName = "Chataigne";
|
||||
name = "chataigne";
|
||||
exec = "chataigne"; # The name of the wrapper script in $out/bin
|
||||
icon = "chataigne"; # The name of the icon file (without extension)
|
||||
genericName = "Creative Control Software";
|
||||
comment = "Control and experiment with creative applications, hardware, and media.";
|
||||
categories = [ "AudioVideo" "Development" ];
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
# 4. Create the final runnable derivation
|
||||
pkgs.stdenv.mkDerivation {
|
||||
pname = "chataigne-runner";
|
||||
version = "1.0";
|
||||
|
||||
# --- Attributes needed for AppImage running (not compiling) ---
|
||||
src = ./.;
|
||||
dontUnpack = true;
|
||||
dontBuild = true;
|
||||
# --------------------------------------------------
|
||||
|
||||
# Inject the combined dependencies into the environment
|
||||
buildInputs = appImageDeps;
|
||||
|
||||
# The install phase creates an executable wrapper script, extracts the AppImage,
|
||||
# and now handles the desktop file and icon.
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
|
||||
# --- STRATEGY: Extract AppImage contents to bypass FUSE, then fix LD_LIBRARY_PATH ---
|
||||
echo "Extracting AppImage contents to bypass FUSE requirement..."
|
||||
|
||||
# Use the absolute Nix Store path of the AppImage
|
||||
${appImageSrc} --appimage-extract
|
||||
echo "appimage extracted"
|
||||
|
||||
# 2. Check if extraction worked and move the content to $out
|
||||
if [ ! -d "squashfs-root" ]; then
|
||||
echo "Extraction failed. The AppImage may not support --appimage-extract."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 2. CRITICAL FIX: Manually create and install the .desktop file
|
||||
mkdir -p $out/share/applications
|
||||
|
||||
# pkgs.lib.makeDesktopItem takes the metadata and creates a small derivation
|
||||
# We copy the resulting .desktop file from that derivation's output path ($desktop_file_path)
|
||||
local desktop_file_path="${pkgs.makeDesktopItem chataigneDesktopItem}"
|
||||
|
||||
# The file is typically named $name.desktop inside the share/applications folder of the new derivation
|
||||
cp $desktop_file_path/share/applications/chataigne.desktop $out/share/applications/
|
||||
|
||||
# Copy the extracted contents into the output directory
|
||||
cp -r squashfs-root $out/
|
||||
|
||||
# --- DESKTOP ENTRY & ICON (NEW) ---
|
||||
echo "Processing icon and desktop file..."
|
||||
|
||||
# AppImages usually place the icon in squashfs-root/.DirIcon or similar
|
||||
# We will assume it's in the root of the extracted content.
|
||||
local icon_source="$out/squashfs-root/.DirIcon"
|
||||
local icon_target="$out/share/icons/hicolor/128x128/apps/chataigne.png" # Standard location
|
||||
|
||||
# Use the icon if it exists (AppImages often use a .png or .svg)
|
||||
if [ -f "$icon_source" ]; then
|
||||
mkdir -p "$(dirname "$icon_target")"
|
||||
cp "$icon_source" "$icon_target"
|
||||
else
|
||||
echo "Warning: Could not find icon at $icon_source. Using default/no icon."
|
||||
fi
|
||||
# ----------------------------------
|
||||
|
||||
# 3. Create the 'chataigne' executable wrapper
|
||||
cat > $out/bin/chataigne << EOF
|
||||
#!${pkgs.stdenv.shell}
|
||||
|
||||
# The LD_LIBRARY_PATH is created using all dependencies (excluding the wrapper 'steam-run').
|
||||
# This ensures the AppImage finds the pinned CURL library.
|
||||
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath (pkgs.lib.remove pkgs.steam-run appImageDeps)}:$LD_LIBRARY_PATH"
|
||||
|
||||
# Use steam-run to launch the main execution script inside the extracted folder.
|
||||
exec ${pkgs.steam-run}/bin/steam-run "$out/squashfs-root/AppRun" "\$@"
|
||||
EOF
|
||||
|
||||
chmod +x $out/bin/chataigne
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Declarative runner for the Chataigne AppImage, providing necessary dependencies.";
|
||||
homepage = "https://chataigne.io/"; # Example: Add the actual homepage
|
||||
license = pkgs.lib.licenses.unfree; # AppImages are often proprietary/unfree
|
||||
platforms = [ "x86_64-linux" ];
|
||||
};
|
||||
}
|
||||
41
modules/chataigne/flake.nix
Normal file
41
modules/chataigne/flake.nix
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
description = "A flake for running the Chataigne AppImage with necessary patched dependencies.";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # Modern Nixpkgs
|
||||
|
||||
# Pinned Nixpkgs for compatibility (the commit that fixes the CURL_GNUTLS_3 issue)
|
||||
pinned-nixpkgs = {
|
||||
url = "github:NixOS/nixpkgs/5171d7b0a9fbaaf216c873622eb5115b6db97957";
|
||||
flake = false; # Treat as a tarball input, not a flake
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, pinned-nixpkgs, ... }:
|
||||
let
|
||||
# Supported systems
|
||||
supportedSystems = [ "x86_64-linux" ];
|
||||
|
||||
# The main package definition logic is imported as a function
|
||||
chataigne-appimage-runner = import ./chataigne.nix;
|
||||
|
||||
# Function to generate the package set for each system
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
|
||||
in
|
||||
{
|
||||
packages = forAllSystems (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; config.allowUnfree = true; };
|
||||
pinnedPkgs = import pinned-nixpkgs { inherit system; };
|
||||
in
|
||||
{
|
||||
chataigne = chataigne-appimage-runner {
|
||||
inherit pkgs pinnedPkgs;
|
||||
};
|
||||
|
||||
# Also expose the default package for convenience
|
||||
default = self.packages.${system}.chataigne;
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
194
modules/davinci/davinci.nix
Normal file
194
modules/davinci/davinci.nix
Normal file
@@ -0,0 +1,194 @@
|
||||
{ lib, pkgs, ... }:
|
||||
let
|
||||
# 1. Pin Nixpkgs to your specific commit
|
||||
pinnedPkgs =
|
||||
import
|
||||
(builtins.fetchTarball {
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/d457818da697aa7711ff3599be23ab8850573a46.tar.gz";
|
||||
# Replace this with the hash from the nix-prefetch-url command above
|
||||
sha256 = "11lf0nq7d4c5mgxiy0n9h8qdzvww6k0vmd5h1a75in6dnkry5l3z";
|
||||
})
|
||||
{
|
||||
inherit (pkgs) system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
ffmpeg-encoder-plugin = pinnedPkgs.stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "ffmpeg-encoder-plugin";
|
||||
version = "1.1.0";
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "EdvinNilsson";
|
||||
repo = "ffmpeg_encoder_plugin";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-orghLIzz9rUnUwka9C71Z2nj+qxHuggrKNlYjLKswQw=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
cmake
|
||||
ffmpeg-full
|
||||
];
|
||||
|
||||
buildInputs = with pkgs; [ ffmpeg ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
cp ffmpeg_encoder_plugin.dvcp $out/
|
||||
runHook postInstall
|
||||
'';
|
||||
});
|
||||
|
||||
davinci-resolve-studio-cracked =
|
||||
let
|
||||
davinci-patched = pinnedPkgs.davinci-resolve-studio.davinci.overrideAttrs (old: {
|
||||
# script based on https://www.reddit.com/r/LinuxCrackSupport/comments/1nfqhld/davinci_resolve_studio_202_fix_linux_crack_guide/
|
||||
#
|
||||
# Additionally, it will install ffmpeg_encoder_plugin to enable H264/5 & AV1 exports:
|
||||
# https://github.com/EdvinNilsson/ffmpeg_encoder_plugin
|
||||
#
|
||||
# Note: $out IS /opt/resolve
|
||||
postInstall = ''
|
||||
${old.postInstall or ""}
|
||||
${lib.getExe pkgs.perl} -pi -e 's/\x74\x11\xe8\x21\x23\x00\x00/\xeb\x11\xe8\x21\x23\x00\x00/g' $out/bin/resolve
|
||||
${lib.getExe pkgs.perl} -pi -e 's/\x03\x00\x89\x45\xFC\x83\x7D\xFC\x00\x74\x11\x48\x8B\x45\xC8\x8B/\x03\x00\x89\x45\xFC\x83\x7D\xFC\x00\xEB\x11\x48\x8B\x45\xC8\x8B/' $out/bin/resolve
|
||||
${lib.getExe pkgs.perl} -pi -e 's/\x74\x11\x48\x8B\x45\xC8\x8B\x55\xFC\x89\x50\x58\xB8\x00\x00\x00/\xEB\x11\x48\x8B\x45\xC8\x8B\x55\xFC\x89\x50\x58\xB8\x00\x00\x00/' $out/bin/resolve
|
||||
${lib.getExe pkgs.perl} -pi -e 's/\x41\xb6\x01\x84\xc0\x0f\x84\xb0\x00\x00\x00\x48\x85\xdb\x74\x08\x45\x31\xf6\xe9\xa3\x00\x00\x00/\x41\xb6\x00\x84\xc0\x0f\x84\xb0\x00\x00\x00\x48\x85\xdb\x74\x08\x45\x31\xf6\xe9\xa3\x00\x00\x00/' $out/bin/resolve
|
||||
touch $out/.license/blackmagic.lic
|
||||
echo -e "LICENSE blackmagic davinciresolvestudio 999999 permanent uncounted\n hostid=ANY issuer=CGP customer=CGP issued=28-dec-2023\n akey=0000-0000-0000-0000 _ck=00 sig=\"00\"" > $out/.license/blackmagic.lic
|
||||
mkdir -p $out/IOPlugins/ffmpeg_encoder_plugin.dvcp.bundle/Contents/Linux-x86-64/
|
||||
cp ${ffmpeg-encoder-plugin}/ffmpeg_encoder_plugin.dvcp $out/IOPlugins/ffmpeg_encoder_plugin.dvcp.bundle/Contents/Linux-x86-64/
|
||||
'';
|
||||
});
|
||||
in
|
||||
|
||||
# the following was copied from davinci's derivation from nixpkgs.
|
||||
# if davinci updates, this should be updated too
|
||||
# but remember to replace "davinci" with "davinci-patched"
|
||||
pinnedPkgs.buildFHSEnv {
|
||||
inherit (davinci-patched) pname version;
|
||||
|
||||
targetPkgs =
|
||||
pkgs:
|
||||
with pinnedPkgs;
|
||||
[
|
||||
alsa-lib
|
||||
aprutil
|
||||
bzip2
|
||||
dbus
|
||||
expat
|
||||
fontconfig
|
||||
freetype
|
||||
glib
|
||||
libGL
|
||||
libGLU
|
||||
libarchive
|
||||
libcap
|
||||
librsvg
|
||||
libtool
|
||||
libuuid
|
||||
libxcrypt # provides libcrypt.so.1
|
||||
libxkbcommon
|
||||
nspr
|
||||
ocl-icd
|
||||
opencl-headers
|
||||
python3
|
||||
python3.pkgs.numpy
|
||||
udev
|
||||
xdg-utils # xdg-open needed to open URLs
|
||||
xorg.libICE
|
||||
xorg.libSM
|
||||
xorg.libX11
|
||||
xorg.libXcomposite
|
||||
xorg.libXcursor
|
||||
xorg.libXdamage
|
||||
xorg.libXext
|
||||
xorg.libXfixes
|
||||
xorg.libXi
|
||||
xorg.libXinerama
|
||||
xorg.libXrandr
|
||||
xorg.libXrender
|
||||
xorg.libXt
|
||||
xorg.libXtst
|
||||
xorg.libXxf86vm
|
||||
xorg.libxcb
|
||||
xorg.xcbutil
|
||||
xorg.xcbutilimage
|
||||
xorg.xcbutilkeysyms
|
||||
xorg.xcbutilrenderutil
|
||||
xorg.xcbutilwm
|
||||
xorg.xkeyboardconfig
|
||||
zlib
|
||||
]
|
||||
++ [ davinci-patched ];
|
||||
|
||||
extraPreBwrapCmds = ''
|
||||
mkdir -p ~/.local/share/DaVinciResolve/Extras || exit 1
|
||||
'';
|
||||
|
||||
extraBwrapArgs = [
|
||||
''--bind "$HOME"/.local/share/DaVinciResolve/Extras ${davinci-patched}/Extras''
|
||||
];
|
||||
|
||||
runScript = "${lib.getExe pkgs.bash} ${pkgs.writeText "davinci-wrapper" ''
|
||||
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
|
||||
${davinci-patched}/bin/resolve
|
||||
''}";
|
||||
|
||||
extraInstallCommands = ''
|
||||
mkdir -p $out/share/applications $out/share/icons/hicolor/128x128/apps
|
||||
ln -s ${davinci-patched}/share/applications/*.desktop $out/share/applications/
|
||||
ln -s ${davinci-patched}/graphics/DV_Resolve.png $out/share/icons/hicolor/128x128/apps/davinci-resolve-studio.png
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit davinci-patched;
|
||||
updateScript = lib.getExe (
|
||||
pkgs.writeShellApplication {
|
||||
name = "update-davinci-resolve";
|
||||
runtimeInputs = [
|
||||
pkgs.curl
|
||||
pkgs.jq
|
||||
pkgs.common-updater-scripts
|
||||
];
|
||||
text = ''
|
||||
set -o errexit
|
||||
drv=pkgs/by-name/da/davinci-resolve/package.nix
|
||||
currentVersion=${lib.escapeShellArg davinci-patched.version}
|
||||
downloadsJSON="$(curl --fail --silent https://www.blackmagicdesign.com/api/support/us/downloads.json)"
|
||||
latestLinuxVersion="$(echo "$downloadsJSON" | jq '[.downloads[] | select(.urls.Linux) | .urls.Linux[] | select(.downloadTitle | test("DaVinci Resolve")) | .downloadTitle]' | grep -oP 'DaVinci Resolve \K\d+\.\d+(\.\d+)?' | sort | tail -n 1)"
|
||||
update-source-version davinci-resolve "$latestLinuxVersion" --source-key=davinci.src
|
||||
# Since the standard and studio both use the same version we need to reset it before updating studio
|
||||
sed -i -e "s/""$latestLinuxVersion""/""$currentVersion""/" "$drv"
|
||||
latestStudioLinuxVersion="$(echo "$downloadsJSON" | jq '[.downloads[] | select(.urls.Linux) | .urls.Linux[] | select(.downloadTitle | test("DaVinci Resolve")) | .downloadTitle]' | grep -oP 'DaVinci Resolve Studio \K\d+\.\d+(\.\d+)?' | sort | tail -n 1)"
|
||||
update-source-version davinci-resolve-studio "$latestStudioLinuxVersion" --source-key=davinci.src
|
||||
'';
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [ davinci-resolve-studio-cracked ];
|
||||
|
||||
# following configuration was taken from
|
||||
# https://wiki.nixos.org/wiki/DaVinci_Resolve#AMD
|
||||
#
|
||||
# Tested and working with AMD cards.
|
||||
# I don't know any configurations for Nvidia cards!
|
||||
environment.variables = {
|
||||
RUSTICL_ENABLE = "radeonsi";
|
||||
};
|
||||
hardware = {
|
||||
# this option sets hardware.graphics.enable to true
|
||||
# and installs rocmPackages.clr/.icd
|
||||
amdgpu.opencl.enable = true;
|
||||
graphics.extraPackages = with pkgs; [
|
||||
# Enables Rusticl (OpenCL) support
|
||||
# Without this, videos won't load in davinci
|
||||
mesa.opencl
|
||||
];
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user