lib/fetchers/fetch-ugee-driver: init

This commit is contained in:
Gabriel Arazas 2024-11-15 16:31:51 +08:00
parent 8fa4d576f8
commit cde957a97d
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
4 changed files with 26 additions and 1 deletions

View File

@ -42,7 +42,7 @@ in pkgs.lib.makeExtensible (self:
buildHugoSite buildFDSEnv;
inherit (self.trivial) countAttrs filterAttrs';
inherit (self.data) importYAML renderTeraTemplate renderMustacheTemplate;
inherit (self.fetchers) fetchInternetArchive;
inherit (self.fetchers) fetchInternetArchive fetchUgeeDriver;
} // lib.optionalAttrs (builtins ? fetchTree) {
flake = callLib ./flake.nix;

View File

@ -2,4 +2,5 @@
{
fetchInternetArchive = pkgs.callPackage ./fetch-internet-archive { };
fetchUgeeDriver = pkgs.callPackage ./fetch-ugee-driver { };
}

View File

@ -0,0 +1,15 @@
{ fetchzip, lib }:
{
fileId,
pid,
ext ? "gz",
...
}@args:
let
args' = lib.removeAttrs args [ "fileId" "pid" "ext" ];
in
fetchzip (args' // {
url = "https://www.ugee.com/download/file/id/${fileId}/pid/${pid}/ext/${ext}";
})

View File

@ -18,4 +18,13 @@
formats = [ "TEXT" "PNG" ];
hash = "sha256-xbhasJ/wEgcY+EcBAJp5UoYB4N4It3QV/iIeGGdCET8=";
};
testsFetchUgeeDriver =
# Ugee M908.
self.fetchers.fetchUgeeDriver {
fileId = "943";
pid = "505";
hash = "sha256-50Dbyaaa1B8nQu3+tTGvh/yjQqwaARB2MWtKSOUYsKg=";
extension = "tar.gz";
};
}