nixpkgs/pkgs/tools/misc/clipboard-jh/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

69 lines
1.3 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, cmake
, libffi
, pkg-config
, wayland-protocols
, wayland-scanner
, wayland
, xorg
, darwin
, nix-update-script
, alsa-lib
}:
stdenv.mkDerivation rec {
pname = "clipboard-jh";
version = "0.9.0.1";
src = fetchFromGitHub {
owner = "Slackadays";
repo = "clipboard";
rev = version;
hash = "sha256-iILtyURYCshicgAV3MWkgMQsXHe7Unj1A08W7tUMU2o=";
};
postPatch = ''
sed -i "/CMAKE_OSX_ARCHITECTURES/d" CMakeLists.txt
'';
nativeBuildInputs = [
cmake
pkg-config
wayland-scanner
];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
libffi
wayland-protocols
wayland
xorg.libX11
alsa-lib
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.AppKit
];
cmakeBuildType = "MinSizeRel";
cmakeFlags = [
"-Wno-dev"
"-DINSTALL_PREFIX=${placeholder "out"}"
];
postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf $out/bin/cb --add-rpath $out/lib
'';
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "Cut, copy, and paste anything, anywhere, all from the terminal";
homepage = "https://github.com/Slackadays/clipboard";
license = licenses.gpl3Only;
maintainers = with maintainers; [ dit7ya ];
platforms = platforms.all;
mainProgram = "cb";
};
}