Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenvNoCC, mercurial }: 2{ name ? null 3, url 4, rev ? null 5, md5 ? null 6, sha256 ? null 7, hash ? null 8, fetchSubrepos ? false 9, preferLocalBuild ? true }: 10 11if md5 != null then 12 throw "fetchhg does not support md5 anymore, please use sha256 or hash" 13else if hash != null && sha256 != null then 14 throw "Only one of sha256 or hash can be set" 15else 16# TODO: statically check if mercurial as the https support if the url starts woth https. 17stdenvNoCC.mkDerivation { 18 name = "hg-archive" + (lib.optionalString (name != null) "-${name}"); 19 builder = ./builder.sh; 20 nativeBuildInputs = [mercurial]; 21 22 impureEnvVars = lib.fetchers.proxyImpureEnvVars; 23 24 subrepoClause = lib.optionalString fetchSubrepos "S"; 25 26 outputHashAlgo = if hash != null then null else "sha256"; 27 outputHashMode = "recursive"; 28 outputHash = if hash != null then 29 hash 30 else if sha256 != null then 31 sha256 32 else 33 lib.fakeSha256; 34 35 inherit url rev; 36 inherit preferLocalBuild; 37}