nixpkgs/pkgs/by-name/tp/tpnote/package.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

64 lines
1.3 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, rustPlatform
, cmake
, pkg-config
, oniguruma
, darwin
, installShellFiles
, tpnote
, testers
}:
rustPlatform.buildRustPackage rec {
pname = "tpnote";
version = "1.24.8";
src = fetchFromGitHub {
owner = "getreu";
repo = "tp-note";
rev = "v${version}";
hash = "sha256-tn6GCBX3DrqyZZz2FJLTn1vJd4eEbawyJM5huco21/8=";
};
cargoHash = "sha256-2qGObTu7g6GbUwd4obgqufig7bABFLBsCWSyZt8AVac=";
nativeBuildInputs = [
cmake
pkg-config
installShellFiles
];
buildInputs = [
oniguruma
] ++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
AppKit
CoreServices
SystemConfiguration
]);
postInstall = ''
installManPage docs/build/man/man1/tpnote.1
'';
RUSTONIG_SYSTEM_LIBONIG = true;
passthru.tests.version = testers.testVersion { package = tpnote; };
# The `tpnote` crate has no unit tests. All tests are in `tpnote-lib`.
checkType = "debug";
cargoTestFlags = "--package tpnote-lib";
doCheck = true;
meta = {
changelog = "https://github.com/getreu/tp-note/releases/tag/v${version}";
description = "Markup enhanced granular note-taking";
homepage = "https://blog.getreu.net/projects/tp-note/";
license = lib.licenses.mit;
mainProgram = "tpnote";
maintainers = with lib.maintainers; [ getreu ];
};
}