nixpkgs/pkgs/applications/misc/openbangla-keyboard/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

92 lines
2.2 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, cargo
, cmake
, pkg-config
, rustPlatform
, rustc
, wrapQtAppsHook
, fcitx5
, ibus
, qtbase
, zstd
, fetchpatch
, withFcitx5Support ? false
, withIbusSupport ? false
}:
stdenv.mkDerivation rec {
pname = "openbangla-keyboard";
version = "unstable-2023-07-21";
src = fetchFromGitHub {
owner = "openbangla";
repo = "openbangla-keyboard";
# no upstream release in 3 years
# fcitx5 support was added over a year after the last release
rev = "780bd40eed16116222faff044bfeb61a07af158f";
hash = "sha256-4CR4lgHB51UvS/RLc0AEfIKJ7dyTCOfDrQdGLf9de8E=";
fetchSubmodules = true;
};
patches = [
# prevents runtime crash when fcitx5-based IM attempts to look in /usr
(fetchpatch {
name = "use-CMAKE_INSTALL_PREFIX-for-loading-data.patch";
url = "https://github.com/OpenBangla/OpenBangla-Keyboard/commit/f402472780c29eaa6b4cc841a70289adf171462b.diff";
hash = "sha256-YahvtyOxe8F40Wfe+31C6fdmm197QN26/Q67oinOplk=";
})
];
nativeBuildInputs = [
cmake
pkg-config
cargo
rustc
rustPlatform.cargoSetupHook
wrapQtAppsHook
];
buildInputs = lib.optionals withFcitx5Support [
fcitx5
] ++ lib.optionals withIbusSupport [
ibus
] ++ [
qtbase
zstd
];
cargoDeps = rustPlatform.fetchCargoTarball {
inherit src;
postPatch = ''
cp ${./Cargo.lock} Cargo.lock
'';
sourceRoot = "${src.name}/${cargoRoot}";
hash = "sha256-XMleyP2h1aBhtjXhuGHyU0BN+tuL12CGoj+kLY5uye0=";
};
cmakeFlags = lib.optionals withFcitx5Support [
"-DENABLE_FCITX=YES"
] ++ lib.optionals withIbusSupport [
"-DENABLE_IBUS=YES"
];
cargoRoot = "src/engine/riti";
postPatch = ''
cp ${./Cargo.lock} ${cargoRoot}/Cargo.lock
'';
meta = {
isIbusEngine = withIbusSupport;
description = "OpenSource, Unicode compliant Bengali Input Method";
mainProgram = "openbangla-gui";
homepage = "https://openbangla.github.io/";
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ hqurve ];
platforms = lib.platforms.linux;
# never built on aarch64-linux since first introduction in nixpkgs
broken = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64;
};
}