2023-10-09 19:29:22 +00:00
|
|
|
{ lib
|
2024-01-25 14:12:00 +00:00
|
|
|
, buildGoModule
|
2023-10-09 19:29:22 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, curl
|
|
|
|
, stdenv
|
|
|
|
, testers
|
|
|
|
, static-server
|
|
|
|
, substituteAll
|
|
|
|
}:
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
buildGoModule rec {
|
2023-10-09 19:29:22 +00:00
|
|
|
pname = "static-server";
|
|
|
|
version = "1.2.1";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "eliben";
|
|
|
|
repo = "static-server";
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-AZcNh/kF6IdAceA7qe+nhRlwU4yGh19av/S1Zt7iKIs=";
|
|
|
|
};
|
|
|
|
|
|
|
|
vendorHash = "sha256-1p3dCLLo+MTPxf/Y3zjxTagUi+tq7nZSj4ZB/aakJGY=";
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# patch out debug.ReadBuidlInfo since version information is not available with buildGoModule
|
|
|
|
(substituteAll {
|
|
|
|
src = ./version.patch;
|
|
|
|
inherit version;
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
curl
|
|
|
|
];
|
|
|
|
|
|
|
|
ldflags = [ "-s" "-w" ];
|
|
|
|
|
|
|
|
# tests sometimes fail with SIGQUIT on darwin
|
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
|
|
|
|
passthru.tests = {
|
|
|
|
version = testers.testVersion {
|
|
|
|
package = static-server;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
__darwinAllowLocalNetworking = true;
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Simple, zero-configuration HTTP server CLI for serving static files";
|
2023-10-09 19:29:22 +00:00
|
|
|
homepage = "https://github.com/eliben/static-server";
|
|
|
|
license = licenses.unlicense;
|
|
|
|
maintainers = with maintainers; [ figsoda ];
|
|
|
|
mainProgram = "static-server";
|
|
|
|
};
|
|
|
|
}
|