nixpkgs/pkgs/applications/science/misc/rink/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

40 lines
1.0 KiB
Nix

{ lib, stdenv, fetchFromGitHub, rustPlatform, openssl, pkg-config, ncurses
, curl, installShellFiles, asciidoctor, libiconv, Security }:
rustPlatform.buildRustPackage rec {
version = "0.8.0";
pname = "rink";
src = fetchFromGitHub {
owner = "tiffany352";
repo = "rink-rs";
rev = "v${version}";
hash = "sha256-2+ZkyWhEnnO/QgCzWscbMr0u5kwdv2HqPLjtiXDfv/o=";
};
cargoHash = "sha256-j1pQfMjDNu57otOBTVBQEZIx80p4/beEUQdUkAJhvso=";
nativeBuildInputs = [ pkg-config installShellFiles asciidoctor ];
buildInputs = [ ncurses ]
++ (if stdenv.hostPlatform.isDarwin then [ curl libiconv Security ] else [ openssl ]);
# Some tests fail and/or attempt to use internet servers.
doCheck = false;
postBuild = ''
make man
'';
postInstall = ''
installManPage build/*
'';
meta = with lib; {
description = "Unit-aware calculator";
mainProgram = "rink";
homepage = "https://rinkcalc.app";
license = with licenses; [ mpl20 gpl3Plus ];
maintainers = with maintainers; [ sb0 Br1ght0ne ];
};
}