about summary refs log tree commit diff
path: root/pkgs/build-support/fetchfossil/default.nix
blob: 3f3bf69db0477ed51cc4c93072028e38eea3256c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{stdenv, lib, fossil, cacert}:

{ name ? null
, url
, rev
, sha256 ? ""
, hash ? ""
}:

if hash != "" && sha256 != "" then
  throw "Only one of sha256 or hash can be set"
else
stdenv.mkDerivation {
  name = "fossil-archive" + (lib.optionalString (name != null) "-${name}");
  builder = ./builder.sh;
  nativeBuildInputs = [fossil cacert];

  # 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" ];

  outputHashAlgo = if hash != "" then null else "sha256";
  outputHashMode = "recursive";
  outputHash = if hash != "" then
    hash
  else if sha256 != "" then
    sha256
  else
    lib.fakeSha256;

  inherit url rev;
  preferLocalBuild = true;
}