nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1diff --git a/src/lib.rs b/src/lib.rs
2index 6f86cc4..a9ca418 100644
3--- a/src/lib.rs
4+++ b/src/lib.rs
5@@ -128,12 +128,17 @@ pub fn fetch(params: FetchParams, builder: impl DictionaryBuilder) -> Result<(),
6 // copy(&source_path, &source_path_for_build)?;
7 let tmp_path = Path::new(&build_dir).join(params.file_name.to_owned() + ".download");
8
9+ if let Some(path) = params.download_url.strip_prefix("file://") {
10+ std::fs::copy(path, &tmp_path)?;
11+ }
12+ else {
13 // Download a tarball
14 let resp = ureq::get(params.download_url).call()?;
15 let mut dest = File::create(&tmp_path)?;
16
17 io::copy(&mut resp.into_reader(), &mut dest)?;
18 dest.flush()?;
19+ }
20
21 rename(tmp_path, source_path_for_build).expect("Failed to rename temporary file");
22
23@@ -153,7 +158,6 @@ pub fn fetch(params: FetchParams, builder: impl DictionaryBuilder) -> Result<(),
24 archive.unpack(&tmp_extract_path)?;
25 rename(tmp_extracted_path, &input_dir).expect("Failed to rename archive directory");
26 let _ = std::fs::remove_dir_all(&tmp_extract_path);
27- drop(dest);
28 let _ = std::fs::remove_file(source_path_for_build);
29 }
30