6 matchForgeRepo = builtins.match "(.+)/(.+)";
8 fetchers = lib.mapAttrs (_: fetcher: self.callPackage fetcher { }) {
15 { sha256, commit, ... }:
17 m = matchForgeRepo repo;
33 { sha256, commit, ... }:
35 m = matchForgeRepo repo;
51 { sha256, commit, ... }:
56 GIT_SSL_NO_VERIFY = true;
66 { sha256, commit, ... }:
69 url = "https://bitbucket.com/${repo}";
79 { sha256, commit, ... }:
91 { sha256, commit, ... }:
93 url = "https://git.sr.ht/~${repo}/archive/${commit}.tar.gz";
103 { sha256, commit, ... }:
105 url = "https://codeberg.org/${repo}/archive/${commit}.tar.gz";
112 melpaDerivation = variant:
118 sourceArgs = args.${variant};
119 version = sourceArgs.version or null;
120 deps = sourceArgs.deps or null;
121 error = sourceArgs.error or args.error or null;
122 hasSource = lib.hasAttr variant args;
123 pname = builtins.replaceStrings [ "@" ] [ "at" ] ename;
124 broken = error != null;
127 lib.nameValuePair ename (
128 self.callPackage ({ melpaBuild, fetchurl, ... }@pkgargs:
131 inherit (sourceArgs) commit;
132 version = lib.optionalString (version != null)
133 (lib.concatStringsSep "." (map toString
134 # Hack: Melpa archives contains versions with parse errors such as [ 4 4 -4 413 ] which should be 4.4-413
135 # This filter method is still technically wrong, but it's computationally cheap enough and tapers over the issue
136 (builtins.filter (n: n >= 0) version)));
137 # TODO: Broken should not result in src being null (hack to avoid eval errors)
138 src = if (sha256 == null || broken) then null else
139 fetchers.${fetcher} args sourceArgs;
140 recipe = if commit == null then null else
142 name = pname + "-recipe";
143 url = "https://raw.githubusercontent.com/melpa/melpa/${commit}/recipes/${ename}";
146 packageRequires = lib.optionals (deps != null)
147 (map (dep: pkgargs.${dep} or self.${dep} or null)
149 meta = (sourceArgs.meta or {}) // {