core/pkgs/build-support/fetchfossil/default.nix

44 lines
838 B
Nix
Raw Normal View History

2024-06-30 08:16:52 +00:00
{
stdenv,
lib,
fossil,
cacert,
}:
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
{
name ? null,
url,
rev,
sha256 ? "",
hash ? "",
2024-05-02 00:46:19 +00:00
}:
if hash != "" && sha256 != "" then
throw "Only one of sha256 or hash can be set"
else
2024-06-30 08:16:52 +00:00
stdenv.mkDerivation {
name = "fossil-archive" + (lib.optionalString (name != null) "-${name}");
builder = ./builder.sh;
nativeBuildInputs = [
fossil
cacert
];
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
# Envvar docs are hard to find. A link for the future:
# https://www.fossil-scm.org/index.html/doc/trunk/www/env-opts.md
impureEnvVars = [ "http_proxy" ];
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
outputHashAlgo = if hash != "" then null else "sha256";
outputHashMode = "recursive";
outputHash =
if hash != "" then
hash
else if sha256 != "" then
sha256
else
lib.fakeSha256;
2024-05-02 00:46:19 +00:00
2024-06-30 08:16:52 +00:00
inherit url rev;
preferLocalBuild = true;
}