Compare commits
No commits in common. "3c483aeb893880e599bebe5824a2b09d4827c430" and "bbcc5a14b71c2bb0ad416ca0fd405f9bdb52bbb1" have entirely different histories.
3c483aeb89
...
bbcc5a14b7
|
@ -0,0 +1,111 @@
|
||||||
|
# a small helper that only builds on top of builtins functions
|
||||||
|
_: (builtins // (
|
||||||
|
let
|
||||||
|
formatSecondsSinceEpoch = t:
|
||||||
|
let
|
||||||
|
rem = x: y: x - x / y * y;
|
||||||
|
days = t / 86400;
|
||||||
|
secondsInDay = rem t 86400;
|
||||||
|
hours = secondsInDay / 3600;
|
||||||
|
minutes = (rem secondsInDay 3600) / 60;
|
||||||
|
seconds = rem t 60;
|
||||||
|
|
||||||
|
# Courtesy of https://stackoverflow.com/a/32158604.
|
||||||
|
z = days + 719468;
|
||||||
|
era = (if z >= 0 then z else z - 146096) / 146097;
|
||||||
|
doe = z - era * 146097;
|
||||||
|
yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365;
|
||||||
|
y = yoe + era * 400;
|
||||||
|
doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
|
||||||
|
mp = (5 * doy + 2) / 153;
|
||||||
|
d = doy - (153 * mp + 2) / 5 + 1;
|
||||||
|
m = mp + (if mp < 10 then 3 else -9);
|
||||||
|
y' = y + (if m <= 2 then 1 else 0);
|
||||||
|
|
||||||
|
pad = s: if builtins.stringLength s < 2 then "0" + s else s;
|
||||||
|
in
|
||||||
|
"${toString y'}${pad (toString m)}${pad (toString d)}${pad (toString hours)}"
|
||||||
|
+ "${pad (toString minutes)}${pad (toString seconds)}";
|
||||||
|
|
||||||
|
fetchTree =
|
||||||
|
# this is the value of flake.lock#lock.nodes.${input_name}.locked
|
||||||
|
{ type
|
||||||
|
, host ? ""
|
||||||
|
, owner ? ""
|
||||||
|
, repo ? ""
|
||||||
|
, rev ? ""
|
||||||
|
, submodules ? ""
|
||||||
|
, path ? ""
|
||||||
|
, narHash ? null
|
||||||
|
, lastModified ? 0
|
||||||
|
, src ? ./.
|
||||||
|
}@info:
|
||||||
|
if info.type == "github" then
|
||||||
|
{
|
||||||
|
outPath =
|
||||||
|
fetchTarball
|
||||||
|
({
|
||||||
|
url = "https://api.${info.host or "github.com"}/repos/"
|
||||||
|
+ "${info.owner}/${info.repo}/tarball/${info.rev}";
|
||||||
|
}
|
||||||
|
// (if info ? narHash then { sha256 = info.narHash; } else { })
|
||||||
|
);
|
||||||
|
rev = info.rev;
|
||||||
|
shortRev = builtins.substring 0 7 info.rev;
|
||||||
|
lastModified = info.lastModified;
|
||||||
|
lastModifiedDate = formatSecondsSinceEpoch info.lastModified;
|
||||||
|
narHash = info.narHash;
|
||||||
|
}
|
||||||
|
else if info.type == "git" then
|
||||||
|
{
|
||||||
|
outPath =
|
||||||
|
builtins.fetchGit
|
||||||
|
({ url = info.url; }
|
||||||
|
// (if info ? rev then { inherit (info) rev; } else { })
|
||||||
|
// (if info ? ref then { inherit (info) ref; } else { })
|
||||||
|
// (if info ? submodules then { inherit (info) submodules; } else { })
|
||||||
|
);
|
||||||
|
lastModified = info.lastModified;
|
||||||
|
lastModifiedDate = formatSecondsSinceEpoch info.lastModified;
|
||||||
|
narHash = info.narHash;
|
||||||
|
} // (if info ? rev then {
|
||||||
|
rev = info.rev;
|
||||||
|
shortRev = builtins.substring 0 7 info.rev;
|
||||||
|
} else { })
|
||||||
|
else if info.type == "path" then
|
||||||
|
{
|
||||||
|
outPath = builtins.path {
|
||||||
|
path =
|
||||||
|
if builtins.substring 0 1 info.path != "/"
|
||||||
|
then src + ("/" + info.path) # make this absolute path by prepending ./
|
||||||
|
else info.path; # it's already an absolute path
|
||||||
|
};
|
||||||
|
narHash = info.narHash;
|
||||||
|
}
|
||||||
|
else if info.type == "tarball" then
|
||||||
|
{
|
||||||
|
outPath =
|
||||||
|
fetchTarball
|
||||||
|
({ inherit (info) url; }
|
||||||
|
// (if info ? narHash then { sha256 = info.narHash; } else { })
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else if info.type == "gitlab" then
|
||||||
|
{
|
||||||
|
inherit (info) rev narHash lastModified;
|
||||||
|
outPath =
|
||||||
|
fetchTarball
|
||||||
|
({ url = "https://${info.host or "gitlab.com"}/api/v4/projects/${info.owner}%2F${info.repo}/repository/archive.tar.gz?sha=${info.rev}"; }
|
||||||
|
// (if info ? narHash then { sha256 = info.narHash; } else { })
|
||||||
|
);
|
||||||
|
shortRev = builtins.substring 0 7 info.rev;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
# FIXME: add Mercurial, tarball inputs.
|
||||||
|
throw "flake input has unsupported input type '${info.type}'";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
inherit fetchTree;
|
||||||
|
}
|
||||||
|
)) nil
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
pkgs.rust4cargo
|
pkgs.rust4cargo
|
||||||
pkgs.sops
|
pkgs.sops
|
||||||
pkgs.ssh-to-age
|
pkgs.ssh-to-age
|
||||||
pkgs.go
|
|
||||||
pkgs.gopls
|
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
|
1094
flake.lock
1094
flake.lock
File diff suppressed because it is too large
Load Diff
139
flake.nix
139
flake.nix
|
@ -6,36 +6,123 @@
|
||||||
};
|
};
|
||||||
description = "My personal configuration in Nix (and some native configurations)";
|
description = "My personal configuration in Nix (and some native configurations)";
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||||
deploy-rs.url = "github:serokell/deploy-rs";
|
# continously merged & rebased lightweight .lib. Basically a huge extension to c_.
|
||||||
std.url = "github:divnix/std";
|
nixlib.url = "github:nix-community/nixpkgs.lib";
|
||||||
hive.url = "github:divnix/hive";
|
agenix = {
|
||||||
|
url = "github:ryantm/agenix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
home-manager = {
|
||||||
|
url = "github:nix-community/home-manager";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
nixgl.url = "path:out-of-tree/nixGL";
|
||||||
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||||
|
# Allows default.nix to call onto flake.nix. Useful for nix eval and automations
|
||||||
|
flake-compat = {
|
||||||
|
url = "path:out-of-tree/flake-compat";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
kpcli-py = {
|
||||||
|
url = "github:rebkwok/kpcli";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
neovim-nightly-overlay = {
|
||||||
|
url = "github:nix-community/neovim-nightly-overlay";
|
||||||
|
inputs.nixpkgs.url = "github:nixos/nixpkgs?rev=fad51abd42ca17a60fc1d4cb9382e2d79ae31836";
|
||||||
|
};
|
||||||
|
nix-index-database = {
|
||||||
|
url = "github:mic92/nix-index-database";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
nickel.url = "github:tweag/nickel";
|
||||||
|
nix-boost.url = "git+https://git.pegasust.com/pegasust/nix-boost.git";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { std, hive, ... }@inputs: std.growOn
|
outputs =
|
||||||
{
|
{ nixpkgs
|
||||||
# boilerplate
|
, agenix
|
||||||
inherit inputs;
|
, home-manager
|
||||||
# All cell blocks are under ./nix/cells/<cell>/<cellblock> as `<cellblock>.nix`
|
, flake-utils
|
||||||
# or `<cellblock/default.nix`
|
, nixgl
|
||||||
cellsFrom = ./nix/cells;
|
, rust-overlay
|
||||||
modules = ./nix/modules;
|
, flake-compat
|
||||||
|
, neovim-nightly-overlay
|
||||||
cellBlocks =
|
, nix-index-database
|
||||||
|
, nixlib
|
||||||
|
, nickel
|
||||||
|
, ...
|
||||||
|
}@_inputs:
|
||||||
let
|
let
|
||||||
inherit (std.blockTypes) devShells;
|
# config_fn:: system -> config
|
||||||
inherit (hive.blockTypes) nixosConfigurations homeConfigurations;
|
# this function should take simple exports of homeConfigurations.${profile},
|
||||||
|
# nixosConfigurations.${profile}, devShells.${profile}, packages.${profile}
|
||||||
|
# and correctly produce
|
||||||
|
supported_systems = flake-utils.lib.defaultSystems;
|
||||||
|
forEachSystem = nixpkgs.lib.genAttrs supported_systems;
|
||||||
|
in
|
||||||
|
let
|
||||||
|
proj_root =
|
||||||
|
let
|
||||||
|
path = builtins.toString ./.;
|
||||||
in
|
in
|
||||||
[
|
|
||||||
(devShells "devshells")
|
|
||||||
(nixosConfigurations "host_profile")
|
|
||||||
(homeConfigurations "home_profile")
|
|
||||||
|
|
||||||
];
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
devShells = std.harvest [ [ "dotfiles" "devshells" ] ];
|
inherit path;
|
||||||
nixosConfigurations = std.harvest [ [ "dotfiles" "nixos" ] ];
|
configs.path = "${path}/native_configs";
|
||||||
homeConfigurations = std.harvest [ [ "dotfiles" "home" ] ];
|
scripts.path = "${path}/scripts";
|
||||||
|
secrets.path = "${path}/secrets";
|
||||||
|
testdata.path = "${path}/tests";
|
||||||
|
modules.path = "${path}/modules";
|
||||||
|
hosts.path = "${path}/hosts";
|
||||||
|
users.path = "${path}/users";
|
||||||
|
};
|
||||||
|
overlays = forEachSystem (system: import ./overlays.nix (_inputs // { inherit system; }));
|
||||||
|
pkgs = forEachSystem (system: (import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = overlays.${system};
|
||||||
|
config = {
|
||||||
|
allowUnfree = true;
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
lib = (builtins.foldl' (lhs: rhs: (nixpkgs.lib.recursiveUpdate lhs rhs)) { } [
|
||||||
|
nixpkgs.lib
|
||||||
|
nixlib.lib
|
||||||
|
]);
|
||||||
|
inputs_w_lib = forEachSystem (
|
||||||
|
system: lib.recursiveUpdate _inputs {
|
||||||
|
inherit system lib;
|
||||||
|
pkgs = pkgs.${system};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
modules = (import ./modules inputs_w_lib);
|
||||||
|
hosts = (import ./hosts inputs_w_lib);
|
||||||
|
users = (import ./users inputs_w_lib);
|
||||||
|
|
||||||
|
# {nixpkgs, agenix, home-manager, flake-utils, nixgl, rust-overlay, flake-compat
|
||||||
|
# ,pkgs, lib (extended), proj_root}
|
||||||
|
final_inputs = inputs_w_lib;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
inherit (hosts) nixosConfigurations;
|
||||||
|
inherit (users) homeConfigurations;
|
||||||
|
inherit lib proj_root;
|
||||||
|
devShells = forEachSystem (system:
|
||||||
|
{default = (import ./dev-shell.nix final_inputs.${system});}
|
||||||
|
);
|
||||||
|
templates = forEachSystem (system: import ./templates final_inputs.${system});
|
||||||
|
secrets = {
|
||||||
|
pubKeys = {
|
||||||
|
hosts = hosts.pubKeys;
|
||||||
|
users = users.pubKeys;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
debug = {
|
||||||
|
inherit final_inputs hosts users modules lib inputs_w_lib pkgs nixpkgs nixlib;
|
||||||
|
};
|
||||||
|
# formatter."${system}" = pkgs.nixpkgs-fmt;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,13 +147,13 @@ vim.opt.scrolloff = 30;
|
||||||
vim.opt.signcolumn = "yes";
|
vim.opt.signcolumn = "yes";
|
||||||
vim.opt.colorcolumn = "80";
|
vim.opt.colorcolumn = "80";
|
||||||
|
|
||||||
vim.opt.background = "dark";
|
vim.opt.background = "light";
|
||||||
|
|
||||||
vim.api.nvim_create_user_command('Dark', function(opts)
|
vim.api.nvim_create_user_command('Dark', function(opts)
|
||||||
-- opts: {name, args: str, fargs: Splited<str>, range, ...}
|
-- opts: {name, args: str, fargs: Splited<str>, range, ...}
|
||||||
---@type string
|
---@type string
|
||||||
local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_light;
|
local contrast = (opts.args and string.len(opts.args) > 0) and opts.args or vim.g.gruvbox_contrast_dark;
|
||||||
= contrast;
|
vim.g.gruvbox_contrast_dark = contrast;
|
||||||
vim.opt.background = "dark";
|
vim.opt.background = "dark";
|
||||||
end,
|
end,
|
||||||
{ nargs = "?", })
|
{ nargs = "?", })
|
||||||
|
@ -616,7 +616,7 @@ require("mason").setup({
|
||||||
},
|
},
|
||||||
check_outdated_packages_on_open = true,
|
check_outdated_packages_on_open = true,
|
||||||
},
|
},
|
||||||
-- NOTE: The default settings is "prepend" https://github.com/williamboman/mason.nvim#default-configuration
|
-- The default settings is "prepend" https://github.com/williamboman/mason.nvim#default-configuration
|
||||||
-- Which means Mason's installed path is prioritized against our local install
|
-- Which means Mason's installed path is prioritized against our local install
|
||||||
-- see: https://git.pegasust.com/pegasust/aoc/commit/b45dc32c74d84c9f787ebce7a174c9aa1d411fc2
|
-- see: https://git.pegasust.com/pegasust/aoc/commit/b45dc32c74d84c9f787ebce7a174c9aa1d411fc2
|
||||||
-- This introduces some pitfalls, so we'll take the approach of trusting user's local installation
|
-- This introduces some pitfalls, so we'll take the approach of trusting user's local installation
|
||||||
|
|
|
@ -88,11 +88,6 @@ Host dev0
|
||||||
User htran
|
User htran
|
||||||
Port 22
|
Port 22
|
||||||
|
|
||||||
Host dev2
|
|
||||||
HostName 10.100.200.210
|
|
||||||
User htran
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
Host dev1
|
Host dev1
|
||||||
HostName 10.100.200.220
|
HostName 10.100.200.220
|
||||||
User htran
|
User htran
|
||||||
|
|
|
@ -18,6 +18,7 @@ set-option -g renumber-windows on
|
||||||
# set -g status-interval 60
|
# set -g status-interval 60
|
||||||
# set -g status-right-style 'bg=#333333 fg=#5eacd3'
|
# set -g status-right-style 'bg=#333333 fg=#5eacd3'
|
||||||
# set -g status-right-length 50
|
# set -g status-right-length 50
|
||||||
|
set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M '
|
||||||
# set -g status-left " "
|
# set -g status-left " "
|
||||||
|
|
||||||
# Keybinds
|
# Keybinds
|
||||||
|
|
|
@ -42,7 +42,6 @@ let
|
||||||
pkgs.nodePackages.pyright
|
pkgs.nodePackages.pyright
|
||||||
pkgs.python3Packages.pylint
|
pkgs.python3Packages.pylint
|
||||||
pkgs.python3Packages.flake8
|
pkgs.python3Packages.flake8
|
||||||
# FIXME: installing ansible from here just doesn't work :/
|
|
||||||
# pkgs.ansible-lint
|
# pkgs.ansible-lint
|
||||||
# pkgs.python38Packages.ansible
|
# pkgs.python38Packages.ansible
|
||||||
# pkgs.ansible-language-server
|
# pkgs.ansible-language-server
|
||||||
|
@ -52,10 +51,7 @@ let
|
||||||
# pkgs.rust-analyzer
|
# pkgs.rust-analyzer
|
||||||
# rust_pkgs
|
# rust_pkgs
|
||||||
# pkgs.evcxr # Rust REPL for Conjure!
|
# pkgs.evcxr # Rust REPL for Conjure!
|
||||||
] ++ lib.optionals (pkgs.stdenv.isDarwin) (let
|
];
|
||||||
inherit (pkgs.darwin.apple_sdk.frameworks) System CoreFoundation; in [
|
|
||||||
System CoreFoundation pkgs.cc
|
|
||||||
]);
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.base.neovim = {
|
options.base.neovim = {
|
||||||
|
|
|
@ -52,13 +52,11 @@ in
|
||||||
};
|
};
|
||||||
programs.tmux = {
|
programs.tmux = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# extraConfigBeforePlugin = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf";
|
configBeforePlugin = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf";
|
||||||
plugins = let inherit (pkgs.tmuxPlugins) cpu net-speed; in [ cpu net-speed ];
|
plugins =
|
||||||
extraConfig = (builtins.readFile "${proj_root.config.path}/tmux/tmux.conf");
|
let inherit (pkgs.tmuxPlugins) cpu net-speed;
|
||||||
|
in [ cpu net-speed ];
|
||||||
};
|
};
|
||||||
xdg.configFile."tmux/tmux.conf".text = myLib.mkOrder 600 ''
|
|
||||||
set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M '
|
|
||||||
'';
|
|
||||||
programs.exa = {
|
programs.exa = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableAliases = true;
|
enableAliases = true;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -16,7 +16,7 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager";
|
url = "github:Pegasust/home-manager";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
neovim-nightly-overlay = {
|
neovim-nightly-overlay = {
|
||||||
url = "github:nix-community/neovim-nightly-overlay";
|
url = "github:nix-community/neovim-nightly-overlay";
|
||||||
# Pin to a nixpkgs revision that doesn't have NixOS/nixpkgs#208103 yet
|
# Pin to a nixpkgs revision that doesn't have NixOS/nixpkgs#208103 yet
|
||||||
# inputs.nixpkgs.url = "github:nixos/nixpkgs?rev=fad51abd42ca17a60fc1d4cb9382e2d79ae31836";
|
inputs.nixpkgs.url = "github:nixos/nixpkgs?rev=fad51abd42ca17a60fc1d4cb9382e2d79ae31836";
|
||||||
};
|
};
|
||||||
nix-index-database = {
|
nix-index-database = {
|
||||||
url = "github:mic92/nix-index-database";
|
url = "github:mic92/nix-index-database";
|
||||||
|
@ -202,7 +202,6 @@
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
nerd_font_module
|
nerd_font_module
|
||||||
{ base.keepass.enable = pkgs.lib.mkForce false; }
|
|
||||||
];
|
];
|
||||||
extraSpecialArgs = mkModuleArgs {
|
extraSpecialArgs = mkModuleArgs {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
|
|
|
@ -37,7 +37,7 @@ in
|
||||||
# pkgs.xorg.xclock # TODO: only include if have gui # For testing GL installation
|
# pkgs.xorg.xclock # TODO: only include if have gui # For testing GL installation
|
||||||
# pkgs.logseq # TODO: only include if have GL # Obsidian alt
|
# pkgs.logseq # TODO: only include if have GL # Obsidian alt
|
||||||
pkgs.mosh # Parsec for SSH
|
pkgs.mosh # Parsec for SSH
|
||||||
# pkgs.nixops_unstable # nixops v2 # insecure for now
|
pkgs.nixops_unstable # nixops v2 # insecure for now
|
||||||
pkgs.lynx # Web browser at your local terminal
|
pkgs.lynx # Web browser at your local terminal
|
||||||
pkgs.zk
|
pkgs.zk
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
{inputs, cells}: let
|
|
||||||
inherit (inputs) std nixpkgs;
|
|
||||||
|
|
||||||
in {
|
|
||||||
default = std.lib.dev.mkShell {
|
|
||||||
name = nixpkgs.lib.
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,81 +1,65 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# execution: fetch.py >nvidia_versions.json
|
import urllib3
|
||||||
|
|
||||||
import http.client
|
|
||||||
import json
|
import json
|
||||||
import sys
|
|
||||||
|
|
||||||
NV_FREE_X86_URL = "download.nvidia.com"
|
http = urllib3.PoolManager()
|
||||||
POTENTIAL_SHA256_EXTS = [".sha256sum", ".sha256"]
|
dl_dir = http.request("GET", "https://download.nvidia.com/XFree86/Linux-x86_64/")
|
||||||
RIGHT_PAD = " " * 20
|
|
||||||
|
|
||||||
conn = http.client.HTTPSConnection(NV_FREE_X86_URL)
|
# print(f"{dl_dir.status=}\n{dl_dir.data=}")
|
||||||
conn.request("GET", "/XFree86/Linux-x86_64/")
|
|
||||||
response = conn.getresponse()
|
|
||||||
dir_html = response.read()
|
|
||||||
|
|
||||||
assert (response.status < 400), "Error occurred fetching for source from"
|
assert (dl_dir.status < 400), "Error probably occurred"
|
||||||
|
|
||||||
def scrape_driver_versions(dir_html: bytes):
|
def find_versions(dir_html: bytes) -> list[str]:
|
||||||
# The idea is to recursively follows all interesting `src` from `<a href={src}>`
|
# this algorithm obviously need recursion because we need to discover the items
|
||||||
def _rec(dir_html: bytes, href_url_start: int = 0, so_far: list[str] = []) -> list[str]:
|
def _rec(dir_html: bytes, start: int = 0, so_far: list[str] = []) -> list[str]:
|
||||||
MATCH_START = b"<span class=\'dir\'><a href=\'"
|
MATCH_START = b"<span class=\'dir\'><a href=\'"
|
||||||
href_url_start = dir_html.find(MATCH_START, href_url_start)
|
potential_start = dir_html.find(MATCH_START, start)
|
||||||
if href_url_start == -1: # EOF
|
if potential_start == -1:
|
||||||
return so_far
|
return so_far
|
||||||
|
# check that it starts with a number
|
||||||
# version href should start with a number
|
potential_version_start = potential_start + len(MATCH_START)
|
||||||
potential_version_start = href_url_start + len(MATCH_START)
|
|
||||||
p = potential_version_start
|
p = potential_version_start
|
||||||
if not (dir_html[p: p+1].decode().isnumeric()):
|
if not (dir_html[p: p+1].decode().isnumeric()):
|
||||||
return _rec(dir_html, potential_version_start, so_far)
|
return _rec(dir_html, potential_version_start, so_far)
|
||||||
|
|
||||||
|
# this thing matches, add to so_far and continue
|
||||||
version_end = dir_html.find(b"/", potential_version_start)
|
version_end = dir_html.find(b"/", potential_version_start)
|
||||||
assert version_end != -1, "Should have end-signaling /"
|
assert version_end != -1, "There should be matching /"
|
||||||
so_far.append(dir_html[potential_version_start:version_end].decode())
|
so_far.append(dir_html[potential_version_start:version_end].decode())
|
||||||
return _rec(dir_html, version_end, so_far)
|
return _rec(dir_html, version_end, so_far)
|
||||||
|
return _rec(dir_html, 0, [])
|
||||||
|
|
||||||
versions = _rec(dir_html, 0, [])
|
versions = find_versions(dl_dir.data)
|
||||||
num_versions = len(versions)
|
# print("\n".join(versions))
|
||||||
for i, version in enumerate(versions):
|
|
||||||
print(f"[{i+1}/{num_versions}] Processing version {version}{RIGHT_PAD}", end="\r", file=sys.stderr)
|
|
||||||
yield version
|
|
||||||
print()
|
|
||||||
|
|
||||||
versions = scrape_driver_versions(dir_html)
|
download_urls = lambda ver: [f"https://download.nvidia.com/XFree86/Linux-x86_64/{ver}/NVIDIA-Linux-x86_64-{ver}.run"]
|
||||||
|
sha256_urls = lambda ver: [f"{url}{dl_ext}" for dl_ext in [".sha256sum", ".sha256"] for url in download_urls(ver)]
|
||||||
|
def req_monad(url: str, err_fn, then_fn):
|
||||||
|
res = http.request("GET", url)
|
||||||
|
if res.status >= 400:
|
||||||
|
return err_fn(res.status)
|
||||||
|
return then_fn(res.data)
|
||||||
|
|
||||||
download_urls_of = lambda ver: [f"/XFree86/Linux-x86_64/{ver}/NVIDIA-Linux-x86_64-{ver}.run"]
|
identity = lambda e: e
|
||||||
sha256_urls_of = lambda ver: [
|
none_id = lambda _: None
|
||||||
f"{url}{dl_ext}"
|
|
||||||
for dl_ext in POTENTIAL_SHA256_EXTS
|
|
||||||
for url in download_urls_of(ver)
|
|
||||||
]
|
|
||||||
|
|
||||||
def sha256_of(version: str) -> str | None:
|
def get_sha256(version: str) -> str | None:
|
||||||
if int(version.split(".")[0]) < 256:
|
for url in sha256_urls(version):
|
||||||
# Has 3 different packages that we should probably not bother
|
res = http.request("GET", url)
|
||||||
|
# print(f"attempting: {url}")
|
||||||
|
if res.status < 400:
|
||||||
|
return res.data.decode().split()[0]
|
||||||
return None
|
return None
|
||||||
for url in sha256_urls_of(version):
|
fetch_data = [(v, download_urls(v)[0], get_sha256(v)) for v in versions]
|
||||||
conn = http.client.HTTPSConnection(NV_FREE_X86_URL)
|
|
||||||
conn.request("GET", url)
|
|
||||||
response = conn.getresponse()
|
|
||||||
if response.status < 400:
|
|
||||||
return response.read().decode().split()[0]
|
|
||||||
print(f"No sha256 for {version}{RIGHT_PAD}", file=sys.stderr)
|
|
||||||
return None
|
|
||||||
|
|
||||||
def fetch(version: str):
|
|
||||||
dl_url = download_urls_of(version)[0]
|
|
||||||
sha256 = sha256_of(version)
|
|
||||||
return (version, dl_url, sha256)
|
|
||||||
|
|
||||||
fetch_data = [fetch(v) for v in versions]
|
|
||||||
fetch_data.append(("latest", *fetch_data[-1][1:]))
|
fetch_data.append(("latest", *fetch_data[-1][1:]))
|
||||||
|
|
||||||
|
# print(fetch_data)
|
||||||
|
|
||||||
# now print the JSON object
|
# now print the JSON object
|
||||||
print(json.dumps({
|
print(json.dumps({
|
||||||
version: {
|
version: {
|
||||||
"url": f"https://{NV_FREE_X86_URL}{dl_url}",
|
"url": dl_url,
|
||||||
"sha256": sha256
|
"sha256": sha256
|
||||||
} for (version, dl_url, sha256) in fetch_data if sha256 is not None}, indent=4))
|
} for (version, dl_url, sha256) in fetch_data if sha256 is not None}, indent=4))
|
||||||
|
# execution: fetch.py >nvidia_versions.json
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
nixGLIntel = pkgs.nixGLIntel;
|
nixGLIntel = pkgs.nixGLIntel;
|
||||||
nixVulkanNvidia = pkgs.auto.nixVulkanNvidia;
|
nixVulkanNvidia = pkgs.auto.nixVulkanNvidia;
|
||||||
nixVulkanIntel = pkgs.nixVulkanIntel;
|
nixVulkanIntel = pkgs.nixVulkanIntel;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# deprecated attributes for retro compatibility
|
# deprecated attributes for retro compatibility
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
"256.25": {
|
"256.25": {
|
||||||
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.25/NVIDIA-Linux-x86_64-256.25.run",
|
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.25/NVIDIA-Linux-x86_64-256.25.run",
|
||||||
|
@ -540,10 +539,6 @@
|
||||||
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/470.161.03/NVIDIA-Linux-x86_64-470.161.03.run",
|
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/470.161.03/NVIDIA-Linux-x86_64-470.161.03.run",
|
||||||
"sha256": "5da82a7f8c76e781e7d7f0be7b798db4d344f26bd4facf9abcf3c71c71fe7640"
|
"sha256": "5da82a7f8c76e781e7d7f0be7b798db4d344f26bd4facf9abcf3c71c71fe7640"
|
||||||
},
|
},
|
||||||
"470.182.03": {
|
|
||||||
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/470.182.03/NVIDIA-Linux-x86_64-470.182.03.run",
|
|
||||||
"sha256": "3dbc1408fc48b865d3ddacefc45f4a3fc13b90b83a628ee546b0082ab2c3fc79"
|
|
||||||
},
|
|
||||||
"510.108.03": {
|
"510.108.03": {
|
||||||
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/510.108.03/NVIDIA-Linux-x86_64-510.108.03.run",
|
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/510.108.03/NVIDIA-Linux-x86_64-510.108.03.run",
|
||||||
"sha256": "410a515e78df29c2cba4ac0b497889ce0ff1b04cfc711ff889e2dfc80f0da0d8"
|
"sha256": "410a515e78df29c2cba4ac0b497889ce0ff1b04cfc711ff889e2dfc80f0da0d8"
|
||||||
|
@ -552,10 +547,6 @@
|
||||||
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/515.86.01/NVIDIA-Linux-x86_64-515.86.01.run",
|
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/515.86.01/NVIDIA-Linux-x86_64-515.86.01.run",
|
||||||
"sha256": "141777e1ca2f11e97d8d33260213f1be327eb73922ae22f4ddab404bb2ef4664"
|
"sha256": "141777e1ca2f11e97d8d33260213f1be327eb73922ae22f4ddab404bb2ef4664"
|
||||||
},
|
},
|
||||||
"515.105.01": {
|
|
||||||
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/515.105.01/NVIDIA-Linux-x86_64-515.105.01.run",
|
|
||||||
"sha256": "9dd2221f26c847c864dfe80cc8533f322c5f4dfaa2939cf54a934b8f7a2f6a0d"
|
|
||||||
},
|
|
||||||
"525.53": {
|
"525.53": {
|
||||||
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.53/NVIDIA-Linux-x86_64-525.53.run",
|
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.53/NVIDIA-Linux-x86_64-525.53.run",
|
||||||
"sha256": "74bb0971f04f1dddd3c4641c891706fb96e8de52e22f6079e50de76d3a51687f"
|
"sha256": "74bb0971f04f1dddd3c4641c891706fb96e8de52e22f6079e50de76d3a51687f"
|
||||||
|
@ -572,28 +563,8 @@
|
||||||
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.78.01/NVIDIA-Linux-x86_64-525.78.01.run",
|
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.78.01/NVIDIA-Linux-x86_64-525.78.01.run",
|
||||||
"sha256": "43da42d2bf69bc37ea9c7c0fa02f52db0dcc483c272f52edacad89a5cb495a93"
|
"sha256": "43da42d2bf69bc37ea9c7c0fa02f52db0dcc483c272f52edacad89a5cb495a93"
|
||||||
},
|
},
|
||||||
"525.85.05": {
|
|
||||||
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.85.05/NVIDIA-Linux-x86_64-525.85.05.run",
|
|
||||||
"sha256": "ea63b4253403b224bb7313a8977a920dfe9d203d661dd5f6fc26585a70179140"
|
|
||||||
},
|
|
||||||
"525.89.02": {
|
|
||||||
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.89.02/NVIDIA-Linux-x86_64-525.89.02.run",
|
|
||||||
"sha256": "0e412c88c5bd98f842a839a6f64614f20e4c0950ef7cffb12b158a71633593e9"
|
|
||||||
},
|
|
||||||
"525.105.17": {
|
|
||||||
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.105.17/NVIDIA-Linux-x86_64-525.105.17.run",
|
|
||||||
"sha256": "c635a21a282c9b53485f19ebb64a0f4b536a968b94d4d97629e0bc547a58142a"
|
|
||||||
},
|
|
||||||
"530.30.02": {
|
|
||||||
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/530.30.02/NVIDIA-Linux-x86_64-530.30.02.run",
|
|
||||||
"sha256": "47fddbbd7a22ba661923dbce6e7f51eec54df68050c406cc0490c3bfbede7963"
|
|
||||||
},
|
|
||||||
"530.41.03": {
|
|
||||||
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/530.41.03/NVIDIA-Linux-x86_64-530.41.03.run",
|
|
||||||
"sha256": "ae27a16a968c85503f5d161dda343c1602612b025f4aee15f92e2ea0acb784b1"
|
|
||||||
},
|
|
||||||
"latest": {
|
"latest": {
|
||||||
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/530.41.03/NVIDIA-Linux-x86_64-530.41.03.run",
|
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.78.01/NVIDIA-Linux-x86_64-525.78.01.run",
|
||||||
"sha256": "ae27a16a968c85503f5d161dda343c1602612b025f4aee15f92e2ea0acb784b1"
|
"sha256": "43da42d2bf69bc37ea9c7c0fa02f52db0dcc483c272f52edacad89a5cb495a93"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
12
overlays.nix
12
overlays.nix
|
@ -6,8 +6,7 @@ flake_input@{ kpcli-py
|
||||||
, nickel
|
, nickel
|
||||||
, nix-boost
|
, nix-boost
|
||||||
, ...
|
, ...
|
||||||
}:
|
}: let
|
||||||
let
|
|
||||||
kpcli-py = (final: prev: {
|
kpcli-py = (final: prev: {
|
||||||
# use python3.9, which works because of cython somehow?
|
# use python3.9, which works because of cython somehow?
|
||||||
kpcli-py = final.poetry2nix.mkPoetryApplication {
|
kpcli-py = final.poetry2nix.mkPoetryApplication {
|
||||||
|
@ -22,7 +21,8 @@ let
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
kpcli = super.kpcli.overridePythonAttrs (old: {
|
kpcli = super.kpcli.overridePythonAttrs (old: {
|
||||||
buildInputs = (old.buildInputs or [ ]) ++ [ self.setuptools ];
|
buildInputs = (old.buildInputs or [ ]) ++ [self.setuptools];
|
||||||
|
src = old.src;
|
||||||
});
|
});
|
||||||
|
|
||||||
# ubersmith = super.ubersmith.overridePythonAttrs (old: {
|
# ubersmith = super.ubersmith.overridePythonAttrs (old: {
|
||||||
|
@ -53,8 +53,7 @@ let
|
||||||
# https://rust-lang.github.io/rustup/concepts/profiles.html
|
# https://rust-lang.github.io/rustup/concepts/profiles.html
|
||||||
rust-default-components = [ "rust-docs" "rustfmt" "clippy" ];
|
rust-default-components = [ "rust-docs" "rustfmt" "clippy" ];
|
||||||
rust-dev-components = rust-default-components ++ [ "rust-src" "rust-analyzer" "miri" ];
|
rust-dev-components = rust-default-components ++ [ "rust-src" "rust-analyzer" "miri" ];
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
rust4devs = nightlyRustWithExts rust-dev-components;
|
rust4devs = nightlyRustWithExts rust-dev-components;
|
||||||
rust4cargo = nightlyRustWithExts [ ];
|
rust4cargo = nightlyRustWithExts [ ];
|
||||||
rust4normi = nightlyRustWithExts rust-default-components;
|
rust4normi = nightlyRustWithExts rust-default-components;
|
||||||
|
@ -64,8 +63,7 @@ let
|
||||||
inherit (flake_input.nickel.packages.${system})
|
inherit (flake_input.nickel.packages.${system})
|
||||||
lsp-nls nickel nickelWasm;
|
lsp-nls nickel nickelWasm;
|
||||||
});
|
});
|
||||||
in
|
in [
|
||||||
[
|
|
||||||
nix-boost.overlays.default
|
nix-boost.overlays.default
|
||||||
nixgl.overlays.default
|
nixgl.overlays.default
|
||||||
rust-overlay.overlays.default
|
rust-overlay.overlays.default
|
||||||
|
|
Loading…
Reference in New Issue