nixpkgs/pkgs/servers/static-web-server/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.5 KiB
Nix
Raw Normal View History

2024-07-21 11:19:59 +02:00
{
lib,
rustPlatform,
fetchFromGitHub,
2024-07-22 00:37:15 +02:00
fetchpatch,
2024-07-21 11:19:59 +02:00
stdenv,
darwin,
nixosTests,
}:
2022-12-18 05:18:56 +01:00
rustPlatform.buildRustPackage rec {
pname = "static-web-server";
2024-07-21 11:19:15 +02:00
version = "2.32.1";
2022-12-18 05:18:56 +01:00
src = fetchFromGitHub {
owner = "static-web-server";
repo = pname;
rev = "v${version}";
2024-07-21 11:19:15 +02:00
hash = "sha256-PkDT6FU6JSIeeKCJeeIjjqZfoo+tGzqyPyWuIiwusQY=";
2022-12-18 05:18:56 +01:00
};
2024-07-21 11:19:15 +02:00
cargoHash = "sha256-ymI5O6j6NEcgIbMLEYgyUZBBkwxDWDWaVn4hqJScGxA=";
2022-12-18 05:18:56 +01:00
2024-07-22 00:37:15 +02:00
patches = [
(fetchpatch {
url = "https://github.com/static-web-server/static-web-server/pull/466.patch";
hash = "sha256-VYSoi6swG4nEFmGKvdEaJ05mJlxaXYsjs8cQai40P4g=";
})
];
2022-12-18 05:18:56 +01:00
2024-07-22 00:37:15 +02:00
buildInputs = lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Security ];
2024-07-21 11:19:15 +02:00
2024-07-22 00:37:15 +02:00
# Some tests rely on timestamps newer than 18 Nov 1974 00:00:00
preCheck = ''
find docker/public -exec touch -m {} \;
'';
2022-12-18 05:18:56 +01: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}
'';
2024-07-21 11:19:59 +02:00
passthru.tests = {
inherit (nixosTests) static-web-server;
};
2022-12-18 05:18:56 +01:00
meta = with lib; {
2023-07-04 18:24:16 +02:00
description = "Asynchronous web server for static files-serving";
homepage = "https://static-web-server.net/";
2022-12-18 05:18:56 +01:00
changelog = "https://github.com/static-web-server/static-web-server/blob/v${version}/CHANGELOG.md";
2024-07-21 11:19:59 +02:00
license = with licenses; [
mit # or
asl20
];
2022-12-18 05:18:56 +01:00
maintainers = with maintainers; [ figsoda ];
2023-11-23 22:09:35 +01:00
mainProgram = "static-web-server";
2022-12-18 05:18:56 +01:00
};
}