Files

63 lines
1.7 KiB
Nix

{
lib,
rustPlatform,
fetchFromGitHub,
nixosTests,
versionCheckHook,
nix-update-script,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "static-web-server";
version = "2.43.0";
src = fetchFromGitHub {
owner = "static-web-server";
repo = "static-web-server";
tag = "v${finalAttrs.version}";
hash = "sha256-oZPUyRN0X4wgJqdiqU3nX/SYb2kE8EuSCQP6Fl4A+AM=";
};
cargoHash = "sha256-Bi53+xl9AdC3NWKJCnz6KA8vg7ydhX1zK13uPxTjJCU=";
# static-web-server already has special handling for files with modification
# time = Unix epoch, but the nix store is Unix epoch + 1 second.
patches = [ ./include-unix-time-plus-one.diff ];
# Some tests which implicitly relied on the above behavior now break.
# Force an mtime update to everything except symbolic inks to fix.
postUnpack = ''
find . -not -type l -exec touch -m {} +
'';
# 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}
'';
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
passthru = {
updateScript = nix-update-script { };
tests = {
inherit (nixosTests) static-web-server;
};
};
meta = {
description = "A cross-platform, high-performance and asynchronous web server for static files-serving";
homepage = "https://static-web-server.net/";
changelog = "https://github.com/static-web-server/static-web-server/blob/v${finalAttrs.version}/CHANGELOG.md";
license = with lib.licenses; [
mit # or
asl20
];
maintainers = with lib.maintainers; [
misilelab
progrm_jarvis
];
mainProgram = "static-web-server";
};
})