This was written by @dzervas, and shared on our Discord. Update the package to the current version (careful that versions 1.4 and higher require Rust 1.90 which is not yet supported by nixpkgs. See update PR).
{ lib,
stdenv,
fetchurl,
dpkg,
wrapGAppsHook4,
dbus,
zlib,
fontconfig,
openssl,
webkitgtk_4_1,
gtk3,
pango,
cairo,
gdk-pixbuf,
libsoup_3,
glib,
glib-networking,
gcc,
pkg-config,
}:
stdenv.mkDerivation rec {
pname = "atuin-desktop";
version = "0.1.0";
src = fetchurl {
url = "https://github.com/atuinsh/desktop/releases/download/v${version}/Atuin_Desktop_${version}_amd64.deb";
sha256 = "sha256-P7FjtavGq2jpoMO8GYNejlDDKN+gIfAjdgjLkF4ZjRg=";
};
nativeBuildInputs = [
dpkg
wrapGAppsHook4
pkg-config
];
buildInputs = [
# System libraries
dbus
zlib
fontconfig
# GTK and related libraries
webkitgtk_4_1
gtk3
pango
cairo
gdk-pixbuf
# Network and utility libraries
libsoup_3
# GLib libraries
glib
glib-networking
# Runtime dependencies
gcc.cc.lib # For libgcc_s.so.1
openssl
];
unpackPhase = ''
dpkg-deb -x $src .
'';
installPhase = ''
mkdir -p $out
cp -r usr/* $out/ || true
# Ensure desktop files exist and are properly configured
if [ -d $out/share/applications ]; then
for desktop in $out/share/applications/*.desktop; do
if [ -f "$desktop" ]; then
substituteInPlace "$desktop" \
--replace "Exec=/usr/bin/" "Exec=$out/bin/"
fi
done
fi
'';
preFixup = ''
gappsWrapperArgs+=(
# Ensure the binary can find all required libraries
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs}
)
'';
postFixup = ''
echo "=== Debugging binary ==="
if [ -f "$out/bin/atuin-desktop" ]; then
echo "Binary exists"
file "$out/bin/atuin-desktop"
ldd "$out/bin/atuin-desktop" || echo "ldd failed"
readelf -l "$out/bin/atuin-desktop" | grep interpreter || echo "No interpreter found"
else
echo "Binary not found, listing contents:"
find "$out" -name "*atuin*" -type f
fi
echo "=== End debugging ==="
find $out/bin -type f -executable | while read -r bin; do
echo "Patching binary: $bin"
# Check if it's an ELF binary
if file "$bin" | grep -q "ELF"; then
echo " Setting interpreter..."
patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} "$bin" || echo " Failed to set interpreter"
echo " Setting rpath..."
patchelf --set-rpath ${lib.makeLibraryPath buildInputs} "$bin" || echo " Failed to set rpath"
echo " Shrinking rpath..."
patchelf --shrink-rpath "$bin" || echo " Failed to shrink rpath"
fi
done
'';
meta = with lib; {
description = "Atuin Desktop";
homepage = "https://atuin.sh";
license = licenses.asl20;
maintainers = [];
platforms = ["x86_64-linux"];
};
}
THANK YOU! I just asked Ellie on Mastodon about this and, while I am not shocked someone already did this, I was almost expecting to do it myself. EITHER WAY, so happy.
Yes please! I’m a NixOS user, and very excited to try desktop. But I definitely shouldn’t be trusted to figure this one out.
A recommended starting point would be greatly appreciated. Is the code in the original post still valid? What download url should I use from the github release?
Hey. For now, just use the derivation from above, and include the package in your packages list. As source, it downloads the deb package from releases on GitHub. I am trying to make compiling from source work, but there are still some issues to solve.
Hey, Ellie. I am trying to make Atuin Desktop compile from source. In the meantime, as a quick and dirty fix, I modified the original post with a working derivation for Atuin Desktop utilizing the existing .deb package from GitHub releases (filling in the previously empty `src = FILL ME IN` link). When the compilation from source works, we can package this derivation upstream in nixpkgs, so that everyone using Nix can run Atuin Desktop without having to fiddle with these derivations themselves.
That’s awesome, thank you so much! I don’t use nix so won’t be able to help there, but lmk if you are facing any weird compilation issues you think I can help with
If you find something I did wrong or need to change, let me know. I was able to build the package just fine and run it. I did notice an issue with the “Window” tab but I need to validate that its not a linux version issue, a missing dependency in the package, or something else.
@dzervas Just pinging you since you did all the hard work. I would love to have you as a fellow maintainer but you absolutely don’t have to. I am using this as a way to learn nix outside of nixos and flakes. Even if you do not want to maintain, I’d love for some help or guidance if I run into issues. No expectations. Thank you for getting this together!