refactor: move fetchers from src/fetchers to v1/nix/fetchers

This commit is contained in:
DavHau 2023-04-27 12:40:52 +02:00
parent fbfb09d2ab
commit 3a8fe7ce6a
12 changed files with 15 additions and 12 deletions

1
src/fetchers Symbolic link
View File

@ -0,0 +1 @@
../v1/nix/fetchers

View File

@ -10,7 +10,7 @@
fetcherModules =
l.genAttrs
fetcherNames
(name: import "${fetchersDir}/${name}" config);
(name: import "${fetchersDir}/${name}" (config.pkgs // config));
in {
config = {
fetchers = fetcherModules;

View File

@ -1,7 +1,7 @@
{
pkgs,
lib,
utils,
utils ? null,
hashPath ? utils.hashPath,
fetchgit,
...
}: let
b = builtins;
@ -53,7 +53,7 @@ in {
else {rev = inp.rev;};
in {
calcHash = algo:
utils.hashPath algo
hashPath algo
(b.fetchGit
(refAndRev
// {
@ -79,7 +79,7 @@ in {
inherit submodules;
})
else
pkgs.fetchgit
fetchgit
(refAndRev
// {
inherit url;

View File

@ -1,7 +1,9 @@
{
pkgs,
utils ? null,
fetchurl,
lib,
utils,
hashFile ? utils.hashFile,
extractSource ? utils.extractSource,
...
}: {
inputs = [
@ -12,7 +14,7 @@
b = builtins;
in {
calcHash = algo:
utils.hashFile algo (b.fetchurl {
hashFile algo (b.fetchurl {
inherit url;
});
@ -20,12 +22,12 @@
drv =
if hash != null && lib.stringLength hash == 40
then
pkgs.fetchurl {
fetchurl {
inherit url;
sha1 = hash;
}
else
pkgs.fetchurl {
fetchurl {
inherit url hash;
};
@ -33,7 +35,7 @@
name = lib.strings.sanitizeDerivationName old.name;
});
extracted = utils.extractSource {
extracted = extractSource {
source = drvSanitized;
};
in