nixpkgs/pkgs/by-name/va/vale-ls/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

62 lines
1.4 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, rustPlatform
, pkg-config
, openssl
, darwin
, vale
}:
rustPlatform.buildRustPackage rec {
pname = "vale-ls";
version = "0.3.8";
src = fetchFromGitHub {
owner = "errata-ai";
repo = "vale-ls";
rev = "refs/tags/v${version}";
hash = "sha256-+2peLqj3/ny0hDwJVKEp2XS68VO50IvpCB2fvZoEdJo=";
};
nativeBuildInputs = [
rustPlatform.bindgenHook
pkg-config
makeWrapper
];
buildInputs = [
openssl
] ++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
SystemConfiguration
]);
checkFlags = [
# The following tests are reaching to the network.
"--skip=vale::tests"
] ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
# This test does not account for the existence of aarch64-linux machines,
# despite upstream shipping artifacts for that architecture
"--skip=utils::tests::arch"
];
env.OPENSSL_NO_VENDOR = true;
cargoHash = "sha256-YurMB54jeMQIAOgDQhXEYrkYUYrSl02M9JG5Wtp6Eb8=";
postInstall = ''
wrapProgram $out/bin/vale-ls \
--prefix PATH : ${lib.makeBinPath [ vale ]}
'';
meta = with lib; {
description = "LSP implementation for the Vale command-line tool";
homepage = "https://github.com/errata-ai/vale-ls";
license = licenses.mit;
mainProgram = "vale-ls";
maintainers = with maintainers; [ foo-dogsquared jansol ];
};
}