nixpkgs-plugin-update: use nix-prefetch-github

This commit is contained in:
Austin Horstman
2026-04-17 10:35:03 -05:00
parent ad763e44fb
commit 231170aa16
2 changed files with 5 additions and 10 deletions
@@ -3,6 +3,7 @@
buildPythonApplication,
makeWrapper,
nix,
nix-prefetch-github,
nix-prefetch-git,
nurl,
python3Packages,
@@ -37,6 +38,7 @@ buildPythonApplication {
makeWrapperArgs+=( --prefix PATH : "${
lib.makeBinPath [
nix
nix-prefetch-github
nix-prefetch-git
neovim-unwrapped
nurl
@@ -420,18 +420,11 @@ class RepoGitHub(Repo):
return sha256
def prefetch_github(self, ref: str) -> str:
quoted_ref = quote(ref, safe="")
safe_name = re.sub(r"[^A-Za-z0-9._+-]", "-", f"{self.repo}-{ref}.tar.gz")
cmd = [
"nix-prefetch-url",
"--unpack",
"--name",
safe_name,
self.url(f"archive/{quoted_ref}.tar.gz"),
]
cmd = ["nix-prefetch-github", self.owner, self.repo, "--rev", ref, "--json"]
log.debug("Running %s", cmd)
data = subprocess.check_output(cmd)
return data.strip().decode("utf-8")
loaded = json.loads(data)
return loaded["hash"]
def as_nix(self, plugin: "Plugin") -> str:
if plugin.has_submodules: