nixpkgs/pkgs/applications/backup/vorta/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

95 lines
2.2 KiB
Nix

{ lib
, python3Packages
, fetchFromGitHub
, wrapQtAppsHook
, borgbackup
, qtbase
, qtwayland
, stdenv
, makeFontsConf
}:
python3Packages.buildPythonApplication rec {
pname = "vorta";
version = "0.9.1";
pyproject = true;
src = fetchFromGitHub {
owner = "borgbase";
repo = "vorta";
rev = "v${version}";
hash = "sha256-wGlnldS2p92NAYAyRPqKjSneIlbdsOiJ0N42n/mMGFI=";
};
nativeBuildInputs = [
python3Packages.setuptools
wrapQtAppsHook
];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
qtwayland
];
propagatedBuildInputs = with python3Packages; [
peewee
pyqt6
psutil
secretstorage
setuptools
platformdirs
];
postPatch = ''
substituteInPlace src/vorta/assets/metadata/com.borgbase.Vorta.desktop \
--replace com.borgbase.Vorta "com.borgbase.Vorta-symbolic"
'';
postInstall = ''
install -Dm644 src/vorta/assets/metadata/com.borgbase.Vorta.desktop $out/share/applications/com.borgbase.Vorta.desktop
install -Dm644 src/vorta/assets/icons/icon.svg $out/share/pixmaps/com.borgbase.Vorta-symbolic.svg
'';
preFixup = ''
makeWrapperArgs+=(
"''${qtWrapperArgs[@]}"
--prefix PATH : ${lib.makeBinPath [ borgbackup ]}
)
'';
nativeCheckInputs = with python3Packages; [
pytest-qt
pytest-mock
pytestCheckHook
];
preCheck = let
fontsConf = makeFontsConf {
fontDirectories = [ ];
};
in ''
export HOME=$(mktemp -d)
export FONTCONFIG_FILE=${fontsConf};
# For tests/test_misc.py::test_autostart
mkdir -p $HOME/.config/autostart
export QT_PLUGIN_PATH="${qtbase}/${qtbase.qtPluginPrefix}"
export QT_QPA_PLATFORM=offscreen
'';
disabledTestPaths = [
# QObject::connect: No such signal QPlatformNativeInterface::systemTrayWindowChanged(QScreen*)
"tests/test_excludes.py"
"tests/integration"
"tests/unit"
];
meta = with lib; {
changelog = "https://github.com/borgbase/vorta/releases/tag/${src.rev}";
description = "Desktop Backup Client for Borg";
homepage = "https://vorta.borgbase.com/";
license = licenses.gpl3Only;
maintainers = with maintainers; [ ma27 ];
platforms = platforms.linux;
mainProgram = "vorta";
};
}