nixpkgs/pkgs/applications/graphics/epick/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

62 lines
1.5 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitHub
, stdenv
, pkg-config
, expat
, fontconfig
, freetype
, libGL
, xorg
, AppKit
}:
rustPlatform.buildRustPackage rec {
pname = "epick";
version = "0.9.0";
src = fetchFromGitHub {
owner = "vv9k";
repo = pname;
rev = version;
sha256 = "sha256-k0WQu1n1sAHVor58jr060vD5/2rDrt1k5zzJlrK9WrU=";
};
cargoHash = "sha256-OQZPOiMTpoWabxHa3TJG8L3zq8WxMeFttw8xggSXsMA=";
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [
pkg-config
];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
expat
fontconfig
freetype
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
AppKit
];
postInstall = ''
install -Dm444 assets/epick.desktop -t $out/share/applications
install -Dm444 assets/icon.svg $out/share/icons/hicolor/scalable/apps/epick.svg
install -Dm444 assets/icon.png $out/share/icons/hicolor/48x48/apps/epick.png
'';
postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf $out/bin/epick --add-rpath ${lib.makeLibraryPath [ libGL ]}
'';
meta = with lib; {
description = "Simple color picker that lets the user create harmonic palettes with ease";
homepage = "https://github.com/vv9k/epick";
changelog = "https://github.com/vv9k/epick/blob/${version}/CHANGELOG.md";
license = licenses.gpl3Only;
maintainers = with maintainers; [ figsoda ];
mainProgram = "epick";
};
}