nixpkgs/pkgs/applications/networking/instant-messengers/quaternion/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

70 lines
1.5 KiB
Nix

{ stdenv
, lib
, fetchFromGitHub
, cmake
, wrapQtAppsHook
, qtbase
, qtquickcontrols2 ? null # only a separate package on qt5
, qtkeychain
, qtmultimedia
, qttools
, libquotient
, libsecret
, olm
}:
let
inherit (lib) cmakeBool;
in
stdenv.mkDerivation (finalAttrs: {
pname = "quaternion";
version = "0.0.96.1";
src = fetchFromGitHub {
owner = "quotient-im";
repo = "Quaternion";
rev = finalAttrs.version;
hash = "sha256-lRCSEb/ldVnEv6z0moU4P5rf0ssKb9Bw+4QEssLjuwI=";
};
buildInputs = [
libquotient
libsecret
olm
qtbase
qtkeychain
qtmultimedia
qtquickcontrols2
];
nativeBuildInputs = [ cmake qttools wrapQtAppsHook ];
# qt6 needs UTF
env.LANG = "C.UTF-8";
cmakeFlags = [
# drop this from 0.0.97 onwards as it will be qt6 only
(cmakeBool "BUILD_WITH_QT6" ((lib.versions.major qtbase.version) == "6"))
];
postInstall =
if stdenv.hostPlatform.isDarwin then ''
mkdir -p $out/Applications
mv $out/bin/quaternion.app $out/Applications
rmdir $out/bin || :
'' else ''
substituteInPlace $out/share/applications/com.github.quaternion.desktop \
--replace 'Exec=quaternion' "Exec=$out/bin/quaternion"
'';
meta = with lib; {
description = "Cross-platform desktop IM client for the Matrix protocol";
mainProgram = "quaternion";
homepage = "https://matrix.org/ecosystem/clients/quaternion/";
license = licenses.gpl3;
maintainers = with maintainers; [ peterhoeg ];
inherit (qtbase.meta) platforms;
};
})