nixpkgs/pkgs/by-name/st/static-web-server/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

52 lines
1.3 KiB
Nix

{
lib,
rustPlatform,
fetchFromGitHub,
fetchpatch,
stdenv,
darwin,
nixosTests,
}:
rustPlatform.buildRustPackage rec {
pname = "static-web-server";
version = "2.33.0";
src = fetchFromGitHub {
owner = "static-web-server";
repo = pname;
rev = "v${version}";
hash = "sha256-WR8fzpeN6zufvakanJBSMtgTpfDRqCyaTfEzE5NqFOA=";
};
cargoHash = "sha256-AasNva4SOTSrvBTrGHX/jOPjcjt3o8KUsFL7e4uhW6M=";
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Security ];
# Some tests rely on timestamps newer than 18 Nov 1974 00:00:00
preCheck = ''
find docker/public -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}
'';
passthru.tests = {
inherit (nixosTests) static-web-server;
};
meta = with lib; {
description = "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${version}/CHANGELOG.md";
license = with licenses; [
mit # or
asl20
];
maintainers = with maintainers; [ figsoda ];
mainProgram = "static-web-server";
};
}