nixpkgs/pkgs/servers/webdav-server-rs/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

49 lines
1.3 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, rustPlatform
, libtirpc
, pam
, rpcsvc-proto
, enablePAM ? stdenv.hostPlatform.isLinux
}:
rustPlatform.buildRustPackage rec {
pname = "webdav-server-rs";
# The v0.4.0 tag cannot build. So we use the 547602e commit.
version = "unstable-2021-08-16";
src = fetchFromGitHub {
owner = "miquels";
repo = pname;
rev = "547602e78783935b4ddd038fb795366c9c476bcc";
sha256 = "sha256-nTygUEjAUXD0mRTmjt8/UPVfZA4rP6oop1s/fI5mYeg=";
};
cargoHash = "sha256-TDDfGQig4i/DpsilTPqMQ1oT0mXK5DKlZmwsPPLrzFc=";
buildInputs = [ libtirpc ] ++ lib.optional enablePAM pam;
nativeBuildInputs = [ rpcsvc-proto ];
buildNoDefaultFeatures = true;
buildFeatures = [ "quota" ] ++ lib.optional enablePAM "pam";
postPatch = ''
substituteInPlace fs_quota/build.rs \
--replace '/usr/include/tirpc' '${libtirpc.dev}/include/tirpc'
'';
meta = with lib; {
description = "Implementation of WebDAV server in Rust";
longDescription = ''
webdav-server-rs is an implementation of WebDAV with full support for
RFC4918. It also supports local unix accounts, PAM authentication, and
quota.
'';
homepage = "https://github.com/miquels/webdav-server-rs";
license = licenses.asl20;
maintainers = with maintainers; [ pmy ];
mainProgram = "webdav-server";
};
}