1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 03:30:45 +00:00
nixpkgs/pkgs/servers/roapi/http.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

56 lines
1.5 KiB
Nix

{ stdenv
, lib
, fetchurl
}:
let
pname = "roapi-http";
version = "0.6.0";
target = lib.optionalString stdenv.hostPlatform.isDarwin "apple-darwin";
in
# TODO build from source, currently compilation fails on darwin on snmalloc with
# ./mem/../ds/../pal/pal_apple.h:277:64: error: use of undeclared identifier 'kCCSuccess'
# reinterpret_cast<void*>(&result), sizeof(result)) != kCCSuccess)
#
# rustPlatform.buildRustPackage {
# pname = "roapi-http";
# inherit version;
# src = fetchFromGitHub {
# owner = "roapi";
# repo = "roapi";
# rev = "roapi-http-v${version}";
# sha256 = "sha256-qHAO3h+TTCQQ7vdd4CoXVGfKZ1fIxTWKqbUNnRsJaok=";
# };
# cargoHash = "sha256-qDJKC6MXeKerPFwJsNND3WkziFtGkTvCgVEsdPbBGAo=";
# buildAndTestSubdir = "roapi-http";
# nativeBuildInputs = [ cmake ];
stdenv.mkDerivation rec {
inherit pname version;
src = fetchurl {
url = "https://github.com/roapi/roapi/releases/download/${pname}-v${version}/${pname}-${target}.tar.gz";
sha256 = "sha256-lv6BHg/LkrOlyq8D1udAYW8/AbZRb344YCcVnwo3ZHk=";
};
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
installPhase = ''
tar xvzf $src
mkdir -p "$out/bin"
cp roapi-http $out/bin
'';
meta = with lib; {
description = "Create full-fledged APIs for static datasets without writing a single line of code.";
homepage = "https://roapi.github.io/docs/";
license = licenses.asl20;
maintainers = with maintainers; [ happysalada ];
platforms = platforms.darwin;
};
}