Update zims
This commit is contained in:
+17
-5
@@ -2,7 +2,7 @@
|
||||
callPackage,
|
||||
fetchtorrent,
|
||||
lib,
|
||||
stdenv,
|
||||
stdenvNoCC,
|
||||
...
|
||||
}:
|
||||
let
|
||||
@@ -10,9 +10,21 @@ let
|
||||
# Converts the inputs from the file into a fetchtorrent command
|
||||
zim =
|
||||
type: val:
|
||||
(fetchtorrent {
|
||||
inherit (val) hash name;
|
||||
url = "https://download.kiwix.org/zim/${type}/${val.name}.torrent";
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
inherit (val) name;
|
||||
src = (
|
||||
fetchtorrent {
|
||||
inherit (val) hash;
|
||||
url = "https://download.kiwix.org/zim/${type}/${val.name}.torrent";
|
||||
backend = "rqbit";
|
||||
postUnpack = "ls -lR";
|
||||
}
|
||||
);
|
||||
phases = [ "installPhase" ];
|
||||
installPhase = ''
|
||||
ls -lR ${finalAttrs.src}
|
||||
cp ${finalAttrs.src} $out
|
||||
'';
|
||||
});
|
||||
rawZims = builtins.fromJSON (builtins.readFile ./zim/blobs.json);
|
||||
# Uses the function above to convert the JSON into a structure of fetchtorrent derivations
|
||||
@@ -26,7 +38,7 @@ let
|
||||
)
|
||||
);
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = "zims";
|
||||
version = "2024-10";
|
||||
|
||||
|
||||
+10
-10
@@ -5,7 +5,7 @@
|
||||
"hash": "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="
|
||||
},
|
||||
"phet": {
|
||||
"name": "phet_en_all_2023-04.zim",
|
||||
"name": "phet_en_all_2025-03.zim",
|
||||
"hash": "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="
|
||||
},
|
||||
"wikibooks": {
|
||||
@@ -21,8 +21,8 @@
|
||||
"hash": "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="
|
||||
},
|
||||
"wikiversity": {
|
||||
"name": "wikiversity_en_all_maxi_2021-03.zim",
|
||||
"hash": "sha256-w/3J2neHPWbz1kK2qR0OB64mkwuDI7RJMuoAWz9yyZs="
|
||||
"name": "wikiversity_en_all_maxi_2025-05.zim",
|
||||
"hash": "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="
|
||||
},
|
||||
"wiktionary": {
|
||||
"name": "wiktionary_en_all_nopic_2024-05.zim",
|
||||
@@ -35,19 +35,19 @@
|
||||
"hash": "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="
|
||||
},
|
||||
"phet": {
|
||||
"name": "phet_fr_all_2023-04.zim",
|
||||
"name": "phet_fr_all_2025-03.zim",
|
||||
"hash": "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="
|
||||
},
|
||||
"wikibooks": {
|
||||
"name": "wikibooks_fr_all_maxi_2024-06.zim",
|
||||
"hash": "sha256-w/3J2neHPWbz1kK2qR0OB64mkwuDI7RJMuoAWz9yyZs="
|
||||
"name": "wikibooks_fr_all_maxi_2025-06.zim",
|
||||
"hash": "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="
|
||||
},
|
||||
"wikipedia": {
|
||||
"name": "wikipedia_fr_all_maxi_2024-05.zim",
|
||||
"hash": "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="
|
||||
},
|
||||
"wikisource": {
|
||||
"name": "wikisource_fr_all_maxi_2022-04.zim",
|
||||
"name": "wikisource_fr_all_maxi_2025-06.zim",
|
||||
"hash": "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="
|
||||
},
|
||||
"wikiversity": {
|
||||
@@ -55,17 +55,17 @@
|
||||
"hash": "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="
|
||||
},
|
||||
"wiktionary": {
|
||||
"name": "wiktionary_fr_all_nopic_2024-06.zim",
|
||||
"name": "wiktionary_fr_all_nopic_2025-03.zim",
|
||||
"hash": "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="
|
||||
}
|
||||
},
|
||||
"ht": {
|
||||
"phet": {
|
||||
"name": "phet_ht_all_2023-04.zim",
|
||||
"name": "phet_ht_all_2025-03.zim",
|
||||
"hash": "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="
|
||||
},
|
||||
"wikipedia": {
|
||||
"name": "wikipedia_ht_all_maxi_2024-06.zim",
|
||||
"name": "wikipedia_ht_all_maxi_2025-05.zim",
|
||||
"hash": "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="
|
||||
},
|
||||
"wikisource": {
|
||||
|
||||
+13
-12
@@ -81,19 +81,20 @@ func getHash(ch chan result, file, category, language string) {
|
||||
// in the existing file
|
||||
fmt.Printf("Fetching hash for %s\n", file)
|
||||
cmd := exec.Command("nix-prefetch",
|
||||
"--option",
|
||||
"extra-experimental-features",
|
||||
"flakes",
|
||||
fmt.Sprintf(`fetchtorrent {
|
||||
"--option",
|
||||
"extra-experimental-features",
|
||||
"flakes",
|
||||
fmt.Sprintf(`fetchtorrent {
|
||||
url="%s/%s/%s.torrent";
|
||||
hash="sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||
backend="rqbit";
|
||||
}`, BASE, category, file),
|
||||
)
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
ch <- result{ category, language, strings.TrimSpace(string(out)) }
|
||||
)
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
ch <- result{category, language, strings.TrimSpace(string(out))}
|
||||
}
|
||||
|
||||
func outputIsValid(o map[string]map[string]Zim) bool {
|
||||
@@ -128,7 +129,7 @@ func main() {
|
||||
if _, ok := output[lang]; !ok {
|
||||
output[lang] = make(map[string]Zim)
|
||||
}
|
||||
output[lang][t] = Zim{ file, "" }
|
||||
output[lang][t] = Zim{file, ""}
|
||||
go getHash(comms, file, t, lang)
|
||||
}
|
||||
}
|
||||
@@ -144,6 +145,6 @@ func main() {
|
||||
break
|
||||
}
|
||||
}
|
||||
ret, _ := json.Marshal(output)
|
||||
ret, _ := json.MarshalIndent(output, " ", "")
|
||||
fmt.Println(string(ret))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user