added avahi

This commit is contained in:
voidarclabs
2026-01-22 11:03:27 +00:00
parent 2387d4e04f
commit ea3a9df799
2 changed files with 62 additions and 55 deletions

View File

@@ -213,6 +213,7 @@
services.upower.enable = true; services.upower.enable = true;
services.openssh.enable = true; services.openssh.enable = true;
services.elephant.enable = true; services.elephant.enable = true;
services.avahi.enable = true;
# Fonts # Fonts
fonts.packages = with pkgs; [ fonts.packages = with pkgs; [

View File

@@ -8,6 +8,7 @@ let
modernLibs = with pkgs; [ modernLibs = with pkgs; [
alsa-lib alsa-lib
freetype freetype
avahi
libglvnd libglvnd
curl curl
SDL2 SDL2
@@ -25,7 +26,9 @@ let
appImageDeps = [ appImageDeps = [
pkgs.steam-run pkgs.steam-run
pkgs.stdenv.cc.cc.lib # Ensures the modern C++ runtime is available pkgs.stdenv.cc.cc.lib # Ensures the modern C++ runtime is available
] ++ modernLibs ++ pinnedCurlLibs; ]
++ modernLibs
++ pinnedCurlLibs;
chataigneDesktopItem = { chataigneDesktopItem = {
desktopName = "Chataigne"; desktopName = "Chataigne";
@@ -34,7 +37,10 @@ let
icon = "chataigne"; # The name of the icon file (without extension) icon = "chataigne"; # The name of the icon file (without extension)
genericName = "Creative Control Software"; genericName = "Creative Control Software";
comment = "Control and experiment with creative applications, hardware, and media."; comment = "Control and experiment with creative applications, hardware, and media.";
categories = [ "AudioVideo" "Development" ]; categories = [
"AudioVideo"
"Development"
];
}; };
in in
@@ -56,66 +62,66 @@ pkgs.stdenv.mkDerivation {
# The install phase creates an executable wrapper script, extracts the AppImage, # The install phase creates an executable wrapper script, extracts the AppImage,
# and now handles the desktop file and icon. # and now handles the desktop file and icon.
installPhase = '' installPhase = ''
mkdir -p $out/bin mkdir -p $out/bin
# --- STRATEGY: Extract AppImage contents to bypass FUSE, then fix LD_LIBRARY_PATH --- # --- STRATEGY: Extract AppImage contents to bypass FUSE, then fix LD_LIBRARY_PATH ---
echo "Extracting AppImage contents to bypass FUSE requirement..." echo "Extracting AppImage contents to bypass FUSE requirement..."
# Use the absolute Nix Store path of the AppImage # Use the absolute Nix Store path of the AppImage
${appImageSrc} --appimage-extract ${appImageSrc} --appimage-extract
echo "appimage extracted" echo "appimage extracted"
# 2. Check if extraction worked and move the content to $out # 2. Check if extraction worked and move the content to $out
if [ ! -d "squashfs-root" ]; then if [ ! -d "squashfs-root" ]; then
echo "Extraction failed. The AppImage may not support --appimage-extract." echo "Extraction failed. The AppImage may not support --appimage-extract."
exit 1 exit 1
fi fi
# 2. CRITICAL FIX: Manually create and install the .desktop file # 2. CRITICAL FIX: Manually create and install the .desktop file
mkdir -p $out/share/applications mkdir -p $out/share/applications
# pkgs.lib.makeDesktopItem takes the metadata and creates a small derivation # 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) # We copy the resulting .desktop file from that derivation's output path ($desktop_file_path)
local desktop_file_path="${pkgs.makeDesktopItem chataigneDesktopItem}" local desktop_file_path="${pkgs.makeDesktopItem chataigneDesktopItem}"
# The file is typically named $name.desktop inside the share/applications folder of the new derivation # 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/ cp $desktop_file_path/share/applications/chataigne.desktop $out/share/applications/
# Copy the extracted contents into the output directory # Copy the extracted contents into the output directory
cp -r squashfs-root $out/ cp -r squashfs-root $out/
# --- DESKTOP ENTRY & ICON (NEW) --- # --- DESKTOP ENTRY & ICON (NEW) ---
echo "Processing icon and desktop file..." echo "Processing icon and desktop file..."
# AppImages usually place the icon in squashfs-root/.DirIcon or similar # AppImages usually place the icon in squashfs-root/.DirIcon or similar
# We will assume it's in the root of the extracted content. # We will assume it's in the root of the extracted content.
local icon_source="$out/squashfs-root/.DirIcon" local icon_source="$out/squashfs-root/.DirIcon"
local icon_target="$out/share/icons/hicolor/128x128/apps/chataigne.png" # Standard location 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) # Use the icon if it exists (AppImages often use a .png or .svg)
if [ -f "$icon_source" ]; then if [ -f "$icon_source" ]; then
mkdir -p "$(dirname "$icon_target")" mkdir -p "$(dirname "$icon_target")"
cp "$icon_source" "$icon_target" cp "$icon_source" "$icon_target"
else else
echo "Warning: Could not find icon at $icon_source. Using default/no icon." echo "Warning: Could not find icon at $icon_source. Using default/no icon."
fi fi
# ---------------------------------- # ----------------------------------
# 3. Create the 'chataigne' executable wrapper # 3. Create the 'chataigne' executable wrapper
cat > $out/bin/chataigne << EOF cat > $out/bin/chataigne << EOF
#!${pkgs.stdenv.shell} #!${pkgs.stdenv.shell}
# The LD_LIBRARY_PATH is created using all dependencies (excluding the wrapper 'steam-run'). # The LD_LIBRARY_PATH is created using all dependencies (excluding the wrapper 'steam-run').
# This ensures the AppImage finds the pinned CURL library. # 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" 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. # Use steam-run to launch the main execution script inside the extracted folder.
exec ${pkgs.steam-run}/bin/steam-run "$out/squashfs-root/AppRun" "\$@" exec ${pkgs.steam-run}/bin/steam-run "$out/squashfs-root/AppRun" "\$@"
EOF EOF
chmod +x $out/bin/chataigne chmod +x $out/bin/chataigne
''; '';
meta = { meta = {
description = "Declarative runner for the Chataigne AppImage, providing necessary dependencies."; description = "Declarative runner for the Chataigne AppImage, providing necessary dependencies.";
homepage = "https://chataigne.io/"; # Example: Add the actual homepage homepage = "https://chataigne.io/"; # Example: Add the actual homepage