diff --git a/lib/default.nix b/lib/default.nix index 85ec1605..a61dbd19 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -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; diff --git a/lib/fetchers/default.nix b/lib/fetchers/default.nix index e4eceb31..0ab1658a 100644 --- a/lib/fetchers/default.nix +++ b/lib/fetchers/default.nix @@ -2,4 +2,5 @@ { fetchInternetArchive = pkgs.callPackage ./fetch-internet-archive { }; + fetchUgeeDriver = pkgs.callPackage ./fetch-ugee-driver { }; } diff --git a/lib/fetchers/fetch-ugee-driver/default.nix b/lib/fetchers/fetch-ugee-driver/default.nix new file mode 100644 index 00000000..6a9da63b --- /dev/null +++ b/lib/fetchers/fetch-ugee-driver/default.nix @@ -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}"; +}) diff --git a/tests/lib/fetchers.nix b/tests/lib/fetchers.nix index c74abecb..545e46e3 100644 --- a/tests/lib/fetchers.nix +++ b/tests/lib/fetchers.nix @@ -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"; + }; }