nixpkgs/pkgs/by-name/ag/agate/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

71 lines
1.7 KiB
Nix

{
lib,
stdenv,
nixosTests,
fetchFromGitHub,
rustPlatform,
libiconv,
darwin,
openssl,
pkg-config,
nix-update-script,
}:
rustPlatform.buildRustPackage rec {
pname = "agate";
version = "3.3.9";
src = fetchFromGitHub {
owner = "mbrubeck";
repo = "agate";
rev = "v${version}";
hash = "sha256-u+v9RydB6OIsq2zOSmTDuejneb2uNFhRXsVNlGcPABs=";
};
cargoHash = "sha256-oNI+UsxDdHSQGtl6vhxNWSiYVc8TV/vG8UoQX2w4ZoM=";
nativeBuildInputs = [ pkg-config ];
buildInputs =
[ openssl ]
++ lib.optionals stdenv.hostPlatform.isDarwin [
libiconv
darwin.apple_sdk.frameworks.Security
];
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
$out/bin/agate --help
$out/bin/agate --version 2>&1 | grep "agate ${version}"
runHook postInstallCheck
'';
__darwinAllowLocalNetworking = true;
passthru = {
tests = {
inherit (nixosTests) agate;
};
updateScript = nix-update-script { };
};
meta = {
homepage = "https://github.com/mbrubeck/agate";
changelog = "https://github.com/mbrubeck/agate/releases/tag/v${version}";
description = "Very simple server for the Gemini hypertext protocol";
mainProgram = "agate";
longDescription = ''
Agate is a server for the Gemini network protocol, built with the Rust
programming language. Agate has very few features, and can only serve
static files. It uses async I/O, and should be quite efficient even when
running on low-end hardware and serving many concurrent requests.
'';
license = with lib.licenses; [
asl20
mit
];
maintainers = with lib.maintainers; [ jk ];
};
}