diff options
author | Yifei Sun <ysun@hey.com> | 2023-12-17 14:02:26 -0500 |
---|---|---|
committer | Yifei Sun <ysun@hey.com> | 2023-12-18 16:03:17 -0500 |
commit | 29cf4af1d58e2fb38840f60d51b930bea7a82cf6 (patch) | |
tree | 7589a75e20dec629489a30e370b0fdb587ead77d /pkgs/by-name/sp | |
parent | 2f1147402b4ad5846afb0ae0b4fadd4921562e7a (diff) | |
download | nixlib-29cf4af1d58e2fb38840f60d51b930bea7a82cf6.tar nixlib-29cf4af1d58e2fb38840f60d51b930bea7a82cf6.tar.gz nixlib-29cf4af1d58e2fb38840f60d51b930bea7a82cf6.tar.bz2 nixlib-29cf4af1d58e2fb38840f60d51b930bea7a82cf6.tar.lz nixlib-29cf4af1d58e2fb38840f60d51b930bea7a82cf6.tar.xz nixlib-29cf4af1d58e2fb38840f60d51b930bea7a82cf6.tar.zst nixlib-29cf4af1d58e2fb38840f60d51b930bea7a82cf6.zip |
spacedrive: add darwin
Co-authored-by: Mikael Fangel <34864484+MikaelFangel@users.noreply.github.com>
Diffstat (limited to 'pkgs/by-name/sp')
-rw-r--r-- | pkgs/by-name/sp/spacedrive/package.nix | 88 |
1 files changed, 63 insertions, 25 deletions
diff --git a/pkgs/by-name/sp/spacedrive/package.nix b/pkgs/by-name/sp/spacedrive/package.nix index 362b02043af7..bf281e372709 100644 --- a/pkgs/by-name/sp/spacedrive/package.nix +++ b/pkgs/by-name/sp/spacedrive/package.nix @@ -1,39 +1,77 @@ -{ lib, appimageTools, fetchurl, pkgs }: +{ lib +, pkgs +, stdenv +, fetchurl +, appimageTools +, undmg +, nix-update-script +}: let pname = "spacedrive"; version = "0.1.4"; src = fetchurl { - url = "https://github.com/spacedriveapp/spacedrive/releases/download/${version}/Spacedrive-linux-x86_64.AppImage"; - hash = "sha256-iBdW8iPuvztP0L5xLyVs7/K8yFe7kD7QwdTuKJLhB+c="; + aarch64-darwin = { + url = "https://github.com/spacedriveapp/spacedrive/releases/download/${version}/Spacedrive-darwin-aarch64.dmg"; + hash = "sha256-gKboB5W0vW6ssZHRRivqbVPE0d0FCUdiNCsP0rKKtNo="; + }; + x86_64-darwin = { + url = "https://github.com/spacedriveapp/spacedrive/releases/download/${version}/Spacedrive-darwin-x86_64.dmg"; + hash = "sha256-KD1hw6aDyqCsXLYM8WrOTI2AfFx7t++UWV7SaCmtypI="; + }; + x86_64-linux = { + url = "https://github.com/spacedriveapp/spacedrive/releases/download/${version}/Spacedrive-linux-x86_64.AppImage"; + hash = "sha256-iBdW8iPuvztP0L5xLyVs7/K8yFe7kD7QwdTuKJLhB+c="; + }; + }.${stdenv.system} or (throw "${pname}-${version}: ${stdenv.system} is unsupported."); + + meta = { + description = "An open source file manager, powered by a virtual distributed filesystem"; + homepage = "https://www.spacedrive.com"; + changelog = "https://github.com/spacedriveapp/spacedrive/releases/tag/${version}"; + platforms = [ "aarch64-darwin" "x86_64-darwin" "x86_64-linux" ]; + license = lib.licenses.agpl3Plus; + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; + maintainers = with lib.maintainers; [ heisfer mikaelfangel stepbrobd ]; + mainProgram = "spacedrive"; }; - appimageContents = appimageTools.extractType2 { inherit pname version src; }; -in appimageTools.wrapType2 { - inherit pname version src; + passthru.updateScript = nix-update-script { }; +in +if stdenv.isDarwin then stdenv.mkDerivation +{ + inherit pname version src meta passthru; - extraPkgs = pkgs: - (appimageTools.defaultFhsEnvArgs.multiPkgs pkgs) ++ [ pkgs.libthai ]; + sourceRoot = "Spacedrive.app"; - extraInstallCommands = '' - # Remove version from entrypoint - mv $out/bin/spacedrive-"${version}" $out/bin/spacedrive + nativeBuildInputs = [ undmg ]; - # Install .desktop files - install -Dm444 ${appimageContents}/spacedrive.desktop -t $out/share/applications - install -Dm444 ${appimageContents}/spacedrive.png -t $out/share/pixmaps - substituteInPlace $out/share/applications/spacedrive.desktop \ - --replace 'Exec=AppRun --no-sandbox %U' 'Exec=spacedrive' + installPhase = '' + mkdir -p "$out/Applications/Spacedrive.app" + cp -r . "$out/Applications/Spacedrive.app" + mkdir -p "$out/bin" + ln -s "$out/Applications/Spacedrive.app/Contents/MacOS/Spacedrive" "$out/bin/spacedrive" ''; +} +else appimageTools.wrapType2 { + inherit pname version src meta passthru; - meta = with lib; { - description = "An open source file manager, powered by a virtual distributed filesystem"; - homepage = "https://www.spacedrive.com/"; - platforms = [ "x86_64-linux" ]; - license = licenses.agpl3Plus; - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; - maintainers = with maintainers; [ mikaelfangel heisfer ]; - mainProgram = "spacedrive"; - }; + extraPkgs = pkgs: + (appimageTools.defaultFhsEnvArgs.multiPkgs pkgs) ++ [ pkgs.libthai ]; + + extraInstallCommands = + let + appimageContents = appimageTools.extractType2 { inherit pname version src; }; + in + '' + # Remove version from entrypoint + mv $out/bin/spacedrive-"${version}" $out/bin/spacedrive + + # Install .desktop files + install -Dm444 ${appimageContents}/spacedrive.desktop -t $out/share/applications + install -Dm444 ${appimageContents}/spacedrive.png -t $out/share/pixmaps + substituteInPlace $out/share/applications/spacedrive.desktop \ + --replace 'Exec=AppRun --no-sandbox %U' 'Exec=spacedrive' + ''; } |