nixpkgs/pkgs/by-name/ht/httpdirfs/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.5 KiB
Nix

{
curl,
expat,
fetchFromGitHub,
fuse,
gumbo,
help2man,
lib,
libuuid,
nix-update-script,
pkg-config,
stdenv,
testers,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "httpdirfs";
version = "1.2.5";
src = fetchFromGitHub {
owner = "fangfufu";
repo = "httpdirfs";
rev = "refs/tags/${finalAttrs.version}";
hash = "sha256-PUYsT0VDEzerPqwrLJrET4kSsWsQhtnfmLepeaqtA+I=";
};
postPatch = lib.optional stdenv.hostPlatform.isDarwin ''
substituteInPlace Makefile --replace-fail '-fanalyzer' '-Xanalyzer'
'';
nativeBuildInputs = [
help2man
pkg-config
];
buildInputs = [
curl
expat
fuse
gumbo
libuuid
];
makeFlags = [ "prefix=${placeholder "out"}" ];
postBuild = ''
make man
'';
passthru = {
# Disabled for Darwin because requires macFUSE installed outside NixOS
tests.version = lib.optionalAttrs stdenv.hostPlatform.isLinux (
testers.testVersion {
command = "${lib.getExe finalAttrs.finalPackage} --version";
package = finalAttrs.finalPackage;
}
);
updateScript = nix-update-script { };
};
meta = {
changelog = "https://github.com/fangfufu/httpdirfs/releases/tag/${finalAttrs.version}";
description = "FUSE filesystem for HTTP directory listings";
homepage = "https://github.com/fangfufu/httpdirfs";
license = lib.licenses.gpl3Only;
mainProgram = "httpdirfs";
maintainers = with lib.maintainers; [ sbruder schnusch anthonyroussel ];
platforms = lib.platforms.unix;
};
})