-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: phanirithvij <[email protected]>
- Loading branch information
1 parent
f7c8b09
commit bf1665b
Showing
4 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
lib, | ||
fetchurl, | ||
}: | ||
let | ||
inherit (lib) mapAttrs; | ||
plugins = builtins.fromJSON (builtins.readFile ./plugins.json); | ||
in | ||
mapAttrs (_: fetchurl) plugins |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"typescript": { | ||
"url": "https://plugins.dprint.dev/typescript-0.93.3.wasm", | ||
"hash": "sha256-urgKQOjgkoDJCH/K7DWLJCkD0iH0Ok+rvrNDI0i4uS0=" | ||
}, | ||
"json": { | ||
"url": "https://plugins.dprint.dev/json-0.19.4.wasm", | ||
"hash": "sha256-Sw+HkUb4K2wrLuQRZibr8gOCR3Rz36IeId4Vd4LijmY=" | ||
}, | ||
"markdown": { | ||
"url": "https://plugins.dprint.dev/markdown-0.17.8.wasm", | ||
"hash": "sha256-PIEN9UnYC8doJpdzS7M6QEHQNQtj7WwXAgvewPsTjqs=" | ||
}, | ||
"toml": { | ||
"url": "https://plugins.dprint.dev/toml-0.6.3.wasm", | ||
"hash": "sha256-aDfo/sKfOeNpyfd/4N1LgL1bObTTnviYrA8T7M/1KNs=" | ||
}, | ||
"dockerfile": { | ||
"url": "https://plugins.dprint.dev/dockerfile-0.3.2.wasm", | ||
"hash": "sha256-gsfMLa4zw8AblOS459ZS9OZrkGCQi5gBN+a3hvOsspk=" | ||
}, | ||
"biome": { | ||
"url": "https://plugins.dprint.dev/biome-0.7.1.wasm", | ||
"hash": "sha256-+zY+myazFAUxeNuWFigkvF4zpKBs+jzVYQT09jRWFKI=" | ||
}, | ||
"ruff": { | ||
"url": "https://plugins.dprint.dev/ruff-0.3.9.wasm", | ||
"hash": "sha256-15InHQgF9c0Js4yUJxmZ1oNj1O16FBU12u/GOoaSAJ8=" | ||
}, | ||
"jupyter": { | ||
"url": "https://plugins.dprint.dev/jupyter-0.1.5.wasm", | ||
"hash": "sha256-877CEZbMlj9cHkFtl16XCnan37SeEGUL3BHaUKUv8S4=" | ||
}, | ||
"malva": { | ||
"url": "https://plugins.dprint.dev/g-plane/malva-v0.11.1.wasm", | ||
"hash": "sha256-zt7F1tgPhPAn+gtps6+JB5RtvjIZw2n/G85Bv6kazgU=" | ||
}, | ||
"markup": { | ||
"url": "https://plugins.dprint.dev/g-plane/markup_fmt-v0.18.0.wasm", | ||
"hash": "sha256-G8UnJbc+oZ60V3oi8W2SS6H06zEYfY3wpmSUp+1GF8k=" | ||
}, | ||
"yaml": { | ||
"url": "https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.0.wasm", | ||
"hash": "sha256-6ua021G7ZW7Ciwy/OHXTA1Joj9PGEx3SZGtvaA//gzo=" | ||
}, | ||
"graphql": { | ||
"url": "https://plugins.dprint.dev/g-plane/pretty_graphql-v0.2.1.wasm", | ||
"hash": "sha256-PlQwpR0tMsghMrOX7is+anN57t9xa9weNtoWpc0E9ec=" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell -i python -p nix 'python3.withPackages (pp: with pp; [ requests ])' | ||
|
||
import json | ||
import subprocess | ||
import requests | ||
|
||
|
||
def nix_prefetch_url(url, algo="sha256"): | ||
hash = ( | ||
subprocess.check_output(["nix-prefetch-url", "--type", algo, url]) | ||
.decode("utf-8") | ||
.rstrip() | ||
) | ||
sri = ( | ||
subprocess.check_output( | ||
["nix", "hash", "convert", "--hash-algo", algo, "--to", "sri", hash] | ||
) | ||
.decode("utf-8") | ||
.rstrip() | ||
) | ||
return sri | ||
|
||
|
||
def update_plugins(): | ||
data = requests.get("https://plugins.dprint.dev/info.json").json()["latest"] | ||
with open("plugins.json", "w+", encoding="utf8") as f: | ||
result = {} | ||
for e in data: | ||
# using configKey instead of name here | ||
# name can have slashes for eg. g-plane/malva | ||
# but configKey is a good sensible unique word per plugin | ||
result[e["configKey"]] = { | ||
"url": e["url"], | ||
"hash": nix_prefetch_url(e["url"]), | ||
} | ||
json.dump(result, f, indent=2) | ||
f.write("\n") | ||
|
||
|
||
update_plugins() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters