nixpkgs/pkgs/tools/networking/httplz/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

55 lines
1.2 KiB
Nix

{ lib
, rustPlatform
, fetchCrate
, installShellFiles
, makeWrapper
, pkg-config
, ronn
, openssl
, stdenv
, darwin
}:
rustPlatform.buildRustPackage rec {
pname = "httplz";
version = "1.13.2";
src = fetchCrate {
inherit version;
pname = "https";
hash = "sha256-uxEMgSrcxMZD/3GQuH9S/oYtMUPzgMR61ZzLcb65zXU=";
};
cargoHash = "sha256-8cH8QrnkfPF0Di7+Ns/P/8cFe0jej/v7m4fkkfTFdvs=";
nativeBuildInputs = [
installShellFiles
makeWrapper
pkg-config
ronn
];
buildInputs = [ openssl ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.Security
];
cargoBuildFlags = [ "--bin" "httplz" ];
postInstall = ''
sed -E 's/http(`| |\(|$)/httplz\1/g' http.md > httplz.1.ronn
RUBYOPT=-Eutf-8:utf-8 ronn --organization "http developers" -r httplz.1.ronn
installManPage httplz.1
wrapProgram $out/bin/httplz \
--prefix PATH : "${openssl}/bin"
'';
meta = with lib; {
description = "Basic http server for hosting a folder fast and simply";
mainProgram = "httplz";
homepage = "https://github.com/thecoshman/http";
changelog = "https://github.com/thecoshman/http/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [ figsoda ];
};
}