Compare commits

...

54 Commits

Author SHA1 Message Date
htran 331183b182 nixr: nix repl that loads .repl.nix 2023-10-21 14:13:19 -07:00
htran e4ae633a1d feat: mkDeprecate, tex math conceal, more zen, spellcheck, show pids 2023-10-21 11:26:56 -07:00
htran eef0fdcd14 feat: update everything, congratz on having your first change on nixpkgs merged Hung 2023-10-17 16:16:42 -07:00
htran a2f0cc9ff4 fix: add py and nodejs interps to neovim, this allows pyright to be happy via Mason 2023-10-05 11:31:23 -07:00
htran 6a5d2b9358 fix: integrate with pyright, need to use mason to force `pyright` to respect $PATH 2023-10-04 00:00:11 -07:00
htran 86f1880748 Merge branch 'docs-cook-book' into bleed 2023-10-02 11:01:19 -07:00
htran cb286b897d Merge branch 'fix-telescope-select-drop' into bleed 2023-10-02 10:58:19 -07:00
htran c893e567a1 Merge branch 'telescope-reuse-window' into bleed 2023-10-02 10:57:23 -07:00
htran e31481c537 docs: add cookbook 2023-10-02 02:27:22 -07:00
htran 6bd858ae4f Merge branch 'telescope-reuse-window' into bleed 2023-09-30 23:21:18 -07:00
htran 8246e8eb93 feat: reuse window
https://github.com/nvim-telescope/telescope.nvim/issues/2188\#issuecomment-1516861881
2023-09-30 23:19:34 -07:00
htran df60611a0c feat: reuse window
https://github.com/nvim-telescope/telescope.nvim/issues/2188\#issuecomment-1516861881
2023-09-30 23:15:51 -07:00
htran 2dd2ae2c08 ref: git lola and git lol as git plugins for ease of shipping 2023-09-30 21:49:13 -07:00
htran 75ba98e276 feat: git-worktree; fix: htran should work, kpxc sadge 2023-09-30 21:03:22 -07:00
htran bcc7f68c1e feat(nvim): +git-worktree 2023-09-29 18:33:38 -07:00
pegasust 8033f1f90c feat: +hlargs back again 2023-09-29 18:03:58 -07:00
pegasust 7f87490ce0 Merge pull request 'plugins-need-update' (#20) from plugins-need-update into bleed
Reviewed-on: #20
2023-09-25 05:06:03 +00:00
pegasust fbbbd6510e feat: git-lola and git-lol now has time 2023-09-24 22:01:51 -07:00
pegasust da666d64b2 fix: make lspconfig bareable 2023-09-24 17:18:28 -07:00
pegasust c43c27f5dd bug: there's also :LspInfo that is outdated 2023-09-24 16:03:12 -07:00
pegasust b5b08fdfd9 fix: neovim nightly works on aarch64-darwin 2023-09-24 15:32:47 -07:00
pegasust 15d0f85f90 feat(nvim+nix): update statically installed plugins 2023-09-24 02:06:11 -07:00
pegasust 3c8c707cb8 fix: exa is unmaintained -> eza 2023-09-24 01:46:32 -07:00
pegasust eb6142e06f feat(nvim): harpoon + telescope multi-select
- Give my gist some love https://gist.github.com/Pegasust/364b123b40dfc36cd113ae9526f83904
2023-09-24 00:51:21 -07:00
pegasust 33a164ba98 feat(nvim): telescope live-args 2023-09-24 00:51:18 -07:00
htran 122693e9c8 feat: done messing around with firacode, looks so much better now 2023-09-22 18:17:13 -07:00
htran 9405373bc8 feat: more ssh hosts 2023-09-22 16:53:40 -07:00
htran ffe82f65f8 feat: ssh huaweil3 matching correctly 2023-09-01 12:20:38 -07:00
pegasust f969912c08 flake lock 2023-08-01 00:36:14 -07:00
pegasust 7b5a6cfa94 feat(pixi): some repl around, cannot match heic with mov 2023-08-01 00:35:06 -07:00
htran 8ba20cbc56 fix: gh ssh hostname 2023-07-29 16:28:00 -07:00
htran 6ba1836a03 add gh shortform 2023-07-29 16:23:31 -07:00
htran c87dba3422 patch latest 2023-07-25 13:26:29 -07:00
pegasust fd4ff2cbbc plugin intelligence 2023-07-25 13:24:49 -07:00
pegasust 7914c40d91 gopls 2023-07-22 01:37:24 -07:00
pegasust 5f5439d793 forgorr to invoke lspconfig 2023-07-21 00:56:04 -07:00
pegasust 4ae426dbad forgorr to add setup logic 2023-07-21 00:51:35 -07:00
pegasust b83f698dc4 add gopls please 2023-07-21 00:49:04 -07:00
pegasust 7c4b7d0db6 fix(nvim): nil_ls uses lspconfig instead of mason-lspconfig 2023-07-10 02:08:36 -07:00
htran 22a78899ed feat: add nix configs for data collections 2023-07-08 20:43:20 -07:00
htran 5b61ab39f9 feat(nvim): nil_ls is now registered, but not ensure_installed from mason 2023-07-08 18:28:13 -07:00
htran e13cd11a68 untested - rclone 2023-07-07 00:43:18 -07:00
htran 187890cc9b add keepassxc 2023-07-07 00:43:14 -07:00
htran b8abf4e3dd bump 2023-07-04 01:43:44 -07:00
htran a2619bf71a fix: ssh looks at me funny and says 'i dont know what xterm-kitty is' 2023-06-23 09:44:02 -07:00
htran 74a0ef58c4 feat: more ssh 2023-06-23 01:29:26 -07:00
htran 0208a946f2 feat: real tab title template hacker mode 2023-06-23 01:13:06 -07:00
htran c2b5908fa5 kitty as my main terminal now 2023-06-22 23:36:52 -07:00
htran 83c2b01570 ^std breaking change 2023-06-22 20:52:40 -07:00
htran ab8e04f3a0 add sg-nvim (cody!) 2023-06-22 10:34:20 -07:00
htran eb91f32d53 move 2023-06-20 14:10:00 -07:00
htran 0dd6558770 doc: reason for removal of mickael-menu/zk 2023-06-18 04:37:00 -07:00
htran f04fea60d2 remove mickael-menu/zk 2023-06-18 04:22:11 -07:00
htran 024e8530d0 alejandra fmt and some cleanup 2023-06-18 02:51:33 -07:00
66 changed files with 3275 additions and 3816 deletions

21
.envrc
View File

@ -1,16 +1,11 @@
#! /bin/sh #!/bin/sh
source "$( # first time
nix eval \ if [[ ! -d $(nix store add-path --name source --dry-run .) ]]; then
--no-update-lock-file \ nix store add-path --name source .
--no-write-lock-file \ fi
--no-warn-dirty \
--accept-flake-config \
.#__std.direnv_lib 2>/dev/null \
|| nix eval .#__std.direnv_lib # show the errors
)"
# FIXME: This should check if $USER is in userShells, if not,
# fall back to `use nix`
use std nix "//repo/userShells:${USER}"
# shellcheck disable=SC1090
. "$(fetchurl "https://raw.githubusercontent.com/paisano-nix/direnv/bd36f51b9d566d8a36e230dab638abf3074625c3/lib" "sha256-IgQhKK7UHL1AfCUntJO2KCaIDJQotRnK2qC4Daxk+wI=")"
use envreload "//repo/userShells/${USER}" //repo/userShells/default //repo/userShells

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
result result
.direnv .direnv
.data

View File

@ -1,7 +1,10 @@
{ {
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json", "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
"Lua.diagnostics.globals": [ "Lua.diagnostics.globals": [
"vim", "vim"
],
"workspace.library": [
], ],
"Lua.workspace.checkThirdParty": false "Lua.workspace.checkThirdParty": false
} }

5
.repl.nix Normal file
View File

@ -0,0 +1,5 @@
# usage: `nix repl --file .repl.nix`
rec {
pkgs = import <nixpkgs> {};
inherit (pkgs) lib;
}

View File

