-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
799 additions
and
33 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,9 +1,30 @@ | ||
{pkgs, ...}: { | ||
projectRootFile = ".git/config"; | ||
programs.alejandra.enable = true; | ||
programs.black.enable = true; | ||
programs.isort = { | ||
enable = true; | ||
profile = "black"; | ||
{ | ||
lib, | ||
inputs, | ||
... | ||
}: { | ||
imports = [ | ||
inputs.treefmt-nix.flakeModule | ||
]; | ||
|
||
perSystem = { | ||
pkgs, | ||
config, | ||
... | ||
}: { | ||
treefmt = { | ||
inherit (config.flake-root) projectRootFile; | ||
|
||
# Nix | ||
programs.alejandra.enable = true; | ||
programs.statix.enable = true; | ||
|
||
# Python | ||
programs.black.enable = true; | ||
programs.isort = { | ||
enable = true; | ||
profile = "black"; | ||
}; | ||
}; | ||
}; | ||
} |
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,103 @@ | ||
{inputs, ...}: { | ||
imports = [ | ||
inputs.flake-root.flakeModule | ||
]; | ||
|
||
perSystem = { | ||
pkgs, | ||
config, | ||
... | ||
}: { | ||
flake-root.projectRootFile = "pkgs/overlay.nix"; | ||
|
||
devShells.update = let | ||
inherit (pkgs) lib python3 formats; | ||
|
||
pytools = python3.withPackages (ps: [ | ||
ps.nvchecker | ||
ps.lxml | ||
]); | ||
|
||
extra_sources = lib.fileset.toSource { | ||
root = ./.; | ||
fileset = ./nvchecker_source; | ||
}; | ||
|
||
configFormat = formats.toml {}; | ||
configFile = configFormat.generate "nvchecker.toml" { | ||
"__config__" = { | ||
"oldver" = "\${FLAKE_ROOT}/pkgs/refs.json"; | ||
#"newver" = "\${FLAKE_ROOT}/dev/current-versions.json"; | ||
}; | ||
"driver.vulkan-dev" = { | ||
source = "htmlparser"; | ||
prefix = "Linux "; | ||
include_regex = "^Linux [.0-9]+$"; | ||
url = "https://developer.nvidia.com/vulkan-driver"; | ||
xpath = ''//*[@id="content"]/div/section/h3''; | ||
}; | ||
"driver.display" = { | ||
source = "unix_drivers"; | ||
known = lib.mapAttrsToList (match: data: | ||
{ | ||
inherit match; | ||
} | ||
// data) { | ||
"Production Branch Version" = { | ||
maturity = "long-lived-branch-release"; | ||
}; | ||
"New Feature Branch Version" = {}; | ||
"Beta Version" = { | ||
maturity = "beta"; | ||
}; | ||
"Legacy GPU version (470.xx series)" = { | ||
branch = "R470_00"; | ||
}; | ||
"Legacy GPU version (390.xx series)" = { | ||
branch = "R390_00"; | ||
}; | ||
"Legacy GPU version (340.xx series)" = { | ||
branch = "R340_00"; | ||
}; | ||
"Legacy GPU version (304.xx series)" = { | ||
branch = "R304_00"; | ||
}; | ||
"Legacy GPU Version (71.86.xx series)" = { | ||
branch = "L7160"; | ||
}; | ||
"Legacy GPU Version (96.43.xx series)" = { | ||
branch = "L9622"; | ||
}; | ||
"Legacy GPU Version (173.14.xx series)" = { | ||
branch = "R173_14"; | ||
}; | ||
}; | ||
}; | ||
"driver.tesla" = { | ||
source = "tesla_releases"; | ||
url = "https://docs.nvidia.com/datacenter/tesla/drivers/releases.json"; | ||
from_pattern = ''(?:[^-]+-)*(.+)''; | ||
to_pattern = ''\1''; | ||
}; | ||
}; | ||
in | ||
pkgs.mkShell { | ||
packages = [pytools pkgs.jq]; | ||
|
||
inputsFrom = [config.flake-root.devShell]; | ||
|
||
env = { | ||
PYTHONPATH = toString extra_sources; | ||
NVCHECKER_CONFIG = toString configFile; | ||
}; | ||
|
||
shellHook = '' | ||
export SCRATCHDIR=$(mktemp -d) | ||
nvchecker -c ''${NVCHECKER_CONFIG} | ||
exit | ||
''; | ||
}; | ||
}; | ||
} |
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,27 @@ | ||
import asyncio | ||
|
||
from nvchecker.api import AsyncCache, BaseWorker, RawResult | ||
|
||
|
||
class Worker(BaseWorker): | ||
async def run(self) -> None: | ||
self.cache = AsyncCache() | ||
await asyncio.gather( | ||
*[self._run_entry(name, entry) for (name, entry) in self.tasks] | ||
) | ||
|
||
async def _run_entry(self, name, entry): | ||
async with self.task_sem: | ||
data = await self.cache.get_json(entry["url"]) | ||
for branch, data in data.items(): | ||
versions = [ | ||
f"{r['release_date']}-{r['release_version']}" | ||
for r in data["driver_info"] | ||
] | ||
await self.result_q.put( | ||
RawResult( | ||
f"{name}.r{branch}", | ||
versions, | ||
entry, | ||
) | ||
) |
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,61 @@ | ||
import re | ||
|
||
from nvchecker.api import BaseWorker, RawResult, session | ||
|
||
PATTERN = re.compile(rb"Latest (?P<label>[^:]+)[^>]+>\s*(?P<version>[^<]+)</a>") | ||
|
||
|
||
class Worker(BaseWorker): | ||
async def get_data(self, url): | ||
for match in PATTERN.finditer(res.body): | ||
yield match.groupdict() | ||
|
||
async def get_unix_results(self, url): | ||
results = {} | ||
res = await session.get(url) | ||
|
||
for match in PATTERN.finditer(res.body): | ||
label = match["label"].lower() | ||
versions = results.get(label) or set() | ||
versions.add(match["version"].decode("UTF-8")) | ||
if label not in results: | ||
results[label] = versions | ||
|
||
return results | ||
|
||
def match_label(self, label: str, known_entries): | ||
for known in known_entries: | ||
if known["match"].lower() in label: | ||
return ( | ||
known.get("branch", "current"), | ||
known.get("maturity", "official"), | ||
) | ||
|
||
return (None, None) | ||
|
||
async def run(self) -> None: | ||
results = None | ||
async with self.task_sem: | ||
results = await self.get_unix_results( | ||
"https://www.nvidia.com/en-us/drivers/unix/" | ||
) | ||
|
||
for name, entry in self.tasks: | ||
known_entries = entry.get("known") | ||
|
||
async with self.task_sem: | ||
for label, versions in results.items(): | ||
label_str = label.decode("UTF-8") | ||
(branch, maturity) = self.match_label(label_str, known_entries) | ||
|
||
new_name = f"{name}.unknown.{label_str}" | ||
if branch: | ||
new_name = f"{name}.{branch}.{maturity}" | ||
|
||
await self.result_q.put( | ||
RawResult( | ||
new_name, | ||
list(versions), | ||
entry, | ||
) | ||
) |
Oops, something went wrong.