nixpkgs/pkgs/servers/sozu/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

53 lines
1.2 KiB
Nix

{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, darwin
, protobuf
, nix-update-script
, testers
, sozu
}:
rustPlatform.buildRustPackage rec {
pname = "sozu";
version = "1.0.4";
src = fetchFromGitHub {
owner = "sozu-proxy";
repo = pname;
rev = version;
hash = "sha256-FiCKRYIbgxSXbnSv1nauCryUA2PB5uVUK1mhtxJECAA=";
};
cargoHash = "sha256-iP5lElqfO4btllVAel5010bgSRQFO/pxyfrj4PFAnJc=";
nativeBuildInputs = [ protobuf ];
buildInputs =
lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.Security;
doCheck = false;
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion {
package = sozu;
command = "sozu --version";
version = "${version}";
};
};
meta = with lib; {
description =
"Open Source HTTP Reverse Proxy built in Rust for Immutable Infrastructures";
homepage = "https://www.sozu.io";
changelog = "https://github.com/sozu-proxy/sozu/releases/tag/${version}";
license = licenses.agpl3Only;
maintainers = with maintainers; [ Br1ght0ne gaelreyrol ];
mainProgram = "sozu";
# error[E0432]: unresolved import `std::arch::x86_64`
broken = !stdenv.hostPlatform.isx86_64;
};
}