diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-05-23 13:26:22 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-05-23 13:26:22 +0200 |
commit | 204731c0a69136c9cebcb54f1afecf5145e26bbe (patch) | |
tree | fc9132e5dc74e4a8e1327cdd411839a90f9410aa /pkgs/sources/generate_moz_extension/res/generate_extensions.py | |
parent | refactor(sys): Modularize and move to `modules/system` or `pkgs` (diff) | |
download | nixos-config-204731c0a69136c9cebcb54f1afecf5145e26bbe.tar.gz nixos-config-204731c0a69136c9cebcb54f1afecf5145e26bbe.zip |
refactor(pkgs): Categorize into `by-name` shards
This might not be the perfect way to organize a package set -- especially if the set is not nearly the size of nixpkgs -- but it is _at_ least a way of organization.
Diffstat (limited to 'pkgs/sources/generate_moz_extension/res/generate_extensions.py')
-rw-r--r-- | pkgs/sources/generate_moz_extension/res/generate_extensions.py | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/pkgs/sources/generate_moz_extension/res/generate_extensions.py b/pkgs/sources/generate_moz_extension/res/generate_extensions.py deleted file mode 100644 index ee8cc966..00000000 --- a/pkgs/sources/generate_moz_extension/res/generate_extensions.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python -# source: https://github.com/etu/nixconfig/blob/ba47d577c8bfb4a1c06927c34ece34118f4a0460/modules/graphical/firefox/generate.py - -from concurrent.futures import ThreadPoolExecutor -import json -import requests - -EXTENSIONS = sorted( - [ - "darkreader", - "firenvim", - "keepassxc-browser", - "simple-tab-groups", - ] -) - - -def index_ext(ext: str): - # print(f"Indexing {ext}...") - - resp = requests.get(f"https://addons.mozilla.org/api/v5/addons/addon/{ext}/").json() - rel = resp["current_version"] - - if not rel["file"]["hash"].startswith("sha256:"): - raise ValueError("Unhandled hash type") - - return { - "pname": ext, - "version": rel["version"], - "addonId": resp["guid"], - "url": rel["file"]["url"], - "sha256": rel["file"]["hash"], - } - - -if __name__ == "__main__": - # outfile = os.path.dirname(os.path.realpath(__file__)) + "/extensions.json" - - with ThreadPoolExecutor() as e: - extensions = {ext: e.submit(index_ext, ext) for ext in EXTENSIONS} - extensions = {k: v.result() for k, v in extensions.items()} - - # with open(outfile, "w") as f: - print(json.dumps(extensions, indent=2)) |