Files
chiasson-nix/modules/wisdom/apps/spacedrive/package/default.nix
T
2026-05-15 00:24:13 -03:00

113 lines
2.7 KiB
Nix

{
lib,
stdenv,
fetchurl,
dpkg,
makeWrapper,
autoPatchelfHook,
wrapGAppsHook3,
adwaita-icon-theme,
ffmpeg,
gdk-pixbuf,
glib,
glib-networking,
gst_all_1,
gtk3,
hicolor-icon-theme,
libsoup_3,
webkitgtk_4_1,
xdotool,
}:
let
version = "2.0.0-alpha.2";
srcInfo =
if stdenv.hostPlatform.system == "x86_64-linux" then
{
url = "https://github.com/spacedriveapp/spacedrive/releases/download/v${version}/Spacedrive-linux-x86_64.deb";
hash = "sha256-KzRPBtyX5x4ZLlZd6SgAS/cy/7irXt7v+b3Yuq9GETo=";
}
else if stdenv.hostPlatform.system == "aarch64-linux" then
{
url = "https://github.com/spacedriveapp/spacedrive/releases/download/v${version}/Spacedrive-linux-aarch64.deb";
hash = "sha256-Arq4seJxd69XdraIaYJSv1p9g+Bz/7rez/l9EP6dc9k=";
}
else
throw "spacedrive ${version}: unsupported platform: ${stdenv.hostPlatform.system}";
in
stdenv.mkDerivation {
pname = "spacedrive";
inherit version;
src = fetchurl srcInfo;
nativeBuildInputs = [
dpkg
makeWrapper
autoPatchelfHook
wrapGAppsHook3
];
buildInputs = [
adwaita-icon-theme
ffmpeg
gdk-pixbuf
glib
glib-networking
gtk3
hicolor-icon-theme
libsoup_3
webkitgtk_4_1
xdotool
gst_all_1.gst-plugins-ugly
gst_all_1.gst-plugins-bad
gst_all_1.gst-plugins-base
gst_all_1.gstreamer
];
# WebKitGTK + TLS + icons; ffmpeg/ffprobe on PATH (alpha Linux builds omit bundled ffmpeg).
preFixup = ''
gappsWrapperArgs+=(
"--prefix" "PATH" ":" "${lib.makeBinPath [ ffmpeg ]}"
"--set-default" "WEBKIT_DISABLE_DMABUF_RENDERER" "1"
)
'';
postFixup = ''
# Core daemon is not GTK-linked; wrapGAppsHook3 skips it still needs ffmpeg for media paths.
wrapProgram $out/bin/sd-daemon --prefix PATH : "${lib.makeBinPath [ ffmpeg ]}"
'';
unpackPhase = "dpkg-deb -x $src source";
installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib,share}
cp -r source/usr/bin/* $out/bin/
cp -r source/usr/lib/* $out/lib/
cp -r source/usr/share/* $out/share/
ln -sf Spacedrive $out/bin/spacedrive
substituteInPlace $out/share/applications/Spacedrive.desktop \
--replace-fail 'Exec=Spacedrive' 'Exec=spacedrive'
runHook postInstall
'';
meta = with lib; {
description = "Local-first file manager and virtual distributed filesystem (v2 alpha)";
homepage = "https://spacedrive.com";
changelog = "https://github.com/spacedriveapp/spacedrive/releases/tag/v${version}";
license = licenses.agpl3Plus;
platforms = [
"x86_64-linux"
"aarch64-linux"
];
mainProgram = "spacedrive";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
};
}