about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/fetchfossil/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/build-support/fetchfossil/default.nix')
-rw-r--r--nixpkgs/pkgs/build-support/fetchfossil/default.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/build-support/fetchfossil/default.nix b/nixpkgs/pkgs/build-support/fetchfossil/default.nix
new file mode 100644
index 000000000000..3f3bf69db047
--- /dev/null
+++ b/nixpkgs/pkgs/build-support/fetchfossil/default.nix
@@ -0,0 +1,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;
+}