Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a0943687d2a5094a6d92f25a4b6e16a76b5b7
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

128 lines
2.8 KiB
Nix

{
stdenv,
lib,
writeScript,
qt5,
fetchurl,
autoPatchelfHook,
dpkg,
glibc,
cpio,
xar,
undmg,
gtk3,
pango,
libxcb,
}:
let
pname = "synology-drive-client";
baseUrl = "https://global.synologydownload.com/download/Utility/SynologyDriveClient";
version = "3.5.1-16101";
buildNumber = lib.last (lib.splitString "-" version);
meta = with lib; {
description = "Desktop application to synchronize files and folders between the computer and the Synology Drive server";
homepage = "https://www.synology.com/en-global/dsm/feature/drive";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
maintainers = with maintainers; [
jcouyang
MoritzBoehme
];
platforms = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
mainProgram = "synology-drive";
};
passthru.updateScript = writeScript "update-synology-drive-client" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl common-updater-scripts
set -eu -o pipefail
version="$(curl -s https://www.synology.com/en-uk/releaseNote/SynologyDriveClient \
| grep -oP '(?<=data-version=")(\d.){2}\d-\d{5}' \
| head -1)"
update-source-version synology-drive-client "$version"
'';
linux = stdenv.mkDerivation {
inherit
pname
version
meta
passthru
;
src = fetchurl {
url = "${baseUrl}/${version}/Ubuntu/Installer/synology-drive-client-${buildNumber}.x86_64.deb";
sha256 = "sha256-VeS5bPcMM4JDCSH5GXkl4OgQjrPKaNDh5PfX28/zqaU=";
};
nativeBuildInputs = [
qt5.wrapQtAppsHook
autoPatchelfHook
dpkg
];
buildInputs = [
glibc
gtk3
pango
libxcb
];
unpackPhase = ''
mkdir -p $out
dpkg -x $src $out
rm -rf $out/usr/lib/nautilus
rm -rf $out/opt/Synology/SynologyDrive/package/cloudstation/icon-overlay
'';
installPhase = ''
cp -av $out/usr/* $out
rm -rf $out/usr
runHook postInstall
'';
postInstall = ''
substituteInPlace $out/bin/synology-drive --replace /opt $out/opt
'';
};
darwin = stdenv.mkDerivation {
inherit
pname
version
meta
passthru
;
src = fetchurl {
url = "${baseUrl}/${version}/Mac/Installer/synology-drive-client-${buildNumber}.dmg";
sha256 = "sha256-VyhROpQCeVHNxxYgPUZdAlng15aJ1/IYadz30FThlsw=";
};
nativeBuildInputs = [
cpio
xar
undmg
];
postUnpack = ''
xar -xf 'Install Synology Drive Client.pkg'
cd synology-drive.installer.pkg
gunzip -dc Payload | cpio -i
'';
sourceRoot = ".";
installPhase = ''
mkdir -p $out/Applications/
cp -R 'Synology Drive Client.app' $out/Applications/
'';
};
in
if stdenv.hostPlatform.isDarwin then darwin else linux