2019-04-08 21:06:50 +01:00
|
|
|
lib: self:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
fetcherGenerators = { repo ? null
|
|
|
|
, url ? null
|
|
|
|
, ... }:
|
|
|
|
{ sha256
|
|
|
|
, commit
|
|
|
|
, ...}: {
|
|
|
|
github = self.callPackage ({ fetchFromGitHub }:
|
|
|
|
fetchFromGitHub {
|
|
|
|
owner = lib.head (lib.splitString "/" repo);
|
|
|
|
repo = lib.head (lib.tail (lib.splitString "/" repo));
|
|
|
|
rev = commit;
|
|
|
|
inherit sha256;
|
|
|
|
}
|
|
|
|
) {};
|
|
|
|
gitlab = self.callPackage ({ fetchFromGitLab }:
|
|
|
|
fetchFromGitLab {
|
|
|
|
owner = lib.head (lib.splitString "/" repo);
|
|
|
|
repo = lib.head (lib.tail (lib.splitString "/" repo));
|
|
|
|
rev = commit;
|
|
|
|
inherit sha256;
|
|
|
|
}
|
|
|
|
) {};
|
|
|
|
git = self.callPackage ({ fetchgit }:
|
2020-05-12 20:48:09 +01:00
|
|
|
(fetchgit {
|
2019-04-08 21:06:50 +01:00
|
|
|
rev = commit;
|
|
|
|
inherit sha256 url;
|
2020-05-12 20:48:09 +01:00
|
|
|
}).overrideAttrs(_: {
|
|
|
|
GIT_SSL_NO_VERIFY = true;
|
|
|
|
})
|
2019-04-08 21:06:50 +01:00
|
|
|
) {};
|
|
|
|
bitbucket = self.callPackage ({ fetchhg }:
|
|
|
|
fetchhg {
|
|
|
|
rev = commit;
|
|
|
|
url = "https://bitbucket.com/${repo}";
|
|
|
|
inherit sha256;
|
|
|
|
}
|
|
|
|
) {};
|
|
|
|
hg = self.callPackage ({ fetchhg }:
|
|
|
|
fetchhg {
|
|
|
|
rev = commit;
|
|
|
|
inherit sha256 url;
|
|
|
|
}
|
|
|
|
) {};
|
|
|
|
};
|
|
|
|
|
|
|
|
in {
|
|
|
|
|
|
|
|
melpaDerivation = variant:
|
|
|
|
{ ename, fetcher
|
|
|
|
, commit ? null
|
|
|
|
, sha256 ? null
|
|
|
|
, ... }@args:
|
|
|
|
let
|
2019-08-13 22:52:01 +01:00
|
|
|
sourceArgs = args.${variant};
|
2019-04-08 21:06:50 +01:00
|
|
|
version = sourceArgs.version or null;
|
|
|
|
deps = sourceArgs.deps or null;
|
|
|
|
error = sourceArgs.error or args.error or null;
|
|
|
|
hasSource = lib.hasAttr variant args;
|
|
|
|
pname = builtins.replaceStrings [ "@" ] [ "at" ] ename;
|
|
|
|
broken = ! isNull error;
|
|
|
|
in
|
2020-03-25 21:09:51 +00:00
|
|
|
if hasSource then
|
|
|
|
lib.nameValuePair ename (
|
|
|
|
self.callPackage ({ melpaBuild, fetchurl, ... }@pkgargs:
|
2019-04-08 21:06:50 +01:00
|
|
|
melpaBuild {
|
|
|
|
inherit pname;
|
|
|
|
ename = ename;
|
|
|
|
version = if isNull version then "" else
|
|
|
|
lib.concatStringsSep "." (map toString version);
|
|
|
|
# TODO: Broken should not result in src being null (hack to avoid eval errors)
|
|
|
|
src = if (isNull sha256 || broken) then null else
|
|
|
|
lib.getAttr fetcher (fetcherGenerators args sourceArgs);
|
|
|
|
recipe = if isNull commit then null else
|
|
|
|
fetchurl {
|
|
|
|
name = pname + "-recipe";
|
|
|
|
url = "https://raw.githubusercontent.com/melpa/melpa/${commit}/recipes/${ename}";
|
|
|
|
inherit sha256;
|
|
|
|
};
|
2019-11-09 23:52:53 +00:00
|
|
|
packageRequires = lib.optionals (! isNull deps)
|
2019-08-13 22:52:01 +01:00
|
|
|
(map (dep: pkgargs.${dep} or self.${dep} or null)
|
2019-04-08 21:06:50 +01:00
|
|
|
deps);
|
|
|
|
meta = (sourceArgs.meta or {}) // {
|
|
|
|
inherit broken;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
) {}
|
2020-03-25 21:09:51 +00:00
|
|
|
)
|
|
|
|
else
|
|
|
|
null;
|
2019-04-08 21:06:50 +01:00
|
|
|
|
|
|
|
}
|