@ -53,6 +53,9 @@ via writing and typing.
I am in the process of moving away from Obsidian so that I can write ZK notes I am in the process of moving away from Obsidian so that I can write ZK notes
text-editor agnostically. text-editor agnostically.
#### mickael-menu/zk
- Config file: `zk/config.toml` - Config file: `zk/config.toml`
- Command: `ln [-s] $PWD/zk/config.toml ~/.config/zk/config.toml` - Command: `ln [-s] $PWD/zk/config.toml ~/.config/zk/config.toml`
@ -62,6 +65,18 @@ text-editor agnostically.
Note (2023-06-07): I'm now using a mix of nvim-zk with Notion. I'm still figuring out Note (2023-06-07): I'm now using a mix of nvim-zk with Notion. I'm still figuring out
a centralize place to put my notes and use it to do some knowledge graph magic a centralize place to put my notes and use it to do some knowledge graph magic
NOTE (2023-06-18): I used `mickael-menu/zk` for some time, but have found myself
resort to notion due to the need for easier linking (just copy-paste onto
selected note) where as I need to:
- `cS]` to encapsulate the selection with `[]`, then do `(<C-v>`. Too many keystrokes.
On retrospect, I could probably remap this workflow to `<LocalLeader>el"`:
Though, I want to just develop my own solution with
[`nucliadb`](https://github.com/nuclia/nucliadb) and
[`h2ogpt`](https://github.com/h2oai/h2ogpt)
## Troubleshoots ## Troubleshoots
### My MacOS just updated, `nix` is no-longer here ### My MacOS just updated, `nix` is no-longer here

1
dev/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
__pycache__

101
dev/pixi/poetry.lock generated Normal file
View File

@ -0,0 +1,101 @@
# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand.
[[package]]
name = "colorama"
version = "0.4.6"
description = "Cross-platform colored terminal text."
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
files = [
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
]
[[package]]
name = "exceptiongroup"
version = "1.1.2"
description = "Backport of PEP 654 (exception groups)"
optional = false
python-versions = ">=3.7"
files = [
{file = "exceptiongroup-1.1.2-py3-none-any.whl", hash = "sha256:e346e69d186172ca7cf029c8c1d16235aa0e04035e5750b4b95039e65204328f"},
{file = "exceptiongroup-1.1.2.tar.gz", hash = "sha256:12c3e887d6485d16943a309616de20ae5582633e0a2eda17f4e10fd61c1e8af5"},
]
[package.extras]
test = ["pytest (>=6)"]
[[package]]
name = "iniconfig"
version = "2.0.0"
description = "brain-dead simple config-ini parsing"
optional = false
python-versions = ">=3.7"
files = [
{file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"},
{file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},
]
[[package]]
name = "packaging"
version = "23.1"
description = "Core utilities for Python packages"
optional = false
python-versions = ">=3.7"
files = [
{file = "packaging-23.1-py3-none-any.whl", hash = "sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61"},
{file = "packaging-23.1.tar.gz", hash = "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"},
]
[[package]]
name = "pluggy"
version = "1.2.0"
description = "plugin and hook calling mechanisms for python"
optional = false
python-versions = ">=3.7"
files = [
{file = "pluggy-1.2.0-py3-none-any.whl", hash = "sha256:c2fd55a7d7a3863cba1a013e4e2414658b1d07b6bc57b3919e0c63c9abb99849"},
{file = "pluggy-1.2.0.tar.gz", hash = "sha256:d12f0c4b579b15f5e054301bb226ee85eeeba08ffec228092f8defbaa3a4c4b3"},
]
[package.extras]
dev = ["pre-commit", "tox"]
testing = ["pytest", "pytest-benchmark"]
[[package]]
name = "pytest"
version = "7.4.0"
description = "pytest: simple powerful testing with Python"
optional = false
python-versions = ">=3.7"
files = [
{file = "pytest-7.4.0-py3-none-any.whl", hash = "sha256:78bf16451a2eb8c7a2ea98e32dc119fd2aa758f1d5d66dbf0a59d69a3969df32"},
{file = "pytest-7.4.0.tar.gz", hash = "sha256:b4bf8c45bd59934ed84001ad51e11b4ee40d40a1229d2c79f9c592b0a3f6bd8a"},
]
[package.dependencies]
colorama = {version = "*", markers = "sys_platform == \"win32\""}
exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
iniconfig = "*"
packaging = "*"
pluggy = ">=0.12,<2.0"
tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""}
[package.extras]
testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
[[package]]
name = "tomli"
version = "2.0.1"
description = "A lil' TOML parser"
optional = false
python-versions = ">=3.7"
files = [
{file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
]
[metadata]
lock-version = "2.0"
python-versions = "^3.10"
content-hash = "1cf751550a88abe6c6ea8896fe41073f08488ebbd3fb959572a2038d4d944ebc"

20
dev/pixi/pyproject.toml Normal file
View File

@ -0,0 +1,20 @@
[tool.poetry]
name = "pixi"
version = "0.0.1"
description = "Toy project to investigate about apple photos synced iphone -> mac"
authors = ["Pegasust <pegasucksgg@gmail.com>"]
readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
[tool.poetry.group.dev.dependencies]
pytest = "^7.3.1"
[[tool.poetry.packages]]
include = "repl"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

View File

@ -0,0 +1,118 @@
#!/usr/bin/env python
"""
REPL-friendly python mono-module for importing and execution singleton
"""
import os
from dataclasses import dataclass
from itertools import groupby
from typing import Iterable
mac_photos = os.getenv("MAC_PHOTOS_PATH", default="mac_photos")
@dataclass(slots=True, frozen=True)
class PhotosKExt:
name: str
parent: tuple[str, ...]
exts_lowered: tuple[str, ...]
@classmethod
def from_root_file(cls, root: str, filename: str):
ext_elems = filename.split('.')
return cls(
name=ext_elems[0],
parent=os.path.split(root),
exts_lowered=tuple(
ext.lower() for ext in ext_elems[1:]
)
)
@dataclass(slots=True, frozen=True)
class PhotosKey:
filename: str
parent: tuple[str, ...]
@classmethod
def from_key_ext(cls, ext: PhotosKExt):
return cls(filename=ext.name, parent=ext.parent)
@dataclass(slots=True)
class PhotosValue:
exts: dict[str, list[str]]
def heic_paths(self) -> list[str]:
return self.exts.get("heic", list())
def mov_paths(self) -> list[str]:
return self.exts.get("mov", list())
def candidate_exts(file_exts: Iterable[PhotosKExt]):
"""
>>> {ext: len(files)for ext, files in cexts.items()}
stdout> {... 'mov': 2769, 'heic': 2354 ...}
We could make a bold guess that iPhone 11 stores both `heic` and `mov`
for materialized best capture and live movie for live capture.
"""
exts_rv: dict[str, list[PhotosKExt]] = dict()
for file in file_exts:
for ext in file.exts_lowered:
exts_rv.setdefault(ext, list()).append(file)
return exts_rv
def file_exts(photos_dir: str = mac_photos):
return {
PhotosKExt.from_root_file(filename=file, root=root)
for root, _, files in os.walk(photos_dir, followlinks=True)
for file in files
}
def photos_exts(files_with_ext: Iterable[PhotosKExt]):
return {
k: list(v)
for k, v in groupby(files_with_ext, key=lambda x: (x.name, x.parent))
}
def main():
fexts = file_exts()
cexts = candidate_exts(fexts)
print(f"{photos_exts(fexts)=}")
print(f"{cexts=}")
ext_counts = {ext: len(files)for ext, files in cexts.items()}
print(ext_counts)
# stdout>
"""
{'jpeg': 6023, 'mov': 2769, 'heic': 2354, 'thm': 197, 'png': 168, 'plist': 163,
'log': 1, 'aae': 102, 'kgdb': 3, 'mp4': 26, 'data': 3, 'db': 3, 'xml': 26,
'cmap': 2, 'plj': 16, 'kgdb-wal': 3, 'sqlite-shm': 11, 'cloudphotodb-wal': 1,
'kgdb-shm': 3, '00001]': 1, 'frag': 2, 'ithmb': 3, 'sqlite': 15, 'lock': 1,
'sqlite-wal': 11, 'aoi': 3, '0': 1,
'm3u8-8f37dbfb-b3a6-4d52-beca-d17aaed01606': 2, 'jpg': 2, 'roi': 3, 'poi': 3,
'db-shm': 1, 'm3u8-37f64716-0b2d-4a82-854a-5a6c78ce505a': 1, 'descriptor': 3,
'bin': 2, 'm3u8': 5, 'cloudphotodb': 1, 'db-wal': 1, 'nature': 3,
'm3u8-d8faad08-4fcc-4161-a600-1562d755c97b': 1, 'initfrag': 2, '20201]': 1,
'cloudphotodb-shm': 1}
"""
movs = cexts['mov']
heics = cexts['heic']
heic_name_set = {heic.name.lower() for heic in heics}
mov_name_set = {mov.name.lower() for mov in movs}
print(len(heic_name_set - mov_name_set) - len(heic_name_set))
# stdout> (not 0)
# Hence, we are not able to match `.heic` with its `.mov` with just names
# Could it be that the `.heic` also contains the high-quality live?
if __name__ == "__main__":
main()

View File

@ -0,0 +1,9 @@
# Local nixlib in `nix repl`
Pretty useful for airplane-driven development
```console
nixlib = import <nixpkgs/lib>
nix-repl> nixlib.genAttrs
«lambda @ /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/attrsets.nix:619:5»
```

View File

@ -3,7 +3,7 @@
The current [`scripts/vim.dsl`](../scripts/vim.dsl) grabs the upstream supported vim plugins The current [`scripts/vim.dsl`](../scripts/vim.dsl) grabs the upstream supported vim plugins
onto a sqlite database to be stored in memory. We could perform some data exploration via this database onto a sqlite database to be stored in memory. We could perform some data exploration via this database
## Explore which plugins should be added to `neovim.nix` ## Example: Explore which plugins should be added to `neovim.nix`
Gather list of plugins need to be added. This can be done simply by adding Gather list of plugins need to be added. This can be done simply by adding
a print statement on `WPlug` in `../native_configs/neovim/init.lua` then run neovim a print statement on `WPlug` in `../native_configs/neovim/init.lua` then run neovim

1493
flake.lock

File diff suppressed because it is too large Load Diff

View File

@ -7,17 +7,18 @@
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 = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-latest.url = "github:nixos/nixpkgs"; # nixpkgs-latest.url = "github:nixos/nixpkgs";
deploy-rs.url = "github:serokell/deploy-rs"; # deploy-rs.url = "github:serokell/deploy-rs";
std.url = "github:divnix/std"; std = {
url = "github:divnix/std";
inputs.devshell.url = "github:numtide/devshell";
};
home-manager = { home-manager = {
url = "github:nix-community/home-manager"; url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
neovim-nightly-overlay = { neovim-nightly-overlay = {
# need to pin this until darwin build is successful again. url = "github:nix-community/neovim-nightly-overlay";
url = "github:nix-community/neovim-nightly-overlay?rev=88a6c749a7d126c49f3374f9f28ca452ea9419b8";
inputs.nixpkgs.follows = "nixpkgs";
}; };
nix-boost = { nix-boost = {
url = "git+https://git.pegasust.com/pegasust/nix-boost?ref=bleed"; url = "git+https://git.pegasust.com/pegasust/nix-boost?ref=bleed";
@ -29,42 +30,54 @@
nix-index-database = { nix-index-database = {
url = "github:mic92/nix-index-database"; url = "github:mic92/nix-index-database";
# Should show the latest nixpkgs whenever possible # Should show the latest nixpkgs whenever possible
inputs.nixpkgs.follows = "nixpkgs-latest"; inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs-vimplugins.url = "github:GaetanLepage/nixpkgs/vim-plugins-update";
sg-nvim = {
url = "git+https://github.com/pegasust/sg.nvim?ref=sg-cody-discover";
}; };
}; };
outputs = {self, std, ...} @ inputs: outputs = {
self,
std,
...
} @ inputs:
std.growOn std.growOn
{ {
# boilerplate # boilerplate
inherit inputs; inherit inputs;
# All cell blocks are under ./nix/cells/<cell>/<cellblock> as `<cellblock>.nix` # All cell blocks are under ./nix/<cell>/<cellblock> as `<cellblock>.nix`
# or `<cellblock/default.nix` # or `<cellblock/default.nix`
cellsFrom = ./nix/cells; cellsFrom = ./nix;
# modules = ./nix/modules; # modules = ./nix/modules;
cellBlocks = let cellBlocks = let
inherit (std.blockTypes) devshells functions anything installables; inherit (std.blockTypes) devshells functions anything installables runnables;
in [ in [
(installables "shells")
(devshells "devshells") (devshells "devshells")
(devshells "userShells") (devshells "userShells")
(functions "home-profiles") (functions "home-profiles")
(functions "home-modules") (functions "home-modules")
(anything "home-configs") (anything "home-configs")
(installables "packages") (installables "packages")
(anything "lib") (anything "lib")
(runnables "formatter")
]; ];
} }
{ {
devShells = std.harvest self [["dotfiles" "devshells"]]; devShells = std.harvest self [["dotfiles" "devshells"] ["dev" "shells"]];
# nixosConfigurations = std.pick [ [ "dotfiles" "nixos" ] ];
# homeConfigurations = std.pick [ [ "dotfiles" "home" ] ];
homeModules = std.pick self [["repo" "home-modules"]]; homeModules = std.pick self [["repo" "home-modules"]];
packages = std.harvest self [["repo" "packages"]]; packages = std.harvest self [
["repo" "packages"]
["dev" "packages"]
];
legacyPackages = std.harvest self [["repo" "home-configs"]]; legacyPackages = std.harvest self [["repo" "home-configs"]];
lib = std.pick self [["repo" "lib"]]; lib = std.pick self [["repo" "lib"]];
# TODO: Debug only # TODO: Debug only
homeProfiles = std.pick self [["repo" "home-profiles"]]; homeProfiles = std.pick self [["repo" "home-profiles"]];
formatter = std.harvest self [["repo" "formatter"]];
}; };
} }

29
hello.tex Normal file
View File

@ -0,0 +1,29 @@
\documentclass{article}
\begin{document}
\section{Sample LaTeX Document with Math Symbols}
Here are some math symbols and commands:
1. Infinity: $\infty$
2. Element of: $a \in A$
3. Angle: $\angle ABC$
4. Approximation: $a \approx b$
5. Union: $A \cup B$
6. Intersection: $A \cap B$
7. Big union: $\bigcup_{i=1}^{n} A_i$
8. Big intersection: $\bigcap_{i=1}^{n} A_i$
9. Down arrow: $\downarrow$
10. Double down arrow: $\Downarrow$
11. Copyright symbol: $\copyright$
12. Quadruple space: $a \qquad b$
13. Empty set: $\emptyset$
14. Aleph symbol: $\aleph$
15. Product: $\prod_{i=1}^{n} a_i$
16. Integration: $\int f(x) \, dx$
17. Clubsuit: $\clubsuit$
18. dot: $\dot{B}$
\end{document}

1
mac_photos Symbolic link
View File

@ -0,0 +1 @@
/Users/hungtran/Pictures/Photos Library.photoslibrary

View File

@ -15,99 +15,99 @@
# environment variables. Some entries may override variables # environment variables. Some entries may override variables
# set by alacritty itself. # set by alacritty itself.
#env: #env:
# TERM variable # TERM variable
# #
# This value is used to set the `$TERM` environment variable for # This value is used to set the `$TERM` environment variable for
# each instance of Alacritty. If it is not present, alacritty will # each instance of Alacritty. If it is not present, alacritty will
# check the local terminfo database and use `alacritty` if it is # check the local terminfo database and use `alacritty` if it is
# available, otherwise `xterm-256color` is used. # available, otherwise `xterm-256color` is used.
#TERM: alacritty #TERM: alacritty
#window: #window:
# Window dimensions (changes require restart) # Window dimensions (changes require restart)
# #
# Number of lines/columns (not pixels) in the terminal. Both lines and columns # Number of lines/columns (not pixels) in the terminal. Both lines and columns
# must be non-zero for this to take effect. The number of columns must be at # must be non-zero for this to take effect. The number of columns must be at
# least `2`, while using a value of `0` for columns and lines will fall back # least `2`, while using a value of `0` for columns and lines will fall back
# to the window manager's recommended size # to the window manager's recommended size
#dimensions: #dimensions:
# columns: 0 # columns: 0
# lines: 0 # lines: 0
# Window position (changes require restart) # Window position (changes require restart)
# #
# Specified in number of pixels. # Specified in number of pixels.
# If the position is not set, the window manager will handle the placement. # If the position is not set, the window manager will handle the placement.
#position: #position:
# x: 0 # x: 0
# y: 0 # y: 0
# Window padding (changes require restart) # Window padding (changes require restart)
# #
# Blank space added around the window in pixels. This padding is scaled # Blank space added around the window in pixels. This padding is scaled
# by DPI and the specified value is always added at both opposing sides. # by DPI and the specified value is always added at both opposing sides.
#padding: #padding:
# x: 0 # x: 0
# y: 0 # y: 0
# Spread additional padding evenly around the terminal content. # Spread additional padding evenly around the terminal content.
#dynamic_padding: false #dynamic_padding: false
# Window decorations # Window decorations
# #
# Values for `decorations`: # Values for `decorations`:
# - full: Borders and title bar # - full: Borders and title bar
# - none: Neither borders nor title bar # - none: Neither borders nor title bar
# #
# Values for `decorations` (macOS only): # Values for `decorations` (macOS only):
# - transparent: Title bar, transparent background and title bar buttons # - transparent: Title bar, transparent background and title bar buttons
# - buttonless: Title bar, transparent background and no title bar buttons # - buttonless: Title bar, transparent background and no title bar buttons
#decorations: full #decorations: full
# Background opacity # Background opacity
# #
# Window opacity as a floating point number from `0.0` to `1.0`. # Window opacity as a floating point number from `0.0` to `1.0`.
# The value `0.0` is completely transparent and `1.0` is opaque. # The value `0.0` is completely transparent and `1.0` is opaque.
#opacity: 1.0 #opacity: 1.0
# Startup Mode (changes require restart) # Startup Mode (changes require restart)
# #
# Values for `startup_mode`: # Values for `startup_mode`:
# - Windowed # - Windowed
# - Maximized # - Maximized
# - Fullscreen # - Fullscreen
# #
# Values for `startup_mode` (macOS only): # Values for `startup_mode` (macOS only):
# - SimpleFullscreen # - SimpleFullscreen
#startup_mode: Windowed #startup_mode: Windowed
# Window title # Window title
#title: Alacritty #title: Alacritty
# Allow terminal applications to change Alacritty's window title. # Allow terminal applications to change Alacritty's window title.
#dynamic_title: true #dynamic_title: true
# Window class (Linux/BSD only): # Window class (Linux/BSD only):
#class: #class:
# Application instance name # Application instance name
#instance: Alacritty #instance: Alacritty
# General application class # General application class
#general: Alacritty #general: Alacritty
# Decorations theme variant (Linux/BSD only) # Decorations theme variant (Linux/BSD only)
# #
# Override the variant of the GTK theme/Wayland client side decorations. # Override the variant of the GTK theme/Wayland client side decorations.
# Commonly supported values are `dark` and `light`. Set this to `None` to use # Commonly supported values are `dark` and `light`. Set this to `None` to use
# the default theme variant. # the default theme variant.
#decorations_theme_variant: None #decorations_theme_variant: None
#scrolling: #scrolling:
# Maximum number of lines in the scrollback buffer. # Maximum number of lines in the scrollback buffer.
# Specifying '0' will disable scrolling. # Specifying '0' will disable scrolling.
#history: 10000 #history: 10000
# Scrolling distance multiplier. # Scrolling distance multiplier.
#multiplier: 3 #multiplier: 3
# Font configuration # Font configuration
font: font:
@ -120,12 +120,11 @@ font:
# - (Linux/BSD) monospace # - (Linux/BSD) monospace
# - (Windows) Consolas # - (Windows) Consolas
family: DroidSansMono NF family: DroidSansMono NF
# The `style` can be specified to pick a specific face. # The `style` can be specified to pick a specific face.
#style: Regular #style: Regular
# Bold font face # Bold font face
#bold: #bold:
# Font family # Font family
# #
# If the bold family is not specified, it will fall back to the # If the bold family is not specified, it will fall back to the
@ -135,8 +134,8 @@ font:
# The `style` can be specified to pick a specific face. # The `style` can be specified to pick a specific face.
#style: Bold #style: Bold
# Italic font face # Italic font face
#italic: #italic:
# Font family # Font family
# #
# If the italic family is not specified, it will fall back to the # If the italic family is not specified, it will fall back to the
@ -146,8 +145,8 @@ font:
# The `style` can be specified to pick a specific face. # The `style` can be specified to pick a specific face.
#style: Italic #style: Italic
# Bold italic font face # Bold italic font face
#bold_italic: #bold_italic:
# Font family # Font family
# #
# If the bold italic family is not specified, it will fall back to the # If the bold italic family is not specified, it will fall back to the
@ -157,9 +156,8 @@ font:
# The `style` can be specified to pick a specific face. # The `style` can be specified to pick a specific face.
#style: Bold Italic #style: Bold Italic
# Point size # Point size
size: 7.0 size: 7.0
# Offset is the extra space around each character. `offset.y` can be thought # Offset is the extra space around each character. `offset.y` can be thought
# of as modifying the line spacing, and `offset.x` as modifying the letter # of as modifying the line spacing, and `offset.x` as modifying the letter
# spacing. # spacing.
@ -181,24 +179,24 @@ font:
# #
#builtin_box_drawing: true #builtin_box_drawing: true
# If `true`, bold text is drawn using the bright color variants. # If `true`, bold text is drawn using the bright color variants.
#draw_bold_text_with_bright_colors: false #draw_bold_text_with_bright_colors: false
# Colors (Tomorrow Night) # Colors (Tomorrow Night)
#colors: #colors:
# Default colors # Default colors
#primary: #primary:
# background: '#1d1f21' # background: '#1d1f21'
# foreground: '#c5c8c6' # foreground: '#c5c8c6'
# Bright and dim foreground colors # Bright and dim foreground colors
# #
# The dimmed foreground color is calculated automatically if it is not # The dimmed foreground color is calculated automatically if it is not
# present. If the bright foreground color is not set, or # present. If the bright foreground color is not set, or
# `draw_bold_text_with_bright_colors` is `false`, the normal foreground # `draw_bold_text_with_bright_colors` is `false`, the normal foreground
# color will be used. # color will be used.
#dim_foreground: '#828482' #dim_foreground: '#828482'
#bright_foreground: '#eaeaea' #bright_foreground: '#eaeaea'
# Cursor colors # Cursor colors
# #
@ -224,32 +222,32 @@ font:
# #
# Colors used for the search bar and match highlighting. # Colors used for the search bar and match highlighting.
#search: #search:
# Allowed values are CellForeground/CellBackground, which reference the # Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff. # affected cell, or hexadecimal colors like #ff00ff.
#matches: #matches:
# foreground: '#000000' # foreground: '#000000'
# background: '#ffffff' # background: '#ffffff'
#focused_match: #focused_match:
# foreground: '#ffffff' # foreground: '#ffffff'
# background: '#000000' # background: '#000000'
# Keyboard hints # Keyboard hints
#hints: #hints:
# First character in the hint label # First character in the hint label
# #
# Allowed values are CellForeground/CellBackground, which reference the # Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff. # affected cell, or hexadecimal colors like #ff00ff.
#start: #start:
# foreground: '#1d1f21' # foreground: '#1d1f21'
# background: '#e9ff5e' # background: '#e9ff5e'
# All characters after the first one in the hint label # All characters after the first one in the hint label
# #
# Allowed values are CellForeground/CellBackground, which reference the # Allowed values are CellForeground/CellBackground, which reference the
# affected cell, or hexadecimal colors like #ff00ff. # affected cell, or hexadecimal colors like #ff00ff.
#end: #end:
# foreground: '#e9ff5e' # foreground: '#e9ff5e'
# background: '#1d1f21' # background: '#1d1f21'
# Line indicator # Line indicator
# #
@ -333,10 +331,10 @@ font:
# regardless of their background color. # regardless of their background color.
#transparent_background_colors: false #transparent_background_colors: false
# Bell # Bell
# #
# The bell is rung every time the BEL control character is received. # The bell is rung every time the BEL control character is received.
#bell: #bell:
# Visual Bell Animation # Visual Bell Animation
# #
# Animation effect for flashing the screen when the visual bell is rung. # Animation effect for flashing the screen when the visual bell is rung.
@ -374,7 +372,7 @@ font:
# #
#command: None #command: None
#selection: #selection:
# This string contains all characters that are used as separators for # This string contains all characters that are used as separators for
# "semantic words" in Alacritty. # "semantic words" in Alacritty.
#semantic_escape_chars: ",│`|:\"' ()[]{}<>\t" #semantic_escape_chars: ",│`|:\"' ()[]{}<>\t"
@ -382,25 +380,25 @@ font:
# When set to `true`, selected text will be copied to the primary clipboard. # When set to `true`, selected text will be copied to the primary clipboard.
#save_to_clipboard: false #save_to_clipboard: false
#cursor: #cursor:
# Cursor style # Cursor style
#style: #style:
# Cursor shape # Cursor shape
# #
# Values for `shape`: # Values for `shape`:
# - ▇ Block # - ▇ Block
# - _ Underline # - _ Underline
# - | Beam # - | Beam
#shape: Block #shape: Block
# Cursor blinking state # Cursor blinking state
# #
# Values for `blinking`: # Values for `blinking`:
# - Never: Prevent the cursor from ever blinking # - Never: Prevent the cursor from ever blinking
# - Off: Disable blinking by default # - Off: Disable blinking by default
# - On: Enable blinking by default # - On: Enable blinking by default
# - Always: Force the cursor to always blink # - Always: Force the cursor to always blink
#blinking: Off #blinking: Off
# Vi mode cursor style # Vi mode cursor style
# #
@ -426,36 +424,36 @@ font:
# from `0.0` to `1.0`. # from `0.0` to `1.0`.
#thickness: 0.15 #thickness: 0.15
# Live config reload (changes require restart) # Live config reload (changes require restart)
#live_config_reload: true #live_config_reload: true
# Shell # Shell
# #
# You can set `shell.program` to the path of your favorite shell, e.g. # You can set `shell.program` to the path of your favorite shell, e.g.
# `/bin/fish`. Entries in `shell.args` are passed unmodified as arguments to the # `/bin/fish`. Entries in `shell.args` are passed unmodified as arguments to the
# shell. # shell.
# #
# Default: # Default:
# - (Linux/BSD/macOS) `$SHELL` or the user's login shell, if `$SHELL` is unset # - (Linux/BSD/macOS) `$SHELL` or the user's login shell, if `$SHELL` is unset
# - (Windows) powershell # - (Windows) powershell
#shell: #shell:
# program: /bin/bash # program: /bin/bash
# args: # args:
# - --login # - --login
# Startup directory # Startup directory
# #
# Directory the shell is started in. If this is unset, or `None`, the working # Directory the shell is started in. If this is unset, or `None`, the working
# directory of the parent process will be used. # directory of the parent process will be used.
#working_directory: None #working_directory: None
# Send ESC (\x1b) before characters when alt is pressed. # Send ESC (\x1b) before characters when alt is pressed.
#alt_send_esc: true #alt_send_esc: true
# Offer IPC using `alacritty msg` (unix only) # Offer IPC using `alacritty msg` (unix only)
# ipc_socket: true # ipc_socket: true
#mouse: #mouse:
# Click settings # Click settings
# #
# The `double_click` and `triple_click` settings control the time # The `double_click` and `triple_click` settings control the time
@ -467,11 +465,11 @@ font:
# If this is `true`, the cursor is temporarily hidden when typing. # If this is `true`, the cursor is temporarily hidden when typing.
#hide_when_typing: false #hide_when_typing: false
# Hints # Hints
# #
# Terminal hints can be used to find text or hyperlink in the visible part of # Terminal hints can be used to find text or hyperlink in the visible part of
# the terminal and pipe it to other applications. # the terminal and pipe it to other applications.
#hints: #hints:
# Keys used for the hint labels. # Keys used for the hint labels.
#alphabet: "jfkdls;ahgurieowpq" #alphabet: "jfkdls;ahgurieowpq"
@ -517,247 +515,247 @@ font:
# key: U # key: U
# mods: Control|Shift # mods: Control|Shift
# Mouse bindings # Mouse bindings
# #
# Mouse bindings are specified as a list of objects, much like the key # Mouse bindings are specified as a list of objects, much like the key
# bindings further below. # bindings further below.
# #
# To trigger mouse bindings when an application running within Alacritty # To trigger mouse bindings when an application running within Alacritty
# captures the mouse, the `Shift` modifier is automatically added as a # captures the mouse, the `Shift` modifier is automatically added as a
# requirement. # requirement.
# #
# Each mouse binding will specify a: # Each mouse binding will specify a:
# #
# - `mouse`: # - `mouse`:
# #
# - Middle # - Middle
# - Left # - Left
# - Right # - Right
# - Numeric identifier such as `5` # - Numeric identifier such as `5`
# #
# - `action` (see key bindings for actions not exclusive to mouse mode) # - `action` (see key bindings for actions not exclusive to mouse mode)
# #
# - Mouse exclusive actions: # - Mouse exclusive actions:
# #
# - ExpandSelection # - ExpandSelection
# Expand the selection to the current mouse cursor location. # Expand the selection to the current mouse cursor location.
# #
# And optionally: # And optionally:
# #
# - `mods` (see key bindings) # - `mods` (see key bindings)
#mouse_bindings: #mouse_bindings:
# - { mouse: Right, action: ExpandSelection } # - { mouse: Right, action: ExpandSelection }
# - { mouse: Right, mods: Control, action: ExpandSelection } # - { mouse: Right, mods: Control, action: ExpandSelection }
# - { mouse: Middle, mode: ~Vi, action: PasteSelection } # - { mouse: Middle, mode: ~Vi, action: PasteSelection }
# Key bindings # Key bindings
# #
# Key bindings are specified as a list of objects. For example, this is the # Key bindings are specified as a list of objects. For example, this is the
# default paste binding: # default paste binding:
# #
# `- { key: V, mods: Control|Shift, action: Paste }` # `- { key: V, mods: Control|Shift, action: Paste }`
# #
# Each key binding will specify a: # Each key binding will specify a:
# #
# - `key`: Identifier of the key pressed # - `key`: Identifier of the key pressed
# #
# - A-Z # - A-Z
# - F1-F24 # - F1-F24
# - Key0-Key9 # - Key0-Key9
# #
# A full list with available key codes can be found here: # A full list with available key codes can be found here:
# https://docs.rs/glutin/*/glutin/event/enum.VirtualKeyCode.html#variants # https://docs.rs/glutin/*/glutin/event/enum.VirtualKeyCode.html#variants
# #
# Instead of using the name of the keys, the `key` field also supports using # Instead of using the name of the keys, the `key` field also supports using
# the scancode of the desired key. Scancodes have to be specified as a # the scancode of the desired key. Scancodes have to be specified as a
# decimal number. This command will allow you to display the hex scancodes # decimal number. This command will allow you to display the hex scancodes
# for certain keys: # for certain keys:
# #
# `showkey --scancodes`. # `showkey --scancodes`.
# #
# Then exactly one of: # Then exactly one of:
# #
# - `chars`: Send a byte sequence to the running application # - `chars`: Send a byte sequence to the running application
# #
# The `chars` field writes the specified string to the terminal. This makes # The `chars` field writes the specified string to the terminal. This makes
# it possible to pass escape sequences. To find escape codes for bindings # it possible to pass escape sequences. To find escape codes for bindings
# like `PageUp` (`"\x1b[5~"`), you can run the command `showkey -a` outside # like `PageUp` (`"\x1b[5~"`), you can run the command `showkey -a` outside
# of tmux. Note that applications use terminfo to map escape sequences back # of tmux. Note that applications use terminfo to map escape sequences back
# to keys. It is therefore required to update the terminfo when changing an # to keys. It is therefore required to update the terminfo when changing an
# escape sequence. # escape sequence.
# #
# - `action`: Execute a predefined action # - `action`: Execute a predefined action
# #
# - ToggleViMode # - ToggleViMode
# - SearchForward # - SearchForward
# Start searching toward the right of the search origin. # Start searching toward the right of the search origin.
# - SearchBackward # - SearchBackward
# Start searching toward the left of the search origin. # Start searching toward the left of the search origin.
# - Copy # - Copy
# - Paste # - Paste
# - IncreaseFontSize # - IncreaseFontSize
# - DecreaseFontSize # - DecreaseFontSize
# - ResetFontSize # - ResetFontSize
# - ScrollPageUp # - ScrollPageUp
# - ScrollPageDown # - ScrollPageDown
# - ScrollHalfPageUp # - ScrollHalfPageUp
# - ScrollHalfPageDown # - ScrollHalfPageDown
# - ScrollLineUp # - ScrollLineUp
# - ScrollLineDown # - ScrollLineDown
# - ScrollToTop # - ScrollToTop
# - ScrollToBottom # - ScrollToBottom
# - ClearHistory # - ClearHistory
# Remove the terminal's scrollback history. # Remove the terminal's scrollback history.
# - Hide # - Hide
# Hide the Alacritty window. # Hide the Alacritty window.
# - Minimize # - Minimize
# Minimize the Alacritty window. # Minimize the Alacritty window.
# - Quit # - Quit
# Quit Alacritty. # Quit Alacritty.
# - ToggleFullscreen # - ToggleFullscreen
# - SpawnNewInstance # - SpawnNewInstance
# Spawn a new instance of Alacritty. # Spawn a new instance of Alacritty.
# - CreateNewWindow # - CreateNewWindow
# Create a new Alacritty window from the current process. # Create a new Alacritty window from the current process.
# - ClearLogNotice # - ClearLogNotice
# Clear Alacritty's UI warning and error notice. # Clear Alacritty's UI warning and error notice.
# - ClearSelection # - ClearSelection
# Remove the active selection. # Remove the active selection.
# - ReceiveChar # - ReceiveChar
# - None # - None
# #
# - Vi mode exclusive actions: # - Vi mode exclusive actions:
# #
# - Open # - Open
# Perform the action of the first matching hint under the vi mode cursor # Perform the action of the first matching hint under the vi mode cursor
# with `mouse.enabled` set to `true`. # with `mouse.enabled` set to `true`.
# - ToggleNormalSelection # - ToggleNormalSelection
# - ToggleLineSelection # - ToggleLineSelection
# - ToggleBlockSelection # - ToggleBlockSelection
# - ToggleSemanticSelection # - ToggleSemanticSelection
# Toggle semantic selection based on `selection.semantic_escape_chars`. # Toggle semantic selection based on `selection.semantic_escape_chars`.
# - CenterAroundViCursor # - CenterAroundViCursor
# Center view around vi mode cursor # Center view around vi mode cursor
# #
# - Vi mode exclusive cursor motion actions: # - Vi mode exclusive cursor motion actions:
# #
# - Up # - Up
# One line up. # One line up.
# - Down # - Down
# One line down. # One line down.
# - Left # - Left
# One character left. # One character left.
# - Right # - Right
# One character right. # One character right.
# - First # - First
# First column, or beginning of the line when already at the first column. # First column, or beginning of the line when already at the first column.
# - Last # - Last
# Last column, or beginning of the line when already at the last column. # Last column, or beginning of the line when already at the last column.
# - FirstOccupied # - FirstOccupied
# First non-empty cell in this terminal row, or first non-empty cell of # First non-empty cell in this terminal row, or first non-empty cell of
# the line when already at the first cell of the row. # the line when already at the first cell of the row.
# - High # - High
# Top of the screen. # Top of the screen.
# - Middle # - Middle
# Center of the screen. # Center of the screen.
# - Low # - Low
# Bottom of the screen. # Bottom of the screen.
# - SemanticLeft # - SemanticLeft
# Start of the previous semantically separated word. # Start of the previous semantically separated word.
# - SemanticRight # - SemanticRight
# Start of the next semantically separated word. # Start of the next semantically separated word.
# - SemanticLeftEnd # - SemanticLeftEnd
# End of the previous semantically separated word. # End of the previous semantically separated word.
# - SemanticRightEnd # - SemanticRightEnd
# End of the next semantically separated word. # End of the next semantically separated word.
# - WordLeft # - WordLeft
# Start of the previous whitespace separated word. # Start of the previous whitespace separated word.
# - WordRight # - WordRight
# Start of the next whitespace separated word. # Start of the next whitespace separated word.
# - WordLeftEnd # - WordLeftEnd
# End of the previous whitespace separated word. # End of the previous whitespace separated word.
# - WordRightEnd # - WordRightEnd
# End of the next whitespace separated word. # End of the next whitespace separated word.
# - Bracket # - Bracket
# Character matching the bracket at the cursor's location. # Character matching the bracket at the cursor's location.
# - SearchNext # - SearchNext
# Beginning of the next match. # Beginning of the next match.
# - SearchPrevious # - SearchPrevious
# Beginning of the previous match. # Beginning of the previous match.
# - SearchStart # - SearchStart
# Start of the match to the left of the vi mode cursor. # Start of the match to the left of the vi mode cursor.
# - SearchEnd # - SearchEnd
# End of the match to the right of the vi mode cursor. # End of the match to the right of the vi mode cursor.
# #
# - Search mode exclusive actions: # - Search mode exclusive actions:
# - SearchFocusNext # - SearchFocusNext
# Move the focus to the next search match. # Move the focus to the next search match.
# - SearchFocusPrevious # - SearchFocusPrevious
# Move the focus to the previous search match. # Move the focus to the previous search match.
# - SearchConfirm # - SearchConfirm
# - SearchCancel # - SearchCancel
# - SearchClear # - SearchClear
# Reset the search regex. # Reset the search regex.
# - SearchDeleteWord # - SearchDeleteWord
# Delete the last word in the search regex. # Delete the last word in the search regex.
# - SearchHistoryPrevious # - SearchHistoryPrevious
# Go to the previous regex in the search history. # Go to the previous regex in the search history.
# - SearchHistoryNext # - SearchHistoryNext
# Go to the next regex in the search history. # Go to the next regex in the search history.
# #
# - macOS exclusive actions: # - macOS exclusive actions:
# - ToggleSimpleFullscreen # - ToggleSimpleFullscreen
# Enter fullscreen without occupying another space. # Enter fullscreen without occupying another space.
# #
# - Linux/BSD exclusive actions: # - Linux/BSD exclusive actions:
# #
# - CopySelection # - CopySelection
# Copy from the selection buffer. # Copy from the selection buffer.
# - PasteSelection # - PasteSelection
# Paste from the selection buffer. # Paste from the selection buffer.
# #
# - `command`: Fork and execute a specified command plus arguments # - `command`: Fork and execute a specified command plus arguments
# #
# The `command` field must be a map containing a `program` string and an # The `command` field must be a map containing a `program` string and an
# `args` array of command line parameter strings. For example: # `args` array of command line parameter strings. For example:
# `{ program: "alacritty", args: ["-e", "vttest"] }` # `{ program: "alacritty", args: ["-e", "vttest"] }`
# #
# And optionally: # And optionally:
# #
# - `mods`: Key modifiers to filter binding actions # - `mods`: Key modifiers to filter binding actions
# #
# - Command # - Command
# - Control # - Control
# - Option # - Option
# - Super # - Super
# - Shift # - Shift
# - Alt # - Alt
# #
# Multiple `mods` can be combined using `|` like this: # Multiple `mods` can be combined using `|` like this:
# `mods: Control|Shift`. # `mods: Control|Shift`.
# Whitespace and capitalization are relevant and must match the example. # Whitespace and capitalization are relevant and must match the example.
# #
# - `mode`: Indicate a binding for only specific terminal reported modes # - `mode`: Indicate a binding for only specific terminal reported modes
# #
# This is mainly used to send applications the correct escape sequences # This is mainly used to send applications the correct escape sequences
# when in different modes. # when in different modes.
# #
# - AppCursor # - AppCursor
# - AppKeypad # - AppKeypad
# - Search # - Search
# - Alt # - Alt
# - Vi # - Vi
# #
# A `~` operator can be used before a mode to apply the binding whenever # A `~` operator can be used before a mode to apply the binding whenever
# the mode is *not* active, e.g. `~Alt`. # the mode is *not* active, e.g. `~Alt`.
# #
# Bindings are always filled by default, but will be replaced when a new # Bindings are always filled by default, but will be replaced when a new
# binding with the same triggers is defined. To unset a default binding, it can # binding with the same triggers is defined. To unset a default binding, it can
# be mapped to the `ReceiveChar` action. Alternatively, you can use `None` for # be mapped to the `ReceiveChar` action. Alternatively, you can use `None` for
# a no-op if you do not wish to receive input characters for that binding. # a no-op if you do not wish to receive input characters for that binding.
# #
# If the same trigger is assigned to multiple actions, all of them are executed # If the same trigger is assigned to multiple actions, all of them are executed
# in the order they were defined in. # in the order they were defined in.
key_bindings: key_bindings:
- { key: N, mods: Control, action: CreateNewWindow } - { key: N, mods: Control, action: CreateNewWindow }
# - { key: Paste, action: Paste } # - { key: Paste, action: Paste }
@ -771,7 +769,12 @@ key_bindings:
# Vi Mode # Vi Mode
#- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode } #- { key: Space, mods: Shift|Control, mode: ~Search, action: ToggleViMode }
- { key: Escape, mods: Shift, mode: ~Search, action: ToggleViMode } - {
key: Escape,
mods: Shift,
mode: ~Search,
action: ToggleViMode
}
#- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom } #- { key: Space, mods: Shift|Control, mode: Vi|~Search, action: ScrollToBottom }
#- { key: Escape, mode: Vi|~Search, action: ClearSelection } #- { key: Escape, mode: Vi|~Search, action: ClearSelection }
#- { key: I, mode: Vi|~Search, action: ToggleViMode } #- { key: I, mode: Vi|~Search, action: ToggleViMode }
@ -834,9 +837,9 @@ key_bindings:
#- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious } #- { key: Return, mods: Shift, mode: Search|~Vi, action: SearchFocusPrevious }
# (Windows, Linux, and BSD only) # (Windows, Linux, and BSD only)
- { key: V, mods: Control|Shift, mode: ~Vi, action: Paste } - { key: V, mods: Control|Shift, mode: ~Vi, action: Paste }
- { key: C, mods: Control|Shift, action: Copy } - { key: C, mods: Control|Shift, action: Copy }
- { key: Return, mods: Alt, action: ToggleFullscreen } # - { key: Return, mods: Alt, action: ToggleFullscreen }
#- { key: F, mods: Control|Shift, mode: ~Search, action: SearchForward } #- { key: F, mods: Control|Shift, mode: ~Search, action: SearchForward }
#- { key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward } #- { key: B, mods: Control|Shift, mode: ~Search, action: SearchBackward }
#- { key: C, mods: Control|Shift, mode: Vi|~Search, action: ClearSelection } #- { key: C, mods: Control|Shift, mode: Vi|~Search, action: ClearSelection }
@ -866,11 +869,13 @@ key_bindings:
#- { key: Q, mods: Command, action: Quit } #- { key: Q, mods: Command, action: Quit }
#- { key: W, mods: Command, action: Quit } #- { key: W, mods: Command, action: Quit }
#- { key: N, mods: Command, action: SpawnNewInstance } #- { key: N, mods: Command, action: SpawnNewInstance }
- { key: Return, mods: Command, action: ToggleFullscreen } # NOTE: Use Command + Control + F
#
# - { key: Return, mods: Command, action: ToggleFullscreen }
#- { key: F, mods: Command, mode: ~Search, action: SearchForward } #- { key: F, mods: Command, mode: ~Search, action: SearchForward }
#- { key: B, mods: Command, mode: ~Search, action: SearchBackward } #- { key: B, mods: Command, mode: ~Search, action: SearchBackward }
#debug: #debug:
# Display the time it takes to redraw each frame. # Display the time it takes to redraw each frame.
#render_timer: false #render_timer: false

View File

@ -0,0 +1,133 @@
# Font configuration
font_family FiraCode Nerd Font Mono
bold_font FiraCode Nerd Font Mono Bold
italic_font FiraCode Nerd Font Mono Italic
bold_italic_font FiraCode Nerd Font Mono Bold Italic
font_size 11.0
# firacode-specific
modify_font cell_height -6px
modify_font baseline 2
sync_to_monitor no
# if I'm hovering over the font, don't perform ligature, thanks.
disable_ligatures cursor
# NO BELLS!
enable_audio_bell no
# theme gruvbox_dark
# include /themes/gruvbox_dark.conf
# window_margin_width 5.0
# window_padding_width 5.0
# I'm on Prime's team here, blinking cursor is too distracting
cursor_blink_interval 0
background #282c34
dynamic_background_opacity true
background_opacity 0.97
macos_traditional_fullscreen no
# from nvim-nonicons
# symbol_map U+f101-U+f208 nonicon regular
# No creating windows
map ctrl+shift+enter no_op
map cmd+enter no_op
# I don't understand why some of these have remaps on MacOS
# new_os_window
map ctrl+shift+n no_op
# new_os_window
map cmd+n no_op
map ctrl+shift+w close_window
map shft+cmd+d no_op # just disable any apple-linux segregation
# tabs
## Tab creation
map ctrl+shift+t combine | new_tab | set_tab_title _
map cmd+t no_op
map ctrl+, set_tab_title _
## No tab destruction
map ctrl+shift+q no_op
map ctrl+shift+w no_op
# close_tab 🍎
map cmd+w no_op
## No tab iteration
# next_tab
map ctrl+shift+right no_op
# next_tab 🍎
map shift+cmd+] no_op
# next_tab
map ctrl+tab no_op
# previous_tab
map ctrl+shift+left no_op
# previous_tab 🍎
map shift+cmd+[ no_op
# previous_tab
map ctrl+shift+tab no_op
# move_tab_forward
map ctrl+shift+. no_op
## Tab linear jumping
map ctrl+1 goto_tab 1
map ctrl+2 goto_tab 2
map ctrl+3 goto_tab 3
map ctrl+4 goto_tab 4
map ctrl+5 goto_tab 5
map ctrl+6 goto_tab 6
map ctrl+7 goto_tab 7
map ctrl+8 goto_tab 8
map ctrl+9 goto_tab 9
map ctrl+0 goto_tab 10
### A bit ergonomics for mac
map cmd+1 goto_tab 1
map cmd+2 goto_tab 2
map cmd+3 goto_tab 3
map cmd+4 goto_tab 4
map cmd+5 goto_tab 5
map cmd+6 goto_tab 6
map cmd+7 goto_tab 7
map cmd+8 goto_tab 8
map cmd+9 goto_tab 9
map cmd+0 goto_tab 10
## Just disable all iteration of tab - use linear mapping
map ctrl+shift+right no_op
map shift+cmd+] no_op
map ctrl+tab no_op
map ctrl+shift+left no_op
map shift+cmd+[ no_op
map ctrl+shift+tab no_op
## Titles
tab_bar_edge top
tab_fade 0.6 1
tab_title_template "{fmt.fg.red}{bell_symbol}{activity_symbol}{fmt.fg.tab}{index}|{title}{(lambda parts: '/'.join([p if len(p) <= 2 else p[:2]+'…' for p in parts[:-1]] + [parts[-1]]))(tab.active_wd.split('/'))}"
active_tab_font_style bold
active_tab_foreground #000
active_tab_background #eee
inactive_tab_foreground #444
inactive_tab_background #999
map ctrl+shift+, set_tab_title
# set_tab_title
map ctrl+shift+alt+t no_op
# set_tab_title
map shift+cmd+i no_op
# map ctrl+shift+p>n kitten hints --type=linenum --linenum-action=tab nvim +{line} {path}
# I don't really have good way to ever press F1
# map f1 kitten hints --customize-processing hint_define_word.py

View File

@ -0,0 +1,18 @@
# Cookbook
## For highlight (groups) explorations, use `:lua require('telescope.builtin').highlights`
`:h telescope.builtin.highlights`. It's a winner in exploring the highlights
compared to `:highlight` that vomits to `:messages`-like interface that you
can't search
## Jump around diagnostics
Use `gh:folke/trouble` for window-persistent diagnostics. Otherwise, Telescope
provides a pretty good diagnostics
`:lua require("telescope.builtin").diagnostics {bufnr = <number | 0: current buffer | nil: all buffers}`
`:TroubleToggle loclist`
`:TroubleToggle workspace_diagnostics`

View File

@ -18,12 +18,13 @@ endif
local Plug = vim.fn['plug#'] local Plug = vim.fn['plug#']
-- prepare a list of installed plugins from rtp -- prepare a list of installed plugins from rtp
--- @type table<string, boolean>
local installed_plugins = {} local installed_plugins = {}
-- NOTE: nvim_list_runtime_paths will expand wildcard paths for us. -- NOTE: nvim_list_runtime_paths will expand wildcard paths for us.
for _, path in ipairs(vim.api.nvim_list_runtime_paths()) do for _, path in ipairs(vim.api.nvim_list_runtime_paths()) do
local last_folder_start = path:find("/[^/]*$") local last_folder_start = path:find("/[^/]*$")
if last_folder_start then if last_folder_start then
local plugin_name = path:sub(last_folder_start + 1) local plugin_name = string.lower(path:sub(last_folder_start + 1))
installed_plugins[plugin_name] = true installed_plugins[plugin_name] = true
end end
end end
@ -31,20 +32,30 @@ end
local wplug_log = require('plenary.log').new({ plugin = 'wplug_log', level = 'debug', use_console = false }) local wplug_log = require('plenary.log').new({ plugin = 'wplug_log', level = 'debug', use_console = false })
-- Do Plug if plugin not yet linked in `rtp`. This takes care of Nix-compatibility -- Do Plug if plugin not yet linked in `rtp`. This takes care of Nix-compatibility
local function WPlug(plugin_path, ...) local function WPlug(plugin_path, ...)
-- hrsh7th/cmp-nvim -> cmp-nvim
local plugin_name = string.lower(plugin_path:match("/([^/]+)$")) local plugin_name = string.lower(plugin_path:match("/([^/]+)$"))
if not installed_plugins[plugin_name] then if not installed_plugins[plugin_name] then
wplug_log.info("Plugging " .. plugin_path) wplug_log.info("Missing in rtp: " .. plugin_name .. " path: " .. plugin_path)
Plug(plugin_path, ...) Plug(plugin_path, ...)
end end
installed_plugins[plugin_name] = false
end end
-- Borked, reason unknown
-- for plugin, plugged in pairs(installed_plugins) do
-- if plugged ~= false then
-- wplug_log.info("Plugin " .. plugin .. " added to rtp but not WPlug-ed")
-- end
-- end
vim.call('plug#begin') vim.call('plug#begin')
-- libs and dependencies -- libs and dependencies
-- Plug('nvim-lua/plenary.nvim') -- The base of all plugins WPlug('nvim-lua/plenary.nvim') -- The base of all plugins
--
-- plugins --
WPlug('tjdevries/nlua.nvim') -- adds symbols of vim stuffs in init.lua -- -- plugins
WPlug('nvim-treesitter/nvim-treesitter') -- language parser engine for highlighting WPlug('nvim-treesitter/nvim-treesitter') -- language parser engine for highlighting
WPlug('nvim-treesitter/nvim-treesitter-textobjects') -- more text objects WPlug('nvim-treesitter/nvim-treesitter-textobjects') -- more text objects
WPlug('nvim-telescope/telescope.nvim', { branch = '0.1.x' }) -- file browser WPlug('nvim-telescope/telescope.nvim', { branch = '0.1.x' }) -- file browser
@ -59,6 +70,7 @@ WPlug('nvim-telescope/telescope.nvim', { branch = '0.1.x' }) -- file browser
-- Make sure that WPlug does not run `make` and use the output it needs -- Make sure that WPlug does not run `make` and use the output it needs
WPlug('nvim-telescope/telescope-fzf-native.nvim', WPlug('nvim-telescope/telescope-fzf-native.nvim',
{ ['do'] = 'make >> /tmp/log 2>&1' }) { ['do'] = 'make >> /tmp/log 2>&1' })
WPlug('nvim-telescope/telescope-live-grep-args.nvim')
WPlug('nvim-telescope/telescope-file-browser.nvim') WPlug('nvim-telescope/telescope-file-browser.nvim')
-- cmp: auto-complete/suggestions -- cmp: auto-complete/suggestions
@ -70,7 +82,7 @@ WPlug('hrsh7th/cmp-cmdline')
WPlug('hrsh7th/nvim-cmp') WPlug('hrsh7th/nvim-cmp')
WPlug('hrsh7th/cmp-nvim-lsp-signature-help') WPlug('hrsh7th/cmp-nvim-lsp-signature-help')
WPlug('onsails/lspkind-nvim') WPlug('onsails/lspkind-nvim')
WPlug('yioneko/nvim-yati', { tag = '*' }) -- copium: fix Python indent auto-correct from smart-indent -- WPlug('yioneko/nvim-yati', { tag = '*' }) -- copium: fix Python indent auto-correct from smart-indent
WPlug('nathanalderson/yang.vim') WPlug('nathanalderson/yang.vim')
-- WPlug('tzachar/cmp-tabnine', { ['do'] = './install.sh' }) -- WPlug('tzachar/cmp-tabnine', { ['do'] = './install.sh' })
@ -88,12 +100,13 @@ WPlug('ThePrimeagen/harpoon') -- 1-click through marked files per p
WPlug('TimUntersberger/neogit') -- Easy-to-see git status WPlug('TimUntersberger/neogit') -- Easy-to-see git status
WPlug('folke/trouble.nvim') -- File-grouped workspace diagnostics WPlug('folke/trouble.nvim') -- File-grouped workspace diagnostics
WPlug('tpope/vim-dispatch') -- Allows quick build/compile/test vim commands WPlug('tpope/vim-dispatch') -- Allows quick build/compile/test vim commands
WPlug('clojure-vim/vim-jack-in') -- Clojure: ":Boot", ":Clj", ":Lein" -- WPlug('clojure-vim/vim-jack-in') -- Clojure: ":Boot", ":Clj", ":Lein"
WPlug('radenling/vim-dispatch-neovim') -- Add support for neovim's terminal emulator WPlug('radenling/vim-dispatch-neovim') -- Add support for neovim's terminal emulator
-- WPlug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs) -- WPlug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs)
WPlug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*) WPlug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*).# TODO: supply chain?
WPlug('kylechui/nvim-surround') -- surrounds with tags/parenthesis WPlug('kylechui/nvim-surround') -- surrounds with tags/parenthesis
WPlug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration WPlug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration
-- WPlug('tjdevries/sg.nvim') -- Cody and other cool sourcegraph stuffs
-- UI & colorscheme -- UI & colorscheme
WPlug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts WPlug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts
@ -107,11 +120,11 @@ WPlug('NvChad/nvim-colorizer.lua') -- color highlighter with tailwi
WPlug('roobert/tailwindcss-colorizer-cmp.nvim') -- color for tailiwnd for compe WPlug('roobert/tailwindcss-colorizer-cmp.nvim') -- color for tailiwnd for compe
-- other utilities -- other utilities
WPlug('ThePrimeagen/git-worktree.nvim') -- Worktrees are the canonical way to git thru
WPlug('nvim-treesitter/nvim-treesitter-context') -- Top one-liner context of func/class scope WPlug('nvim-treesitter/nvim-treesitter-context') -- Top one-liner context of func/class scope
WPlug('nvim-treesitter/playground') -- Sees Treesitter AST - less hair pulling, more PRs WPlug('nvim-treesitter/playground') -- Sees Treesitter AST - less hair pulling, more PRs
WPlug('saadparwaiz1/cmp_luasnip') -- snippet engine WPlug('saadparwaiz1/cmp_luasnip') -- snippet engine
WPlug('L3MON4D3/LuaSnip') -- snippet engine WPlug('L3MON4D3/LuaSnip') -- snippet engine
WPlug('mickael-menu/zk-nvim') -- Zettelkasten
WPlug('folke/neodev.nvim') -- Neovim + lua development setup WPlug('folke/neodev.nvim') -- Neovim + lua development setup
-- Switch cases: -- Switch cases:
-- `gsp` -> PascalCase (classes), `gsc` -> camelCase (Java), `gs_` -> snake_case (C/C++/Rust) -- `gsp` -> PascalCase (classes), `gsc` -> camelCase (Java), `gs_` -> snake_case (C/C++/Rust)
@ -157,6 +170,14 @@ vim.api.nvim_create_autocmd({ "VimEnter" }, {
vim.g.gruvbox_contrast_dark = "soft"; vim.g.gruvbox_contrast_dark = "soft";
vim.g.gruvbox_contrast_light = "soft"; vim.g.gruvbox_contrast_light = "soft";
-- no more partial keystrokes, it's distracting
vim.opt.showcmd = false;
-- rely on lualine
vim.opt.showmode = false;
-- Suppress buffer/file written message
vim.opt.shortmess = "atToOCF"
vim.opt.ignorecase = true; vim.opt.ignorecase = true;
vim.opt.smartcase = true; vim.opt.smartcase = true;
vim.opt.incsearch = true; vim.opt.incsearch = true;
@ -176,6 +197,75 @@ vim.opt.colorcolumn = "80";
vim.opt.background = "dark"; vim.opt.background = "dark";
vim.opt.spelllang = "en_us";
do -- selective spell-checking
local spellcheck = vim.api.nvim_create_augroup("SpellChecking", { clear = true })
vim.api.nvim_create_autocmd({ "FileType" }, {
group = spellcheck,
pattern = { "tex", "markdown", "md", },
callback = function() vim.opt_local.spell = true end,
})
end
do -- selective concealing/ligature {{{
g_docs = "docs"
group_map = {
plaintex = g_docs,
tex = g_docs,
markdown = g_docs,
}
conceal_by_mode = {
n = 2,
i = 0,
c = 2,
v = 0,
}
local group_handler = {
[g_docs] = function(_ft, _group)
local buf = vim.api.nvim_get_current_buf()
vim.notify("group_handler: " .. vim.inspect({ buf, _ft, _group }))
vim.opt_local.concealcursor = "n"
-- HACK: seems to be some lifetime racing issues here
-- Putting this inside `vim.schedule` puts this at the end of the
-- queue, so under the assumption that aucommands are done in an
-- event loop, we're sure that the current augroup invocation
-- would be done before syn is set.
-- The important part is we're strictly setting this in the
-- correct bufnr
vim.schedule(function()
vim.api.nvim_set_option_value('syntax', 'tex', { buf = buf })
end)
end
}
local conceal = vim.api.nvim_create_augroup("Conceal", { clear = true })
vim.api.nvim_create_autocmd({ "FileType" }, {
group = conceal,
pattern = { "*" },
callback = function(args)
-- `:h FileType` and `:h nvim_create_augroup`.
-- `amatch`: value of filetype; args.match <- amatch
local ft = args.match
local group = group_map[ft]
if group == nil then
return
end
group_handler[group](ft, group)
end
})
vim.api.nvim_create_autocmd({ "ModeChanged" }, {
group = conceal,
pattern = "?:?",
callback = function()
local new_mode = vim.fn.mode("1")
local level = conceal_by_mode[new_mode]
if level then
vim.opt_local.conceallevel = level
end
end
})
end -- }}}
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
@ -209,8 +299,8 @@ vim.opt.completeopt = { "menu", "menuone", "noselect", "noinsert" }
-- vim.opt.clipboard = "unnamedplus" -- vim.opt.clipboard = "unnamedplus"
-- more aggressive swap file writing. ThePrimeagen believes higher number
-- leads to low DX -- more aggressive swap file writing. ThePrimeagen believes higher number leads to low DX
vim.opt.updatetime = 50 vim.opt.updatetime = 50
vim.g.mapleader = ' ' vim.g.mapleader = ' '
@ -242,18 +332,18 @@ colorscheme gruvbox
require('hlargs').setup() require('hlargs').setup()
require('nvim-web-devicons').setup() require('nvim-web-devicons').setup()
require('trouble').setup { require('trouble').setup {
position = "bottom", -- position of the list can be: bottom, top, left, right position = "bottom", -- position of the list can be: bottom, top, left, right
height = 10, -- height of the trouble list when position is top or bottom height = 10, -- height of the trouble list when position is top or bottom
width = 50, -- width of the list when position is left or right width = 50, -- width of the list when position is left or right
icons = true, -- use devicons for filenames icons = true, -- use devicons for filenames
mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist" mode = "workspace_diagnostics", -- "workspace_diagnostics", "document_diagnostics", "quickfix", "lsp_references", "loclist"
severity = nil, -- nil (ALL) or vim.diagnostic.severity.ERROR | WARN | INFO | HINT severity = nil, -- nil (ALL) or vim.diagnostic.severity.ERROR | WARN | INFO | HINT
fold_open = "", -- icon used for open folds fold_open = "", -- icon used for open folds
fold_closed = "", -- icon used for closed folds fold_closed = "", -- icon used for closed folds
group = true, -- group results by file group = true, -- group results by file
padding = true, -- add an extra new line on top of the list padding = true, -- add an extra new line on top of the list
action_keys = { action_keys = {
-- key mappings for actions in the trouble list -- key mappings for actions in the trouble list
-- map to {} to remove a mapping, for example: -- map to {} to remove a mapping, for example:
-- close = {}, -- close = {},
close = "q", -- close the list close = "q", -- close the list
@ -289,12 +379,13 @@ require('trouble').setup {
information = "", information = "",
other = "", other = "",
}, },
use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client use_diagnostic_signs = false -- enabling this will use the signs defined in your lsp client
} }
-- TODO: Any way to collect all the TODOs and its variants? -- TODO + Trouble: `:TodoTrouble`
require('todo-comments').setup() require('todo-comments').setup {}
-- plugin keymaps -- plugin keymaps
@ -305,14 +396,15 @@ end
-- Comment.nvim -- Comment.nvim
require('Comment').setup() require('Comment').setup()
-- lukas-reineke/indent-blankline.nvim -- -- lukas-reineke/indent-blankline.nvim
vim.opt.list = true vim.opt.list = true
vim.opt.listchars:append "space:⋅" vim.opt.listchars:append "space:⋅"
vim.opt.listchars:append "eol:↴" vim.opt.listchars:append "eol:↴"
require("indent_blankline").setup { require("ibl").setup {
show_end_of_line = true, -- indent = {char = {space='', eol=''}, },
space_char_blankline = " ", -- show_end_of_line = true,
-- space_char_blankline = " ",
} }
-- User command that transform into 2-spaces by translating to tabstop -- User command that transform into 2-spaces by translating to tabstop
@ -344,22 +436,125 @@ vim.api.nvim_create_user_command(
-- telescope -- telescope
local fb_actions = require "telescope".extensions.file_browser.actions local fb_actions = require "telescope".extensions.file_browser.actions
local tel_actions = require("telescope.actions") local tel_actions = require("telescope.actions")
local tel_action_state = require("telescope.actions.state")
local tel_actionset = require("telescope.actions.set") local tel_actionset = require("telescope.actions.set")
-- telescope + harpoon mark
local function default_harpoon_mark()
require('harpoon.mark').add_file()
end
local harpoon_keymap = '<leader>m'
local function telescope_multi_selection(prompt_bufnr)
local picker = tel_action_state.get_current_picker(prompt_bufnr)
---@class telescope.make_entry.Entry
---@field value any
---@field valid boolean | nil
---@field ordinal string for filtering and (fuzzy) search-friendly string
---@field display string|function
---@field filename string | nil
---@field bufnr number | nil
---@field lum number | nil
---@field col number | nil
---@class telescope.make_entry.gen_from_file__rv: telescope.make_entry.Entry
---@field cwd string | nil
---@field path string via __index
---@field __index function
---@type telescope.make_entry.gen_from_file__rv[]
local rv = picker:get_multi_selection()
return rv
end
local function mark_telescope_selections(prompt_bufnr)
-- NOTE: This works for both bulitin Telescope file browser and fuzzy search
local selections = telescope_multi_selection(prompt_bufnr)
--[[
local entries = {}
for k, e in ipairs(selections) do
table.insert(entries, { k = k, e = e })
end
print(vim.inspect({
prompt_bufnr = prompt_bufnr,
selections = selections,
entries = entries,
}))
stdout> (builtin.__file)
{
entries = { { "native_configs/ssh/authorized_keys",
index = 6,
<metatable> = <1>{
__index = <function 1>,
cwd = "/Users/hungtran/local_repos/dotfiles",
display = <function 2>
}
}, { "native_configs/ssh/config", index = 7, <metatable> = <table 1> } },
prompt_bufnr = 56
}
--]]
---@type string[]
local filenames = {}
for _, entry in ipairs(selections) do
local has_path, path = pcall(function() return entry:__index("path") --[[ @as string ]] end)
if has_path then
table.insert(filenames, path)
goto continue
end
-- invariant: pcall on has_path false will assign second rv as the error
-- payload. Most of the time, this is a string, but for safety, we could
-- not assume so.
local err = path
log.warn("No `.path` for entry `" .. vim.inspect(entry) .. "`: " .. vim.inspect(err))
::continue::
end
log.debug(vim.inspect(filenames))
for _, filename in pairs(filenames) do
require('harpoon.mark').add_file(filename)
end
end
local function term_height() local function term_height()
return vim.opt.lines:get() return vim.opt.lines:get()
end end
require('telescope').setup { require('telescope').setup {
defaults = { defaults = {
-- path_display = "smart", -- realisitically should trim out pathlets, but is buggy to git views
get_selection_window = function(_, entry)
local bufnr = entry.bufnr
local tabpage = vim.api.nvim_get_current_tabpage()
for _, win_id in ipairs(vim.api.nvim_tabpage_list_wins(tabpage)) do
if vim.api.nvim_win_get_buf(win_id) == bufnr then
return win_id
end
end
return 0 -- Fallback to default behavior
end,
mappings = { mappings = {
n = { n = {
['<C-u>'] = function(prompt_bufnr) tel_actionset.shift_selection(prompt_bufnr, -math.floor(term_height() / 2)) end, ['<C-u>'] = function(prompt_bufnr) tel_actionset.shift_selection(prompt_bufnr, -math.floor(term_height() / 2)) end,
['<C-d>'] = function(prompt_bufnr) tel_actionset.shift_selection(prompt_bufnr, math.floor(term_height() / 2)) end, ['<C-d>'] = function(prompt_bufnr) tel_actionset.shift_selection(prompt_bufnr, math.floor(term_height() / 2)) end,
[harpoon_keymap] = function(prompt_bufnr)
mark_telescope_selections(prompt_bufnr)
end,
},
i = {
}, },
}, },
}, },
extensions = { extensions = {
live_grep_args = {
auto_quoting = true,
},
fzf = { fzf = {
fuzzy = true, -- allow fuzzy matches fuzzy = true, -- allow fuzzy matches
override_generic_sorter = true, override_generic_sorter = true,
@ -367,7 +562,7 @@ require('telescope').setup {
case_mode = 'smart_case' case_mode = 'smart_case'
}, },
file_browser = { file_browser = {
theme = require('telescope.themes').get_ivy().theme, theme = "ivy",
hiject_netrw = true, -- disables netrw and use file-browser instead hiject_netrw = true, -- disables netrw and use file-browser instead
mappings = { mappings = {
["i"] = {}, -- disable any shortcut in insert mode for now ["i"] = {}, -- disable any shortcut in insert mode for now
@ -387,19 +582,29 @@ require('telescope').setup {
["s"] = fb_actions.toggle_all, ["s"] = fb_actions.toggle_all,
} }
} }
} },
} }
} }
-- Telescope key remap stuffs -- Telescope key remap stuffs
pcall(require('telescope').load_extension, 'fzf') pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'file_browser') pcall(require('telescope').load_extension, 'file_browser')
pcall(require('telescope').load_extension, 'git_worktree')
remap('n', '<C-p>', '<cmd>Telescope<cr>', { desc = 'Open Telescope general search' }) remap('n', '<C-p>', '<cmd>Telescope<cr>', { desc = 'Open Telescope general search' })
remap('n', '<leader>fm', function() remap('n', '<leader>fm', function()
require("telescope").extensions.file_browser.file_browser({}) require("telescope").extensions.file_browser.file_browser({})
end, { desc = '[F]ile [M]utation' }) end, { desc = '[F]ile [M]utation' })
remap('n', '<leader>ft', function()
require("telescope").extensions.git_worktree.git_worktrees()
end, { desc = '[F]ind [T]ree' })
remap('n', '<leader>tm', function()
require("telescope").extensions.git_worktree.create_git_worktree()
end, { desc = '[T]ree [M]utate' })
remap('n', '<leader>ff', function() remap('n', '<leader>ff', function()
require('telescope.builtin').find_files({ require('telescope.builtin').find_files({
hidden = false, hidden = false,
@ -417,12 +622,14 @@ remap('n', '<leader>fa', function()
end, { desc = '[F]ind [A]ll files' }) end, { desc = '[F]ind [A]ll files' })
remap('n', '<leader>fg', function() remap('n', '<leader>fg', function()
require('telescope.builtin').live_grep() require('telescope').extensions.live_grep_args.live_grep_args()
end, { desc = '[F]ind thru [G]rep' }) end, { desc = '[F]ind thru [G]rep' })
remap('n', '<leader>fug', function() remap('n', '<leader>fug', function()
-- This relies on many factors: We use `rg` and that `-g '**/*'` effectively -- This relies on many factors: We use `rg` and that `-g '**/*'` effectively
-- drops ignore rules like the default `.gitignore` rule. -- drops ignore rules like the default `.gitignore` rule.
vim.notify("fuzzy unrestricted grep is deprecated, use Find thru Grep with `-uuu` query instead")
require('telescope.builtin').live_grep({ glob_pattern = '**/*' }) require('telescope.builtin').live_grep({ glob_pattern = '**/*' })
end, { desc = '[F]ind thru [u]nrestricted [G]rep' }) end, { desc = '[F]ind thru [u]nrestricted [G]rep' })
@ -438,21 +645,12 @@ remap('n', '<leader>fd', function()
require('telescope.builtin').diagnostics() require('telescope.builtin').diagnostics()
end, { desc = '[F]ind [D]iagnostics' }) end, { desc = '[F]ind [D]iagnostics' })
-- ZK remap stuffs
remap('n', '<leader>zf', function()
-- vim.cmd([[:ZkNotes]])
require('zk').edit({}, { multi_select = false })
end, { desc = '[Z]ettelkasten [F]iles' })
remap('n', '<leader>zg', function()
vim.cmd(":ZkGrep")
end, { desc = '[Z]ettelkasten [G]rep' })
-- tab management {{{ -- tab management {{{
-- Jump to specific tab with <C-t>[number] -- Jump to specific tab with <C-t>[number]
for i = 1, 9 do for i = 1, 9 do
vim.api.nvim_set_keymap('n', '<C-t>' .. i, ':tabn ' .. i .. '<CR>', { noremap = true, silent = true }) vim.api.nvim_set_keymap('n', '<C-t>' .. i, ':tabn ' .. i .. '<CR>',
{ noremap = true, silent = true, desc = "Jump to tab {idx:" .. i .. "}" })
end end
-- Show tab number in tab display -- Show tab number in tab display
@ -491,12 +689,12 @@ vim.api.nvim_set_keymap('n', '<C-t>x', ':tabdo if tabpagenr() > 1 | tabclose | e
-- treesitter -- treesitter
require 'treesitter-context' require 'treesitter-context'
require('nvim-treesitter.configs').setup { require('nvim-treesitter.configs').setup {
yati = { -- yati = {
enable = true, -- enable = true,
default_lazy = true, -- default_lazy = true,
default_fallback = "auto", -- default_fallback = "auto",
disable = { "nix" } -- disable = { "nix" }
}, -- },
indent = { enable = false }, indent = { enable = false },
highlight = { highlight = {
enable = true, enable = true,
@ -558,7 +756,12 @@ require('guess-indent').setup {
} }
-- harpoon: O(1) buffer/terminal switching -- harpoon: O(1) buffer/terminal switching
remap('n', '<leader>m', function() require('harpoon.mark').add_file() end, { desc = "[H]arpoon [M]ark" }) remap('n', harpoon_keymap, function()
local is_err, err = pcall(require('harpoon.mark').add_file)
if is_err then
log.warn(vim.inspect(err))
end
end, { desc = "[H]arpoon [M]ark" })
local function harpoon_nav(key, nav_file_index, lead_keybind) local function harpoon_nav(key, nav_file_index, lead_keybind)
lead_keybind = lead_keybind or '<leader>h' lead_keybind = lead_keybind or '<leader>h'
assert(type(key) == "string", "expect key to be string(keybind)") assert(type(key) == "string", "expect key to be string(keybind)")
@ -678,6 +881,10 @@ local on_attach = function(client, bufnr)
-- enable inlay hints if available -- enable inlay hints if available
require('inlay-hints').on_attach(client, bufnr) require('inlay-hints').on_attach(client, bufnr)
end end
-- require("sg").setup {
-- on_attach = on_attach,
-- }
-- nvim-cmp -- nvim-cmp
local cmp = require 'cmp' local cmp = require 'cmp'
@ -803,11 +1010,11 @@ local cmp_config = {
vim_item = kind_fn(entry, vim_item) vim_item = kind_fn(entry, vim_item)
-- copium that this will force resolve for entry -- copium that this will force resolve for entry
entry_filter(entry, function(entry) -- entry_filter(entry, function(entry)
if entry.source_name == "nvim_lsp" then -- if entry.source_name == "nvim_lsp" then
log.debug('format:entry: ' .. vim.inspect(entry, { depth = 2 })) -- log.debug('format:entry: ' .. vim.inspect(entry, { depth = 2 }))
end -- end
end) -- end)
return require('tailwindcss-colorizer-cmp').formatter(entry, vim_item) return require('tailwindcss-colorizer-cmp').formatter(entry, vim_item)
end, end,
@ -901,7 +1108,7 @@ local capabilities = require('cmp_nvim_lsp').default_capabilities()
local servers = { local servers = {
'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'lua_ls', 'cmake', 'tailwindcss', 'prismals', 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'lua_ls', 'cmake', 'tailwindcss', 'prismals',
'nil_ls', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "ansiblels", 'nil_ls', 'eslint', 'terraformls', 'tflint', 'svelte', 'astro', 'clojure_lsp', "bashls", 'yamlls', "ansiblels",
"jsonls", "denols", "gopls", "nickel_ls", 'pylsp', "jsonls", "denols", "gopls", "nickel_ls",
} }
require("mason").setup({ require("mason").setup({
ui = { ui = {
@ -921,7 +1128,7 @@ require("mason").setup({
require('mason-lspconfig').setup({ require('mason-lspconfig').setup({
-- ensure_installed = servers, -- ensure_installed = servers,
ensure_installed = { ensure_installed = {
"pylsp", "pyright", "tailwindcss", "svelte", "astro", "lua_ls", "tsserver", "pyright", "tailwindcss", "svelte", "astro", "lua_ls", "tsserver",
"ansiblels", "yamlls", "docker_compose_language_service", "jsonls", "ansiblels", "yamlls", "docker_compose_language_service", "jsonls",
}, },
automatic_installation = false, automatic_installation = false,
@ -937,6 +1144,86 @@ local inlay_hint_tsjs = {
includeInlayVariableTypeHints = true, includeInlayVariableTypeHints = true,
}; };
local setup = {
["nil_ls"] = function()
require('lspconfig').nil_ls.setup {
on_attach = on_attach,
capabilities = capabilities,
--- refer to https://github.com/oxalica/nil/blob/main/docs/configuration.md
--- for the list of configurations available for `nil_ls`
settings = {
["nil"] = {
formatting = {
-- NOTE: nil_ls automatically adds the specific path to the filename
-- at the end, so we couldn't really have a fallback mechanism without
-- wrapping.
command = {
"nix", "run", "nixpkgs#alejandra"
},
},
nix = {
flake = {
-- calls `nix flake archive` to put a flake and its output to store
autoArchive = true,
-- auto eval flake inputs for improved completion
autoEvalInputs = true,
},
},
},
},
}
end,
["gopls"] = function()
local lspconfig = require('lspconfig')
lspconfig.gopls.setup {
cmd = { "gopls" },
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
},
},
root_dir = lspconfig.util.root_pattern('.git', 'go.mod'),
on_attach = on_attach,
capabilities = capabilities,
}
end,
["pyright"] = function()
require('lspconfig').pyright.setup {
on_attach = on_attach,
cmd = { "pyright-langserver", "--stdio", },
capabilities = capabilities,
settings = {
pyright = {
disableLanguageServices = false,
disableOrganizeImports = false,
reportShadowedImports = "warning",
},
python = {
analysis = {
autoImportCompletions = true,
autoSearchPaths = true,
useLibraryCodeForTypes = true,
diagnosticMode = "openFilesOnly",
-- diagnosticSeverityOverrides =
extraPaths = {},
logLevel = "Trace",
-- stubPath = "typings",
typeCheckingMode = "strict",
-- typeshedPaths = {},
venvPath = nil,
},
linting = {
mypyEnabled = true,
}
},
},
}
end,
}
require('mason-lspconfig').setup_handlers({ require('mason-lspconfig').setup_handlers({
-- default handler -- default handler
function(server_name) function(server_name)
@ -978,37 +1265,6 @@ require('mason-lspconfig').setup_handlers({
}, },
} }
end, end,
["pyright"] = function()
require('lspconfig').pyright.setup {
on_attach = on_attach,
capabilities = capabilities,
settings = {
pyright = {
disableLanguageServices = false,
disableOrganizeImports = false,
},
python = {
analysis = {
autoImportCompletions = true,
autoSearchPaths = true,
diagnosticMode = "openFilesOnly",
-- diagnosticSeverityOverrides =
extraPaths = {},
logLevel = "Information",
stubPath = "typings",
typeCheckingMode = "basic",
typeshedPaths = {},
useLibraryCodeForTypes = false,
pythonPath = "python",
venvPath = "",
},
linting = {
mypyEnabled = true,
}
},
},
}
end,
["tsserver"] = function() ["tsserver"] = function()
require('lspconfig').tsserver.setup { require('lspconfig').tsserver.setup {
on_attach = on_attach, on_attach = on_attach,
@ -1043,30 +1299,11 @@ require('mason-lspconfig').setup_handlers({
}, },
} }
end, end,
["nil_ls"] = function()
require('lspconfig').nil_ls.setup {
on_attach = on_attach,
capabilities = capabilities,
--- refer to https://github.com/oxalica/nil/blob/main/docs/configuration.md
--- for the list of configurations available for `nil_ls`
settings = {
["nil"] = {
formatting = {
command = { "nix", "run", "nixpkgs#alejandra" },
},
nix = {
flake = {
-- calls `nix flake archive` to put a flake and its output to store
autoArchive = true,
-- auto eval flake inputs for improved completion
autoEvalInputs = true,
},
},
},
},
}
end,
}) })
setup["nil_ls"]()
setup["gopls"]()
setup["pyright"]()
require("rust-tools").setup { require("rust-tools").setup {
tools = { tools = {
-- rust-tools options -- rust-tools options
@ -1253,49 +1490,6 @@ require("rust-tools").setup {
}, },
} }
require('zk').setup({
picker = "telescope",
lsp = {
config = {
cmd = { "zk", "lsp" },
name = "zk",
on_attach = on_attach,
},
auto_attach = {
enable = true,
filetypes = { "markdown" }
},
},
})
-- Custom ZkOrphans that determines unlinked notes
-- `:ZkOrphans {tags = {"work"}}`
require('zk.commands').add("ZkOrphans", function(options)
options = vim.tbl_extend("force", { orphan = true }, options or {})
-- zk.edit opens notes picker
require('zk').edit(options, { title = "Zk Orphans (unlinked notes)" })
end)
--
-- ZkGrep: opens file picker
-- In the case where `match_ctor` is falsy, create a prompt.
-- This is so that we distinguish between ZkGrep and ZkNotes
-- Params:
-- match_ctor: string | {match= :string,...} | "" | nil
require('zk.commands').add("ZkGrep", function(match_ctor)
-- handle polymorphic `match_ctor`
local grep_str = match_ctor
local match
if match_ctor == nil or match_ctor == '' then
vim.fn.inputsave()
grep_str = vim.fn.input('Grep string: >')
match = { match = grep_str }
elseif type(match_ctor) == 'string' then
match = { match = grep_str }
end
require('zk').edit(match, { title = "Grep: '" .. grep_str .. "'", mutli_select = false })
end)
-- Gitsigns -- Gitsigns
require('gitsigns').setup { require('gitsigns').setup {
signs = { signs = {
@ -1320,15 +1514,17 @@ require('lualine').setup {
newfile_status = false, newfile_status = false,
path = 1, path = 1,
symbols = { symbols = {
modified = '[+]', modified = '[~]',
readonly = '[-]', readonly = '[-]',
unnamed = '[Unnamed]', unnamed = '<?>',
newfile = '[New]',
}, },
}, },
}, },
lualine_x = { 'encoding', 'fileformat', 'filetype', }, lualine_x = { 'encoding', 'fileformat', {
lualine_y = { 'progress' }, 'filetype',
colored = true,
}, },
lualine_y = { function() return "pid#" .. vim.loop.os_getpid() end },
lualine_z = { 'location' }, lualine_z = { 'location' },
}, },
inactive_sections = { inactive_sections = {
@ -1344,9 +1540,9 @@ require('lualine').setup {
require('nvim-surround').setup {} require('nvim-surround').setup {}
require('fidget').setup({ require('fidget').setup({
text = { text = {
spinner = "moon", -- animation shown when tasks are ongoing spinner = "moon", -- animation shown when tasks are ongoing
done = "", -- character shown when all tasks are complete done = "", -- character shown when all tasks are complete
commenced = "Started", -- message shown when task starts commenced = "Started", -- message shown when task starts
completed = "Completed", -- message shown when task completes completed = "Completed", -- message shown when task completes
}, },
align = { align = {

View File

@ -5,3 +5,5 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFQN5Ia8rTalnQgcvdxH2n7UNNT1Tq9UvNdJeg9ziJ
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCgmng5xL/auvI2F8ufFAfId2Ey55ONHjgnKKSEWLVWkPMutXT3BCnSglNAuEVRLX2zfzg3beQd80AHTow+qro5QWI/rYfeL1QPNEwoThbRFcvtWLTlgzBGA4ejjpIF9sCPNp0sXrrQRfxRP7w4b23BcRJQcsDoaEtKGKJZ2GQIoOafkYypwcunANb54EAouZTfHEPKDr26Gfw8usc2Sae32G/80QLBF2jGabyexJjNE3F6hdJTwq5iiqIVdSr4ue82zo3M8jBdtCMDGaOliI5RWSa9iuX9o2scCGDU69Gkw7ma+JHOP/e9Z8sUz03TkjPbEnGi3EC3YAHEoDzmwqTi07hppCuzacLB5NZ9UZ1g5PzBIZR8TJTONngT08EQyGrkNv2sUnn0dtBqve5tHR04NuXy65ym7Iwl2DDVbAL0NlM4gKWzOGZ2CnSLT0WmkG2sQKU37NmS2pBJ8RXJBatUFe4vQVzqlFj39iRGIBV5XR0I9xcxDfCxBHFs3aIqAqE= hwtr@hwtr-prince ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCgmng5xL/auvI2F8ufFAfId2Ey55ONHjgnKKSEWLVWkPMutXT3BCnSglNAuEVRLX2zfzg3beQd80AHTow+qro5QWI/rYfeL1QPNEwoThbRFcvtWLTlgzBGA4ejjpIF9sCPNp0sXrrQRfxRP7w4b23BcRJQcsDoaEtKGKJZ2GQIoOafkYypwcunANb54EAouZTfHEPKDr26Gfw8usc2Sae32G/80QLBF2jGabyexJjNE3F6hdJTwq5iiqIVdSr4ue82zo3M8jBdtCMDGaOliI5RWSa9iuX9o2scCGDU69Gkw7ma+JHOP/e9Z8sUz03TkjPbEnGi3EC3YAHEoDzmwqTi07hppCuzacLB5NZ9UZ1g5PzBIZR8TJTONngT08EQyGrkNv2sUnn0dtBqve5tHR04NuXy65ym7Iwl2DDVbAL0NlM4gKWzOGZ2CnSLT0WmkG2sQKU37NmS2pBJ8RXJBatUFe4vQVzqlFj39iRGIBV5XR0I9xcxDfCxBHFs3aIqAqE= hwtr@hwtr-prince
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC/UzKwmFsAlLoCXvOq2lsC1sr1BRDW5uPkdcYUfQ7z4JowL/pscoTV9zjfJd1hPBvHLBvn7gs7gWt0wNnJfD1Oor26VreHjhi1PZE2kovrEzjmPoz+GqMPciV+HF9XNIRwDiHlUNFPt9qJjAJXJCFhzcmT9q0JQuPlNgJtQ6+By7RgPuJczpf17IbxpheLcXqtOFcTHyRT01KijIPhAtWRlmG5dahVuu50EfpmHRYZ8nCJJqkuJ6uRbFaPE6mYLnXLSzJUdyakYnzWbCd5phpoGAuFyQZnS503CFZUOFCnNEN8QfO2DXihp7lvrzzpI6PgcpvpotSo9kYFiEuB+DRlBQcVMWL0lUk2J1JHJH83y3CxwH0pUc7E1k6FAZE4pv4x0KEvbZSvmb8jAGWZkn4HvZCwXR5wGVi22s6RCdIHvR2PCpAy+ZSjpM+2FJIqDHpxY/vo3ktM9rpeCSwp14F/iiw6nanVq/KZBpCZ2paMcAU4WreCFZiPdGsdiixYlts= hungtr@bao ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC/UzKwmFsAlLoCXvOq2lsC1sr1BRDW5uPkdcYUfQ7z4JowL/pscoTV9zjfJd1hPBvHLBvn7gs7gWt0wNnJfD1Oor26VreHjhi1PZE2kovrEzjmPoz+GqMPciV+HF9XNIRwDiHlUNFPt9qJjAJXJCFhzcmT9q0JQuPlNgJtQ6+By7RgPuJczpf17IbxpheLcXqtOFcTHyRT01KijIPhAtWRlmG5dahVuu50EfpmHRYZ8nCJJqkuJ6uRbFaPE6mYLnXLSzJUdyakYnzWbCd5phpoGAuFyQZnS503CFZUOFCnNEN8QfO2DXihp7lvrzzpI6PgcpvpotSo9kYFiEuB+DRlBQcVMWL0lUk2J1JHJH83y3CxwH0pUc7E1k6FAZE4pv4x0KEvbZSvmb8jAGWZkn4HvZCwXR5wGVi22s6RCdIHvR2PCpAy+ZSjpM+2FJIqDHpxY/vo3ktM9rpeCSwp14F/iiw6nanVq/KZBpCZ2paMcAU4WreCFZiPdGsdiixYlts= hungtr@bao
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDAW4E8L/zGkcqixJo1102ddqeexoBMHIhXRXpWR3dTmJtbaaVbo4+rHRsjHPvHif9CRfi+BQ8CHG3zmBjH7DZPZIRCVtkms1EDe1k/G3fEnfgYc6gboJfoTdLkVjNOtdStTi03dCA/riQqUKc7/v16R5ZXIAmNCnmMHelObCSDPzYg8psZAUk1ZZY//pnhp9JRPsC2JxsshN7HCNIED9aFgrJkvUt+wUVGjVHzyQwyR6J7m1yyoivTwdmYdulG7OriLeeNq8vkoDmLGgLSC+zKehzJYOZsH3EKuxuZjQ3J9tK/NseQOhsQglRHE/OvphMwT/J96gl9dZR/LQXp4S6hwLccTzFfs8rLaTOIK6CEpqBUuBonot/1vJP5j5E73hfkHwZO7TQKwfXtpRCxCl5Nm3cB2Y3kz5mArDiwWioVsX4qd0XR0F9MFtuTVTn2f4K/Gwr9P3XMkLWXU1+1KbQiWIg+Zf5DpQgBW5HWryZzsMcjyMC2I2BJCl6Q+V8ofSM= nixos@Felia ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDAW4E8L/zGkcqixJo1102ddqeexoBMHIhXRXpWR3dTmJtbaaVbo4+rHRsjHPvHif9CRfi+BQ8CHG3zmBjH7DZPZIRCVtkms1EDe1k/G3fEnfgYc6gboJfoTdLkVjNOtdStTi03dCA/riQqUKc7/v16R5ZXIAmNCnmMHelObCSDPzYg8psZAUk1ZZY//pnhp9JRPsC2JxsshN7HCNIED9aFgrJkvUt+wUVGjVHzyQwyR6J7m1yyoivTwdmYdulG7OriLeeNq8vkoDmLGgLSC+zKehzJYOZsH3EKuxuZjQ3J9tK/NseQOhsQglRHE/OvphMwT/J96gl9dZR/LQXp4S6hwLccTzFfs8rLaTOIK6CEpqBUuBonot/1vJP5j5E73hfkHwZO7TQKwfXtpRCxCl5Nm3cB2Y3kz5mArDiwWioVsX4qd0XR0F9MFtuTVTn2f4K/Gwr9P3XMkLWXU1+1KbQiWIg+Zf5DpQgBW5HWryZzsMcjyMC2I2BJCl6Q+V8ofSM= nixos@Felia
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJvOCZ4nyFiiKK7gkwzP4hXJ6NmtgbdUJdWgIzUL0GMA htran@Hungs-MacBook-Pro.local
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBCA6TLpBjcffVHr7DwSqaqPgFStuI7W8VJA3/ya5Xhw hungtran@Hungs-MacBook-Air.local

View File

@ -3,18 +3,30 @@ Host felia-win
HostName felia.coati-celsius.ts.net HostName felia.coati-celsius.ts.net
Port 2222 Port 2222
User _nhitrl User _nhitrl
SendEnv TERM
SetEnv TERM=xterm-256color
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
# Ubuntu 12c 32G-RAM # Ubuntu 12c 32G-RAM
Host felia Host felia
HostName felia.coati-celsius.ts.net HostName felia.coati-celsius.ts.net
User ubuntu_admin User ubuntu_admin
Port 22 Port 22
SendEnv TERM
SetEnv TERM=xterm-256color
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
# 2c 16G-RAM 200G drive # 2c 16G-RAM 200G drive
Host fel Host fel
HostName fel.coati-celsius.ts.net HostName fel.coati-celsius.ts.net
User user User user
Port 22 Port 22
SendEnv TERM
SetEnv TERM=xterm-256color
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
# AMZ Linux aarch64 hungtr@AMZ # AMZ Linux aarch64 hungtr@AMZ
Host nioma Host nioma
@ -22,32 +34,56 @@ Host nioma
User ec2-user User ec2-user
IdentityFile ~/.ssh/free-aws.pem IdentityFile ~/.ssh/free-aws.pem
Port 22 Port 22
SendEnv TERM
SetEnv TERM=xterm-256color
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
# NixOS Pegasust-gh@Linode # NixOS Pegasust-gh@Linode
Host nyx Host nyx
HostName nyx.pegasust.com HostName nyx.pegasust.com
User hungtr User hungtr
Port 22 Port 22
SendEnv TERM
SetEnv TERM=xterm-256color
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
Host lizzi Host lizzi
HostName 172.105.135.218 HostName 172.105.135.218
User hungtr User hungtr
Port 22 Port 22
SendEnv TERM
SetEnv TERM=xterm-256color
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
Host pixi Host pixi
HostName 139.144.60.254 HostName 139.144.60.254
User hungtr User hungtr
Port 22 Port 22
SendEnv TERM
SetEnv TERM=xterm-256color
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
Host mokoi Host mokoi
HostName 129.146.98.121 HostName 129.146.98.121
User ubuntu_admin User ubuntu_admin
Port 22 Port 22
SendEnv TERM
SetEnv TERM=xterm-256color
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
Host noami Host noami
HostName 10.100.200.230 HostName 10.100.200.230
User htran User htran
Port 22 Port 22
SendEnv TERM
SetEnv TERM=xterm-256color
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
Host sr1 Host sr1
HostName 10.30.76.46 HostName 10.30.76.46
@ -56,22 +92,57 @@ Host sr1
StrictHostKeyChecking no StrictHostKeyChecking no
HostKeyAlgorithms=+ssh-dss,ssh-rsa HostKeyAlgorithms=+ssh-dss,ssh-rsa
KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1 KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1
SendEnv TERM
SetEnv TERM=xterm-256color
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
Host bgp1 Host bgp1
HostName 10.111.100.113 HostName 10.111.100.113
User htran User htran
Port 22 Port 22
StrictHostKeyChecking no StrictHostKeyChecking no
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
HostKeyAlgorithms=+ssh-dss,ssh-rsa HostKeyAlgorithms=+ssh-dss,ssh-rsa
KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1 KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1
SendEnv TERM
SetEnv TERM=xterm-256color
Host bgp2 Host bgp2
HostName 10.111.100.114 HostName 10.111.100.114
User htran User htran
Port 22 Port 22
StrictHostKeyChecking no StrictHostKeyChecking no
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
HostKeyAlgorithms=+ssh-dss,ssh-rsa HostKeyAlgorithms=+ssh-dss,ssh-rsa
KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1 KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1
SendEnv TERM
SetEnv TERM=xterm-256color
Host 10.111.100.*
User htran
Port 22
StrictHostKeyChecking no
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
HostKeyAlgorithms=+ssh-dss,ssh-rsa
KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1
SendEnv TERM
SetEnv TERM=xterm-256color
Host 10.111.101.*
User htran
Port 22
StrictHostKeyChecking no
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
HostKeyAlgorithms=+ssh-dss,ssh-rsa
KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1
SendEnv TERM
SetEnv TERM=xterm-256color
Host d1-30 Host d1-30
HostName 10.111.103.60 HostName 10.111.103.60
User htran User htran
@ -80,6 +151,8 @@ Host d1-30
UserKnownHostsFile /dev/null UserKnownHostsFile /dev/null
IdentityFile ~/.ssh/id_ed25519 IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa IdentityFile ~/.ssh/id_rsa
SendEnv TERM
SetEnv TERM=xterm-256color
Host d3l-3 Host d3l-3
HostName 10.111.103.65 HostName 10.111.103.65
@ -89,54 +162,127 @@ Host d3l-3
UserKnownHostsFile /dev/null UserKnownHostsFile /dev/null
IdentityFile ~/.ssh/id_ed25519 IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa IdentityFile ~/.ssh/id_rsa
SendEnv TERM
SetEnv TERM=xterm-256color
Host dev0 Host dev0
HostName 10.100.200.230 HostName 10.100.200.230
User htran User htran
Port 22 Port 22
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
SendEnv TERM
SetEnv TERM=xterm-256color
Host dev2 Host dev2
HostName 10.100.200.210 HostName 10.100.200.210
User htran User htran
Port 22 Port 22
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
SendEnv TERM
SetEnv TERM=xterm-256color
Host dev1 Host dev1
HostName 10.100.200.220 HostName 10.100.200.220
User htran User htran
Port 22 Port 22
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
SendEnv TERM
SetEnv TERM=xterm-256color
Host ztp-egi Host ztp-egi
HostName 10.23.27.201 HostName 10.23.27.201
User root User root
Port 22 Port 22
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
SendEnv TERM
SetEnv TERM=xterm-256color
Host goat Host goat
HostName 10.133.32.100 HostName 10.133.32.100
User "EGN NOC" User "EGN NOC"
Port 22 Port 22
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
SendEnv TERM
SetEnv TERM=xterm-256color
Host portal2 Host portal2
HostName portal2.egihosting.com HostName portal2.egihosting.com
User root User root
Port 22 Port 22
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
SendEnv TERM
SetEnv TERM=xterm-256color
Host egn-rest-api Host egn-rest-api
HostName egn-rest-api.egihosting.com HostName egn-rest-api.egihosting.com
User root User root
Port 22 Port 22
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
SendEnv TERM
SetEnv TERM=xterm-256color
Host gl-egi Host gl-egi
HostName gitlab.egihosting.com HostName gitlab.egihosting.com
User git User git
Port 22 Port 22
IdentityFile ~/.ssh/id_ed25519 IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
Host 10.111.103.* Host 10.111.103.*
StrictHostKeyChecking no StrictHostKeyChecking no
UserKnownHostsFile /dev/null UserKnownHostsFile /dev/null
Host *
IdentityFile ~/.ssh/id_ed25519 IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa IdentityFile ~/.ssh/id_rsa
Host *
SendEnv TERM
SetEnv TERM=xterm-256color
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
Host *.egihosting.com
StrictHostKeyChecking no
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
Host grafana-egi
HostName grafana.egihosting.com
User nokia
Port 22
SendEnv TERM
SetEnv TERM=xterm-256color
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
Host syslog-egi
HostName syslog.egihosting.com
User root
Port 22
SendEnv TERM
SetEnv TERM=xterm-256color
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
Host geofeed-egi
HostName geofeed.egihosting.com
User root
Port 22
SendEnv TERM
SetEnv TERM=xterm-256color
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa
Host gh
HostName github.com
User git
Port 22
IdentityFile ~/.ssh/id_ed25519
IdentityFile ~/.ssh/id_rsa

View File

@ -1,4 +1,5 @@
# TODO: vim-plug and Mason supports laziness. Probably worth it to explore incremental dependencies based on the project TODO: just install these things, then symlink to mason's bin directory # TODO: vim-plug and Mason supports laziness. Probably worth it to explore incremental dependencies based on the project
# TODO: just install these things, then symlink to mason's bin directory
# #
# One thing to consider, though, /nix/store of `nix-shell` or `nix-develop` # One thing to consider, though, /nix/store of `nix-shell` or `nix-develop`
# might be different from `home-manager`'s (~/.nix_profile/bin/jq) # might be different from `home-manager`'s (~/.nix_profile/bin/jq)
@ -15,27 +16,13 @@
# see: :/--suffix.*PATH # see: :/--suffix.*PATH
# there should be mentions of additional packages # there should be mentions of additional packages
my_neovim = pkgs.neovim-unwrapped; my_neovim = pkgs.neovim-unwrapped;
rust_pkgs =
pkgs.rust-bin.selectLatestNightlyWith
(
toolchain:
toolchain.default.override {
extensions = ["rust-src" "rust-analyzer" "rust-docs" "rustfmt" "clippy" "miri"];
}
);
nvim_pkgs = nvim_pkgs =
[ [
# pkgs.gccStdenv # pkgs.gccStdenv
pkgs.tree-sitter # pkgs.tree-sitter
pkgs.fzf # file name fuzzy search pkgs.fzf # file name fuzzy search
pkgs.ripgrep # content fuzzy search pkgs.ripgrep # content fuzzy search
pkgs.zk # Zettelkasten (limited support)
pkgs.fd # Required by a Telescope plugin (?) pkgs.fd # Required by a Telescope plugin (?)
pkgs.stdenv.cc.cc.lib
pkgs.rnix-lsp # doesn't work, Mason just installs it using cargo
pkgs.rust4cargo
pkgs.nickel
pkgs.nls
pkgs.go # doesn't work, Mason installs from runtime path pkgs.go # doesn't work, Mason installs from runtime path
@ -140,6 +127,8 @@ in {
vim-dispatch-neovim vim-dispatch-neovim
vim-fugitive vim-fugitive
vim-jack-in vim-jack-in
sg-nvim
telescope-live-grep-args-nvim
; ;
in [ in [
plenary-nvim plenary-nvim
@ -185,6 +174,8 @@ in {
vim-dispatch-neovim vim-dispatch-neovim
vim-fugitive vim-fugitive
vim-jack-in vim-jack-in
sg-nvim
telescope-live-grep-args-nvim
]; ];
}; };
# home.packages = nvim_pkgs; # home.packages = nvim_pkgs;

View File

@ -1,135 +0,0 @@
# Configurations for shell stuffs.
# Should probably be decoupled even more for each feature
{
config,
proj_root,
myLib,
pkgs,
...
}: let
cfg = config.base.shells;
in {
options.base.shells = {
enable = myLib.mkOption {
type = myLib.types.bool;
description = "Enable umbrella shell configuration";
default = true;
example = false;
};
# TODO: Support shell-specific init
shellInitExtra = myLib.mkOption {
type = myLib.types.str;
description = "Extra shell init. The syntax should be sh-compliant";
default = "";
example = ''
# X11 support for WSL
export DISPLAY=$(ip route list default | awk '{print $3}'):0
export LIBGL_ALWAYS_INDIRECT=1
'';
};
shellAliases = myLib.mkOption {
type = myLib.types.attrs;
description = "Shell command aliases";
default = {};
example = {
nixGL = "nixGLIntel";
};
};
};
config = myLib.mkIf cfg.enable {
# nix: Propagates the environment with packages and vars when enter (children of)
# a directory with shell.nix-compatible and .envrc
programs.direnv = {
enable = true;
nix-direnv.enable = true;
# nix-direnv.enableFlakes = true; # must remove. this will always be supported.
};
# z <path> as smarter cd
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
programs.tmux = {
enable = true;
# extraConfigBeforePlugin = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf";
plugins = let inherit (pkgs.tmuxPlugins) cpu net-speed; in [cpu net-speed];
extraConfig = builtins.readFile "${proj_root.config.path}/tmux/tmux.conf";
};
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 '
'';
# Colored ls
programs.exa = {
enable = true;
enableAliases = true;
};
# Make the shell look beautiful
programs.starship = {
enable = true;
enableZshIntegration = true;
settings = let
native = builtins.fromTOML (builtins.readFile "${proj_root.config.path}/starship/starship.toml");
patch-nix = pkgs.lib.recursiveUpdate native {
# WARNING: home-manager fails on here for some reason. Likely not at the
# validation phase (type-checking), but at evaluation phaase (stringify)
# c.commands = [
# ["nix" "run" "nixpkgs#clang" "--" "--version"]
# ["nix" "run" "nixpkgs#gcc" "--" "--version"]
# ];
c.commands = "fuk";
};
in
patch-nix;
};
# Fuzzy finder. `fzf` for TUI, `fzf -f '<fuzzy query>'` for UNIX piping
programs.fzf.enable = true;
programs.bash = {
enable = true;
enableCompletion = true;
initExtra = cfg.shellInitExtra or "";
};
programs.zsh = {
enable = true;
enableCompletion = true;
enableAutosuggestions = true;
shellAliases =
{
nix-rebuild = "sudo nixos-rebuild switch";
hm-switch = "home-manager switch --flake";
}
// (cfg.shellAliases or {});
history = {
size = 10000;
path = "${config.xdg.dataHome}/zsh/history";
};
oh-my-zsh = {
enable = true;
plugins = [
"git" # git command aliases: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git#aliases
# "sudo" # double-escape to prepend sudo # UPDATE: just use vi-mode lol
"command-not-found" # suggests which package to install; does not support nixos (we have solution already)
"gitignore" # `gi list` -> `gi java >>.gitignore`
"ripgrep" # adds completion for `rg`
"rust" # compe for rustc/cargo
"poetry" # compe for poetry - Python's cargo
# "vi-mode" # edit promps with vi motions :)
];
};
sessionVariables = {
# Vim mode on the terminal
# VI_MODE_RESET_PROMPT_ON_MODE_CHANGE = true;
# VI_MODE_SET_CURSOR = true;
# ZVM_VI_ESCAPE_BINDKEY = "";
ZVM_READKEY_ENGINE = "$ZVM_READKEY_ENGINE_NEX";
ZVM_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :)
ZVM_ESCAPE_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :)
};
initExtra =
(cfg.shellInitExtra or "")
+ ''
source ${pkgs.zsh-vi-mode}/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh
'';
};
};
}

View File

@ -4,3 +4,6 @@ post-build-hook = /etc/nix/upload-to-cache.sh
trusted-users = root htran hungtran hwtr trusted-users = root htran hungtran hwtr
max-jobs = 8 max-jobs = 8
cores = 12 cores = 12
# default is true for Linux, false for every one else
# https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-sandbox
sandbox = true

View File

@ -2,8 +2,9 @@ let
# user-specific (~/.ssh/id_ed25519.pub) # user-specific (~/.ssh/id_ed25519.pub)
users = { users = {
"hungtr@bao" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z"; "hungtr@bao" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK+1+gps6phbZboIb9fH51VNPUCkhSSOAbkI3tq3Ou0Z";
"htran@Hungs-MacBook-Pro.local" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJvOCZ4nyFiiKK7gkwzP4hXJ6NmtgbdUJdWgIzUL0GMA";
}; };
# System-specific settings (/etc/ssh/ssh_hsot_ed25519_key.pub) # System-specific settings (/etc/ssh/ssh_host_ed25519_key.pub)
systems = { systems = {
"bao" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIBuAaAE7TiQmMH300VRj/pYCri1qPmHjd+y9aX2J0Fs"; "bao" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIBuAaAE7TiQmMH300VRj/pYCri1qPmHjd+y9aX2J0Fs";
}; };

View File

@ -1,47 +0,0 @@
# TODO: this should use winnow with a fair matching of supported systems
{
inputs,
cell,
}: let
inherit (cell) home-profiles home-modules;
inherit (inputs) home-manager;
pkgs = inputs.nixpkgs;
# hm is derivation that is compatible with homeConfigurations
home-config = {supported_systems, hm, tested_systems ? []}:
hm // {
_supported_systems = supported_systems;
_tested_systems = tested_systems;
};
base-modules = [
home-profiles.alacritty
# home-profiles.git
home-profiles.ssh
home-profiles.shells
({config.programs.home-manager.enable = true;})
home-profiles.nix-index
home-profiles.neovim
];
in {
homeConfigurations.htran = home-config {
supported_systems = ["aarch64-darwin" "x86_64-darwin"];
tested_systems = ["aarch64-darwin"];
hm = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = base-modules ++ [
home-profiles.nerd_font_module
home-profiles.git-htran
home-profiles.dev-packages
home-profiles.zk
home-modules.darwin-spotlight
({
home.username = "htran";
home.homeDirectory = "/Users/htran";
home.stateVersion = "23.11";
})
];
};
};
}

View File

@ -1,250 +0,0 @@
# This is an interface for home-profiles and should not contain opinionated
# configurations. It should provide alternative configurations, aggregates
# or new configurations
_imports@{ inputs, cell }:
let
namespace = "repo";
imports = _imports // { inherit namespace; };
in
{
git = { config, lib, ... }:
let
cfg = config."${namespace}".git;
baseAliases = {
a = "add";
c = "commit";
ca = "commit --amend";
cm = "commit -m";
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all";
sts = "status";
co = "checkout";
b = "branch";
};
default-user = "Pegasust";
default-email = "pegasucksgg@gmail.com";
in
{
options."${namespace}".git = {
aliases = lib.mkOption {
type = lib.types.attrs;
default = { };
example = baseAliases;
description = ''
Additional git aliases. This settings comes with base configuration.
Redeclaring the base config will override the values.
''; # TODO: Add baseAliases as string here (builtins.toString doesn't work)
};
name = lib.mkOption {
type = lib.types.str;
default = default-user;
description = "Git username that appears on commits";
example = default-user;
};
email = lib.mkOption {
type = lib.types.str;
default = default-email;
example = default-email;
description = "Git email that appears on commits";
};
ignores = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [
".vscode" # vscode settings
".direnv" # .envrc cached outputs
".DS_Store" # MacOS users, amrite
];
description = ''
.gitignore patterns that are applied in every "${namespace}"sitory.
This is useful for IDE-specific settings.
'';
example = [ ".direnv" "node_modules" ];
};
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Enables git
'';
example = false;
};
credentialCacheTimeoutSeconds = lib.mkOption {
type = lib.types.int;
default = 3000;
description = "Credential cache (in-memory store) for Git in seconds.";
example = 3000;
};
};
# TODO : anyway to override configuration?
# idk wtf I was thinking about. there is no context in this question
config.programs.git = {
inherit (cfg) enable ignores;
userName = cfg.name;
userEmail = cfg.email;
aliases = baseAliases // cfg.aliases;
extraConfig = {
# TODO: in the case of darwin, git always open up the built-in keychain.
# possibly something we can't really control since we don't have access to `nix-darwin`
credential.helper = "cache --timeout=${builtins.toString cfg.credentialCacheTimeoutSeconds}";
};
lfs.enable = true;
};
};
alacritty = { config, lib, ... }:
let
inherit (inputs.cells.repo.lib) fromYAML;
cfg = config."${namespace}".alacritty;
in
{
options."${namespace}".alacritty = {
font.family = lib.mkOption {
type = lib.types.nullOr lib.types.singleLineStr;
default = null;
description = ''
The font family for Alacritty
'';
example = "DroidSansMono NF";
};
font.size = lib.mkOption {
type = lib.types.nullOr lib.types.number;
default = 11.0;
description = ''
The default font size for Alacritty. This is probably measured in px.
'';
example = 7.0;
};
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Enables alacritty
'';
example = true;
};
config-path = lib.mkOption {
type = lib.types.path;
description = "Path to alacritty yaml";
default = null;
example = "./config/alacritty.yaml";
};
};
config.programs.alacritty = {
enable = cfg.enable;
settings =
let
actualConfig =
if cfg.config-path != null then fromYAML (builtins.readFile cfg.config-path) else { };
in
lib.recursiveUpdate actualConfig {
font.normal.family = lib.mkIf (cfg.font.family != null) cfg.font.family;
font.size = lib.mkIf (cfg.font.size != null) cfg.font.size;
};
};
};
# TODO: chromium is not really supported on darwin
private_chromium = { config, pkgs, lib, ... }:
let
cfg = config."${namespace}".private_chromium;
in
{
options."${namespace}".private_chromium = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
example = false;
description = ''
Enable extremely lightweight chromium with vimium plugin
'';
};
};
config = lib.mkIf (cfg.enable) {
# home.packages = [pkgs.ungoogled-chromium];
programs.chromium = {
enable = true;
package = pkgs.ungoogled-chromium;
extensions =
let
# TODO: how about a chrome extension registry?
mkChromiumExtForVersion = browserVersion: { id, sha256, extVersion, ... }:
{
inherit id;
crxPath = builtins.fetchurl {
url = "https://clients2.google.com/service/update2/crx" +
"?response=redirect" +
"&acceptformat=crx2,crx3" +
"&prodversion=${browserVersion}" +
"&x=id%3D${id}%26installsource%3Dondemand%26uc";
name = "${id}.crx";
inherit sha256;
};
version = extVersion;
};
mkChromiumExt = mkChromiumExtForVersion (lib.versions.major pkgs.ungoogled-chromium.version);
in
[
# vimium
(mkChromiumExt {
id = "dbepggeogbaibhgnhhndojpepiihcmeb";
sha256 = "00qhbs41gx71q026xaflgwzzridfw1sx3i9yah45cyawv8q7ziic";
extVersion = "1.67.4";
})
];
};
};
};
darwin-spotlight = { lib, pkgs, config, ... }: {
# This patch exists since Darwin's search bar requires solid apps and not
# symlinked
# TODO: QA
# - [x] works for base case
# - [x] works for repeated case
# - [ ] works after base case, then removed
# - [ ] works for repeated case, then removed
# Copy GUI apps to "~/Applications/Home Manager Apps"
# Based on this comment: https://github.com/nix-community/home-manager/issues/1341#issuecomment-778820334
home.activation.patch-spotlight =
if pkgs.stdenv.isDarwin then
let
apps = pkgs.buildEnv {
name = "home-manager-applications";
paths = config.home.packages;
pathsToLink = "/Applications";
};
in
lib.hm.dag.entryAfter [ "linkGeneration" ] ''
# Install MacOS applications to the user environment.
HM_APPS="$HOME/Applications/Home Manager Apps"
# Reset current state
if [ -e "$HM_APPS" ]; then
$DRY_RUN_CMD mv "$HM_APPS" "$HM_APPS.$(date +%Y%m%d%H%M%S)"
fi
$DRY_RUN_CMD mkdir -p "$HM_APPS"
# .app dirs need to be actual directories for Finder to detect them as Apps.
# In the env of Apps we build, the .apps are symlinks. We pass all of them as
# arguments to cp and make it dereference those using -H
$DRY_RUN_CMD cp --archive -H --dereference ${apps}/Applications/* "$HM_APPS"
$DRY_RUN_CMD chmod +w -R "$HM_APPS"
''
else
"";
# We need this in case upstream home-manager changes the behavior of linking
# applications
home.activation.remove-patch-spotlight =
if pkgs.stdenv.isDarwin then
lib.hm.dag.entryBefore [ "checkLinkTargets" ] ''
HM_APPS="$HOME/Applications/Home Manager Apps"
# Reset current state
if [ -e "$HM_APPS" ]; then
$DRY_RUN_CMD mv "$HM_APPS" "$HM_APPS.$(date +%Y%m%d%H%M%S)"
fi
''
else
"";
};
}

View File

@ -1,16 +0,0 @@
{ inputs, cell }:
let
namespace = "repo"; # ignore: unused
yamlToJsonDrv = pkgs: yamlContent: outputPath: (pkgs.runCommand
outputPath
{ inherit yamlContent; nativeBuildInputs = [ pkgs.yq ]; }
# run yq which outputs '.' (no filter) on file at yamlPath
# note that $out is passed onto the bash/sh script for execution
''
echo "$yamlContent" | yq >$out
'');
in
{
fromYAML = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv inputs.nixpkgs yamlContent "fromYaml.json"));
}

View File

@ -1,6 +0,0 @@
{
inputs,
cell,
}: {
inherit (inputs.cells.dotfiles.packages) kpcli-py;
}

22
nix/dev/packages.nix Normal file
View File

@ -0,0 +1,22 @@
{
inputs,
cell,
}: let
inherit (inputs.nixpkgs) system;
poetry2nix = inputs.nix-boost.inputs.poetry2nix.legacyPackages.${system};
pixi-src = "${inputs.self}/dev/pixi";
in {
pixi-deps = poetry2nix.mkPoetryEnv {
projectDir = pixi-src;
editablePackageSources = {
pixi = pixi-src;
};
};
pixi-edit = poetry2nix.mkPoetryEditablePackage {
projectDir = pixi-src;
editablePackageSources = {
pixi = pixi-src;
};
};
}

15
nix/dev/shells.nix Normal file
View File

@ -0,0 +1,15 @@
{
inputs,
cell,
}: let
inherit (inputs.nixpkgs) system;
inherit (cell.packages) pixi-deps pixi-edit;
in {
pixi = inputs.nixpkgs.mkShell {
buildInputs = [
pixi-deps
# pixi-edit
inputs.std.packages.${system}.default
];
};
}

View File

@ -6,6 +6,8 @@
in { in {
default = std.lib.dev.mkShell { default = std.lib.dev.mkShell {
name = "default"; name = "default";
imports = [inputs.std.std.devshellProfiles.default]; imports = [
inputs.std.std.devshellProfiles.default
];
}; };
} }

View File

@ -21,4 +21,16 @@ in {
}); });
}; };
# sg-nvim = inputs.nixpkgs.vimUtils.buildVimPluginFrom2Nix {
# pname = "sg.nvim";
# version = "2023-06-20";
# src = inputs.nixpkgs.fetchFromGitHub {
# owner = "sourcegraph";
# repo = "sg.nvim";
# rev = "b87f87614357e0a7e6ff888918532ea11e87feb3";
# sha256 = "1xmj05i4bw2cx9d18mm85ynkn29dkngn5090r71wssvan6dm3fb4";
# };
# meta.homepage = "https://github.com/sourcegraph/sg.nvim/";
# };
sg-nvim = inputs.sg-nvim.packages.${system}.default;
} }

5
nix/repo/formatter.nix Normal file
View File

@ -0,0 +1,5 @@
{
inputs,
cell,
}:
inputs.nixpkgs.alejandra

View File

@ -0,0 +1,83 @@
# TODO: this should use winnow with a fair matching of supported systems
{
inputs,
cell,
}: let
inherit (cell) home-profiles home-modules;
inherit (inputs) home-manager;
pkgs = inputs.nixpkgs;
# hm is derivation that is compatible with homeConfigurations
home-config = {
supported_systems,
hm,
tested_systems ? [],
}:
hm
// {
_supported_systems = supported_systems;
_tested_systems = tested_systems;
};
base-modules = [
# home-profiles.alacritty
home-modules.alacritty
home-profiles.kitty
home-profiles.git
home-profiles.ssh
home-profiles.shells
{config.programs.home-manager.enable = true;}
# home-profiles.nix-index
home-profiles.neovim
{home.packages = [cell.packages.nixr];}
];
in {
homeConfigurations.htran = home-config {
supported_systems = ["aarch64-darwin" "x86_64-darwin"];
tested_systems = ["aarch64-darwin"];
hm = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules =
base-modules
++ [
home-profiles.darwin-patches
home-profiles.nerd_font_module
home-profiles.git-htran
home-profiles.dev-packages
# home-profiles.zk
home-modules.darwin-spotlight
{
home.username = "htran";
home.homeDirectory = "/Users/htran";
home.stateVersion = "23.11";
}
# home-profiles.passman
];
};
};
homeConfigurations.hungtran = home-config {
supported_systems = ["aarch64-darwin" "x86_64-darwin"];
tested_systems = ["aarch64-darwin"];
hm = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules =
base-modules
++ [
home-profiles.darwin-patches
home-profiles.nerd_font_module
home-profiles.git-pegasust
home-profiles.dev-packages
# home-profiles.zk
home-modules.darwin-spotlight
{
home.username = "hungtran";
home.homeDirectory = "/Users/hungtran";
home.stateVersion = "23.11";
}
];
};
};
}

View File

@ -0,0 +1,287 @@
# This is an interface for home-profiles and should not contain opinionated
# configurations. It should provide alternative configurations, aggregates
# or new configurations
_imports @ {
inputs,
cell,
}: let
namespace = "repo";
imports = _imports // {inherit namespace;};
in {
git = { config, lib, options, ... }: let
cfg = config."${namespace}".git;
baseAliases = {
a = "add";
c = "commit";
ca = "commit --amend";
cm = "commit -m";
# lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
# lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all";
sts = "status";
co = "checkout";
b = "branch";
};
default-user = "Pegasust";
default-email = "pegasucksgg@gmail.com";
in {
options."${namespace}".git = {
aliases = lib.mkOption {
type = lib.types.attrs;
default = {};
example = baseAliases;
description = ''
Additional git aliases. This settings comes with base configuration.
Redeclaring the base config will override the values.
''; # TODO: Add baseAliases as string here (builtins.toString doesn't work)
};
name = lib.mkOption {
type = lib.types.str;
default = default-user;
description = "Git username that appears on commits";
example = default-user;
};
email = lib.mkOption {
type = lib.types.str;
default = default-email;
example = default-email;
description = "Git email that appears on commits";
};
ignores = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [
".vscode" # vscode settings
".direnv" # .envrc cached outputs
".DS_Store" # MacOS users, amrite
];
description = ''
.gitignore patterns that are applied in every "${namespace}"sitory.
This is useful for IDE-specific settings.
'';
example = [".direnv" "node_modules"];
};
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Enables git
'';
example = false;
};
credentialCacheTimeoutSeconds = lib.mkOption {
type = lib.types.int;
default = 3000;
description = "Credential cache (in-memory store) for Git in seconds.";
example = 3000;
};
};
# TODO : anyway to override configuration?
# idk wtf I was thinking about. there is no context in this question
config.programs.git = {
inherit (cfg) enable ignores;
userName = cfg.name;
userEmail = cfg.email;
aliases = baseAliases // cfg.aliases;
extraConfig = {
# TODO: in the case of darwin, git always open up the built-in keychain.
# possibly something we can't really control since we don't have access to `nix-darwin`
credential.helper = "cache --timeout=${builtins.toString cfg.credentialCacheTimeoutSeconds}";
};
lfs.enable = true;
};
};
alacritty = {
config,
lib,
...
}: let
inherit (inputs.cells.repo.lib) fromYAML;
cfg = config."${namespace}".alacritty;
in {
options."${namespace}".alacritty = {
font.family = lib.mkOption {
type = lib.types.nullOr lib.types.singleLineStr;
default = null;
description = ''
The font family for Alacritty
'';
example = "DroidSansMono NF";
};
font.size = lib.mkOption {
type = lib.types.nullOr lib.types.number;
default = 11.0;
description = ''
The default font size for Alacritty. This is probably measured in px.
'';
example = 7.0;
};
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Enables alacritty
'';
example = true;
};
config-path = lib.mkOption {
type = lib.types.path;
description = "Path to alacritty yaml";
default = null;
example = "./config/alacritty.yaml";
};
};
config.programs.alacritty = {
enable = cfg.enable;
settings = let
actualConfig =
if cfg.config-path != null
then fromYAML (builtins.readFile cfg.config-path)
else {};
in
lib.recursiveUpdate actualConfig {
font.normal.family = lib.mkIf (cfg.font.family != null) cfg.font.family;
font.size = lib.mkIf (cfg.font.size != null) cfg.font.size;
};
};
};
kitty = {
config,
lib,
# pkgs,
...
}: let
cfg = config."${namespace}".kitty;
in {
options."${namespace}".kitty = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enables kitty";
};
conf = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
description = "Path to kitty.conf. See https://sw.kovidgoyal.net/kitty/conf.html";
example = "../../../native_configs/kitty/kitty.conf";
};
};
config.programs.kitty = {
enable = cfg.enable;
extraConfig = lib.mkIf (cfg.conf != null) (builtins.readFile cfg.conf);
};
};
# TODO: chromium is not really supported on darwin
private_chromium = {
config,
pkgs,
lib,
...
}: let
cfg = config."${namespace}".private_chromium;
in {
options."${namespace}".private_chromium = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
example = false;
description = ''
Enable extremely lightweight chromium with vimium plugin
'';
};
};
config = lib.mkIf (cfg.enable) {
# home.packages = [pkgs.ungoogled-chromium];
programs.chromium = {
enable = true;
package = pkgs.ungoogled-chromium;
extensions = let
# TODO: how about a chrome extension registry?
mkChromiumExtForVersion = browserVersion: {
id,
sha256,
extVersion,
...
}: {
inherit id;
crxPath = builtins.fetchurl {
url =
"https://clients2.google.com/service/update2/crx"
+ "?response=redirect"
+ "&acceptformat=crx2,crx3"
+ "&prodversion=${browserVersion}"
+ "&x=id%3D${id}%26installsource%3Dondemand%26uc";
name = "${id}.crx";
inherit sha256;
};
version = extVersion;
};
mkChromiumExt = mkChromiumExtForVersion (lib.versions.major pkgs.ungoogled-chromium.version);
in [
# vimium
(mkChromiumExt {
id = "dbepggeogbaibhgnhhndojpepiihcmeb";
sha256 = "00qhbs41gx71q026xaflgwzzridfw1sx3i9yah45cyawv8q7ziic";
extVersion = "1.67.4";
})
];
};
};
};
darwin-spotlight = {
lib,
pkgs,
config,
...
}: {
# This patch exists since Darwin's search bar requires solid apps and not
# symlinked
# TODO: QA
# - [x] works for base case
# - [x] works for repeated case
# - [ ] works after base case, then removed
# - [ ] works for repeated case, then removed
# Copy GUI apps to "~/Applications/Home Manager Apps"
# Based on this comment: https://github.com/nix-community/home-manager/issues/1341#issuecomment-778820334
home.activation.patch-spotlight =
if pkgs.stdenv.isDarwin
then let
apps = pkgs.buildEnv {
name = "home-manager-applications";
paths = config.home.packages;
pathsToLink = "/Applications";
};
in
lib.hm.dag.entryAfter ["linkGeneration"] ''
# Install MacOS applications to the user environment.
HM_APPS="$HOME/Applications/Home Manager Apps"
# Reset current state
if [ -e "$HM_APPS" ]; then
$DRY_RUN_CMD mv "$HM_APPS" "$HM_APPS.$(date +%Y%m%d%H%M%S)"
fi
$DRY_RUN_CMD mkdir -p "$HM_APPS"
# .app dirs need to be actual directories for Finder to detect them as Apps.
# In the env of Apps we build, the .apps are symlinks. We pass all of them as
# arguments to cp and make it dereference those using -H
$DRY_RUN_CMD cp --archive -H --dereference ${apps}/Applications/* "$HM_APPS"
$DRY_RUN_CMD chmod +w -R "$HM_APPS"
''
else "";
# We need this in case upstream home-manager changes the behavior of linking
# applications
home.activation.remove-patch-spotlight =
if pkgs.stdenv.isDarwin
then
lib.hm.dag.entryBefore ["checkLinkTargets"] ''
HM_APPS="$HOME/Applications/Home Manager Apps"
# Reset current state
if [ -e "$HM_APPS" ]; then
$DRY_RUN_CMD mv "$HM_APPS" "$HM_APPS.$(date +%Y%m%d%H%M%S)"
fi
''
else "";
};
}

View File

@ -0,0 +1,71 @@
{
inputs,
cell,
}: {
rclone-mount = {
config,
lib,
pkgs,
...
}: let
cfg = config.services.rclone;
rcloneCommand = "${pkgs.rclone}/bin/rclone";
inherit (lib) mkEnableOption mkOption types mkIf mapAttrs' nameValuePair;
makeMountService = name: mountCfg: {
Unit = {
Description = "Rclone Mount ${name}";
After = ["network.target"];
};
Service = {
ExecStart = "${rcloneCommand} mount ${mountCfg.remotePath} ${mountCfg.mountPoint}";
Restart = "on-failure";
};
Install = {WantedBy = ["default.target"];};
};
makeLaunchdService = name: mountCfg: {
enable = true;
settings = {
ProgramArguments = ["/bin/sh" "-c" "${rcloneCommand} mount ${mountCfg.remotePath} ${mountCfg.mountPoint}"];
KeepAlive = {
NetworkState = true;
};
};
};
in {
options.services.rclone = {
enable = mkEnableOption "rclone mount service";
mounts = mkOption {
type = types.attrsOf (types.submodule {
options = {
remotePath = mkOption {
type = types.str;
default = "";
description = "The remote path to mount via rclone";
};
mountPoint = mkOption {
type = types.str;
default = "";
description = "The local mount point for the rclone mount";
};
};
});
default = {};
description = "Rclone mounts";
};
};
config = mkIf cfg.enable {
home.packages = [pkgs.rclone];
systemd.user.services = mapAttrs' (n: v: nameValuePair "rclone-mount-${n}" (makeMountService n v)) cfg.mounts;
launchd.user.agents = mapAttrs' (n: v: nameValuePair "rclone-mount-${n}" (makeLaunchdService n v)) cfg.mounts;
};
};
}

View File

@ -18,9 +18,9 @@ in {
}: { }: {
config.fonts.fontconfig.enable = true; config.fonts.fontconfig.enable = true;
config.home.packages = [ config.home.packages = [
(pkgs.nerdfonts.override {fonts = ["Hack"];}) (pkgs.nerdfonts.override {fonts = ["FiraCode"];})
]; ];
config."${namespace}".alacritty.font.family = "Hack Nerd Font Mono"; config."${namespace}".alacritty.font.family = "FiraCode Nerd Font Mono";
}; };
secrets = { secrets = {
@ -67,9 +67,7 @@ in {
config, config,
lib, lib,
... ...
}: let }: {
cfg = config."${namespace}".alacritty;
in {
imports = [ imports = [
inputs.cells.repo.home-modules.alacritty inputs.cells.repo.home-modules.alacritty
]; ];
@ -77,7 +75,21 @@ in {
enable = true; enable = true;
config-path = "${inputs.self}//native_configs/alacritty/alacritty.yml"; config-path = "${inputs.self}//native_configs/alacritty/alacritty.yml";
font.size = 11.0; font.size = 11.0;
font.family = "Hack Nerd Font Mono"; font.family = "FiraCode Nerd Font Mono";
};
};
kitty = {
config,
lib,
...
}: {
imports = [
inputs.cells.repo.home-modules.kitty
];
config."${namespace}".kitty = {
enable = true;
conf = "${inputs.self}/native_configs/kitty/kitty.conf";
}; };
}; };
@ -139,16 +151,30 @@ in {
''; '';
example = [".direnv" "node_modules"]; example = [".direnv" "node_modules"];
}; };
plugins = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [
cell.packages.git-plus
];
description = ''
Git plugins are just programs that are exposed to git-custom-command.
Git takes the responsibility to do map it into `git custom-command`
'';
example = ''
[ pkgs.git-filter-repo ]
'';
};
}; };
# WARNING: This should be completed wtf config = {
config."${namespace}".git = { "${namespace}".git = {
inherit (cfg) name email ignores aliases; inherit (cfg) name email ignores aliases;
enable = true; enable = true;
};
home.packages = cfg.plugins;
}; };
}; };
git-htran = { git-htran = {
imports = [inputs.cells.repo.home-profiles.git];
config."${namespace}".profile.git = { config."${namespace}".profile.git = {
name = "htran"; name = "htran";
email = "htran@egihosting.com"; email = "htran@egihosting.com";
@ -156,14 +182,15 @@ in {
}; };
git-pegasust = { git-pegasust = {
imports = [inputs.cells.repo.home-profiles.git];
config."${namespace}".profile.git = { config."${namespace}".profile.git = {
email = "pegasucksgg@gmail.com"; email = "pegasucksgg@gmail.com";
name = "pegasust"; name = "pegasust";
}; };
}; };
dev-packages = let pkgs = inputs.nixpkgs; in { dev-packages = let
pkgs = inputs.nixpkgs;
in {
programs.jq.enable = true; programs.jq.enable = true;
home.packages = [ home.packages = [
pkgs.htop pkgs.htop
@ -197,4 +224,31 @@ in {
inputs.nixpkgs.zk inputs.nixpkgs.zk
]; ];
}; };
passman = {pkgs}: {
# Bruh, keepassxc on Darwin doesn't contain cli
# On Linux, however, it correctly gives `keepassxc-cli`
home.packages = assert !pkgs.stdenv.isDarwin || throw "kpxc known to have caused sandbox-exec problem"; [
cell.packages.kpxc
];
};
darwin-patches = {
# This should ideally be as empty as possible. Though, home-manager is
# a community-driven project. Things fail to build all the time.
manual.manpages.enable = false;
};
# inspo: https://github.com/NixOS/nixpkgs/blob/0396d3b0fb7f62ddc79a506ad3e6124f01d2ed0a/nixos/modules/rename.nix
rename = {
config,
options,
pkgs,
}: {
imports = let
inherit (pkgs.lib) mkRemovedOptionModule;
in [
(mkRemovedOptionModule ["programs" "nix-index" "enable"] "nix-index seems to not really benefit us")
];
};
} }

View File

@ -1,5 +1,5 @@
# TODO: vim-plug and Mason supports laziness. Probably worth it to explore incremental dependencies based on the project TODO: just install these things, then symlink to mason's bin directory # TODO: vim-plug and Mason supports laziness. Probably worth it to explore incremental dependencies based on the project
# # TODO: just install these things, then symlink to mason's bin directory
# One thing to consider, though, /nix/store of `nix-shell` or `nix-develop` # One thing to consider, though, /nix/store of `nix-shell` or `nix-develop`
# might be different from `home-manager`'s (~/.nix_profile/bin/jq) # might be different from `home-manager`'s (~/.nix_profile/bin/jq)
{ {
@ -12,33 +12,37 @@
config, config,
... ...
}: let }: let
inherit (inputs.nixpkgs) system;
# NOTE: Add packages to nvim_pkgs instead, so that it's available at userspace # NOTE: Add packages to nvim_pkgs instead, so that it's available at userspace
# and is added to the path after wrapping. # and is added to the path after wrapping.
# check: nix repl `homeConfigurations.hungtr.config.programs.neovim.finalPackage.buildCommand` # check: nix repl `homeConfigurations.hungtr.config.programs.neovim.finalPackage.buildCommand`
# see: :/--suffix.*PATH # see: :/--suffix.*PATH
# there should be mentions of additional packages # there should be mentions of additional packages
my_neovim = pkgs.neovim-unwrapped; # my_neovim = pkgs.neovim-unwrapped;
inherit (inputs.nixpkgs) system;
my_neovim = inputs.neovim-nightly-overlay.packages.${system}.neovim;
# These are added to the wrapper. Which means `which zk` is likely to show only
# within neovim's environment
nvim_pkgs = nvim_pkgs =
[ [
# pkgs.gccStdenv # pkgs.gccStdenv
pkgs.tree-sitter pkgs.tree-sitter
pkgs.fzf # file name fuzzy search pkgs.fzf # file name fuzzy search
pkgs.ripgrep # content fuzzy search pkgs.ripgrep # content fuzzy search
pkgs.zk # Zettelkasten (limited support) # pkgs.zk # Zettelkasten (limited support)
pkgs.fd # Required by a Telescope plugin (?) pkgs.fd # Required by a Telescope plugin (?)
pkgs.stdenv.cc.cc.lib pkgs.stdenv.cc.cc.lib
pkgs.nil # oxalica's better nix language server pkgs.nil # oxalica's better nix language server
inputs.nix-boost.packages."${system}".rust4cargo inputs.nix-boost.packages."${system}".rust4cargo
pkgs.nickel # inputs.sg-nvim.packages.${system}.default
pkgs.nls
pkgs.go # doesn't work, Mason installs from runtime path pkgs.go # doesn't work, Mason installs from runtime path
# Helps Mason on requirements of manual interpreter installations
pkgs.nodejs
pkgs.python3
# Language-specific stuffs # Language-specific stuffs
pkgs.sumneko-lua-language-server
# pkgs.python3Packages.python-lsp-server
pkgs.nodePackages.pyright
pkgs.python3Packages.pylint pkgs.python3Packages.pylint
pkgs.python3Packages.flake8 pkgs.python3Packages.flake8
# FIXME: installing ansible from here just doesn't work :/ # FIXME: installing ansible from here just doesn't work :/
@ -76,14 +80,25 @@ in {
package = my_neovim; package = my_neovim;
viAlias = true; viAlias = true;
vimAlias = true; vimAlias = true;
withPython3 = true; # withPython3 = true;
withNodeJs = true; # withNodeJs = true;
# NOTE: this adds path to the wrapped version of neovim # NOTE: this adds path to the wrapped version of neovim
extraPackages = nvim_pkgs; extraPackages = nvim_pkgs;
extraLuaConfig = builtins.readFile "${inputs.self}/native_configs/neovim/init.lua"; extraLuaConfig = builtins.readFile "${inputs.self}/native_configs/neovim/init.lua";
/*
* type: (either derivation pluginWithConfigType)
* pluginWithConfigType {
* config: nullOr lines,
* type: enum[],
* optional: (mkType (mkDefault false) bool), # Don't load by default (:packadd)
* plugin: package,
* runtime: (mkType (mkDefault {}) {?})
* }
*/
plugins = let plugins = let
inherit (cell.lib.deprecate) mkDeprecate deprecate-seq-handler;
inherit inherit
(inputs.nixpkgs-latest.legacyPackages.${system}.vimPlugins) (inputs.nixpkgs-vimplugins.legacyPackages.${system}.vimPlugins)
plenary-nvim plenary-nvim
nvim-treesitter nvim-treesitter
nvim-treesitter-textobjects nvim-treesitter-textobjects
@ -104,7 +119,6 @@ in {
nvim-ts-autotag nvim-ts-autotag
guess-indent-nvim guess-indent-nvim
harpoon harpoon
zk-nvim
luasnip luasnip
fidget-nvim fidget-nvim
rust-tools-nvim rust-tools-nvim
@ -115,7 +129,75 @@ in {
mason-lspconfig-nvim mason-lspconfig-nvim
mason-nvim mason-nvim
neogit neogit
nlua-nvim nvim-jqx
nvim-surround
nvim-web-devicons
playground
todo-comments-nvim
comment-nvim
trouble-nvim
vim-dispatch
vim-dispatch-neovim
vim-fugitive
vim-jack-in
nui-nvim
telescope-live-grep-args-nvim
nvim-colorizer-lua
git-worktree-nvim
;
sg-nvim = let
_sg = inputs.cells.dotfiles.packages.sg-nvim;
in {
plugin = _sg;
# NOTE: Wait, this mean the plugin is exclusively lua only since package.cpath is Lua API
config = ''
package.cpath = package.cpath .. ";${_sg}/lib/*.so;${_sg}/lib/*.dylib"
'';
type = "lua";
};
in
deprecate-seq-handler 1 [
(mkDeprecate {inherit sg-nvim;} {
stage = 2;
meta.since = "2023-10-20";
})
(mkDeprecate {inherit vim-jack-in;} {
stage = 2;
meta.since = "2023-10-20";
})
plenary-nvim
nvim-treesitter.withAllGrammars
nvim-treesitter-textobjects
telescope-fzf-native-nvim
telescope-file-browser-nvim
telescope-nvim
nvim-lspconfig
gruvbox-community
neodev-nvim
cmp-nvim-lsp
cmp-path
cmp-buffer
cmp-cmdline
nvim-cmp
lspkind-nvim
nvim-autopairs
nvim-ts-autotag
guess-indent-nvim
harpoon
luasnip
nvim-treesitter-context
fidget-nvim
rust-tools-nvim
telescope-live-grep-args-nvim
comment-nvim
cmp_luasnip
gitsigns-nvim
indent-blankline-nvim
lualine-nvim
mason-lspconfig-nvim
mason-nvim
neogit
nvim-jqx nvim-jqx
nvim-surround nvim-surround
nvim-web-devicons nvim-web-devicons
@ -125,53 +207,13 @@ in {
vim-dispatch vim-dispatch
vim-dispatch-neovim vim-dispatch-neovim
vim-fugitive vim-fugitive
vim-jack-in nvim-colorizer-lua
; git-worktree-nvim
in [ (mkDeprecate {inherit nui-nvim;} {
plenary-nvim stage = 2;
nvim-treesitter.withAllGrammars meta.since = "2023-10-20";
nvim-treesitter-textobjects })
telescope-fzf-native-nvim ];
telescope-file-browser-nvim
telescope-nvim
nvim-lspconfig
gruvbox-community
neodev-nvim
cmp-nvim-lsp
cmp-path
cmp-buffer
cmp-cmdline
nvim-cmp
lspkind-nvim
nvim-autopairs
nvim-ts-autotag
guess-indent-nvim
harpoon
zk-nvim
luasnip
nvim-treesitter-context
fidget-nvim
rust-tools-nvim
cmp_luasnip
gitsigns-nvim
indent-blankline-nvim
lualine-nvim
mason-lspconfig-nvim
mason-nvim
neogit
nlua-nvim
nvim-jqx
nvim-surround
nvim-web-devicons
playground
todo-comments-nvim
trouble-nvim
vim-dispatch
vim-dispatch-neovim
vim-fugitive
vim-jack-in
];
}; };
# home.packages = nvim_pkgs; # home.packages = nvim_pkgs;
}; };

View File

@ -58,7 +58,7 @@ in {
set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M ' set -g status-right '#{cpu_bg_color} CPU: #{cpu_icon} #{cpu_percentage} | %a %h-%d %H:%M '
''; '';
# Colored ls # Colored ls
programs.exa = { programs.eza = {
enable = true; enable = true;
enableAliases = true; enableAliases = true;
}; };
@ -69,14 +69,6 @@ in {
settings = let settings = let
native = builtins.fromTOML (builtins.readFile "${inputs.self}/native_configs/starship/starship.toml"); native = builtins.fromTOML (builtins.readFile "${inputs.self}/native_configs/starship/starship.toml");
patch-nix = pkgs.lib.recursiveUpdate native { patch-nix = pkgs.lib.recursiveUpdate native {
# WARNING: home-manager fails on here for some reason. Likely not at the
# validation phase (type-checking), but at evaluation phaase (stringify)
# I'm thinking when `settings` are evaluated, it has some sort of
# recursive processing before it gets turned into a toml
# c.commands = [
# ["nix" "run" "nixpkgs#clang" "--" "--version"]
# ["nix" "run" "nixpkgs#gcc" "--" "--version"]
# ];
c.disabled = true; c.disabled = true;
}; };
in in
@ -88,6 +80,9 @@ in {
enable = true; enable = true;
enableCompletion = true; enableCompletion = true;
initExtra = cfg.shellInitExtra or ""; initExtra = cfg.shellInitExtra or "";
shellAliases =
{ }
// (cfg.shellAliases or {});
}; };
programs.zsh = { programs.zsh = {
enable = true; enable = true;
@ -107,11 +102,12 @@ in {
enable = true; enable = true;
plugins = [ plugins = [
"git" # git command aliases: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git#aliases "git" # git command aliases: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git#aliases
"command-not-found" # suggests which package to install; does not support nixos (we have solution already) # DEPRECATION: potentially smelly plugin with nix
"gitignore" # `gi list` -> `gi java >>.gitignore` # "command-not-found" # suggests which package to install; does not support nixos (we have solution already)
"ripgrep" # adds completion for `rg` # "gitignore", allows gi CLI interaction
"rust" # compe for rustc/cargo "ripgrep" # adds completion for ripgrep
"poetry" # compe for poetry - Python's cargo "rust"
"poetry"
]; ];
}; };
sessionVariables = { sessionVariables = {
@ -120,6 +116,7 @@ in {
# VI_MODE_SET_CURSOR = true; # VI_MODE_SET_CURSOR = true;
# ZVM_VI_ESCAPE_BINDKEY = ""; # ZVM_VI_ESCAPE_BINDKEY = "";
ZVM_READKEY_ENGINE = "$ZVM_READKEY_ENGINE_NEX"; ZVM_READKEY_ENGINE = "$ZVM_READKEY_ENGINE_NEX";
# lowest possible: 0.004s
ZVM_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :) ZVM_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :)
ZVM_ESCAPE_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :) ZVM_ESCAPE_KEYTIMEOUT = 0.004; # 40ms, or subtly around 25 FPS. I'm a gamer :)
}; };

30
nix/repo/lib/default.nix Normal file
View File

@ -0,0 +1,30 @@
std-passthru @ {
inputs,
cell,
}: let
yamlToJsonDrv = pkgs: yamlContent: outputPath: (pkgs.runCommand
outputPath
{
inherit yamlContent;
nativeBuildInputs = [pkgs.yq];
}
# run yq which outputs '.' (no filter) on file at yamlPath
# note that $out is passed onto the bash/sh script for execution
''
echo "$yamlContent" | yq >$out
'');
exec_tests = testUnit: let
testNames = builtins.attrNames testUnit;
evaluateTest = testName: assert testUnit."${testName}" == true; testName;
in
builtins.concatStringsSep ", " (builtins.foldl' (acc: testName: acc ++ [(evaluateTest testName)]) [] testNames);
tests = import ./tests.nix std-passthru;
in {
fromYAML = yamlContent: builtins.fromJSON (builtins.readFile (yamlToJsonDrv inputs.nixpkgs yamlContent "fromYaml.json"));
ty = import ./ty.nix std-passthru;
deprecate = import ./mk-deprecate.nix std-passthru;
inherit tests;
exec-tests = exec_tests tests;
}

2
nix/repo/lib/effects.nix Normal file
View File

@ -0,0 +1,2 @@
{inputs, cell}: {
}

View File

@ -0,0 +1,52 @@
{
inputs,
cell,
}: let
inherit (cell.lib.ty) brand-ctor brand-coalesce-seq unbranded_name;
deprecate_t = a @ {
id ? null,
msg ? null,
ctx_str ? null,
meta ? null,
/*
the higher the more likely to be removed
*/
stage ? 0,
}: let
ctx =
if ctx_str == null
then ""
else ": ${ctx_str}";
_msg =
if msg == null
then
if id == null
then "deprecated${ctx}"
else "${id} is deprecated${ctx}"
else msg;
in
builtins.trace _msg (v: (brand-ctor "deprecate" v) // {inherit stage;} // a);
in {
inherit deprecate_t;
mkDeprecate = inherit_v: a: deprecate_t ({id = builtins.head (builtins.attrNames inherit_v);} // a) (builtins.head (builtins.attrValues inherit_v));
deprecate-seq-handler = trim_stage: s: let
v = builtins.foldl' (lst: {
__value,
__brand,
...
} @ a:
if __brand == "deprecate" && trim_stage < a.stage
then lst
else
lst
++ [
(
if __brand == "deprecate" || __brand == unbranded_name
then __value
else a
)
]) [] (brand-coalesce-seq s);
in
v;
}

89
nix/repo/lib/tests.nix Normal file
View File

@ -0,0 +1,89 @@
{
inputs,
cell,
}: {
ty-deprecate = let
exampleBrand = cell.lib.ty.brand-ctor "example";
brandedItem = exampleBrand "someValue";
in
assert (brandedItem.__brand == "example");
assert (brandedItem.__value == "someValue"); let
coalescedItem = cell.lib.ty.brand-coalesce brandedItem;
coalescedSeq = cell.lib.ty.brand-coalesce-seq [brandedItem "hello"];
promoted = cell.lib.ty.brand-coalesce "hello";
in
assert (coalescedItem.__brand != "__unbranded__");
assert (promoted.__brand == "__unbranded__");
assert ((builtins.elemAt coalescedSeq 0) == brandedItem);
assert ((let v = builtins.elemAt coalescedSeq 1; in builtins.trace "${builtins.toJSON v}" v) == promoted); let
items = [(exampleBrand "A") (exampleBrand "B") (cell.lib.ty.brand-ctor "second" "C")];
grouped = cell.lib.ty.brand-group items;
in
assert (builtins.length (grouped.example) == 2);
assert (builtins.length (grouped.second) == 1); let
retainItem = cell.lib.deprecate.mkDeprecate {myItem = "value";} {ctx_str = "example context";};
deprecate = cell.lib.deprecate.mkDeprecate {deprecate = 15;} {stage = 256;};
processedSeq = cell.lib.deprecate.deprecate-seq-handler 0 [retainItem];
partiallyRemoved = cell.lib.deprecate.deprecate-seq-handler 2 [retainItem brandedItem];
removeDeprecated = cell.lib.deprecate.deprecate-seq-handler 2 [deprecate brandedItem];
passthru = cell.lib.deprecate.deprecate-seq-handler 4 [retainItem brandedItem deprecate];
in
assert (retainItem.__brand == "deprecate");
# Since the stage is 0, it filters the deprecated item out
assert (builtins.length processedSeq == 1);
assert (builtins.head partiallyRemoved == "value");
assert (builtins.head removeDeprecated == brandedItem);
assert (builtins.length passthru == 2); true;
deprecate = let
inherit (cell.lib.deprecate) mkDeprecate deprecate-seq-handler;
inherit (inputs.nixpkgs) system;
inherit
(inputs.nixpkgs-vimplugins.legacyPackages.${system}.vimPlugins)
plenary-nvim
nvim-treesitter
nvim-treesitter-textobjects
nvim-treesitter-context
telescope-fzf-native-nvim
telescope-file-browser-nvim
vim-jack-in
nui-nvim
telescope-live-grep-args-nvim
nvim-colorizer-lua
git-worktree-nvim
;
sg-nvim = let
_sg = inputs.cells.dotfiles.packages.sg-nvim;
in {
plugin = _sg;
# NOTE: Wait, this mean the plugin is exclusively lua only since package.cpath is Lua API
config = ''
package.cpath = package.cpath .. ";${_sg}/lib/*.so;${_sg}/lib/*.dylib"
'';
type = "lua";
};
plugins = [
(mkDeprecate {inherit sg-nvim;} {
stage = 2;
meta.since = "2023-10-20";
})
(mkDeprecate {inherit vim-jack-in;} {
stage = 2;
meta.since = "2023-10-20";
})
plenary-nvim
nvim-treesitter.withAllGrammars
nvim-treesitter-textobjects
telescope-fzf-native-nvim
telescope-file-browser-nvim
nvim-treesitter-context
telescope-live-grep-args-nvim
nvim-colorizer-lua
git-worktree-nvim
nui-nvim
];
pluglen = builtins.length plugins;
rm = let v = deprecate-seq-handler 1 plugins; in assert (builtins.length v) < pluglen; v;
retain = let v = deprecate-seq-handler 10 plugins; in assert (builtins.length v) == pluglen; v;
in
builtins.trace (builtins.toJSON {inherit rm retain;}) true;
}

23
nix/repo/lib/ty.nix Normal file
View File

@ -0,0 +1,23 @@
{
inputs,
cell,
}: let
brand-ctor = name:
assert builtins.isString name;
v: {
__brand = name;
__value = v;
};
unbranded_name = "__unbranded__";
unbranded_t = brand-ctor unbranded_name;
brand-of = {
__brand ? unbranded_name,
__value ? null,
}:
__brand;
brand-coalesce = v: if v ? __brand then v else unbranded_t v;
in {
inherit brand-ctor brand-of brand-coalesce unbranded_name;
brand-group = seq: builtins.mapAttrs (_: builtins.map (v: v.__value)) (builtins.groupBy (brnd: brnd.__brand) seq);
brand-coalesce-seq = builtins.map brand-coalesce;
}

30
nix/repo/nixConfig.nix Normal file
View File

@ -0,0 +1,30 @@
{
inputs,
cell,
}: let
# decorator for now, for data collecting :)
nix-conf = a: a;
in {
"htran@mbp" = nix-conf ''
accept-flake-config = true
experimental-features = nix-command flakes
post-build-hook = /etc/nix/upload-to-cache.sh
trusted-users = root htran hungtran hwtr
max-jobs = 8
cores = 12
# default is true for Linux, false for every one else
# https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-sandbox
sandbox = true
'';
"hungtran@mba-m2" = nix-conf ''
accept-flake-config = true
experimental-features = nix-command flakes
post-build-hook = /etc/nix/upload-to-cache.sh
trusted-users = root htran hungtran hwtr
max-jobs = 7
cores = 8
# default is true for Linux, false for every one else
# https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-sandbox
sandbox = true
'';
}

View File

@ -0,0 +1,108 @@
{
inputs,
cell,
}: let
pkgs = inputs.nixpkgs;
in {
inherit (inputs.cells.dotfiles.packages) kpcli-py;
kpxc = let
inherit (pkgs) keepassxc;
in
if pkgs.stdenv.isDarwin
then
pkgs.stdenv.mkDerivation {
pname = "keepassxc-darwin";
version = keepassxc.version;
phases = ["installPhase"];
installPhase = ''
mkdir -p $out/bin
cp -r ${keepassxc}/* $out/
${
if pkgs.stdenv.hostPlatform.isDarwin
then ''
for exe in $(find $out/Applications/KeePassXC.app/Contents/MacOS/ -type f -executable); do
exe_name=$(basename $exe)
ln -s $exe $out/bin/$exe_name
done
''
else ""
}
'';
meta =
keepassxc.meta
// {
description = "Wrapper for keepassxc and keepassxc-cli with additional Darwin-specific fixes";
};
}
else keepassxc;
pixi-edit = inputs.cells.dev.packages.pixi-edit;
nil = inputs.nixpkgs.nil;
# These should probably go to dotfiles {{{
git-plus = pkgs.symlinkJoin {
name = "pegasust-git-plus";
paths = [
(pkgs.writeShellScriptBin "git-lola" ''
git log --graph --decorate --color=always --abbrev-commit --all\
--pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' |
while IFS= read -r line; do
# Format the relative time
line=$(echo "$line" | sed -e 's/ minute/ min/' \
-e 's/ week/ wk/' \
-e 's/ hour/ hr/' \
-e 's/ month/ mo/' \
-e 's/ year/ yr/' \
-e 's/ ago//')
# Print the formatted line
echo "$line"
done | less -R
'')
(pkgs.writeShellScriptBin "git-lol" ''
git log --graph --decorate --color=always --abbrev-commit \
--pretty=format:'%C(auto)%h %d %C(cyan)%s %C(green)(%cr)%C(reset)' |
while IFS= read -r line; do
# Format the relative time
line=$(echo "$line" | sed -e 's/ minute/ min/' \
-e 's/ week/ wk/' \
-e 's/ hour/ hr/' \
-e 's/ month/ mo/' \
-e 's/ year/ yr/' \
-e 's/ ago//')
# Print the formatted line
echo "$line"
done | less -R
'')
];
};
nixr = pkgs.writeShellScriptBin "nixr" ''
rc_path=""
p0="$(pwd)/.repl.nix"
p1=~/.config/.repl.nix
if [ -f $p0 ]; then
echo "[nixr]: trying $p0"
rc_path="$p0"
elif [ -f $p1 ]; then
echo "[nixr]: trying $p1"
rc_path="$p1"
fi
if [ -n "$rc_path" ]; then
echo "nix-repl: sourcing from $rc_path; content:"
echo '```'
cat $rc_path
echo '```'
nix repl --file "$rc_path"
else
nix repl
fi
'';
# }}}
}

View File

@ -1,20 +0,0 @@
Copyright (c) 2020-2021 Eelco Dolstra and the flake-compat contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,29 +0,0 @@
# flake-compat
## Usage
To use, add the following to your `flake.nix`:
```nix
inputs.flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
```
Afterwards, create a `default.nix` file containing the following:
```nix
(import
(
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
sha256 = lock.nodes.flake-compat.locked.narHash;
}
)
{ src = ./.; }
).defaultNix
```
If you would like a `shell.nix` file, create one containing the above, replacing `defaultNix` with `shellNix`.

View File

@ -1,301 +0,0 @@
# Compatibility function to allow flakes to be used by
# non-flake-enabled Nix versions. Given a source tree containing a
# 'flake.nix' and 'flake.lock' file, it fetches the flake inputs and
# calls the flake's 'outputs' function. It then returns an attrset
# containing 'defaultNix' (to be used in 'default.nix'), 'shellNix'
# (to be used in 'shell.nix').
{
src,
system ? builtins.currentSystem or "unknown-system",
}: let
lockFilePath = src + "/flake.lock";
lockFile = builtins.fromJSON (builtins.readFile lockFilePath);
fetchTree = 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}'";
callFlake4 = flakeSrc: locks: let
flake = import (flakeSrc + "/flake.nix");
inputs =
builtins.mapAttrs
(n: v:
if v.flake or true
then callFlake4 (fetchTree (v.locked // v.info)) v.inputs
else fetchTree (v.locked // v.info))
locks;
outputs = flakeSrc // (flake.outputs (inputs // {self = outputs;}));
in
assert flake.edition == 201909; outputs;
callLocklessFlake = flakeSrc: let
flake = import (flakeSrc + "/flake.nix");
outputs = flakeSrc // (flake.outputs {self = outputs;});
in
outputs;
rootSrc = let
# Try to clean the source tree by using fetchGit, if this source
# tree is a valid git repository.
tryFetchGit = src:
if isGit && !isShallow
then let
res = builtins.fetchGit src;
in
if res.rev == "0000000000000000000000000000000000000000"
then removeAttrs res ["rev" "shortRev"]
else res
else {outPath = src;};
# NB git worktrees have a file for .git, so we don't check the type of .git
isGit = builtins.pathExists (src + "/.git");
isShallow = builtins.pathExists (src + "/.git/shallow");
in
{
lastModified = 0;
lastModifiedDate = formatSecondsSinceEpoch 0;
}
// (
if src ? outPath
then src
else tryFetchGit src
);
# Format number of seconds in the Unix epoch as %Y%m%d%H%M%S.
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)}";
allNodes =
builtins.mapAttrs
(
key: node: let
sourceInfo =
if key == lockFile.root
then rootSrc
else fetchTree (node.info or {} // removeAttrs node.locked ["dir"]);
subdir =
if key == lockFile.root
then ""
else node.locked.dir or "";
flake = import (sourceInfo
+ (
if subdir != ""
then "/"
else ""
)
+ subdir
+ "/flake.nix");
inputs =
builtins.mapAttrs
(inputName: inputSpec: allNodes.${resolveInput inputSpec})
(node.inputs or {});
# Resolve a input spec into a node name. An input spec is
# either a node name, or a 'follows' path from the root
# node.
resolveInput = inputSpec:
if builtins.isList inputSpec
then getInputByPath lockFile.root inputSpec
else inputSpec;
# Follow an input path (e.g. ["dwarffs" "nixpkgs"]) from the
# root node, returning the final node.
getInputByPath = nodeName: path:
if path == []
then nodeName
else
getInputByPath
# Since this could be a 'follows' input, call resolveInput.
(resolveInput lockFile.nodes.${nodeName}.inputs.${builtins.head path})
(builtins.tail path);
outputs = flake.outputs (inputs // {self = result;});
result =
outputs
// sourceInfo
// {
inherit inputs;
inherit outputs;
inherit sourceInfo;
};
in
if node.flake or true
then assert builtins.isFunction flake.outputs; result
else sourceInfo
)
lockFile.nodes;
result =
if !(builtins.pathExists lockFilePath)
then callLocklessFlake rootSrc
else if lockFile.version == 4
then callFlake4 rootSrc (lockFile.inputs)
else if lockFile.version >= 5 && lockFile.version <= 7
then allNodes.${lockFile.root}
else throw "lock file '${lockFilePath}' has unsupported version ${toString lockFile.version}";
in rec {
defaultNix =
(builtins.removeAttrs result ["__functor"])
// (
if result ? defaultPackage.${system}
then {default = result.defaultPackage.${system};}
else {}
)
// (
if result ? packages.${system}.default
then {default = result.packages.${system}.default;}
else {}
);
shellNix =
defaultNix
// (
if result ? devShell.${system}
then {default = result.devShell.${system};}
else {}
)
// (
if result ? devShells.${system}.default
then {default = result.devShells.${system}.default;}
else {}
);
}

View File

@ -1,19 +0,0 @@
name: Test
on: [ push, pull_request ]
jobs:
test:
name: 'Test'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.4.2
- uses: cachix/install-nix-action@v17
- uses: cachix/cachix-action@v10
with:
name: guibou
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build all
run: nix-build all.nix

View File

@ -1,248 +0,0 @@
# NixGL
NixGL solve the "OpenGL" problem with [nix](https://nixos.org/nix/). It works with all mesa drivers (Intel cards and "free" version for Nvidia or AMD cards), Nvidia proprietary drivers, and even with hybrid configuration via bumblebee. It works for Vulkan programs too.
# Motivation
Using Nix on non-NixOS distros, it's common to see GL application errors:
```bash
$ program
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: i965_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: i965
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
```
NixGL provides a set of wrappers able to launch GL or Vulkan applications:
```bash
$ nixGL program
$ nixVulkan program
```
# Installation
## nix-channel (Recommended)
To get started,
```bash
$ nix-channel --add https://github.com/guibou/nixGL/archive/main.tar.gz nixgl && nix-channel --update
$ nix-env -iA nixgl.auto.nixGLDefault # or replace `nixGLDefault` with your desired wrapper
```
Many wrappers are available, depending on your hardware and the graphical API you want to use (i.e. Vulkan or OpenGL). You may want to install a few of them, for example if you want to support OpenGL and Vulkan on a laptop with an hybrid configuration.
OpenGL wrappers:
- `auto.nixGLDefault`: Tries to auto-detect and install Nvidia, if not, fallback to mesa. Recommended. Invoke with `nixGL program`.
- `auto.nixGLNvidia`: Proprietary Nvidia driver (auto detection of version)
- `auto.nixGLNvidiaBumblebee`: Proprietary Nvidia driver on hybrid hardware (auto detection).
- `nixGLIntel`: Mesa OpenGL implementation (intel, amd, nouveau, ...).
Vulkan wrappers:
- `auto.nixVulkanNvidia`: Proprietary Nvidia driver (auto detection).
- `nixVulkanIntel`: Mesa Vulkan implementation.
The Vulkan wrapper also sets `VK_LAYER_PATH` the validation layers in the nix store.
## Flakes
### Directly run nixGL
You need to specify the same version of `nixpkgs` that your `program` is using. For example, replace `nixos-21.11` with `nixos-21.05`.
```sh
nix run --override-input nixpkgs nixpkgs/nixos-21.11 --impure github:guibou/nixGL -- program
```
If you use the default `nixpkgs` channel (i.e. `nixpkgs-unstable`), you can ommit those arguments like so:
```sh
nix run --impure github:guibou/nixGL -- program
```
You can also specify which wrapper to use instead of using the default auto detection:
```sh
nix run github:guibou/nixGL#nixGLIntel -- program
```
This will result in a lighter download and execution time. Also, this evaluation is pure.
#### Error about experimental features
You can directly use:
```sh
nix --extra-experimental-features "nix-command flakes" run --impure github:guibou/nixGL -- program
```
Or set the appropriate conf in `~/.config/nix/nix.conf` / `/etc/nix/nix.conf` / `nix.extraOptions`.
#### Error with GLIBC version
if you get errors with messages similar to
```
/nix/store/g02b1lpbddhymmcjb923kf0l7s9nww58-glibc-2.33-123/lib/libc.so.6: version `GLIBC_2.34' not found (required by /nix/store/hrl51nkr7dszlwcs29wmyxq0jsqlaszn-libglvnd-1.4.0/lib/libGLX.so.0)
```
It means that there's a mismatch between the versions of `nixpkgs` used by `nixGL` and `program`.
### Use an overlay
Add nixGL as a flake input:
```Nix
{
inputs = {
nixgl.url = "github:guibou/nixGL";
};
outputs = { nixgl, ... }: { };
}
```
Then, use the flake's `overlay` attr:
```Nix
{
outputs = { nixgl, nixpkgs, ... }:
let
pkgs = import nixpkgs {
system = "x86_64-linux";
overlays = [ nixgl.overlay ];
};
in
# You can now reference pkgs.nixgl.nixGLIntel, etc.
{ }
}
```
## Installation from source
```bash
$ git clone https://github.com/guibou/nixGL
$ cd nixGL
$ nix-env -f ./ -iA <your desired wrapper name>
```
# Usage
Just launch the program you want prefixed by the right wrapper.
For example, for OpenGL programs:
```bash
$ nixGL program args # For the `nixGLDefault` wrapper, recommended.
$ nixGLNvidia program args
$ nixGLIntel program args
$ nixGLNvidiaBumblebee program args
```
For Vulkan programs:
```bash
$ nixVulkanNvidia program args
$ nixVulkanIntel program args
```
# OpenGL - Hybrid Intel + Nvidia laptop
After installing `nixGLIntel` and `nixGLNvidiaBumblebee`.
```bash
$ nixGLIntel $(nix run nixpkgs.glxinfo -c glxinfo) | grep -i 'OpenGL version string'
OpenGL version string: 3.0 Mesa 17.3.3
$ nixGLNvidiaBumblebee $(nix run nixpkgs.glxinfo -c glxinfo) | grep -i 'OpenGL version string'
OpenGL version string: 4.6.0 NVIDIA 390.25
```
If the program you'd like to run is already installed by nix in your current environment, you can simply run it with the wrapper, for example:
```bash
$ nixGLIntel blender
```
# Vulkan - Intel GPU
After installing `nixVulkanIntel`.
```bash
$ sudo apt install mesa-vulkan-drivers
...
$ nixVulkanIntel $(nix-build '<nixpkgs>' --no-out-link -A vulkan-tools)/bin/vulkaninfo | grep VkPhysicalDeviceProperties -A 7
VkPhysicalDeviceProperties:
===========================
apiVersion = 0x400036 (1.0.54)
driverVersion = 71311368 (0x4402008)
vendorID = 0x8086
deviceID = 0x591b
deviceType = INTEGRATED_GPU
deviceName = Intel(R) HD Graphics 630 (Kaby Lake GT2)
```
# Troubleshooting
## Nvidia auto detection does not work
```bash
building '/nix/store/ijs5h6h07faai0k74diiy5b2xlxh891g-auto-detect-nvidia.drv'...
pcregrep: Failed to open /proc/driver/nvidia/version: No such file or directory
builder for '/nix/store/ijs5h6h07faai0k74diiy5b2xlxh891g-auto-detect-nvidia.drv' failed with exit code 2
error: build of '/nix/store/ijs5h6h07faai0k74diiy5b2xlxh891g-auto-detect-nvidia.drv' faile
```
You can run the Nvidia installer using an explicit version string instead of the automatic detection method:
```bash
nix-build -A auto.nixGLNvidia --argstr nvidiaVersion 440.82
```
(or `nixGLNvidiaBumblebee`, `nixVulkanNividia`)
The version of your driver can be found using `glxinfo` from your system default package manager, or `nvidia-settings`.
## On nixOS
`nixGL` can also be used on nixOS if the system is installed with a different
nixpkgs clone than the one your application are installed with. Override the
`pkgs` argument of the script with the correct nixpkgs clone:
```bash
nix-build ./default.nix -A nixGLIntel --arg pkgs "import path_to_your_nixpkgs {}".
```
## Old nvidia drivers
Users of Nvidia legacy driver should use the `backport/noGLVND` branch. This branch is not tested and may not work well, please open a bug report, it will be taken care of as soon as possible.
# `nixGLCommon`
`nixGLCommon nixGLXXX` can be used to get `nixGL` executable which fallback to `nixGLXXX`. It is a shorter name for people with only one OpenGL configuration.
For example:
```
nix-build -E "with import ./default.nix {}; nixGLCommon nixGLIntel"
```
# Limitations
`nixGL` is badly tested, mostly because it is difficult to test automatically in a continuous integration context because you need access to different type of hardware.
Some OpenGL configurations may not work, for example AMD proprietary drivers. There is no fundamental limitation, so if you want support for theses configurations, open an issue.
# Hacking
One great way to contribute to nixGL is to run the test suite. Just run
`./Test.hs` in the main directory and check that all the test relevant to your
hardware are green.

View File

@ -1,110 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i runhaskell -p "haskellPackages.ghcWithPackages(p: with p; [hspec process])" -p nix
{-# LANGUAGE OverloadedStrings #-}
import Test.Hspec
import System.Process
import qualified Data.Text as Text
import Data.Text (Text)
import Control.Monad.IO.Class (liftIO)
import Data.List (find)
-- nixos-19-09 is used so hopefully it will have a different libc than
-- the current `<nixpkgs>` used in a current nixOS system, so it will trigger the
-- driver failure.
-- Run `./Test.hs --match "/Sanity/"` to ensure that non wrapped
-- binaries fails on NixOS.
currentChannel = "channel:nixos-19.09-small"
-- | Utils function: run a command and returns its output.
processOutput p args = Text.strip . Text.pack <$> readCreateProcess ((proc (Text.unpack p) (Text.unpack <$> args)) { std_err = Inherit }) ""
-- * OpenGL
-- | Returns the path to the nixGLXXX binary.
getNixGLBin version = (<>("/bin/"<>version)) <$> processOutput "nix-build" ["./", "-A", version, "-I", "nixpkgs=" <> currentChannel]
-- | Returns the vendor string associated with a glxinfo wrapped by a nixGL.
getVendorString io = do
output <- Text.lines <$> io
pure $ Text.unpack <$> find ("OpenGL version string"`Text.isPrefixOf`) output
-- | Checks that a nixGL wrapper works with glxinfo 32 & 64 bits.
checkOpenGL_32_64 glxinfo32 glxinfo64 vendorName nixGLName = do
beforeAll (getNixGLBin nixGLName) $ do
it "32 bits" $ \nixGLBin -> do
Just vendorString <- getVendorString (processOutput nixGLBin [glxinfo32, "-B"])
vendorString `shouldContain` vendorName
it "64 bits" $ \nixGLBin -> do
Just vendorString <- getVendorString (processOutput nixGLBin [glxinfo64, "-B"])
vendorString `shouldContain` vendorName
-- * Vulkan
-- | Heuristic to detect if vulkan work. `driverName` must appears in the output
checkVulkanIsWorking io = do
res <- io
res `shouldSatisfy` ("driverName"`Text.isInfixOf`)
-- | Checks that a nixGL wrapper works with glxinfo 32 & 64 bits.
checkVulkan_32_64 vulkaninfo32 vulkaninfo64 vendorName nixGLName = do
beforeAll (getNixGLBin nixGLName) $ do
it "32 bits" $ \nixGLBin -> do
checkVulkanIsWorking (processOutput nixGLBin [vulkaninfo32])
it "64 bits" $ \nixGLBin -> do
checkVulkanIsWorking (processOutput nixGLBin [vulkaninfo64])
main = do
putStrLn "Running tests for nixGL"
putStrLn "It can take a while, this will build and test all drivers in the background"
glxinfo64 <- (<>"/bin/glxinfo") <$> processOutput "nix-build" [currentChannel, "-A", "glxinfo"]
glxinfo32 <- (<>"/bin/glxinfo") <$> processOutput "nix-build" [currentChannel, "-A", "pkgsi686Linux.glxinfo"]
vulkaninfo64 <- (<>"/bin/vulkaninfo") <$> processOutput "nix-build" [currentChannel, "-A", "vulkan-tools"]
vulkaninfo32 <- (<>"/bin/vulkaninfo") <$> processOutput "nix-build" [currentChannel, "-A", "pkgsi686Linux.vulkan-tools"]
let checkOpenGL = checkOpenGL_32_64 glxinfo32 glxinfo64
checkVulkan = checkVulkan_32_64 vulkaninfo32 vulkaninfo64
hspec $ do
-- This category ensure that tests are failing if not run with nixGL
-- This allows testing on nixOS
describe "Sanity" $ do
describe "OpenGL" $ do
it "fails with unwrapped glxinfo64" $ do
vendorString <- getVendorString (processOutput glxinfo64 ["-B"])
vendorString `shouldBe` Nothing
it "fails with unwrapped glxinfo32" $ do
vendorString <- getVendorString (processOutput glxinfo32 ["-B"])
vendorString `shouldBe` Nothing
describe "Vulkan" $ do
it "fails with unwrapped vulkaninfo64" $ do
processOutput vulkaninfo64 [] `shouldThrow` anyIOException
it "fails with unwrapped vulkaninfo32" $ do
processOutput vulkaninfo32 [] `shouldThrow` anyIOException
describe "NixGL" $ do
describe "Mesa" $ do
describe "OpenGL" $ do
checkOpenGL "Mesa" "nixGLIntel"
describe "Vulkan" $ do
checkVulkan "Mesa" "nixVulkanIntel"
describe "Nvidia - Bumblebee" $ do
describe "OpenGL" $ do
checkOpenGL "NVIDIA" "nixGLNvidiaBumblebee"
xdescribe "Vulkan" $ do
-- Not tested: I don't have the hardware (@guibou)
checkVulkan "NVIDIA" "nixVulkanNvidiaBumblebee"
-- TODO: check Nvidia (I don't have this hardware)
describe "Nvidia" $ do
describe "OpenGL" $ do
checkOpenGL "NVIDIA" "nixGLNvidia"
describe "Vulkan" $ do
checkVulkan "NVIDIA" "nixVulkanNvidia"

View File

@ -1,25 +0,0 @@
let
pkgs = import ./nixpkgs.nix {config = {allowUnfree = true;};};
pure = pkgs.recurseIntoAttrs (pkgs.callPackage ./nixGL.nix {
nvidiaVersion = "440.82";
nvidiaHash = "edd415acf2f75a659e0f3b4f27c1fab770cf21614e84a18152d94f0d004a758e";
});
versionFile440 = pkgs.callPackage ./nixGL.nix {
nvidiaVersionFile = pkgs.writeText "nvidia-version-440.82" ''
NVRM version: NVIDIA UNIX x86_64 Kernel Module 440.82 Wed Apr 1 20:04:33 UTC 2020
GCC version: gcc version 9.3.0 (Arch Linux 9.3.0-1)
'';
};
versionFile510 = pkgs.callPackage ./nixGL.nix {
nvidiaVersionFile = pkgs.writeText "nvidia-version-510.54" ''
NVRM version: NVIDIA UNIX x86_64 Kernel Module 510.54 Wed Apr 1 20:04:33 UTC 2020
GCC version: gcc version 9.3.0 (Arch Linux 9.3.0-1)
'';
};
in
(with pure; [nixGLIntel nixVulkanNvidia nixGLNvidia nixVulkanIntel])
++ (with versionFile440.auto; [nixGLNvidia nixGLDefault nixVulkanNvidia])
++ (with versionFile510.auto; [nixGLNvidia nixGLDefault nixVulkanNvidia])

View File

@ -1,41 +0,0 @@
{
## Nvidia informations.
# Version of the system kernel module. Let it to null to enable auto-detection.
nvidiaVersion ? null,
# Hash of the Nvidia driver .run file. null is fine, but fixing a value here
# will be more reproducible and more efficient.
nvidiaHash ? null,
# Alternatively, you can pass a path that points to a nvidia version file
# and let nixGL extract the version from it. That file must be a copy of
# /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see
# https://github.com/NixOS/nix/issues/3539 ).
nvidiaVersionFile ? null,
# Enable 32 bits driver
# This is on by default, you can switch it to off if you want to reduce a
# bit the size of nixGL closure.
enable32bits ? true,
# Make sure to enable config.allowUnfree to the instance of nixpkgs to be
# able to access the nvidia drivers.
pkgs ?
import <nixpkgs> {
config = {allowUnfree = true;};
},
# Enable all Intel specific extensions which only works on x86_64
enableIntelX86Extensions ? true,
}:
pkgs.callPackage ./nixGL.nix ({
inherit
nvidiaVersion
nvidiaVersionFile
nvidiaHash
enable32bits
;
}
// (
if enableIntelX86Extensions
then {}
else {
intel-media-driver = null;
vaapiIntel = null;
}
))

View File

@ -1,81 +0,0 @@
#!/usr/bin/env python3
# execution: fetch.py >nvidia_versions.json
import http.client
import json
import sys
NV_FREE_X86_URL = "download.nvidia.com"
POTENTIAL_SHA256_EXTS = [".sha256sum", ".sha256"]
RIGHT_PAD = " " * 20
conn = http.client.HTTPSConnection(NV_FREE_X86_URL)
conn.request("GET", "/XFree86/Linux-x86_64/")
response = conn.getresponse()
dir_html = response.read()
assert (response.status < 400), "Error occurred fetching for source from"
def scrape_driver_versions(dir_html: bytes):
# The idea is to recursively follows all interesting `src` from `<a href={src}>`
def _rec(dir_html: bytes, href_url_start: int = 0, so_far: list[str] = []) -> list[str]:
MATCH_START = b"<span class=\'dir\'><a href=\'"
href_url_start = dir_html.find(MATCH_START, href_url_start)
if href_url_start == -1: # EOF
return so_far
# version href should start with a number
potential_version_start = href_url_start + len(MATCH_START)
p = potential_version_start
if not (dir_html[p: p+1].decode().isnumeric()):
return _rec(dir_html, potential_version_start, so_far)
version_end = dir_html.find(b"/", potential_version_start)
assert version_end != -1, "Should have end-signaling /"
so_far.append(dir_html[potential_version_start:version_end].decode())
return _rec(dir_html, version_end, so_far)
versions = _rec(dir_html, 0, [])
num_versions = len(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_of = lambda ver: [f"/XFree86/Linux-x86_64/{ver}/NVIDIA-Linux-x86_64-{ver}.run"]
sha256_urls_of = lambda ver: [
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:
if int(version.split(".")[0]) < 256:
# Has 3 different packages that we should probably not bother
return None
for url in sha256_urls_of(version):
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:]))
# now print the JSON object
print(json.dumps({
version: {
"url": f"https://{NV_FREE_X86_URL}{dl_url}",
"sha256": sha256
} for (version, dl_url, sha256) in fetch_data if sha256 is not None}, indent=4))

View File

@ -1,42 +0,0 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1660551188,
"narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "441dc5d512153039f19ef198e662e4f3dbb9fd65",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@ -1,49 +0,0 @@
{
description = "A wrapper tool for nix OpenGL applications";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:nixos/nixpkgs";
outputs = {
self,
nixpkgs,
flake-utils,
}:
(flake-utils.lib.eachDefaultSystem (system: let
isIntelX86Platform = system == "x86_64-linux";
nix_pkgs = import nixpkgs {inherit system;};
pkgs = import ./default.nix {
pkgs = nix_pkgs;
enable32bits = isIntelX86Platform;
enableIntelX86Extensions = isIntelX86Platform;
};
in rec {
packages = {
# makes it easy to use "nix run nixGL --impure -- program"
default = pkgs.auto.nixGLDefault;
nixGLDefault = pkgs.auto.nixGLDefault;
nixGLNvidia = pkgs.auto.nixGLNvidia;
nixGLNvidiaBumblebee = pkgs.auto.nixGLNvidiaBumblebee;
nixGLIntel = pkgs.nixGLIntel;
nixVulkanNvidia = pkgs.auto.nixVulkanNvidia;
nixVulkanIntel = pkgs.nixVulkanIntel;
};
# deprecated attributes for retro compatibility
defaultPackage = packages;
}))
// rec {
# deprecated attributes for retro compatibility
overlay = overlays.default;
overlays.default = final: _: let
isIntelX86Platform = final.system == "x86_64-linux";
in {
nixgl = import ./default.nix {
pkgs = final;
enable32bits = isIntelX86Platform;
enableIntelX86Extensions = isIntelX86Platform;
};
};
};
}

View File

@ -1,293 +0,0 @@
{
# # Nvidia informations.
# Version of the system kernel module. Let it to null to enable auto-detection.
nvidiaVersion ? null,
# Hash of the Nvidia driver .run file. null is fine, but fixing a value here
# will be more reproducible and more efficient.
nvidiaHash ? null,
# Alternatively, you can pass a path that points to a nvidia version file
# and let nixGL extract the version from it. That file must be a copy of
# /proc/driver/nvidia/version. Nix doesn't like zero-sized files (see
# https://github.com/NixOS/nix/issues/3539 ).
nvidiaVersionFile ? null,
# Enable 32 bits driver
# This is one by default, you can switch it to off if you want to reduce a
# bit the size of nixGL closure.
enable32bits ? true,
writeTextFile,
shellcheck,
pcre,
runCommand,
linuxPackages,
fetchurl,
lib,
runtimeShell,
bumblebee,
libglvnd,
vulkan-validation-layers,
mesa,
libvdpau-va-gl,
intel-media-driver,
vaapiIntel,
pkgsi686Linux,
driversi686Linux,
zlib,
libdrm,
xorg,
wayland,
gcc,
}: let
writeExecutable = {
name,
text,
}:
writeTextFile {
inherit name text;
executable = true;
destination = "/bin/${name}";
checkPhase = ''
${shellcheck}/bin/shellcheck "$out/bin/${name}"
# Check that all the files listed in the output binary exists
for i in $(${pcre}/bin/pcregrep -o0 '/nix/store/.*?/[^ ":]+' $out/bin/${name})
do
ls $i > /dev/null || (echo "File $i, referenced in $out/bin/${name} does not exists."; exit -1)
done
'';
};
fetch_db = builtins.fromJSON (builtins.readFile ./nvidia_versions.json);
top = rec {
/*
It contains the builder for different nvidia configuration, parametrized by
the version of the driver and sha256 sum of the driver installer file.
*/
nvidiaPackages = {
version,
sha256 ? fetch_db."${version}".sha256,
}: let
nvidiaDrivers =
(linuxPackages.nvidia_x11.override {}).overrideAttrs
(oldAttrs: {
pname = "nvidia";
name = "nvidia-x11-${version}-nixGL";
inherit version;
src = let
url = "https://download.nvidia.com/XFree86/Linux-x86_64/${version}/NVIDIA-Linux-x86_64-${version}.run";
in
fetchurl {inherit url sha256;};
useGLVND = true;
});
nvidiaLibsOnly = nvidiaDrivers.override {
libsOnly = true;
kernel = null;
};
nixNvidiaWrapper = api:
writeExecutable {
name = "nix${api}Nvidia-${version}";
text = ''
#!${runtimeShell}
${lib.optionalString (api == "Vulkan")
"export VK_LAYER_PATH=${vulkan-validation-layers}/share/vulkan/explicit_layer.d"}
NVIDIA_JSON=(${nvidiaLibsOnly}/share/glvnd/egl_vendor.d/*nvidia.json)
${lib.optionalString enable32bits "NVIDIA_JSON32=(${nvidiaLibsOnly.lib32}/share/glvnd/egl_vendor.d/*nvidia.json)"}
${''export __EGL_VENDOR_LIBRARY_FILENAMES=''${NVIDIA_JSON[*]}${
lib.optionalString enable32bits
'':''${NVIDIA_JSON32[*]}''
}"''${__EGL_VENDOR_LIBRARY_FILENAMES:+:$__EGL_VENDOR_LIBRARY_FILENAMES}"''}
${
lib.optionalString (api == "Vulkan")
''export VK_ICD_FILENAMES=${nvidiaLibsOnly}/share/vulkan/icd.d/nvidia_icd.json${
lib.optionalString enable32bits
":${nvidiaLibsOnly.lib32}/share/vulkan/icd.d/nvidia_icd.json"
}"''${VK_ICD_FILENAMES:+:$VK_ICD_FILENAMES}"''
}
export LD_LIBRARY_PATH=${
lib.makeLibraryPath ([libglvnd nvidiaLibsOnly]
++ lib.optional (api == "Vulkan") vulkan-validation-layers
++ lib.optionals enable32bits [
nvidiaLibsOnly.lib32
pkgsi686Linux.libglvnd
])
}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
exec "$@"
'';
};
in {
inherit nvidiaDrivers nvidiaLibsOnly;
nixGLNvidiaBumblebee = writeExecutable {
name = "nixGLNvidiaBumblebee-${version}";
text = ''
#!${runtimeShell}
export LD_LIBRARY_PATH=${
lib.makeLibraryPath [nvidiaDrivers]
}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
${
bumblebee.override {
nvidia_x11 = nvidiaDrivers;
nvidia_x11_i686 = nvidiaDrivers.lib32;
}
}/bin/optirun --ldpath ${
lib.makeLibraryPath ([libglvnd nvidiaDrivers]
++ lib.optionals enable32bits [
nvidiaDrivers.lib32
pkgsi686Linux.libglvnd
])
} "$@"
'';
};
# TODO: 32bit version? Not tested.
inherit nixNvidiaWrapper;
# TODO: 32bit version? Not tested.
nixGLNvidia = nixNvidiaWrapper "GL";
# TODO: 32bit version? Not tested.
nixVulkanNvidia = nixNvidiaWrapper "Vulkan";
};
nixGLIntel = writeExecutable {
name = "nixGLIntel";
# add the 32 bits drivers if needed
text = let
mesa-drivers =
[mesa.drivers]
++ lib.optional enable32bits pkgsi686Linux.mesa.drivers;
intel-driver =
[intel-media-driver vaapiIntel]
# Note: intel-media-driver is disabled for i686 until https://github.com/NixOS/nixpkgs/issues/140471 is fixed
++ lib.optionals enable32bits [
/*
pkgsi686Linux.intel-media-driver
*/
driversi686Linux.vaapiIntel
];
libvdpau =
[libvdpau-va-gl]
++ lib.optional enable32bits pkgsi686Linux.libvdpau-va-gl;
glxindirect = runCommand "mesa_glxindirect" {} ''
mkdir -p $out/lib
ln -s ${mesa.drivers}/lib/libGLX_mesa.so.0 $out/lib/libGLX_indirect.so.0
'';
in ''
#!${runtimeShell}
export LIBGL_DRIVERS_PATH=${lib.makeSearchPathOutput "lib" "lib/dri" mesa-drivers}
export LIBVA_DRIVERS_PATH=${lib.makeSearchPathOutput "out" "lib/dri" intel-driver}
${''export __EGL_VENDOR_LIBRARY_FILENAMES=${mesa.drivers}/share/glvnd/egl_vendor.d/50_mesa.json${
lib.optionalString enable32bits
":${pkgsi686Linux.mesa.drivers}/share/glvnd/egl_vendor.d/50_mesa.json"
}"''${__EGL_VENDOR_LIBRARY_FILENAMES:+:$__EGL_VENDOR_LIBRARY_FILENAMES}"''}
export LD_LIBRARY_PATH=${lib.makeLibraryPath mesa-drivers}:${lib.makeSearchPathOutput "lib" "lib/vdpau" libvdpau}:${glxindirect}/lib:${lib.makeLibraryPath [libglvnd]}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
exec "$@"
'';
};
nixVulkanIntel = writeExecutable {
name = "nixVulkanIntel";
text = let
# generate a file with the listing of all the icd files
icd = runCommand "mesa_icd" {} (
# 64 bits icd
''
ls ${mesa.drivers}/share/vulkan/icd.d/*.json > f
''
# 32 bits ones
+ lib.optionalString enable32bits ''
ls ${pkgsi686Linux.mesa.drivers}/share/vulkan/icd.d/*.json >> f
''
# concat everything as a one line string with ":" as seperator
+ ''cat f | xargs | sed "s/ /:/g" > $out''
);
in ''
#!${runtimeShell}
if [ -n "$LD_LIBRARY_PATH" ]; then
echo "Warning, nixVulkanIntel overwriting existing LD_LIBRARY_PATH" 1>&2
fi
export VK_LAYER_PATH=${vulkan-validation-layers}/share/vulkan/explicit_layer.d
ICDS=$(cat ${icd})
export VK_ICD_FILENAMES=$ICDS"''${VK_ICD_FILENAMES:+:$VK_ICD_FILENAMES}"
export LD_LIBRARY_PATH=${
lib.makeLibraryPath [
zlib
libdrm
xorg.libX11
xorg.libxcb
xorg.libxshmfence
wayland
gcc.cc
]
}"''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
exec "$@"
'';
};
nixGLCommon = nixGL:
runCommand "nixGL" {} ''
mkdir -p "$out/bin"
# star because nixGLNvidia... have version prefixed name
cp ${nixGL}/bin/* "$out/bin/nixGL";
'';
auto = let
_nvidiaVersionFile =
if nvidiaVersionFile != null
then nvidiaVersionFile
else
# HACK: Get the version from /proc. It turns out that /proc is mounted
# inside of the build sandbox and varies from machine to machine.
#
# builtins.readFile is not able to read /proc files. See
# https://github.com/NixOS/nix/issues/3539.
runCommand "impure-nvidia-version-file"
{
# To avoid sharing the build result over time or between machine,
# Add an impure parameter to force the rebuild on each access.
# time = builtins.currentTime;
preferLocalBuild = true;
allowSubstitutes = false;
} "cp /proc/driver/nvidia/version $out 2> /dev/null || touch $out";
# The nvidia version. Either fixed by the `nvidiaVersion` argument, or
# auto-detected. Auto-detection is impure.
nvidiaVersionAuto =
if nvidiaVersion != null
then nvidiaVersion
else
# Get if from the nvidiaVersionFile
let
data = builtins.readFile _nvidiaVersionFile;
versionMatch = builtins.match ".*Module ([0-9.]+) .*" data;
in
if versionMatch != null
then builtins.head versionMatch
else null;
autoNvidia = nvidiaPackages {version = nvidiaVersionAuto;};
in
rec {
# The output derivation contains nixGL which point either to
# nixGLNvidia or nixGLIntel using an heuristic.
nixGLDefault =
if nvidiaVersionAuto != null
then nixGLCommon autoNvidia.nixGLNvidia
else nixGLCommon nixGLIntel;
}
// autoNvidia;
};
in
top
// (
if nvidiaVersion != null
then
top.nvidiaPackages
{
version = nvidiaVersion;
sha256 = nvidiaHash;
}
else {}
)

View File

@ -1,7 +0,0 @@
let
rev = "4f6d8095fd51";
in
import (fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/${rev}.tar.gz";
sha256 = "14sm0bjjcmi9qmznwy3nkd2vbhj5xcshgm54a5wiprl9ssvxqw53";
})

View File

@ -1,599 +0,0 @@
{
"256.25": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.25/NVIDIA-Linux-x86_64-256.25.run",
"sha256": "a93e4de6df8336741ace5a4bd2bc80b3b0b0ebde8c31003671af91bc44db61d3"
},
"256.29": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.29/NVIDIA-Linux-x86_64-256.29.run",
"sha256": "e387780b265e9eec2f68295f7f08dab0238c87426e9968d8dd9d02d6ff023da3"
},
"256.35": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.35/NVIDIA-Linux-x86_64-256.35.run",
"sha256": "ef10ecddd8db11f0fa3c6e4727dc275eb0ca9d23a7b7d37a038d17d2a42acb2a"
},
"256.38.02": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.38.02/NVIDIA-Linux-x86_64-256.38.02.run",
"sha256": "c3c9c60932830a648034b98f38910058df339a84ad5998adc8df19c697fd6663"
},
"256.38.03": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.38.03/NVIDIA-Linux-x86_64-256.38.03.run",
"sha256": "0dcb0098e294d5b89f57b8100f6af660225310ba48b4298a2ac79bb19cc8ca7c"
},
"256.44": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.44/NVIDIA-Linux-x86_64-256.44.run",
"sha256": "528aaed18b6b4ba79dbf4ae5c5ecda8350007d610d2c7c608eb646739cfeb500"
},
"256.52": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.52/NVIDIA-Linux-x86_64-256.52.run",
"sha256": "3ab713f969fe7cf0d7ccfdfee2863c92ea96d1eb5bf3f734b3a1e5b37c2611c8"
},
"256.53": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/256.53/NVIDIA-Linux-x86_64-256.53.run",
"sha256": "febee3eb128e1d62565fccb3ad1577f741c4bf067072e45e7766ab999aa590c9"
},
"260.19.04": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.04/NVIDIA-Linux-x86_64-260.19.04.run",
"sha256": "09391b63daa6bc08ea520c28295a8535b83710f8ba48d01778bf7fe22d095485"
},
"260.19.06": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.06/NVIDIA-Linux-x86_64-260.19.06.run",
"sha256": "ecd3e2113fbf9dd7e167c737d3b4490dd653b49b70ead62c194635ffc3fd4d00"
},
"260.19.12": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.12/NVIDIA-Linux-x86_64-260.19.12.run",
"sha256": "7cc90b5bd402742167a1647d0d92aa997af4184da614c2ca882afb2f2e48eb7e"
},
"260.19.21": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.21/NVIDIA-Linux-x86_64-260.19.21.run",
"sha256": "bf80147e94ab4c86dffe4529635e5f5b0caff5f6758a068d0e2d95ee466d2214"
},
"260.19.26": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.26/NVIDIA-Linux-x86_64-260.19.26.run",
"sha256": "78ce4e3344ee15330708054b5c3ceabb96aabaa1194a9bc92cee9559c7cd3c9f"
},
"260.19.29": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.29/NVIDIA-Linux-x86_64-260.19.29.run",
"sha256": "09461a1eb6f46b394e9a2cfef20448311a395c3969521881b334c413715174eb"
},
"260.19.36": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.36/NVIDIA-Linux-x86_64-260.19.36.run",
"sha256": "35a8769585e1f9b426c9c21b5f5898c06251a642ed73e9fb9eea9ab87ef91067"
},
"260.19.44": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/260.19.44/NVIDIA-Linux-x86_64-260.19.44.run",
"sha256": "8526267407d71b1257e43abc2b98e588c8d271e30584a754b8b8ef426cc69c64"
},
"270.18": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.18/NVIDIA-Linux-x86_64-270.18.run",
"sha256": "b10af40db402f9f8e6a3a5a55b2385a06e2b8b14c8fc539624b07c63d70bef32"
},
"270.26": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.26/NVIDIA-Linux-x86_64-270.26.run",
"sha256": "120ead8941ad6c9ea5bc263e12b004e6c4639151469cfe46a99781ab1cc1f33a"
},
"270.29": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.29/NVIDIA-Linux-x86_64-270.29.run",
"sha256": "c45209b72b2a0128fa4721c616dd51ad799e2698d46f672b006c4b2cc0c44f9c"
},
"270.30": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.30/NVIDIA-Linux-x86_64-270.30.run",
"sha256": "5f49d1497c60ea3d82e6640ebc233e05c855adf5f6702dfc0a5c73773f26207e"
},
"270.41.03": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.41.03/NVIDIA-Linux-x86_64-270.41.03.run",
"sha256": "35dd4a1d89228a8ffc26dd9513aaf806e67826c42ff34954e2bd576068abd0b5"
},
"270.41.06": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.41.06/NVIDIA-Linux-x86_64-270.41.06.run",
"sha256": "825c593e77d33df599b2cfe2a3b4cde0c61b837a843a3caa6469298de721f2fa"
},
"270.41.19": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/270.41.19/NVIDIA-Linux-x86_64-270.41.19.run",
"sha256": "4d7131f07e739abc787d69696ca4ac52df2fc0b338405ffd474288c2a4a1e7a6"
},
"275.09": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.09/NVIDIA-Linux-x86_64-275.09.run",
"sha256": "e4c94cbd85f619c2b83f6c53bddc8a7b7ce306f28b80c8cfacdfba884da45f4d"
},
"275.09.04": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.09.04/NVIDIA-Linux-x86_64-275.09.04.run",
"sha256": "dceb415aec70d7fa2bafea45268b1913100cc19e08e57dfda0f0920caad43b68"
},
"275.09.07": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.09.07/NVIDIA-Linux-x86_64-275.09.07.run",
"sha256": "747c09b0a0a8d60e1b5fee49fb1ea07ee5812f8e85a87b2403011af6de58164d"
},
"275.19": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.19/NVIDIA-Linux-x86_64-275.19.run",
"sha256": "58bf5d90fbabd30c5980a8ce5fe831337ccfe0ab843e78e0b0b12eec8e327e40"
},
"275.21": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.21/NVIDIA-Linux-x86_64-275.21.run",
"sha256": "9e071aef05545ece8f2836b57f49f73853adb998f9987669c4803549fb50f479"
},
"275.28": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.28/NVIDIA-Linux-x86_64-275.28.run",
"sha256": "fc1dfded42d21b08f40fa7f50589c6c0c4922cc0d30af71bf721ab8682b00648"
},
"275.36": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.36/NVIDIA-Linux-x86_64-275.36.run",
"sha256": "91a8c8865514fbeec20fa90c00690011426ad7b5d5c9a221f7ced253d94ddab7"
},
"275.43": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/275.43/NVIDIA-Linux-x86_64-275.43.run",
"sha256": "468515a3b3fb2423dc47a6066e2f1b646ec78283b008a3702c111e5cfd3f5dc2"
},
"280.04": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/280.04/NVIDIA-Linux-x86_64-280.04.run",
"sha256": "e230b25462ab4eeba71363f12360d4785223c023111f08d21ce1a7456665e712"
},
"280.11": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/280.11/NVIDIA-Linux-x86_64-280.11.run",
"sha256": "9d56c08c45a0648c62f00745413f0828549928f0e4e7549bea3d9fce8e498e5f"
},
"280.13": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/280.13/NVIDIA-Linux-x86_64-280.13.run",
"sha256": "98a08c7d943912a178a9bbe419db60634088e5262ae9053bf2fe730984e5a012"
},
"285.03": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/285.03/NVIDIA-Linux-x86_64-285.03.run",
"sha256": "fc1e895635b9ea7171f4e7c549e6502f3853838cb4cc254a190b004579a1f919"
},
"285.05.09": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/285.05.09/NVIDIA-Linux-x86_64-285.05.09.run",
"sha256": "7159a1f7e898b50dd49ea2273ac6facb870546ad5496bf70c6fbe1642d2c4970"
},
"290.03": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/290.03/NVIDIA-Linux-x86_64-290.03.run",
"sha256": "14a412b6a01cd9ae98b1dba0f1a2805c9038fd731dd66747ca57ab6ec4f550b0"
},
"290.06": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/290.06/NVIDIA-Linux-x86_64-290.06.run",
"sha256": "48df72cd225043ebecbe1a6a9a575d692e0a9fa0b0bb65c037800d83ba54f3ec"
},
"290.10": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/290.10/NVIDIA-Linux-x86_64-290.10.run",
"sha256": "34a2ab07f4ae7afdeb2c8415f3f37c1099e6690eb25f3dbef92eca771f7ce4cd"
},
"295.09": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.09/NVIDIA-Linux-x86_64-295.09.run",
"sha256": "4b2ff7f9fcc1db6f30f4b4a2eb5a22bc5fe1c566828e3d6a56ef088d187bf786"
},
"295.17": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.17/NVIDIA-Linux-x86_64-295.17.run",
"sha256": "b1fede162dce9c3d31a991cf48a4743dacece05cfef86dafac8e8284369a86c2"
},
"295.20": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.20/NVIDIA-Linux-x86_64-295.20.run",
"sha256": "3b84fdeae335c047193f68a1da26f2a736461c35cfe94566fc7ace1e5762d34c"
},
"295.33": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.33/NVIDIA-Linux-x86_64-295.33.run",
"sha256": "4e939bac1ebc03c6439969d638540b99900b0fe4e4799b4186e5ff9521d37b73"
},
"295.40": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.40/NVIDIA-Linux-x86_64-295.40.run",
"sha256": "f6d5ae338b3b8ac6c512d06b335010934a62728f181a1fa5253aa84b7bf45e7a"
},
"295.49": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.49/NVIDIA-Linux-x86_64-295.49.run",
"sha256": "61dc9623ea1981f801d97de7c67c32b7e4f7ef4aaa6744910967cb634d9ace62"
},
"295.53": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.53/NVIDIA-Linux-x86_64-295.53.run",
"sha256": "4525e994a0d0a8cd776415401423e7de3985923637642955c3fe50a3d047d4ca"
},
"295.59": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.59/NVIDIA-Linux-x86_64-295.59.run",
"sha256": "4b1d96389abd2b804ad470c5189142a02ee4c82c1ac56cea37ecb45e8051313e"
},
"295.71": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.71/NVIDIA-Linux-x86_64-295.71.run",
"sha256": "956c7660bff61c07a99cea2130e73baf1574907008d41d9462147aad6b83dcc6"
},
"295.75": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/295.75/NVIDIA-Linux-x86_64-295.75.run",
"sha256": "b7ae04da001ade59b87abd15e7786b3f0fc75a312368fa466f6c0400e803debd"
},
"302.07": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/302.07/NVIDIA-Linux-x86_64-302.07.run",
"sha256": "6a9e515c21afed122621a69a844a2891bb625773e481ebfe70699bf2d06be5e1"
},
"302.11": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/302.11/NVIDIA-Linux-x86_64-302.11.run",
"sha256": "e44816814bce58a9f1cf0d10edec1a2f4b25104a212714c2bbd1bc9e70b53f61"
},
"302.17": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/302.17/NVIDIA-Linux-x86_64-302.17.run",
"sha256": "5cf9059ebb70ade99e5621c0a605ed5bbb6c274f7c52a7ef40342ceb41b381fc"
},
"304.22": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.22/NVIDIA-Linux-x86_64-304.22.run",
"sha256": "4c1b6f7dcda007622bb5e243b858abdb3881d5d5befdc617b23393545d9c96fd"
},
"304.30": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.30/NVIDIA-Linux-x86_64-304.30.run",
"sha256": "ada4deee8a7a19093af7bb724dfd55e2594fb28932ff915723532ddf16b85e1f"
},
"304.32": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.32/NVIDIA-Linux-x86_64-304.32.run",
"sha256": "a26d6c64108371027fbca1b35b182d0ff1609dd53ce6f9d06fea85f039393bc8"
},
"304.37": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.37/NVIDIA-Linux-x86_64-304.37.run",
"sha256": "cae75158047d0b97ea48f269fd2903a6731f53b978a1065720343436c97ca9c2"
},
"304.43": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.43/NVIDIA-Linux-x86_64-304.43.run",
"sha256": "76946e2fe4160cfd59e7a75fefd174a9c7e71c51cca6b88c40a16cf35947b777"
},
"304.48": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.48/NVIDIA-Linux-x86_64-304.48.run",
"sha256": "c018541d30e4f276e1afc60077e5c75b54954daa8888c870fc80a19b28d4eae8"
},
"304.51": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.51/NVIDIA-Linux-x86_64-304.51.run",
"sha256": "28654ff26923660de7296488054154bbbac0ef6e669377eeed84178fd0c17e64"
},
"304.60": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.60/NVIDIA-Linux-x86_64-304.60.run",
"sha256": "12dbd2661e8b6114fa3f531cb0c7a6820c98198aa6044bddff0d2431141bc6d0"
},
"304.64": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.64/NVIDIA-Linux-x86_64-304.64.run",
"sha256": "b3c3bb7f136ccd978c9c5a511a02199ec2498c4243baae19ac68e5d905ca5340"
},
"304.84": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.84/NVIDIA-Linux-x86_64-304.84.run",
"sha256": "8d51e0a8e5bd20d0add5dbacdcdb95eba05bc01d17c3bb247b5a1880feb0e0fe"
},
"304.88": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.88/NVIDIA-Linux-x86_64-304.88.run",
"sha256": "c1a73211566b085214b0ad1824733aa56d09c6139f729feebd0eff44f6113da3"
},
"304.108": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.108/NVIDIA-Linux-x86_64-304.108.run",
"sha256": "56a61871f0488521f50c04607c568a177cad48a577c0f4ca625665d0015e2b39"
},
"304.116": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.116/NVIDIA-Linux-x86_64-304.116.run",
"sha256": "3f267f2cd3f4ede4f954c5f36c8427ae4a2fa19ca8c275f892488f4dc3a4109a"
},
"304.117": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.117/NVIDIA-Linux-x86_64-304.117.run",
"sha256": "0e5a751cf12b55057c00ccf53d05c8934d5eee49c5f8b3f33c5e11e2c6989e6e"
},
"304.119": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.119/NVIDIA-Linux-x86_64-304.119.run",
"sha256": "1fd710a78d2bf711ede3bcbd20058de1e94c498db31973dfec1b8c25bf87e6cd"
},
"304.121": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.121/NVIDIA-Linux-x86_64-304.121.run",
"sha256": "6532eef8b6f65dc44ed912b4ffa86494a954ae98f53c3ffd394fa511cdf75928"
},
"304.123": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.123/NVIDIA-Linux-x86_64-304.123.run",
"sha256": "68ee60d2a96ff80adad7e62f79f55f137dd10b8c38ce6c60fb481e73fdf6b155"
},
"304.125": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.125/NVIDIA-Linux-x86_64-304.125.run",
"sha256": "c654889b85a18326f2c610260a8fbc3b1bb6f9b8be1c052a46a213f60bd62262"
},
"304.128": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/304.128/NVIDIA-Linux-x86_64-304.128.run",
"sha256": "e301342b93af24a6676519cb3a7fbe5d557b6a23a588ef121478b7fbab8a495f"
},
"310.14": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.14/NVIDIA-Linux-x86_64-310.14.run",
"sha256": "a187cc9de4939b171b600544e8dbf78dbb1a05cb481b2b3b506c3699f8e6c4c7"
},
"310.19": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.19/NVIDIA-Linux-x86_64-310.19.run",
"sha256": "3326cf9eb432a10fee5cb663132cd6c175813d0225750ef237dcc7feefd20fca"
},
"310.32": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.32/NVIDIA-Linux-x86_64-310.32.run",
"sha256": "e5f179a62d1a0e6a877f3f89315d0a28cb7c3cbceff7df13e1a71ab189ac3616"
},
"310.40": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.40/NVIDIA-Linux-x86_64-310.40.run",
"sha256": "48fc9ff847b57ce959b401ad37040dc1332f9c0b3bdef08c246dba91e091a65e"
},
"310.44": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.44/NVIDIA-Linux-x86_64-310.44.run",
"sha256": "585365fc37939794ab7ed6907ab2fd9fbcc6f4f19c003d21139895dc97dd88f4"
},
"310.51": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/310.51/NVIDIA-Linux-x86_64-310.51.run",
"sha256": "4d0f9829105a8f06121f8308fa5e67834f52b84add48eaf4101b02522db15f53"
},
"313.09": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/313.09/NVIDIA-Linux-x86_64-313.09.run",
"sha256": "11cc2c4d32da321ad7ce63b9cdb41578400542d0b9d0ac6c5061a3253db96e13"
},
"313.18": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/313.18/NVIDIA-Linux-x86_64-313.18.run",
"sha256": "9aaf6ce2fb08f72b2ab4f7a2d9fc5af8216ac263fa4883deec3844f34ea7ba3a"
},
"313.26": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/313.26/NVIDIA-Linux-x86_64-313.26.run",
"sha256": "4cbf3ec4fe1ce0b24ebbdcc3badde369aeb98ab59b6689261fa39f2dde00d41e"
},
"313.30": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/313.30/NVIDIA-Linux-x86_64-313.30.run",
"sha256": "72317f2e4c459c33c764e3283deb3e1615b1852ead1f9bfad82148e120506022"
},
"319.12": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.12/NVIDIA-Linux-x86_64-319.12.run",
"sha256": "4b68617d75d0d1149d2d6e836783429c715204fad567aa621ae7982df676a8d4"
},
"319.17": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.17/NVIDIA-Linux-x86_64-319.17.run",
"sha256": "5579a8c4f5a7927eb9756d276c4e3d60540877cd68f6c946890fddc5d176764a"
},
"319.23": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.23/NVIDIA-Linux-x86_64-319.23.run",
"sha256": "d130dd0a9d889063d0dbad0a27789af756076af879a68a5dbc1175821542fa78"
},
"319.32": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.32/NVIDIA-Linux-x86_64-319.32.run",
"sha256": "204a00728c3cfbe3dcb12a9dae5bf0371a1e5b2c48dedf86a2bb6c881e901e2a"
},
"319.49": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.49/NVIDIA-Linux-x86_64-319.49.run",
"sha256": "f4bfee9f48725e20e05439ee099730fb1b42892b9ecfac000180426b044be585"
},
"319.60": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.60/NVIDIA-Linux-x86_64-319.60.run",
"sha256": "2bd663d0d0a9ae8769b0335ff282acfddea3cd86a3992970e445eb2f82fa1b04"
},
"319.72": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.72/NVIDIA-Linux-x86_64-319.72.run",
"sha256": "25a15200d6fd58782db860c7bc0807583b1d78c13810013c024700e63df4c643"
},
"319.82": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/319.82/NVIDIA-Linux-x86_64-319.82.run",
"sha256": "9e00555488fd1c934a86ccf04f3a9eb8c5bcbc29ea38ce66d72788d0bd9dde7b"
},
"325.08": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/325.08/NVIDIA-Linux-x86_64-325.08.run",
"sha256": "83a567dc6b1ddd0c74af1ebc54e966ae19f52baa17166981046af4d6288c6ce4"
},
"325.15": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/325.15/NVIDIA-Linux-x86_64-325.15.run",
"sha256": "01446fbd94f6eb3b2e1b3d3f2b06970bf470c3ee2cb1838b3d0c2416e6c74500"
},
"331.13": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.13/NVIDIA-Linux-x86_64-331.13.run",
"sha256": "571741b8ea153281916382d287849f99a9fa65b911aa54d678b48ef0091cc0cd"
},
"331.17": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.17/NVIDIA-Linux-x86_64-331.17.run",
"sha256": "22968b7bd6460456e99edcad18ec237ebe66fd19e349c9ec9c3d5a16c074eab4"
},
"331.20": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.20/NVIDIA-Linux-x86_64-331.20.run",
"sha256": "b8803906402354d201d3b9bc21938a0fe8a7d76e93e486fddaab340df18092ec"
},
"331.38": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.38/NVIDIA-Linux-x86_64-331.38.run",
"sha256": "1015ac65a85ba39bdbe9e6bac54ae7ce3b2441fc7512909074e991242a46cf34"
},
"331.49": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.49/NVIDIA-Linux-x86_64-331.49.run",
"sha256": "ee0e0c3e95439e3d55e76aa6477fdb62bc62c04805b3efaa1f028ea64d2422f8"
},
"331.67": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.67/NVIDIA-Linux-x86_64-331.67.run",
"sha256": "9c7f2bb44bb26a5effb915d8aa22132a6c06483e0cfa6f47b7265b15da83bbd7"
},
"331.79": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.79/NVIDIA-Linux-x86_64-331.79.run",
"sha256": "c3314bd7f1f722929a2b401e12301a750ee7a73640518932a5a9af39c390a604"
},
"331.89": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.89/NVIDIA-Linux-x86_64-331.89.run",
"sha256": "e7f51a6c7abfe3ba8f03dbb284e2ade7430cc909b2241ff7703b17beff0dd237"
},
"331.104": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.104/NVIDIA-Linux-x86_64-331.104.run",
"sha256": "e0a26dc4444e84dae876db773f717e33846e1ae8a23802795ba3d39f1631f79e"
},
"331.113": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/331.113/NVIDIA-Linux-x86_64-331.113.run",
"sha256": "e9d5eb4394ef31825f7a86290b19b522851d1b599284095d81bac0f33a996219"
},
"334.16": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/334.16/NVIDIA-Linux-x86_64-334.16.run",
"sha256": "59a930f7ed6391a1e57b9fc7683420facd1c4548757d4120b1c594479af759f7"
},
"334.21": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/334.21/NVIDIA-Linux-x86_64-334.21.run",
"sha256": "dd35011967b815e096c267f80b36664e34d779bc33017f396dabbd1a1b86d057"
},
"337.12": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/337.12/NVIDIA-Linux-x86_64-337.12.run",
"sha256": "8fa588e0491e652a1cfd45aa01be9336c9b5bb5dd54bf45801a40d53d957e4b4"
},
"337.19": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/337.19/NVIDIA-Linux-x86_64-337.19.run",
"sha256": "bd6998c4aa5e491fb8fcb957b11dfb983ebfb755e938fce0382b006a7aba59d2"
},
"337.25": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/337.25/NVIDIA-Linux-x86_64-337.25.run",
"sha256": "83280f7738f65bb2e790e7530a38978cf0bd0aa741eda51629c9e9b068128af0"
},
"340.17": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.17/NVIDIA-Linux-x86_64-340.17.run",
"sha256": "b3311d4bc82dd1c58805f2ac29d20711f2b0c0978407bba138d603606e603662"
},
"340.24": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.24/NVIDIA-Linux-x86_64-340.24.run",
"sha256": "db0f4f45ece587b95a8ceb0d1acf6f7f758a370ee0c4adfa2403ba4828d58ce6"
},
"340.32": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.32/NVIDIA-Linux-x86_64-340.32.run",
"sha256": "ef96003110564953cad4ffaec073696dcf9652338dfe5eb0c58ae3ce45db42ac"
},
"340.46": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.46/NVIDIA-Linux-x86_64-340.46.run",
"sha256": "57e7694b5a985ee95d2da37598ec37cdabf40f914490f4cdb0c5184f12a74270"
},
"340.58": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.58/NVIDIA-Linux-x86_64-340.58.run",
"sha256": "70cc452161b969d659225a3a7d4cc17d5827f8f8ce6eb053757f30f6a666a643"
},
"340.65": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.65/NVIDIA-Linux-x86_64-340.65.run",
"sha256": "cd3948db5c1e2468c50140efb4bb50f1a4c84c923db8ec756bd56ff35df9ff04"
},
"340.76": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.76/NVIDIA-Linux-x86_64-340.76.run",
"sha256": "3bf670e9a2bdb184648dec54ce06fab65e798a9a4c9dd5155e2be4efee3e0994"
},
"340.93": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/340.93/NVIDIA-Linux-x86_64-340.93.run",
"sha256": "ea2ac747fd473ea55ed5f6263bd314efa94c71384f3e03d527f8d550ba84c218"
},
"343.13": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/343.13/NVIDIA-Linux-x86_64-343.13.run",
"sha256": "424a7d0fbf668c94454a140c880c298c71496ad7dee699a0bfc594c70e499e54"
},
"343.22": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/343.22/NVIDIA-Linux-x86_64-343.22.run",
"sha256": "762e9d3c1253712a5a62f7052d58e4768eaea3f0492cab934dbf5349c8523315"
},
"343.36": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/343.36/NVIDIA-Linux-x86_64-343.36.run",
"sha256": "2285efa2c0e6675d8724e47a09403630a674c32e514bdcfb54cec3c81810fc78"
},
"346.16": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.16/NVIDIA-Linux-x86_64-346.16.run",
"sha256": "d44bc3f868ce9cbd6c5bbe88d8622f693ef44282f14ed018d150fcab21a0ce32"
},
"346.22": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.22/NVIDIA-Linux-x86_64-346.22.run",
"sha256": "ecb3edab63ff053aa1d6e19eb0a69360075ab1b021e5181a6df738e29be9b71a"
},
"346.35": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.35/NVIDIA-Linux-x86_64-346.35.run",
"sha256": "8625acbbc7a2abdda436a5cb9d06f2a7f5913b16e0a35ac4f9f106853a94d086"
},
"346.47": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.47/NVIDIA-Linux-x86_64-346.47.run",
"sha256": "85ab28abe9defc2838839969b31aea647e0de34615fbfed3ba716205de365d0a"
},
"346.59": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.59/NVIDIA-Linux-x86_64-346.59.run",
"sha256": "231020548431569c0172605815ba131a18f969966b4abf82129f974740bc64ca"
},
"346.72": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.72/NVIDIA-Linux-x86_64-346.72.run",
"sha256": "2ae3777bcff6bf4883b6a903c82b82257bf8fc323fe174992df96a3208c50cef"
},
"346.82": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.82/NVIDIA-Linux-x86_64-346.82.run",
"sha256": "f68b74479a2c329628fed061977e99f744980329c94b6e9c3f396714f2a10f0e"
},
"346.87": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.87/NVIDIA-Linux-x86_64-346.87.run",
"sha256": "908446b20c9992cc6a7700866d36c13d9f53646837842d096d91b35644ee4e31"
},
"346.96": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/346.96/NVIDIA-Linux-x86_64-346.96.run",
"sha256": "229b28a6b65965a248d07223d941de7d79b54cee7c6574f1037293e8a8026727"
},
"349.12": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/349.12/NVIDIA-Linux-x86_64-349.12.run",
"sha256": "fe2e3be342859d2de947aed55c369f4944211ecde00435c76e50a4842fffd68a"
},
"349.16": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/349.16/NVIDIA-Linux-x86_64-349.16.run",
"sha256": "f980b22729b20c9eb3a3a800af524da181afbc78e2409a3f83845894983f8322"
},
"352.09": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/352.09/NVIDIA-Linux-x86_64-352.09.run",
"sha256": "a3ec271896b775c936e1a14e7af2e8ebf02b0bd59381217510185b313c5a5fd6"
},
"352.21": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/352.21/NVIDIA-Linux-x86_64-352.21.run",
"sha256": "aadfbd991b5418cbf89d2368cc49485a4194196ef08362a18f92df049381f791"
},
"352.30": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/352.30/NVIDIA-Linux-x86_64-352.30.run",
"sha256": "4c5fb75ba94c97b6d70ddb9ea2cb11b5ed01829b5f671d9e8abce7afba20aef5"
},
"352.41": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/352.41/NVIDIA-Linux-x86_64-352.41.run",
"sha256": "0eb60d0543a0e7c5c3cfec13702005ffec6e2b8c7f22c631f324736ba2a1a832"
},
"355.06": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/355.06/NVIDIA-Linux-x86_64-355.06.run",
"sha256": "898304e1455bbccad4a3da3520d7fe17db254413f3458d0a296b45fb9cf2bcd6"
},
"355.11": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/355.11/NVIDIA-Linux-x86_64-355.11.run",
"sha256": "a59b425381add9d9058dc2d987bf3087ab59c43224b5eb04c3f273f5886451ed"
},
"470.161.03": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/470.161.03/NVIDIA-Linux-x86_64-470.161.03.run",
"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": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/510.108.03/NVIDIA-Linux-x86_64-510.108.03.run",
"sha256": "410a515e78df29c2cba4ac0b497889ce0ff1b04cfc711ff889e2dfc80f0da0d8"
},
"515.86.01": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/515.86.01/NVIDIA-Linux-x86_64-515.86.01.run",
"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": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.53/NVIDIA-Linux-x86_64-525.53.run",
"sha256": "74bb0971f04f1dddd3c4641c891706fb96e8de52e22f6079e50de76d3a51687f"
},
"525.60.11": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.60.11/NVIDIA-Linux-x86_64-525.60.11.run",
"sha256": "816ee6c2e0813ccc3d4a7958f71fc49a37c60efe1d51d6146c1ce72403983d5d"
},
"525.60.13": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.60.13/NVIDIA-Linux-x86_64-525.60.13.run",
"sha256": "dce1c184f9f038be72237ccd29c66bb151077f6037f1c158c83d582bd2dba8ca"
},
"525.78.01": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/525.78.01/NVIDIA-Linux-x86_64-525.78.01.run",
"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": {
"url": "https://download.nvidia.com/XFree86/Linux-x86_64/530.41.03/NVIDIA-Linux-x86_64-530.41.03.run",
"sha256": "ae27a16a968c85503f5d161dda343c1602612b025f4aee15f92e2ea0acb784b1"
}
}

View File

@ -1 +0,0 @@

View File

@ -1,4 +1,7 @@
#!/usr/bin/env python3 # A simple playground to explore vim plugins that are available in nixpkgs #!/usr/bin/env python3
"""
A simple playground to explore vim plugins that are available in nixpkgs
"""
import csv import csv
import urllib.request import urllib.request
@ -45,11 +48,11 @@ class VimPlugins:
return self.conn.cursor().execute(query).fetchall() return self.conn.cursor().execute(query).fetchall()
def vim_plugin_slug(name: str): def vim_plugin_slug(name: str) -> str:
return name.replace(".", "-").lower() return name.replace(".", "-").lower()
def name_from_repo(repo: str): def name_from_repo(repo: str) -> str:
spl = repo.split("/") spl = repo.split("/")
return vim_plugin_slug(spl[-1] or spl[-2]) return vim_plugin_slug(spl[-1] or spl[-2])
@ -86,7 +89,8 @@ L3MON4D3/LuaSnip
arthurxavierx/vim-caser arthurxavierx/vim-caser
~/local_repos/ts-ql ~/local_repos/ts-ql
""".split() """.split()
need_install_plugins = [plugin.strip() for plugin in need_install_plugins if plugin.strip()] need_install_plugins = [plugin.strip()
for plugin in need_install_plugins if plugin.strip()]
# Create the GitHub URL list # Create the GitHub URL list
need_install_plugins_gh = [ need_install_plugins_gh = [
@ -104,7 +108,7 @@ arthurxavierx/vim-caser
# Check if the repo is not in the list # Check if the repo is not in the list
repos = [repo for repo, _ in values] repos = [repo for repo, _ in values]
not_in_repo = [name_from_repo(gh) for gh in need_install_plugins_gh if gh not in repos] not_in_repo = [name_from_repo(
print("not in repo", not_in_repo) # nvim-yati, yang-vim, Comment-nvim, inlay-hints-nvim, hlargs-nvim, vim-caser, gruvbox-community gh) for gh in need_install_plugins_gh if gh not in repos]
# nvim-yati, yang-vim, Comment-nvim, inlay-hints-nvim, hlargs-nvim, vim-caser, gruvbox-community
print("not in repo", not_in_repo)

View File

@ -15,46 +15,47 @@
flake-utils, flake-utils,
nixpkgs, nixpkgs,
}: }:
with flake-utils; lib.eachSystem lib.defaultSystems (sys: let with flake-utils;
overlays = [turbo.overlay]; lib.eachSystem lib.defaultSystems (sys: let
# pkgs is our tweaked nixpkgs overlays = [turbo.overlay];
pkgs = import nixpkgs { # pkgs is our tweaked nixpkgs
system = sys; pkgs = import nixpkgs {
overlays = overlays; system = sys;
}; overlays = overlays;
shellMsg = '' };
echo "Hello from nix ${sys}" shellMsg = ''
echo "Local development may use our remote planetscale database (pscale login && pnpm dev:infra; pnpm dev)" echo "Hello from nix ${sys}"
echo "Or from the specified docker-compose.yml (pnpm dev:local_infra && pnpm dev)" echo "Local development may use our remote planetscale database (pscale login && pnpm dev:infra; pnpm dev)"
echo "See more on CONTRIBUTING.md" echo "Or from the specified docker-compose.yml (pnpm dev:local_infra && pnpm dev)"
''; echo "See more on CONTRIBUTING.md"
in { '';
devShell = pkgs.mkShell { in {
nativeBuildInputs = [pkgs.bashInteractive]; devShell = pkgs.mkShell {
buildInputs = [ nativeBuildInputs = [pkgs.bashInteractive];
pkgs.nodejs-18_x buildInputs = [
pkgs.nodePackages.pnpm pkgs.nodejs-18_x
pkgs.nodePackages.prisma pkgs.nodePackages.pnpm
pkgs.prisma-engines pkgs.nodePackages.prisma
pkgs.turbo pkgs.prisma-engines
# pkgs.turbo-tooling pkgs.turbo
pkgs.jq # pkgs.turbo-tooling
pkgs.pscale pkgs.jq
pkgs.act # Github workflow pkgs.pscale
]; pkgs.act # Github workflow
shellHook = ];
# https://github.com/prisma/prisma/issues/3026#issuecomment-927258138 shellHook =
# nix-direnv is required (impure build?) https://github.com/nix-community/nix-direnv # https://github.com/prisma/prisma/issues/3026#issuecomment-927258138
'' # nix-direnv is required (impure build?) https://github.com/nix-community/nix-direnv
export PRISMA_MIGRATION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/migration-engine" ''
export PRISMA_QUERY_ENGINE_BINARY="${pkgs.prisma-engines}/bin/query-engine" export PRISMA_MIGRATION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/migration-engine"
export PRISMA_QUERY_ENGINE_LIBRARY="${pkgs.prisma-engines}/lib/libquery_engine.node" export PRISMA_QUERY_ENGINE_BINARY="${pkgs.prisma-engines}/bin/query-engine"
export PRISMA_INTROSPECTION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/introspection-engine" export PRISMA_QUERY_ENGINE_LIBRARY="${pkgs.prisma-engines}/lib/libquery_engine.node"
export PRISMA_FMT_BINARY="${pkgs.prisma-engines}/bin/prisma-fmt" export PRISMA_INTROSPECTION_ENGINE_BINARY="${pkgs.prisma-engines}/bin/introspection-engine"
export TURBO_BINARY_PATH="${pkgs.turbo}/bin/turbo" export PRISMA_FMT_BINARY="${pkgs.prisma-engines}/bin/prisma-fmt"
pnpm install export TURBO_BINARY_PATH="${pkgs.turbo}/bin/turbo"
'' pnpm install
+ shellMsg; ''
}; + shellMsg;
}); };
});
} }