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

79 lines
1.7 KiB
Nix

{ stdenv
, lib
, fetchFromGitLab
, buildPackages
, cargo
, gettext
, meson
, ninja
, pkg-config
, rustPlatform
, rustc
, wrapGAppsHook4
, appstream-glib
, desktop-file-utils
, glib
, gtk4
, gdk-pixbuf
, libadwaita
, Foundation
}:
stdenv.mkDerivation (finalAttrs: {
pname = "gnome-obfuscate";
version = "0.0.10";
src = fetchFromGitLab {
domain = "gitlab.gnome.org";
owner = "World";
repo = "Obfuscate";
rev = finalAttrs.version;
hash = "sha256-/Plvvn1tle8t/bsPcsamn5d81CqnyGCyGYPF6j6U5NI=";
};
cargoDeps = rustPlatform.fetchCargoTarball {
inherit (finalAttrs) src;
name = "${finalAttrs.pname}-${finalAttrs.version}";
hash = "sha256-9lrxK2psdIPGsOC6p8T+3AGPrX6PjrK9mFirdJqBSMM=";
};
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
# Set the location to gettext to ensure the nixpkgs one on Darwin instead of the vendored one.
# The vendored gettext does not build with clang 16.
GETTEXT_BIN_DIR = "${lib.getBin buildPackages.gettext}/bin";
GETTEXT_INCLUDE_DIR = "${lib.getDev gettext}/include";
GETTEXT_LIB_DIR = "${lib.getLib gettext}/lib";
};
nativeBuildInputs = [
gettext
meson
ninja
pkg-config
rustPlatform.cargoSetupHook
cargo
rustc
wrapGAppsHook4
appstream-glib
desktop-file-utils
];
buildInputs = [
glib
gtk4
gdk-pixbuf
libadwaita
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
Foundation
];
meta = with lib; {
description = "Censor private information";
homepage = "https://gitlab.gnome.org/World/obfuscate";
license = licenses.gpl3Plus;
platforms = platforms.all;
mainProgram = "obfuscate";
maintainers = with maintainers; [ fgaz ];
};
})