mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-26 06:44:06 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
59 lines
1.5 KiB
Nix
59 lines
1.5 KiB
Nix
{
|
|
lib,
|
|
rustPlatform,
|
|
fetchFromGitHub,
|
|
fetchpatch,
|
|
stdenv,
|
|
darwin,
|
|
nixosTests,
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "static-web-server";
|
|
version = "2.32.1";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "static-web-server";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
hash = "sha256-PkDT6FU6JSIeeKCJeeIjjqZfoo+tGzqyPyWuIiwusQY=";
|
|
};
|
|
|
|
cargoHash = "sha256-ymI5O6j6NEcgIbMLEYgyUZBBkwxDWDWaVn4hqJScGxA=";
|
|
|
|
patches = [
|
|
(fetchpatch {
|
|
url = "https://github.com/static-web-server/static-web-server/pull/466.patch";
|
|
hash = "sha256-VYSoi6swG4nEFmGKvdEaJ05mJlxaXYsjs8cQai40P4g=";
|
|
})
|
|
];
|
|
|
|
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";
|
|
};
|
|
}
|