2023-07-15 17:15:38 +00:00
|
|
|
{ lib, rustPlatform, fetchFromGitHub, stdenv, darwin, nixosTests }:
|
2022-12-28 21:21:41 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "static-web-server";
|
2023-07-15 17:15:38 +00:00
|
|
|
version = "2.20.0";
|
2022-12-28 21:21:41 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "static-web-server";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
hash = "sha256-xhe6N718Tuqzjuo5Kt1X4myoxA5zmwf/fOJRJpchNug=";
|
2022-12-28 21:21:41 +00:00
|
|
|
};
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
cargoHash = "sha256-GBzS4UJGvBYacGVOcAhWjueSQWg1o7QGMIIwePf5TVI=";
|
2022-12-28 21:21:41 +00:00
|
|
|
|
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [
|
|
|
|
darwin.apple_sdk.frameworks.Security
|
|
|
|
];
|
|
|
|
|
|
|
|
checkFlags = [
|
|
|
|
# TODO: investigate why these tests fail
|
|
|
|
"--skip=tests::handle_byte_ranges_if_range_too_old"
|
|
|
|
"--skip=tests::handle_not_modified"
|
|
|
|
"--skip=handle_precondition"
|
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# Need to copy in the systemd units for systemd.packages to discover them
|
|
|
|
postInstall = ''
|
|
|
|
install -Dm444 -t $out/lib/systemd/system/ systemd/static-web-server.{service,socket}
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.tests = { inherit (nixosTests) static-web-server; };
|
|
|
|
|
2022-12-28 21:21:41 +00:00
|
|
|
meta = with lib; {
|
2023-07-15 17:15:38 +00:00
|
|
|
description = "An asynchronous web server for static files-serving";
|
2023-04-29 16:46:19 +00:00
|
|
|
homepage = "https://static-web-server.net/";
|
2022-12-28 21:21:41 +00:00
|
|
|
changelog = "https://github.com/static-web-server/static-web-server/blob/v${version}/CHANGELOG.md";
|
|
|
|
license = with licenses; [ mit /* or */ asl20 ];
|
|
|
|
maintainers = with maintainers; [ figsoda ];
|
|
|
|
};
|
|
|
|
}
|