Compare commits
51 commits
9597490783
...
cbca0c694e
Author | SHA1 | Date | |
---|---|---|---|
cbca0c694e | |||
306835e1b0 | |||
f2e46d90bb | |||
c5512ec9e9 | |||
5bc27fbffb | |||
243c3e6b69 | |||
2bb4d85963 | |||
814f9a1bea | |||
dbface588a | |||
b14335ac8c | |||
904f8d1e0c | |||
de980f6464 | |||
eae5d72091 | |||
2b0bdc994a | |||
b79effce83 | |||
0b1fef9643 | |||
b1e52dde09 | |||
d3b93d1064 | |||
2366f2f523 | |||
7ed053524f | |||
28f4c81795 | |||
e369aa5fae | |||
17a8f0e500 | |||
1eb581b32d | |||
1c9258ee7d | |||
febc51ab6e | |||
b29ed1d480 | |||
95ac8522db | |||
184afebce1 | |||
3bfc56bf2a | |||
3a3d4f847b | |||
f265752a8a | |||
712c2c2163 | |||
6d567a5e6e | |||
426206d4b3 | |||
210d45a02e | |||
87673019ab | |||
5e89baa6c4 | |||
3ff056aff9 | |||
e45e334313 | |||
3892f3ae56 | |||
782a988e08 | |||
871644b09d | |||
65add9c660 | |||
546c9e4f27 | |||
78b536bd8b | |||
e78602199d | |||
47d084f852 | |||
cf2fb32195 | |||
b6762c1fc4 | |||
868a902639 |
58 changed files with 2687 additions and 337 deletions
|
@ -1,5 +1,6 @@
|
|||
zipline: ENC[AES256_GCM,data:oz+3ZOVaIUF+b/pkWgEQnfcSKgoTOUdxN76ggaMxaVPag/1AwizhzWaHxTHPcu2MEL/cWdtr9+7egXjkF/9dZKxucmUJBXUp9KSoBQAd/xaDOts/sLJKdEqF7dG7UfxgL4P6tiUyRpr0XIspyDXB8w9o0orrT2VoIUJQpTSrclAqqOF7p3bRktl5IDOfZZKqkT7eSepFHRs6bXbTLHyDehAWhy+GDpWY23p3rqj5CWGXhO6poPH9kLgKA0v5hNCVrKgdfgj4yiSuNo8RBJ9RTumrDvsFQs+8sCLK+gVSAkuIqd3Df+XjuGqT3R1/xmL/yWz5/6NDhAvACvPbmnHfan07xJKbfJAZk7KqSalxxn7r0XuGfKbdkC4=,iv:Z2POj0P4VXmZZPom5TqdXu6W8IKEIgSCf/6KSwQhTm4=,tag:ue77bVCS7GDI2Z4oq+GXwQ==,type:str]
|
||||
coastalcommits: ENC[AES256_GCM,data:VVpY/T93GUf7eeGrfCtpeujrY27CTBbpquGlZo6m9a20Tiy32hwiAw==,iv:R2rQUF4MbA/n6z9Vd9LpTPM2y8dFL726IXErprpQqOc=,tag:N5duDIWbHHVVAWidzF3dpw==,type:str]
|
||||
coastalcommits: ENC[AES256_GCM,data:a3raKZsPs8AMxFnt17ckUlsjNykWUmd9vDC60D4bdxIOWHSBn2BziQ==,iv:nnUZLy+jkUkHM9RcUZSdz5xNWPwBEGOUhlHZC6PqLAs=,tag:luOBlOcXrOJijYxOhmR8LA==,type:str]
|
||||
codeberg: ENC[AES256_GCM,data:Rny42N6K3VvzGDgqambLEclzznJpm6lRQVKha4U8M7rWg2HHgZqKHQ==,iv:YQ80nWm4z7wt7/jyWO7FjAa7zeDhkOWn6CLJYUNJ0tQ=,tag:4TZAfd5NUHB6Y32oH5CbSA==,type:str]
|
||||
users:
|
||||
cswimr:
|
||||
password: ENC[AES256_GCM,data:KPB3C8z1vBB6M6hcuLQyIzoID23v/syTui3eFfrVKwzDwL4X7BdYbnYfuJSXedce+KHmvZv+AE6w3PTD9c7CPpLUlUQmteAY6w==,iv:a393VckzNy+vRqb9vDr9QRBQe27bHOUJR3JwrHAP5g4=,tag:UDl+3dWV+GrJ7Wva3y9VsQ==,type:str]
|
||||
|
@ -27,8 +28,8 @@ sops:
|
|||
b1JvNi9YODZPN1FObWpOVHN3aU85NFEK1dN5pV8g3nG3D2l482z1JCRzmJ/9m495
|
||||
YEobjXbEqQDhvA47ueWojoMjvQ3CgrPyiL6v+DLj7VfI5cyuo+89IQ==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2025-01-22T13:13:52Z"
|
||||
mac: ENC[AES256_GCM,data:42EEOtKLohLi5oBSEZZ2Z/KsCHDg96M/XORQk7C05pg7FdeuIl+Inxc/KjWUDuLnuyom9qXbUkBqJp3HbXS16zHroFi4axd100av2N4DgrIC7f/cxeAsScdmcCRvDI9VUANMtV95PZHjlhuDqe0+MVoLxIkA6C/2e3PPXC0C5os=,iv:Mk+/2uNHVwSSAzoHOdI/1FEvSZ+uzEj1rJ/hsT4V3xY=,tag:5Vw9voVdj5eZzWgrr10JZQ==,type:str]
|
||||
lastmodified: "2025-01-30T20:20:54Z"
|
||||
mac: ENC[AES256_GCM,data:fOHHQ8mZ1QAV2Q5fKig2DQ87wTLVdssyxmGrHVtP9Bkt42cIcZ0XfNOrUkOZWFs8xLP37zDgGSQck6BMsDExN5Lh00QMWAEVpZ1YS/eEUBwcwsIEuWnJ7f3smkISI/Rvm5OLXj/NdTwMePWKPQO5sEHd062vem1P9PL2vRLIR00=,iv:6C0nxp1KyZ2SmjgyuJbRoiE4PFsTqwmg0CAoJ/ESe4U=,tag:99K9yz87AKR/brzHYy/M8g==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.9.2
|
||||
version: 3.9.4
|
||||
|
|
10
README.md
10
README.md
|
@ -4,8 +4,7 @@ Hi there! This repository contains my NixOS flake. This is mainly meant as a uti
|
|||
|
||||
## Notes
|
||||
|
||||
- This configuration offers [`xonsh`](https://xon.sh) as the default shell. You can change this in [`shell.nix`](https://www.coastalcommits.com/cswimr/flake/src/branch/master/nixos/shell.nix). This also includes a [`starship`](https://starship.rs) prompt.
|
||||
- Currently, [`shell.nix`](https://www.coastalcommits.com/cswimr/flake/src/branch/master/nixos/shell.nix) contains a bandaid fix to make the `starship` prompt load properly. This will become unnecessary when [`github:NixOS/nixpkgs#359614`](https://github.com/NixOS/nixpkgs/pull/359614) is merged.
|
||||
- This configuration offers [`zsh`](https://www.zsh.org) as the default shell. You can change this in [`shell.nix`](./nixos/shell.nix). This also includes a [`starship`](https://starship.rs) prompt.
|
||||
- The Tailscale configuration requires you to create a file at `/run/secrets/tailscale` with your Tailscale registration key. This is only required on first-time setup, and the file will automatically be removed after the next system restart.
|
||||
- This repository manages secrets using [`sops-nix`](https://github.com/Mic92/sops-nix).
|
||||
|
||||
|
@ -13,12 +12,11 @@ Hi there! This repository contains my NixOS flake. This is mainly meant as a uti
|
|||
|
||||
This list contains a bunch of applications and tools that I use a lot. Some of these will have configs declared in this repository, while others may not.
|
||||
|
||||
- [xonsh](https://xon.sh) ([Module](https://www.coastalcommits.com/cswimr/flake/src/branch/master/nixos/shell.nix) | [Config](https://www.coastalcommits.com/cswimr/flake/src/branch/master/config/xonsh)): A Python-based shell that I use as my default shell. It's incredibly powerful, as all of its configuration is done in a superset of Python that shares the xonsh name. The main caveat is that it's slower than other shells, due to being written in Python. However, the power and flexibility it offers more than make up for this in my opinion.
|
||||
- [uv](https://astral.sh/uv): So, I develop most of my projects with Python. I used to use a lot of tools like Poetry, pipx, and virtualenv. I had also heard of others like PDM and pyenv. uv does what those tools do, but better. It's effortless to use, and is so incredibly fast. Like, it's actually insane just how fast this tool is, compared to Poetry.
|
||||
- [ruff](https://astral.sh/ruff): Again, as a primarily Python developer, I used to use pylint a lot. Unfortunately I do still have to, but only because ruff doesn't yet have feature comparability to pylint. However, it is blazingly fast, just like its brother uv. A codebase that takes plint about ~55 seconds to lint, takes ruff less than a second. It is kind of insane how fast this linter is, sometimes I don't know if it's working or not in my IDE just because it updates so fast.
|
||||
- [neovim](https://neovim.io/) ([Module](https://www.coastalcommits.com/cswimr/flake/src/branch/master/nixos/nvim.nix)): A Vim-based text editor that I'm actually using to write this list!
|
||||
- [Visual Studio Code](https://code.visualstudio.com/) ([Module](https://www.coastalcommits.com/cswimr/flake/src/branch/master/home-manager/vscode.nix)): While neovim can be used as a full-fledged development environment, I personally prefer the ease of use of VSCode when I'm working on larger projects.
|
||||
- [btop](https://github.com/aristocratos/btop) ([Config](https://www.coastalcommits.com/cswimr/flake/src/branch/master/config/btop.conf)): Ever used `htop`? This is that, but better! Also supports GPUs as of a recent update.
|
||||
- [neovim](https://neovim.io/) ([Module](./nixos/nvim)): A Vim-based text editor that I'm actually using to write this list!
|
||||
- [Visual Studio Code](https://code.visualstudio.com/) ([Module](./home-manager/vscode.nix)): While neovim can be used as a full-fledged development environment, I personally prefer the ease of use of VSCode when I'm working on larger projects.
|
||||
- [btop](https://github.com/aristocratos/btop) ([Config](./config/btop.conf)): Ever used `htop`? This is that, but better! Also supports GPUs as of a recent update.
|
||||
- [Vesktop](https://github.com/Vencord/Vesktop): As everyone knows, the official Discord Linux client is... subpar, at best, and has features that just don't work on modern compositors like Wayland, such as screen sharing. Vesktop fixes a lot of those issues, and also comes with the awesome client modification [Vencord](https://github.com/Vencord/Vencord) built-in.
|
||||
- [Sober](https://sober.vinegarhq.org/): Ever since Byfron's Hyperion was added to the ROBLOX client, playing ROBLOX on Linux has been impossible without using an Android emulator. Well, Sober aims to fix this. It does still use the official ROBLOX Android apk, but it is a full port to Linux, as opposed to an emulator. I can personally confirm the performance claims they advertise on their website, it does massively increase performance over the Windows version of ROBLOX.
|
||||
- [Lucem](https://github.com/xTrayambak/lucem): Lucem aims to bridge the gap between Vinegar, the previous way to run ROBLOX on Linux, and Sober. It does this by offering various improvements like the ability to override the default ROBLOX font, and has a graphical interface to edit various settings and fflags. It is quite reminiscent of [Bloxstrap](https://github.com/bloxstraplabs/bloxstrap), which is the definitive ROBLOX bootstrapper for Windows.
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 581 B |
9
config/servicemenus/tidalstream.desktop
Executable file
9
config/servicemenus/tidalstream.desktop
Executable file
|
@ -0,0 +1,9 @@
|
|||
[Desktop Entry]
|
||||
Type=Service
|
||||
MimeType=application/octet-stream;
|
||||
Actions=uploadToTidalstream;
|
||||
|
||||
[Desktop Action uploadToTidalstream]
|
||||
Name=Upload to Tidalstream
|
||||
Icon=document-send-symbolic
|
||||
Exec=/etc/nixos/scripts/py/zipline.py %f --application-name=Dolphin --desktop-entry=org.kde.dolphin.desktop
|
|
@ -1,72 +0,0 @@
|
|||
{
|
||||
"version": 4,
|
||||
"background_darkest_color": {
|
||||
"r": 24,
|
||||
"g": 24,
|
||||
"b": 37,
|
||||
"a": 1.0
|
||||
},
|
||||
"background_darker_color": {
|
||||
"r": 30,
|
||||
"g": 30,
|
||||
"b": 46,
|
||||
"a": 1.0
|
||||
},
|
||||
"background_lighter_color": {
|
||||
"r": 49,
|
||||
"g": 50,
|
||||
"b": 68,
|
||||
"a": 1.0
|
||||
},
|
||||
"background_lightest_color": {
|
||||
"r": 69,
|
||||
"g": 71,
|
||||
"b": 90,
|
||||
"a": 1.0
|
||||
},
|
||||
"text_lightest_color": {
|
||||
"r": 205,
|
||||
"g": 214,
|
||||
"b": 244,
|
||||
"a": 1.0
|
||||
},
|
||||
"text_lighter_color": {
|
||||
"r": 186,
|
||||
"g": 194,
|
||||
"b": 222,
|
||||
"a": 1.0
|
||||
},
|
||||
"text_darker_color": {
|
||||
"r": 166,
|
||||
"g": 173,
|
||||
"b": 200,
|
||||
"a": 1.0
|
||||
},
|
||||
"text_darkest_color": {
|
||||
"r": 147,
|
||||
"g": 153,
|
||||
"b": 178,
|
||||
"a": 1.0
|
||||
},
|
||||
"primary_darker_color": {
|
||||
"r": 30,
|
||||
"g": 30,
|
||||
"b": 46,
|
||||
"a": 1.0
|
||||
},
|
||||
"primary_lighter_color": {
|
||||
"r": 49,
|
||||
"g": 50,
|
||||
"b": 68,
|
||||
"a": 1.0
|
||||
},
|
||||
"root_border_radius": 0,
|
||||
"root_border_width": 1,
|
||||
"root_border_color": {
|
||||
"r": 17,
|
||||
"g": 17,
|
||||
"b": 27,
|
||||
"a": 1.0
|
||||
},
|
||||
"content_border_radius": 4.0
|
||||
}
|
13
config/themes/gauntlet.toml
Normal file
13
config/themes/gauntlet.toml
Normal file
|
@ -0,0 +1,13 @@
|
|||
mode = "dark"
|
||||
|
||||
background = ["#45475a", "#313244", "#1e1e2e", "#181825"]
|
||||
|
||||
text = ["#cdd6f4", "#bac2de", "#a6adc8", "#9399b2"]
|
||||
|
||||
[window.border]
|
||||
radius = 0
|
||||
width = 1
|
||||
color = { color = "#11111b", alpha = 0.5 }
|
||||
|
||||
[content.border]
|
||||
radius = 4.0
|
|
@ -1,44 +1,69 @@
|
|||
from os.path import dirname
|
||||
import subprocess
|
||||
from os import environ
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
from shutil import which
|
||||
from socket import gethostname
|
||||
|
||||
import colors
|
||||
from typing import Mapping
|
||||
|
||||
|
||||
def format_link(link: str, text: str) -> str:
|
||||
return f"\033]8;;{link}\033\\{text}\033]8;;\033\\"
|
||||
|
||||
|
||||
def get_environment() -> dict[str, str]:
|
||||
env = dict(environ)
|
||||
env["DIRENV_DISABLE"] = "1"
|
||||
return env
|
||||
|
||||
def run(cmd: list[str], cwd: Path = Path.cwd(), exit_on_error: bool = True, env: dict[str, str] | None = None, **kwargs) -> subprocess.CompletedProcess:
|
||||
|
||||
def run(
|
||||
cmd: list[str],
|
||||
cwd: Path = Path.cwd(),
|
||||
exit_on_error: bool = True,
|
||||
env: dict[str, str] | None = None,
|
||||
**kwargs,
|
||||
) -> subprocess.CompletedProcess:
|
||||
if not env:
|
||||
env = get_environment()
|
||||
c = colors.Colors
|
||||
|
||||
print(f"{c.GREEN}Running command: {c.PURPLE}'{' '.join(cmd)}'{c.END}")
|
||||
if cwd != Path.cwd():
|
||||
print(f"{c.GREEN} in directory: {c.YELLOW}'{format_link(link="file://" + str(cwd), text=cwd)}'{c.END}")
|
||||
print(
|
||||
f"{c.GREEN} in directory: {c.YELLOW}'{format_link(link='file://' + str(cwd), text=cwd)}'{c.END}"
|
||||
)
|
||||
|
||||
result = subprocess.run(cmd, cwd=cwd, check=False, env=env, **kwargs)
|
||||
|
||||
if result.returncode != 0:
|
||||
print(f"{c.RED}Command exited with non-zero exit code {c.CYAN}{c.BOLD}{result.returncode}{c.END}")
|
||||
print(
|
||||
f"{c.RED}Command exited with non-zero exit code {c.CYAN}{c.BOLD}{result.returncode}{c.END}"
|
||||
)
|
||||
if exit_on_error is True:
|
||||
result.check_returncode()
|
||||
else:
|
||||
print(f"{c.GREEN}Command exited with exit code {c.CYAN}{c.BOLD}{result.returncode}{c.END}")
|
||||
print(
|
||||
f"{c.GREEN}Command exited with exit code {c.CYAN}{c.BOLD}{result.returncode}{c.END}"
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
@aliases.register
|
||||
@aliases.return_command
|
||||
def _sudo(args):
|
||||
return ["sudo", "--", *aliases.eval_alias(args)]
|
||||
|
||||
|
||||
@aliases.register
|
||||
@aliases.return_command
|
||||
def _ssh(args):
|
||||
if which("kitten"):
|
||||
return ["kitten", "ssh", *args]
|
||||
return ["ssh", *args]
|
||||
|
||||
|
||||
@aliases.register
|
||||
def _vm(args):
|
||||
if not args:
|
||||
|
@ -54,16 +79,21 @@ def _vm(args):
|
|||
if (vm_path / "flake.nix").exists():
|
||||
build_vm_args.extend(["--flake", f"{vm_path}#nixos"])
|
||||
elif (vm_path / "default.nix").exists():
|
||||
build_vm_args.extend(["-I", f"nixos-config={vm_path}/default.nix", "--no-flake"])
|
||||
build_vm_args.extend(
|
||||
["-I", f"nixos-config={vm_path}/default.nix", "--no-flake"]
|
||||
)
|
||||
|
||||
print(f"{c.BLUE}Building virtual machine {c.YELLOW}{vm_name}{c.END}")
|
||||
run(["nixos-rebuild", "build-vm", *build_vm_args], cwd=vm_path)
|
||||
print(f"{c.BLUE}Starting virtual vachine {c.YELLOW}{vm_name}{c.END}")
|
||||
run(["./result/bin/run-nixos-vm"], cwd=vm_path)
|
||||
print(f"{c.BLUE}Virtual machine {c.YELLOW}{vm_name} {c.BLUE}has {c.RED}stopped.{c.END}")
|
||||
print(
|
||||
f"{c.BLUE}Virtual machine {c.YELLOW}{vm_name} {c.BLUE}has {c.RED}stopped.{c.END}"
|
||||
)
|
||||
else:
|
||||
raise FileNotFoundError(f"Virtual machine {vm_name} does not exist.")
|
||||
|
||||
|
||||
@aliases.register
|
||||
def _upd(args: list):
|
||||
path = Path("/etc/nixos")
|
||||
|
@ -78,10 +108,12 @@ def _upd(args: list):
|
|||
c = colors.Colors
|
||||
files_to_delete = {
|
||||
"Visual Studio Code user settings": ".config/Code/User/settings.json.bak",
|
||||
"fontconfig": ".config/fontconfig/conf.d/10-hm-fonts.conf.bak"
|
||||
"fontconfig": ".config/fontconfig/conf.d/10-hm-fonts.conf.bak",
|
||||
}
|
||||
if not "--no-pull" in args:
|
||||
print(f"{c.BLUE}Pulling {c.YELLOW}NixOS{c.BLUE} configuration from remote{c.END}")
|
||||
if "--no-pull" not in args:
|
||||
print(
|
||||
f"{c.BLUE}Pulling {c.YELLOW}NixOS{c.BLUE} configuration from remote{c.END}"
|
||||
)
|
||||
run(["git", "pull"], cwd=path)
|
||||
else:
|
||||
args.remove("--no-pull")
|
||||
|
@ -91,22 +123,55 @@ def _upd(args: list):
|
|||
run(["nix", "flake", "update", *args], cwd=path)
|
||||
if "--rewrite-hardware-configuration" in args:
|
||||
args.remove("--rewrite-hardware-configuration")
|
||||
print(f"{c.BLUE}Updating {c.YELLOW}NixOS{c.BLUE} hardware configuration file for {c.YELLOW}{gethostname()}{c.BLUE}{c.END}")
|
||||
run(["sudo", "nixos-generate-config", "--dir", ".",], cwd=path / "hosts")
|
||||
print(f"{c.BLUE}Deleting redundant {c.YELLOW}NixOS{c.BLUE} configuration file{c.END}")
|
||||
print(
|
||||
f"{c.BLUE}Updating {c.YELLOW}NixOS{c.BLUE} hardware configuration file for {c.YELLOW}{gethostname()}{c.BLUE}{c.END}"
|
||||
)
|
||||
run(
|
||||
[
|
||||
"sudo",
|
||||
"nixos-generate-config",
|
||||
"--dir",
|
||||
".",
|
||||
],
|
||||
cwd=path / "hosts",
|
||||
)
|
||||
print(
|
||||
f"{c.BLUE}Deleting redundant {c.YELLOW}NixOS{c.BLUE} configuration file{c.END}"
|
||||
)
|
||||
run(["sudo", "rm", "configuration.nix"], cwd=path / "hosts")
|
||||
print(f"{c.BLUE}Moving {c.YELLOW}NixOS{c.BLUE} hardware configuration file{c.END}")
|
||||
run(["sudo", "mv", "hardware-configuration.nix", "{hostname}.nix".format(hostname=gethostname())], cwd=path / "hosts")
|
||||
print(f"{c.BLUE}Adding {c.YELLOW}NixOS{c.BLUE} hardware configuration file for {c.YELLOW}{gethostname()}{c.BLUE} to git{c.END}")
|
||||
run(["git", "add", "hosts/{hostname}.nix".format(hostname=gethostname())], cwd=path)
|
||||
print(
|
||||
f"{c.BLUE}Moving {c.YELLOW}NixOS{c.BLUE} hardware configuration file{c.END}"
|
||||
)
|
||||
run(
|
||||
[
|
||||
"sudo",
|
||||
"mv",
|
||||
"hardware-configuration.nix",
|
||||
"{hostname}.nix".format(hostname=gethostname()),
|
||||
],
|
||||
cwd=path / "hosts",
|
||||
)
|
||||
print(
|
||||
f"{c.BLUE}Adding {c.YELLOW}NixOS{c.BLUE} hardware configuration file for {c.YELLOW}{gethostname()}{c.BLUE} to git{c.END}"
|
||||
)
|
||||
run(
|
||||
["git", "add", "hosts/{hostname}.nix".format(hostname=gethostname())],
|
||||
cwd=path,
|
||||
)
|
||||
for file_description, file_path in files_to_delete.items():
|
||||
print(f"{c.BLUE}Deleting {c.YELLOW}{file_description}{c.BLUE} backup file{c.END}")
|
||||
print(
|
||||
f"{c.BLUE}Deleting {c.YELLOW}{file_description}{c.BLUE} backup file{c.END}"
|
||||
)
|
||||
run(["rm", file_path], exit_on_error=False, cwd="/home/cswimr")
|
||||
if "--purge-vscode-extensions" in args:
|
||||
args.remove("--purge-vscode-extensions")
|
||||
print(f"{c.BLUE}Killing {c.YELLOW}Visual Studio Code{c.BLUE} processes{c.END}")
|
||||
print(
|
||||
f"{c.BLUE}Killing {c.YELLOW}Visual Studio Code{c.BLUE} processes{c.END}"
|
||||
)
|
||||
run(["killall", "code"], exit_on_error=False)
|
||||
print(f"{c.BLUE}Purging {c.YELLOW}Visual Studio Code{c.BLUE} extensions{c.END}")
|
||||
print(
|
||||
f"{c.BLUE}Purging {c.YELLOW}Visual Studio Code{c.BLUE} extensions{c.END}"
|
||||
)
|
||||
run(["rm", "-rf", ".vscode/extensions"], cwd="/home/cswimr")
|
||||
print(f"{c.BLUE}Rebuilding {c.YELLOW}NixOS{c.BLUE} configuration{c.END}")
|
||||
# TODO: Remove --impure once the Starship module is merged - see ../../nixos/shell.nix for more information
|
||||
|
@ -115,6 +180,7 @@ def _upd(args: list):
|
|||
print(f"{c.RED}WARNING: The --impure flag is set!{c.END}")
|
||||
run(["sudo", "nixos-rebuild", subcommand, *args], cwd=path)
|
||||
|
||||
|
||||
@aliases.register
|
||||
@aliases.return_command
|
||||
def _edit(args):
|
||||
|
@ -124,45 +190,47 @@ def _edit(args):
|
|||
return ["$EDITOR", *args]
|
||||
return ["$VISUAL", *args]
|
||||
|
||||
|
||||
@aliases.register
|
||||
def _create_devenv(args):
|
||||
if not args:
|
||||
template = "simple"
|
||||
else:
|
||||
template = args[0]
|
||||
run(["nix", "flake", "init", "--template", f"github:cswimr/dev-flakes#{template}"], cwd=Path.cwd(), exit_on_error=False)
|
||||
run(
|
||||
["nix", "flake", "init", "--template", f"github:cswimr/dev-flakes#{template}"],
|
||||
cwd=Path.cwd(),
|
||||
exit_on_error=False,
|
||||
)
|
||||
run(["direnv", "allow"], cwd=Path.cwd())
|
||||
|
||||
|
||||
alias_dictionary = {
|
||||
"nvim": "env SHELL=bash nvim",
|
||||
"vim": "nvim",
|
||||
"vi": "nvim",
|
||||
"ff": "fastfetch",
|
||||
"neofetch": "fastfetch",
|
||||
"nf": "fastfetch",
|
||||
|
||||
"lg": "lazygit",
|
||||
"lad": "lazydocker",
|
||||
|
||||
"clip": "clp",
|
||||
"paste": "wl-paste",
|
||||
|
||||
"cat": "bat",
|
||||
"git": "hub",
|
||||
|
||||
"cc": "fj --host=https://www.coastalcommits.com --style=fancy",
|
||||
"cb": "fj --host=https://codeberg.org --style=fancy",
|
||||
"l": "eza -lhg --time-style=long-iso --icons=auto --hyperlink",
|
||||
"la": "eza -lAh --time-style=long-iso --icons=auto --hyperlink",
|
||||
"ll": "eza -lhg --time-style=long-iso --icons=auto --hyperlink",
|
||||
"ls": "eza --time-style=long-iso --icons=auto --hyperlink",
|
||||
"lsa": "eza -lah --time-style=long-iso --icons=auto --hyperlink",
|
||||
"tree": "eza --tree --git-ignore --time-style=long-iso --icons=auto --hyperlink",
|
||||
|
||||
"nixpkgs-update": "nix run --option extra-substituters 'https://nix-community.cachix.org/' --option extra-trusted-public-keys 'nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=' github:ryantm/nixpkgs-update --",
|
||||
"nixrc": "edit /etc/nixos",
|
||||
|
||||
"taildrop": "tailscale file",
|
||||
|
||||
"forgejo-runner": "act_runner",
|
||||
"runactions": "act_runner exec --default-actions-url=https://www.coastalcommits.com --gitea-instance=https://www.coastalcommits.com",
|
||||
|
||||
"uvr": "uv run",
|
||||
"ns": "nix-shell",
|
||||
"e": "edit",
|
||||
|
@ -179,7 +247,9 @@ if script_path.exists():
|
|||
if sub_dir.name == "nix":
|
||||
continue
|
||||
if not sub_dir.is_dir():
|
||||
print(f"{colors.Colors.YELLOW}{colors.Colors.BOLD}WARNING: The path {colors.Colors.PURPLE}'{sub_dir}'{colors.Colors.YELLOW} is not a directory. Skipping alias creation for this path.{colors.Colors.END}")
|
||||
print(
|
||||
f"{colors.Colors.YELLOW}{colors.Colors.BOLD}WARNING: The path {colors.Colors.PURPLE}'{sub_dir}'{colors.Colors.YELLOW} is not a directory. Skipping alias creation for this path.{colors.Colors.END}"
|
||||
)
|
||||
continue
|
||||
|
||||
extension = f".{sub_dir.name}"
|
||||
|
|
197
flake.lock
generated
197
flake.lock
generated
|
@ -25,11 +25,11 @@
|
|||
"onchg": "onchg"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1732416782,
|
||||
"narHash": "sha256-evu/J6D79rlQ6oYtKgZxpWvT6ORt0SH573R6IOIS6R0=",
|
||||
"lastModified": 1738542138,
|
||||
"narHash": "sha256-PcNuxeBysocnDBMK8WwufYP5UY492O5465iaOR0ldYQ=",
|
||||
"owner": "aksiksi",
|
||||
"repo": "compose2nix",
|
||||
"rev": "a81c2e5e485c722e74dce7c8e308c7b0a1381854",
|
||||
"rev": "8941b4f4c1256ea38a85db88e423e53a9104e4d7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -45,11 +45,11 @@
|
|||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1738213515,
|
||||
"narHash": "sha256-0cYr91WBMCmlPCKxZrH8habV9tkAA1SkeKPnI+A76WU=",
|
||||
"lastModified": 1738876009,
|
||||
"narHash": "sha256-NWOsGZshqmErypjw62LnzOfZZ3kiclMisF1f1JaKpgc=",
|
||||
"owner": "lilyinstarlight",
|
||||
"repo": "nixos-cosmic",
|
||||
"rev": "ddbaf00ce2a74478278aa17459dda5c5893d998d",
|
||||
"rev": "af0ad2ecf0a6229f07cd29f1e083243ff3f7fc55",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -234,11 +234,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1736143030,
|
||||
"narHash": "sha256-+hu54pAoLDEZT9pjHlqL9DNzWz0NbUn8NEAHP7PQPzU=",
|
||||
"lastModified": 1738453229,
|
||||
"narHash": "sha256-7H9XgNiGLKN1G1CgRh0vUL4AheZSYzPm+zmZ7vxbJdo=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "b905f6fc23a9051a6e1b741e1438dbfc0634c6de",
|
||||
"rev": "32ea77a06711b758da0ad9bd6a844c5740a87abd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -285,7 +285,7 @@
|
|||
},
|
||||
"flake-utils_2": {
|
||||
"inputs": {
|
||||
"systems": "systems_2"
|
||||
"systems": "systems_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
|
@ -303,7 +303,7 @@
|
|||
},
|
||||
"flake-utils_3": {
|
||||
"inputs": {
|
||||
"systems": "systems_3"
|
||||
"systems": "systems_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
|
@ -319,6 +319,25 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"forgejo-cli": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"utils": "utils"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1734534828,
|
||||
"narHash": "sha256-TrCoO37Rjf7ToBq1R8O7mz2J6HgY6F42S93yxc2hEu0=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "a58080e87240fde7f2783432022cbc751fb2d624",
|
||||
"revCount": 313,
|
||||
"type": "git",
|
||||
"url": "https://codeberg.org/Cyborus/forgejo-cli"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://codeberg.org/Cyborus/forgejo-cli"
|
||||
}
|
||||
},
|
||||
"gauntlet": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
|
@ -327,20 +346,20 @@
|
|||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": "systems"
|
||||
"systems": "systems_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1735207841,
|
||||
"narHash": "sha256-m/TOVOqnlfHWg+jXLSNFW5cJC3Hf6I7mk7W1WH1viuI=",
|
||||
"lastModified": 1738189623,
|
||||
"narHash": "sha256-ndk7FY3m5VEukLcqcCCFiUnyN1HkLLTaZKI1MEXrohk=",
|
||||
"owner": "project-gauntlet",
|
||||
"repo": "gauntlet",
|
||||
"rev": "11af8eaff2416c94b70705e5db17369feb307b7a",
|
||||
"rev": "792baa7e6aa6262416d18babda2ef81eb3cd3f30",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "project-gauntlet",
|
||||
"repo": "gauntlet",
|
||||
"rev": "11af8eaff2416c94b70705e5db17369feb307b7a",
|
||||
"rev": "792baa7e6aa6262416d18babda2ef81eb3cd3f30",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
|
@ -421,11 +440,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1738257949,
|
||||
"narHash": "sha256-Q/xbvWHqCNcw+nDXgRaKH31fggZiA0Ciqs0t1H28fL8=",
|
||||
"lastModified": 1738878603,
|
||||
"narHash": "sha256-fmhq8B3MvQLawLbMO+LWLcdC2ftLMmwSk+P29icJ3tE=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "7a457746847c9cb3a1e46e5bc86b205fbadf5da8",
|
||||
"rev": "433799271274c9f2ab520a49527ebfe2992dcfbd",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -443,11 +462,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1738228963,
|
||||
"narHash": "sha256-Ee5hVHM7AWxaq7XJN6xiZztTZX8csdXernjqaTW5r9I=",
|
||||
"lastModified": 1738841109,
|
||||
"narHash": "sha256-sEgE3nifaRU5gfAx33ds0tx/j+qM0/5/bHopv/w6c0c=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "d963ed335b890a70ed53eecf14cdb21528eda9b8",
|
||||
"rev": "f99c704fe3a4cf8d72b2d568ec80bc38be1a9407",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -518,11 +537,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1738033138,
|
||||
"narHash": "sha256-qlIM8A3bdL9c6PexhpS+QyZLO9y/8a3V75HVyJgDE5Q=",
|
||||
"lastModified": 1738743987,
|
||||
"narHash": "sha256-O3bnAfsObto6l2tQOmQlrO6Z2kD6yKwOWfs7pA0CpOc=",
|
||||
"owner": "lnl7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "349a74c66c596ef97ee97b4d80a3ca61227b6120",
|
||||
"rev": "ae406c04577ff9a64087018c79b4fdc02468c87c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -553,11 +572,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1737861961,
|
||||
"narHash": "sha256-LIRtMvAwLGb8pBoamzgEF67oKlNPz4LuXiRPVZf+TpE=",
|
||||
"lastModified": 1738466368,
|
||||
"narHash": "sha256-PZhUjtvQZOH3PO0EYdTpQvcqkgkq1NkP2A6w9SPHYsk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-index-database",
|
||||
"rev": "79b7b8eae3243fc5aa9aad34ba6b9bbb2266f523",
|
||||
"rev": "46a8f5fc9552b776bfc5c5c96ea3bede33f68f52",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -593,14 +612,14 @@
|
|||
"inputs": {
|
||||
"flake-compat": "flake-compat_4",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
"nixpkgs": "nixpkgs_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1738201509,
|
||||
"narHash": "sha256-gyKBLziqn47BqpELlorHxlQTQxBS2GFQah2KNqh8Uzg=",
|
||||
"lastModified": 1738892952,
|
||||
"narHash": "sha256-1mDXsXvUV+PNJHJ51HPtkbGEGwAfZVNmxtWC5OQ64h4=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nix-vscode-extensions",
|
||||
"rev": "1b54a1707f1388b457792736b9903980ab26afaf",
|
||||
"rev": "5cbce56ae7ae89025ae7b149f2ee2bc994dd31e9",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -639,11 +658,11 @@
|
|||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1738023785,
|
||||
"narHash": "sha256-BPHmb3fUwdHkonHyHi1+x89eXB3kA1jffIpwPVJIVys=",
|
||||
"lastModified": 1738702386,
|
||||
"narHash": "sha256-nJj8f78AYAxl/zqLiFGXn5Im1qjFKU8yBPKoWEeZN5M=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2b4230bf03deb33103947e2528cac2ed516c5c89",
|
||||
"rev": "030ba1976b7c0e1a67d9716b17308ccdab5b381e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -671,11 +690,11 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1738142207,
|
||||
"narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=",
|
||||
"lastModified": 1738680400,
|
||||
"narHash": "sha256-ooLh+XW8jfa+91F1nhf9OF7qhuA/y1ChLx6lXDNeY5U=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9d3ae807ebd2981d593cddd0080856873139aa40",
|
||||
"rev": "799ba5bffed04ced7067a91798353d360788b30d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -686,6 +705,22 @@
|
|||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1723151389,
|
||||
"narHash": "sha256-9AVY0ReCmSGXHrlx78+1RrqcDgVSRhHUKDVV1LLBy28=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "13fe00cb6c75461901f072ae62b5805baef9f8b2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1713805509,
|
||||
"narHash": "sha256-YgSEan4CcrjivCNO5ZNzhg7/8ViLkZ4CB/GrGBVSudo=",
|
||||
|
@ -701,13 +736,13 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1738142207,
|
||||
"narHash": "sha256-NGqpVVxNAHwIicXpgaVqJEJWeyqzoQJ9oc8lnK9+WC4=",
|
||||
"lastModified": 1738680400,
|
||||
"narHash": "sha256-ooLh+XW8jfa+91F1nhf9OF7qhuA/y1ChLx6lXDNeY5U=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9d3ae807ebd2981d593cddd0080856873139aa40",
|
||||
"rev": "799ba5bffed04ced7067a91798353d360788b30d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -732,11 +767,11 @@
|
|||
"treefmt-nix": "treefmt-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1738255431,
|
||||
"narHash": "sha256-n0NCyg7JYGl7AcfDkYpB7RwtUGSxnX6WCqLqjaGMFU0=",
|
||||
"lastModified": 1738873988,
|
||||
"narHash": "sha256-FpQmO2/NABt5suLYR0t7cjEdnWoaBTWu9psKXviEpo8=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixvim",
|
||||
"rev": "e4ed227f99be42cd0ce28b6ae0c85c306ef70d40",
|
||||
"rev": "a5147a36f9d3df06fd1246cf5a089678cbf59d3a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -754,11 +789,11 @@
|
|||
"treefmt-nix": "treefmt-nix_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1738256454,
|
||||
"narHash": "sha256-vxU2VrAsmQ6XD6pOwIV63Yx7HXsliCybyrLG0D0XmB4=",
|
||||
"lastModified": 1738901905,
|
||||
"narHash": "sha256-UsKm6Elr9Yt5cSd+mWCW7FtmXHEyTUtWyA4L0MDQzew=",
|
||||
"owner": "nix-community",
|
||||
"repo": "NUR",
|
||||
"rev": "5caeb6744cd9a201a82908f6deafac63b7ef234e",
|
||||
"rev": "b472f6acb4f45efd882e554a2d5c9ae766b62b40",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -777,11 +812,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1737924095,
|
||||
"narHash": "sha256-9RO/IlxiE7bpY7GYsdDMNB533PnDOBo9UvYyXXqlN4c=",
|
||||
"lastModified": 1738508923,
|
||||
"narHash": "sha256-4DaDrQDAIxlWhTjH6h/+xfG05jt3qDZrZE/7zDLQaS4=",
|
||||
"owner": "NuschtOS",
|
||||
"repo": "search",
|
||||
"rev": "5efc9c966bb9bdad07a3c28667eac38b758c6f18",
|
||||
"rev": "86e2038290859006e05ca7201425ea5b5de4aecb",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -867,13 +902,14 @@
|
|||
"catppuccin-vsc": "catppuccin-vsc",
|
||||
"compose2nix": "compose2nix",
|
||||
"cosmic": "cosmic",
|
||||
"forgejo-cli": "forgejo-cli",
|
||||
"gauntlet": "gauntlet",
|
||||
"home-manager": "home-manager",
|
||||
"lanzaboote": "lanzaboote",
|
||||
"nix-flatpak": "nix-flatpak",
|
||||
"nix-index-database": "nix-index-database",
|
||||
"nix-vscode-extensions": "nix-vscode-extensions",
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"nixpkgs": "nixpkgs_5",
|
||||
"nixvim": "nixvim",
|
||||
"nur": "nur",
|
||||
"plasma-manager": "plasma-manager",
|
||||
|
@ -910,11 +946,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1737411508,
|
||||
"narHash": "sha256-j9IdflJwRtqo9WpM0OfAZml47eBblUHGNQTe62OUqTw=",
|
||||
"lastModified": 1738291974,
|
||||
"narHash": "sha256-wkwYJc8cKmmQWUloyS9KwttBnja2ONRuJQDEsmef320=",
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"rev": "015d461c16678fc02a2f405eb453abb509d4e1d4",
|
||||
"rev": "4c1251904d8a08c86ac6bc0d72cc09975e89aef7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -925,11 +961,11 @@
|
|||
},
|
||||
"stable": {
|
||||
"locked": {
|
||||
"lastModified": 1738163270,
|
||||
"narHash": "sha256-B/7Y1v4y+msFFBW1JAdFjNvVthvNdJKiN6EGRPnqfno=",
|
||||
"lastModified": 1738702386,
|
||||
"narHash": "sha256-nJj8f78AYAxl/zqLiFGXn5Im1qjFKU8yBPKoWEeZN5M=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "59e618d90c065f55ae48446f307e8c09565d5ab0",
|
||||
"rev": "030ba1976b7c0e1a67d9716b17308ccdab5b381e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -941,11 +977,11 @@
|
|||
},
|
||||
"staging-next": {
|
||||
"locked": {
|
||||
"lastModified": 1738245746,
|
||||
"narHash": "sha256-etDp3EzvIzSdYCI4tybEAP9IGw7uVgkOaHRLqPeXCrM=",
|
||||
"lastModified": 1738887273,
|
||||
"narHash": "sha256-P/y5aiEAeby7MWgxqndkkesveXhSxmlRqNNSxqRB/BE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "97fc6f36d0a5c2e03b89dc98b0ed86d6953da172",
|
||||
"rev": "13fd8fecfed938d7b22b6eea42d6c8901025ed08",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1000,6 +1036,21 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_4": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -1008,11 +1059,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1738070913,
|
||||
"narHash": "sha256-j6jC12vCFsTGDmY2u1H12lMr62fnclNjuCtAdF1a4Nk=",
|
||||
"lastModified": 1738680491,
|
||||
"narHash": "sha256-8X7tR3kFGkE7WEF5EXVkt4apgaN85oHZdoTGutCFs6I=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "bebf27d00f7d10ba75332a0541ac43676985dea3",
|
||||
"rev": "64dbb922d51a42c0ced6a7668ca008dded61c483",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -1041,6 +1092,24 @@
|
|||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
|
@ -41,8 +41,9 @@
|
|||
};
|
||||
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
|
||||
catppuccin-vsc.url = "https://flakehub.com/f/catppuccin/vscode/*.tar.gz";
|
||||
forgejo-cli.url = "git+https://codeberg.org/Cyborus/forgejo-cli";
|
||||
gauntlet = {
|
||||
url = "github:/project-gauntlet/gauntlet/11af8eaff2416c94b70705e5db17369feb307b7a"; # v12
|
||||
url = "github:/project-gauntlet/gauntlet/792baa7e6aa6262416d18babda2ef81eb3cd3f30"; # main, 1/31/2025
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
@ -83,7 +84,7 @@
|
|||
./nixos/gaming.nix
|
||||
./nixos/gui-pkgs.nix
|
||||
./nixos/nvidia.nix
|
||||
./nixos/nvim.nix
|
||||
./nixos/nvim
|
||||
./nixos/ollama.nix
|
||||
./nixos/pkg.nix
|
||||
./nixos/shell.nix
|
||||
|
@ -110,7 +111,7 @@
|
|||
boot.loader.systemd-boot.enable = lib.mkForce false;
|
||||
boot.lanzaboote = {
|
||||
enable = true;
|
||||
pkiBundle = "/etc/secureboot";
|
||||
pkiBundle = "/var/lib/sbctl";
|
||||
};
|
||||
}
|
||||
)
|
||||
|
@ -140,7 +141,9 @@
|
|||
imports = [
|
||||
./home-manager/browser.nix
|
||||
./home-manager/gauntlet.nix
|
||||
./home-manager/kitty.nix
|
||||
./home-manager/mangohud.nix
|
||||
./home-manager/nnn.nix
|
||||
./home-manager/plasma.nix
|
||||
./home-manager/tpm.nix
|
||||
./home-manager/user.nix
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
{ pkgs, user, ... }:
|
||||
let
|
||||
extensions-repo = pkgs.nur.repos.rycee.firefox-addons;
|
||||
extensions = with extensions-repo; [
|
||||
|
@ -44,7 +44,7 @@ in
|
|||
};
|
||||
};
|
||||
profiles = {
|
||||
"cswimr (personal)" = {
|
||||
${user} = {
|
||||
id = 0;
|
||||
isDefault = true;
|
||||
extensions = extensions;
|
||||
|
|
49
home-manager/kitty.nix
Normal file
49
home-manager/kitty.nix
Normal file
|
@ -0,0 +1,49 @@
|
|||
{
|
||||
programs.kitty = {
|
||||
enable = true;
|
||||
themeFile = "Catppuccin-Mocha";
|
||||
shellIntegration = {
|
||||
mode = "no-rc";
|
||||
};
|
||||
settings = {
|
||||
# tab bar styling
|
||||
tab_bar_min_tabs = 1;
|
||||
tab_bar_edge = "bottom";
|
||||
tab_bar_style = "powerline";
|
||||
tab_powerline_style = "angled";
|
||||
active_tab_foreground = "#1e1e2e";
|
||||
active_tab_background = "#89b4fa";
|
||||
active_tab_font_style = "bold-italic";
|
||||
inactive_tab_foreground = "#1e1e2e";
|
||||
inactive_tab_background = "#b4befe";
|
||||
inactive_tab_font_style = "normal";
|
||||
tab_title_template = "{title}{' ({})'.format(num_windows) if num_windows > 1 else ''}";
|
||||
|
||||
enabled_layouts = "fat, grid, tall, stack";
|
||||
|
||||
# mappings
|
||||
"map ctrl+p" = "nth_window -1";
|
||||
"map ctrl+up" = "neighboring_window up";
|
||||
"map ctrl+down" = "neighboring_window down";
|
||||
"map ctrl+left" = "neighboring_window left";
|
||||
"map ctrl+right" = "neighboring_window right";
|
||||
"map ctrl+shift+up" = "move_window up";
|
||||
"map ctrl+shift+down" = "move_window down";
|
||||
"map ctrl+shift+left" = "move_window left";
|
||||
"map ctrl+shift+right" = "move_window right";
|
||||
|
||||
# socket
|
||||
listen_on = "unix:/tmp/kitty";
|
||||
allow_remote_control = "socket-only";
|
||||
};
|
||||
};
|
||||
|
||||
home.file = {
|
||||
".config/kitty/open-actions.conf".text = ''
|
||||
# Open any image in the full kitty window by clicking on it
|
||||
protocol file
|
||||
mime image/*
|
||||
action launch --type=overlay kitten icat --hold -- ''${FILE_PATH}
|
||||
'';
|
||||
};
|
||||
}
|
42
home-manager/nnn.nix
Normal file
42
home-manager/nnn.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.nnn = {
|
||||
enable = true;
|
||||
package = pkgs.nnn.override {
|
||||
withNerdIcons = true;
|
||||
extraMakeFlags = [ "O_GITSTATUS=1" ];
|
||||
};
|
||||
extraPackages = with pkgs; [
|
||||
bat
|
||||
eza
|
||||
fzf
|
||||
imv
|
||||
mediainfo
|
||||
libarchive
|
||||
ueberzug
|
||||
ffmpegthumbnailer
|
||||
ffmpeg
|
||||
glow
|
||||
poppler
|
||||
imagemagick
|
||||
gnome-epub-thumbnailer
|
||||
w3m
|
||||
];
|
||||
plugins = {
|
||||
src = "${pkgs.nnn.src}/plugins";
|
||||
mappings = {
|
||||
c = "fzcd";
|
||||
f = "finder";
|
||||
o = "fzopen";
|
||||
p = "preview-tui";
|
||||
v = "imgview";
|
||||
};
|
||||
};
|
||||
bookmarks = {
|
||||
h = "~";
|
||||
D = "~/Downloads";
|
||||
d = "~/Documents";
|
||||
p = "~/Projects";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -36,7 +36,7 @@
|
|||
hotkeys.commands = {
|
||||
"spectacle-screenshot" = {
|
||||
name = "Spectacle Screenshot";
|
||||
command = "/etc/nixos/scripts/py/spectacle-screenshot.py";
|
||||
command = "/etc/nixos/scripts/py/spectacle-screenshot.py --format=webp";
|
||||
comment = "Take a screenshot of a region on the screen and automatically upload it to Zipline";
|
||||
keys = [
|
||||
"Print"
|
||||
|
@ -45,7 +45,7 @@
|
|||
};
|
||||
"spectacle-recording" = {
|
||||
name = "Spectacle Recording";
|
||||
command = "/etc/nixos/scripts/py/spectacle-screenshot.py --record";
|
||||
command = "/etc/nixos/scripts/py/spectacle-screenshot.py --record --format=webm";
|
||||
comment = "Record a region on the screen and automatically upload it to Zipline";
|
||||
keys = [
|
||||
"Shift+Print"
|
||||
|
@ -80,8 +80,7 @@
|
|||
"applications:vesktop.desktop"
|
||||
"applications:steam.desktop"
|
||||
"applications:org.prismlauncher.PrismLauncher.desktop"
|
||||
"applications:code.desktop"
|
||||
"applications:org.kde.konsole.desktop"
|
||||
"applications:kitty.desktop"
|
||||
"applications:org.kde.dolphin.desktop"
|
||||
];
|
||||
};
|
||||
|
@ -143,7 +142,7 @@
|
|||
};
|
||||
programs.konsole =
|
||||
let
|
||||
colorSchemesPackage = pkgs.callPackage ../packages/catppuccin-konsole.nix { inherit pkgs; };
|
||||
colorSchemesPackage = pkgs.callPackage ../packages/catppuccin/konsole.nix { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
|
|
|
@ -9,20 +9,24 @@
|
|||
home.homeDirectory = "/home/${user}";
|
||||
|
||||
home.file = {
|
||||
".face.icon".source = config.lib.file.mkOutOfStoreSymlink "/etc/nixos/assets/img/clownfish.png";
|
||||
".face.icon".source = config.lib.file.mkOutOfStoreSymlink ../assets/img/clownfish.png;
|
||||
".config/fastfetch/config.jsonc".source =
|
||||
config.lib.file.mkOutOfStoreSymlink "/etc/nixos/config/fastfetch.jsonc";
|
||||
".psqlrc".source = config.lib.file.mkOutOfStoreSymlink "/etc/nixos/config/.psqlrc";
|
||||
".config/btop/btop.conf".source = config.lib.file.mkOutOfStoreSymlink "/etc/nixos/config/btop.conf";
|
||||
config.lib.file.mkOutOfStoreSymlink ../config/fastfetch.jsonc;
|
||||
".psqlrc".source = config.lib.file.mkOutOfStoreSymlink ../config/.psqlrc;
|
||||
".config/btop/btop.conf".source = config.lib.file.mkOutOfStoreSymlink ../config/btop.conf;
|
||||
".config/btop/themes/catppuccin_mocha.theme".source =
|
||||
config.lib.file.mkOutOfStoreSymlink "/etc/nixos/config/themes/btop.theme";
|
||||
".config/gauntlet/simple-theme.json".source =
|
||||
config.lib.file.mkOutOfStoreSymlink "/etc/nixos/config/themes/gauntlet.json";
|
||||
".config/glow/glow.yml".source = config.lib.file.mkOutOfStoreSymlink "/etc/nixos/config/glow.yml";
|
||||
".config/glow/theme.json".source =
|
||||
config.lib.file.mkOutOfStoreSymlink "/etc/nixos/config/themes/glow.json";
|
||||
config.lib.file.mkOutOfStoreSymlink ../config/themes/btop.theme;
|
||||
".config/gauntlet/theme.toml".source =
|
||||
config.lib.file.mkOutOfStoreSymlink ../config/themes/gauntlet.toml;
|
||||
".config/glow/glow.yml".source = config.lib.file.mkOutOfStoreSymlink ../config/glow.yml;
|
||||
".config/glow/theme.json".source = config.lib.file.mkOutOfStoreSymlink ../config/themes/glow.json;
|
||||
".config/vinegar/config.toml".source =
|
||||
config.lib.file.mkOutOfStoreSymlink "/etc/nixos/config/vinegar.toml";
|
||||
config.lib.file.mkOutOfStoreSymlink ../etc/nixos/config/vinegar.toml;
|
||||
".local/share/kio/servicemenus" = {
|
||||
source = ../config/servicemenus;
|
||||
recursive = true;
|
||||
executable = true;
|
||||
};
|
||||
};
|
||||
|
||||
# link the configuration file in current directory to the specified location in home directory
|
||||
|
@ -75,9 +79,11 @@
|
|||
directory = "/etc/nixos";
|
||||
};
|
||||
url = {
|
||||
"git@coastalcommits.com:" = {
|
||||
"git@c.csw.im:" = {
|
||||
insteadOf = [
|
||||
"https://www.coastalcommits.com/"
|
||||
"git@coastalcommits.com"
|
||||
"https://c.csw.im/"
|
||||
"cc:"
|
||||
"coastalcommits:"
|
||||
];
|
||||
|
|
|
@ -38,21 +38,21 @@ rec {
|
|||
];
|
||||
|
||||
programs.vscode =
|
||||
let
|
||||
vscode = inputs.nix-vscode-extensions.extensions.${system}.vscode-marketplace;
|
||||
vscode-release = inputs.nix-vscode-extensions.extensions.${system}.vscode-marketplace-release;
|
||||
in
|
||||
# vsx = inputs.nix-vscode-extensions.extensions.${system}.open-vsx;
|
||||
# vsx-release = inputs.nix-vscode-extensions.extensions.${system}.open-vsx-release;
|
||||
{
|
||||
enable = true;
|
||||
enableUpdateCheck = false;
|
||||
enableExtensionUpdateCheck = false;
|
||||
package = pkgs.vscode;
|
||||
# package = pkgs.vscode.fhsWithPackages (
|
||||
# ps: with pkgs; [
|
||||
# dotnetCorePackages.sdk_8_0
|
||||
# jdk21
|
||||
# go
|
||||
# ]
|
||||
# );
|
||||
extensions =
|
||||
with inputs.nix-vscode-extensions.extensions.${system}.vscode-marketplace;
|
||||
with inputs.nix-vscode-extensions.extensions.${system}.vscode-marketplace-release;
|
||||
# In `with A; with B;`, the attributes of `B` shadow the attributes of `A`
|
||||
with vscode;
|
||||
with vscode-release;
|
||||
[
|
||||
# Themes
|
||||
(pkgs.catppuccin-vsc.override {
|
||||
|
@ -95,7 +95,6 @@ rec {
|
|||
ms-python.vscode-pylance
|
||||
ms-python.debugpy
|
||||
ms-python.black-formatter
|
||||
ms-python.mypy-type-checker
|
||||
charliermarsh.ruff
|
||||
|
||||
# JavaScript / TypeScript
|
||||
|
@ -168,6 +167,7 @@ rec {
|
|||
tboby.paradox-syntax
|
||||
xteal.mcmeta
|
||||
footerman.heracles-support
|
||||
nico-castell.linux-desktop-file
|
||||
|
||||
# Misc - Debuggers
|
||||
firefox-devtools.vscode-firefox-debug
|
||||
|
@ -190,8 +190,6 @@ rec {
|
|||
vasubasraj.flashpost
|
||||
adpyke.codesnap
|
||||
elypia.magick-image-reader
|
||||
adpyke.vscode-sql-formatter
|
||||
qwtel.sqlite-viewer
|
||||
yy0931.vscode-sqlite3-editor
|
||||
leonardssh.vscord
|
||||
alefragnani.project-manager
|
||||
|
@ -204,6 +202,7 @@ rec {
|
|||
ms-vscode.remote-explorer
|
||||
pkgs.vscode-extensions.ms-vscode-remote.remote-containers
|
||||
ms-vscode.remote-repositories
|
||||
tailscale.vscode-tailscale
|
||||
formulahendry.auto-rename-tag
|
||||
prunoideae.probejs
|
||||
d-koppenhagen.file-tree-to-text-generator
|
||||
|
@ -284,7 +283,6 @@ rec {
|
|||
};
|
||||
"[python]" = {
|
||||
"editor.formatOnType" = true;
|
||||
"editor.formatOnSave" = true;
|
||||
"editor.defaultFormatter" = "charliermarsh.ruff";
|
||||
"editor.codeActionsOnSave" = {
|
||||
"source.fixAll" = "explicit";
|
||||
|
@ -299,14 +297,12 @@ rec {
|
|||
"python.terminal.activateEnvInCurrentTerminal" = false;
|
||||
"[csharp]" = {
|
||||
"editor.defaultFormatter" = "csharpier.csharpier-vscode";
|
||||
"editor.formatOnSave" = true;
|
||||
"editor.formatOnSaveMode" = "file";
|
||||
};
|
||||
"[typescript]" = {
|
||||
"editor.defaultFormatter" = "esbenp.prettier-vscode";
|
||||
"editor.formatOnType" = false;
|
||||
"editor.formatOnPaste" = true;
|
||||
"editor.formatOnSave" = true;
|
||||
"editor.formatOnSaveMode" = "file";
|
||||
"files.autoSave" = "onFocusChange";
|
||||
};
|
||||
|
@ -369,7 +365,7 @@ rec {
|
|||
"codesnap.showWindowControls" = false;
|
||||
"gitlens.remotes" = [
|
||||
{
|
||||
"domain" = "www.coastalcommits.com";
|
||||
"domain" = "c.csw.im";
|
||||
"type" = "Gitea";
|
||||
}
|
||||
];
|
||||
|
@ -466,6 +462,17 @@ rec {
|
|||
"github.copilot.enable" = {
|
||||
"markdown" = true;
|
||||
};
|
||||
"extensions.autoUpdate" = false;
|
||||
"python.analysis.generateWithTypeAnnotation" = true;
|
||||
"python.analysis.autoFormatStrings" = true;
|
||||
"python.analysis.autoImportCompletions" = true;
|
||||
"python.analysis.completeFunctionParens" = true;
|
||||
"python.analysis.diagnosticMode" = "workspace";
|
||||
"python.analysis.supportDocstringTemplate" = true;
|
||||
"python.analysis.typeEvaluation.enableReachabilityAnalysis" = true;
|
||||
"python.analysis.typeEvaluation.strictDictionaryInference" = true;
|
||||
"python.analysis.typeEvaluation.strictListInference" = true;
|
||||
"python.analysis.typeEvaluation.strictSetInference" = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
24
hosts/virtual-machines/cosmic/flake.lock
generated
24
hosts/virtual-machines/cosmic/flake.lock
generated
|
@ -7,11 +7,11 @@
|
|||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1738041275,
|
||||
"narHash": "sha256-4Oqq357Q//Ra5qV9PdPLMkdH0uFFxy1stQF8hTe8xEM=",
|
||||
"lastModified": 1739151439,
|
||||
"narHash": "sha256-t9R1n58/FP2+FLng71JAvNgvm70XqNHZMa2Ojx9NL3s=",
|
||||
"owner": "lilyinstarlight",
|
||||
"repo": "nixos-cosmic",
|
||||
"rev": "36eabddc2d033f4fd31c53570db7e1e21591cba3",
|
||||
"rev": "e32f5377d4c65e0c49591aad6f6be1e68e95747f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -38,11 +38,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1737885589,
|
||||
"narHash": "sha256-Zf0hSrtzaM1DEz8//+Xs51k/wdSajticVrATqDrfQjg=",
|
||||
"lastModified": 1739020877,
|
||||
"narHash": "sha256-mIvECo/NNdJJ/bXjNqIh8yeoSjVLAuDuTUzAo7dzs8Y=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "852ff1d9e153d8875a83602e03fdef8a63f0ecf8",
|
||||
"rev": "a79cfe0ebd24952b580b1cf08cd906354996d547",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -54,11 +54,11 @@
|
|||
},
|
||||
"nixpkgs-stable": {
|
||||
"locked": {
|
||||
"lastModified": 1737885640,
|
||||
"narHash": "sha256-GFzPxJzTd1rPIVD4IW+GwJlyGwBDV1Tj5FLYwDQQ9sM=",
|
||||
"lastModified": 1739055578,
|
||||
"narHash": "sha256-2MhC2Bgd06uI1A0vkdNUyDYsMD0SLNGKtD8600mZ69A=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4e96537f163fad24ed9eb317798a79afc85b51b7",
|
||||
"rev": "a45fa362d887f4d4a7157d95c28ca9ce2899b70e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -70,11 +70,11 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1737885589,
|
||||
"narHash": "sha256-Zf0hSrtzaM1DEz8//+Xs51k/wdSajticVrATqDrfQjg=",
|
||||
"lastModified": 1739020877,
|
||||
"narHash": "sha256-mIvECo/NNdJJ/bXjNqIh8yeoSjVLAuDuTUzAo7dzs8Y=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "852ff1d9e153d8875a83602e03fdef8a63f0ecf8",
|
||||
"rev": "a79cfe0ebd24952b580b1cf08cd906354996d547",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -42,13 +42,7 @@
|
|||
};
|
||||
|
||||
# install the most recent stable linux kernel
|
||||
/*
|
||||
TODO: change this back to 'pkgs.linuxPackages_latest' once
|
||||
https://github.com/NixOS/nixpkgs/commit/c805021f3a95da44a1811f1235b997f57d893dc3
|
||||
and https://github.com/NixOS/nixpkgs/pull/375838
|
||||
trickle down to nixos-unstable
|
||||
*/
|
||||
boot.kernelPackages = pkgs.linuxPackages_6_12;
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
||||
# Bootloader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
|
|
|
@ -1,18 +1,26 @@
|
|||
{ lib, ... }:
|
||||
{
|
||||
environment.variables = {
|
||||
PATH = "$PATH:/etc/nixos/scripts";
|
||||
environment.variables = rec {
|
||||
EDITOR = "nvim";
|
||||
VISUAL = "code";
|
||||
VISUAL = "nvim";
|
||||
|
||||
# XDG settings
|
||||
XDG_CONFIG_HOME = lib.mkDefault "$HOME/.config";
|
||||
XDG_CACHE_HOME = "$HOME/.cache";
|
||||
XDG_CONFIG_HOME = "$HOME/.config";
|
||||
XDG_DATA_HOME = "$HOME/.local/share";
|
||||
XDG_STATE_HOME = "$HOME/.local/state";
|
||||
XDG_BIN_HOME = "$HOME/.local/bin";
|
||||
|
||||
# less settings
|
||||
LESS = "-R";
|
||||
# Fix unicode characters not being displayed properly in less or cat (bat)
|
||||
# https://github.com/sharkdp/bat/issues/2578#issuecomment-1598332705
|
||||
LESSUTFCHARDEF = "E000-F8FF:p,F0000-FFFFD:p,100000-10FFFD:p";
|
||||
|
||||
PATH = [
|
||||
"${XDG_BIN_HOME}"
|
||||
../scripts
|
||||
];
|
||||
};
|
||||
|
||||
environment.sessionVariables = {
|
||||
|
|
|
@ -5,13 +5,15 @@
|
|||
}:
|
||||
let
|
||||
customfonts = pkgs.callPackage ../packages/customfonts.nix { inherit pkgs; };
|
||||
catppuccin-konsole = pkgs.callPackage ../packages/catppuccin-konsole.nix { inherit pkgs; };
|
||||
catppuccin-konsole = pkgs.callPackage ../packages/catppuccin/konsole.nix { inherit pkgs; };
|
||||
kdePackages = with pkgs.kdePackages; [
|
||||
qtbase
|
||||
catppuccin-konsole
|
||||
plasma-browser-integration
|
||||
plasma-sdk
|
||||
];
|
||||
packages = with pkgs; [
|
||||
neovim-qt
|
||||
bitwarden-desktop
|
||||
onlyoffice-bin
|
||||
obs-studio
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
extraPackages = with pkgs; [ fd ];
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
colorschemes.catppuccin.enable = true;
|
||||
plugins = {
|
||||
conform-nvim = {
|
||||
enable = true;
|
||||
};
|
||||
treesitter.enable = true;
|
||||
cmp.enable = true;
|
||||
cmp-nvim-lsp.enable = true;
|
||||
lsp.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
26
nixos/nvim/default.nix
Normal file
26
nixos/nvim/default.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
imports = [
|
||||
./keymaps.nix
|
||||
./settings.nix
|
||||
|
||||
./plugins/autoclose.nix
|
||||
./plugins/cmp.nix
|
||||
./plugins/codesnap.nix
|
||||
./plugins/conform.nix
|
||||
./plugins/dap
|
||||
./plugins/dashboard.nix
|
||||
./plugins/devcontainer.nix
|
||||
./plugins/floatterm.nix
|
||||
./plugins/hover.nix
|
||||
./plugins/indent-blankline.nix
|
||||
./plugins/lazygit.nix
|
||||
./plugins/lsp.nix
|
||||
./plugins/lualine.nix
|
||||
./plugins/profile.nix
|
||||
./plugins/rooter.nix
|
||||
./plugins/snacks.nix
|
||||
./plugins/surround.nix
|
||||
./plugins/telescope.nix
|
||||
./plugins/treesitter.nix
|
||||
];
|
||||
}
|
142
nixos/nvim/keymaps.nix
Normal file
142
nixos/nvim/keymaps.nix
Normal file
|
@ -0,0 +1,142 @@
|
|||
{
|
||||
programs.nixvim = {
|
||||
globals = {
|
||||
mapleader = " ";
|
||||
maplocalleader = " ";
|
||||
};
|
||||
keymaps = [
|
||||
{
|
||||
mode = [
|
||||
"n"
|
||||
"s"
|
||||
"x"
|
||||
"v"
|
||||
];
|
||||
key = "<Space>";
|
||||
action = "<Nop>";
|
||||
options.silent = true;
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<A-Left>";
|
||||
action = "<C-w>h";
|
||||
options = {
|
||||
desc = "Move Left";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<A-Down>";
|
||||
action = "<C-w>j";
|
||||
options = {
|
||||
desc = "Move Down";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<A-Up>";
|
||||
action = "<C-w>k";
|
||||
options = {
|
||||
desc = "Move Up";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<A-Right>";
|
||||
action = "<C-w>l";
|
||||
options = {
|
||||
desc = "Move Right";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<Tab>";
|
||||
action = "<CMD>bnext<CR>";
|
||||
options = {
|
||||
desc = "Next Buffer";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<S-Tab>";
|
||||
action = "<CMD>bprevious<CR>";
|
||||
options = {
|
||||
desc = "Previous Buffer";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>c";
|
||||
action = "<CMD>%y+<CR>";
|
||||
options = {
|
||||
desc = "Copy Buffer to Clipboard";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = [
|
||||
"v"
|
||||
"x"
|
||||
"s"
|
||||
];
|
||||
key = "<leader>c";
|
||||
action = "<CMD>\"+y<CR>";
|
||||
options = {
|
||||
desc = "Copy Selection to Clipboard";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>w";
|
||||
action = "<CMD>w<CR>";
|
||||
options = {
|
||||
desc = "Save Buffer to File";
|
||||
silent = false;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>q";
|
||||
action = "<CMD>bd<CR>";
|
||||
options = {
|
||||
desc = "Close Buffer";
|
||||
silent = false;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>Q";
|
||||
action = "<CMD>bd!<CR>";
|
||||
options = {
|
||||
desc = "Force Close Buffer";
|
||||
silent = false;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>`";
|
||||
action = "<CMD>qa<CR>";
|
||||
options = {
|
||||
desc = "Quit All";
|
||||
silent = false;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "t";
|
||||
key = "<C-Esc>";
|
||||
action = "<C-\\><C-n>";
|
||||
options = {
|
||||
desc = "Exit Terminal Mode"; # why does Neovim not have this by default??? wtf???
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
10
nixos/nvim/plugins/autoclose.nix
Normal file
10
nixos/nvim/plugins/autoclose.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
nvim-autopairs = {
|
||||
enable = true;
|
||||
settings = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
46
nixos/nvim/plugins/cmp.nix
Normal file
46
nixos/nvim/plugins/cmp.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
cmp = {
|
||||
enable = true;
|
||||
settings = {
|
||||
sources = [
|
||||
{
|
||||
name = "copilot";
|
||||
group_index = 2;
|
||||
}
|
||||
{
|
||||
name = "nvim_lsp";
|
||||
group_index = 2;
|
||||
}
|
||||
{
|
||||
name = "buffer";
|
||||
group_index = 2;
|
||||
}
|
||||
{
|
||||
name = "path";
|
||||
group_index = 2;
|
||||
}
|
||||
];
|
||||
mapping = {
|
||||
"<C-Space>" = "cmp.mapping.complete()";
|
||||
"<C-d>" = "cmp.mapping.scroll_docs(-4)";
|
||||
"<C-e>" = "cmp.mapping.close()";
|
||||
"<C-f>" = "cmp.mapping.scroll_docs(4)";
|
||||
"<CR>" = "cmp.mapping.confirm({ select = false })";
|
||||
"<S-Tab>" = "cmp.mapping(cmp.mapping.select_prev_item(), {'i', 's'})";
|
||||
"<Tab>" = "cmp.mapping(cmp.mapping.select_next_item(), {'i', 's'})";
|
||||
};
|
||||
};
|
||||
};
|
||||
copilot-lua = {
|
||||
enable = true;
|
||||
settings = {
|
||||
suggestion.enabled = false;
|
||||
panel.enabled = false;
|
||||
};
|
||||
};
|
||||
copilot-cmp.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
39
nixos/nvim/plugins/codesnap.nix
Normal file
39
nixos/nvim/plugins/codesnap.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
codesnap = {
|
||||
enable = true;
|
||||
settings = {
|
||||
bg_theme = "grape";
|
||||
breadcrumbs_separator = "/";
|
||||
has_breadcrumbs = true;
|
||||
show_workspace = true;
|
||||
has_line_number = true;
|
||||
mac_window_bar = false;
|
||||
# https://github.com/mistricky/codesnap.nvim/issues/135
|
||||
# code_font_family = "ComicCodeLigatures Nerd Font";
|
||||
title = "Nixvim";
|
||||
watermark = "";
|
||||
# half of defaults (122, 82)
|
||||
bg_x_padding = 61;
|
||||
bg_y_padding = 41;
|
||||
};
|
||||
};
|
||||
};
|
||||
keymaps = [
|
||||
{
|
||||
mode = [
|
||||
"v"
|
||||
"x"
|
||||
"s"
|
||||
];
|
||||
key = "<leader>s";
|
||||
action = "<CMD>CodeSnap<CR>";
|
||||
options = {
|
||||
desc = "Copy Selection as CodeSnap Image";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
189
nixos/nvim/plugins/conform.nix
Normal file
189
nixos/nvim/plugins/conform.nix
Normal file
|
@ -0,0 +1,189 @@
|
|||
{ pkgs, lib, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
extraPackages = with pkgs; [
|
||||
shellcheck
|
||||
shellharden
|
||||
shfmt
|
||||
ruff
|
||||
stylua
|
||||
nixfmt-rfc-style
|
||||
clang-tools
|
||||
csharpier
|
||||
prettierd
|
||||
];
|
||||
plugins = {
|
||||
conform-nvim = {
|
||||
enable = true;
|
||||
settings = {
|
||||
formatters_by_ft =
|
||||
let
|
||||
prettier = {
|
||||
__unkeyed-1 = "prettierd";
|
||||
__unkeyed_2 = "prettier";
|
||||
timeout_ms = "5000";
|
||||
stop_after_first = "true";
|
||||
};
|
||||
in
|
||||
{
|
||||
bash = [
|
||||
"shellcheck"
|
||||
"shellharden"
|
||||
"shfmt"
|
||||
];
|
||||
python = [
|
||||
"ruff_fix"
|
||||
"ruff_format"
|
||||
"ruff_organize_imports"
|
||||
];
|
||||
c = [ "clang-format" ];
|
||||
cpp = [ "clang-format" ];
|
||||
cs = [ "csharpier" ];
|
||||
csharp = [ "csharpier" ];
|
||||
lua = [ "stylua" ];
|
||||
nix = [ "nixfmt" ];
|
||||
javascript = prettier;
|
||||
javascriptreact = prettier;
|
||||
typescript = prettier;
|
||||
typescriptreact = prettier;
|
||||
markdown = prettier;
|
||||
yaml = prettier;
|
||||
json = prettier;
|
||||
svelte = prettier;
|
||||
html = prettier;
|
||||
css = prettier;
|
||||
graphql = prettier;
|
||||
"_" = [
|
||||
"trim_whitespace"
|
||||
"trim_newlines"
|
||||
];
|
||||
};
|
||||
log_level = "warn";
|
||||
notify_on_error = true;
|
||||
notify_no_formatters = true;
|
||||
default_format_opts = {
|
||||
lsp_format = "fallback";
|
||||
timeout_ms = 1000;
|
||||
};
|
||||
formatters = {
|
||||
shellcheck = {
|
||||
command = lib.getExe pkgs.shellcheck;
|
||||
};
|
||||
shfmt = {
|
||||
command = lib.getExe pkgs.shfmt;
|
||||
};
|
||||
shellharden = {
|
||||
command = lib.getExe pkgs.shellharden;
|
||||
};
|
||||
nixfmt = {
|
||||
command = lib.getExe pkgs.nixfmt-rfc-style;
|
||||
};
|
||||
stylua = {
|
||||
command = lib.getExe pkgs.stylua;
|
||||
};
|
||||
clang-format = {
|
||||
command = "${pkgs.clang-tools}/bin/clang-format";
|
||||
};
|
||||
csharpier = {
|
||||
command = lib.getExe pkgs.csharpier;
|
||||
};
|
||||
ruff_fix = {
|
||||
command = lib.getExe pkgs.ruff;
|
||||
};
|
||||
ruff_format = {
|
||||
command = lib.getExe pkgs.ruff;
|
||||
};
|
||||
ruff_organize_imports = {
|
||||
command = lib.getExe pkgs.ruff;
|
||||
};
|
||||
};
|
||||
format_on_save = # lua
|
||||
''
|
||||
function(bufnr)
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
|
||||
if slow_format_filetypes[vim.bo[bufnr].filetype] then
|
||||
return
|
||||
end
|
||||
|
||||
local function on_format(err)
|
||||
if err and err:match("timeout$") then
|
||||
slow_format_filetypes[vim.bo[bufnr].filetype] = true
|
||||
end
|
||||
end
|
||||
|
||||
return { timeout_ms = 200, lsp_fallback = true }, on_format
|
||||
end
|
||||
'';
|
||||
format_after_save = # lua
|
||||
''
|
||||
function(bufnr)
|
||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||
return
|
||||
end
|
||||
|
||||
if not slow_format_filetypes[vim.bo[bufnr].filetype] then
|
||||
return
|
||||
end
|
||||
|
||||
return { lsp_fallback = true }
|
||||
end
|
||||
'';
|
||||
};
|
||||
luaConfig.post = # lua
|
||||
''
|
||||
slow_format_filetypes = {} -- Filetypes that are slow to format, and should be formatted after saving a buffer instead of before
|
||||
require("conform").formatters.injected = {
|
||||
options = {
|
||||
lang_to_ext = {
|
||||
c = "c",
|
||||
cpp = "cpp",
|
||||
cs = "cs",
|
||||
csharp = "cs",
|
||||
lua = "lua",
|
||||
nix = "nix",
|
||||
python = "py",
|
||||
bash = "sh",
|
||||
javascript = "js",
|
||||
javascriptreact = "jsx",
|
||||
typescript = "ts",
|
||||
typescriptreact = "tsx",
|
||||
markdown = "md",
|
||||
yaml = "yaml",
|
||||
json = "json",
|
||||
svelte = "svelte",
|
||||
html = "html",
|
||||
css = "css",
|
||||
graphql = "graphql",
|
||||
},
|
||||
},
|
||||
}
|
||||
vim.api.nvim_create_user_command("Format", function(args)
|
||||
local range = nil
|
||||
if args.count ~= -1 then
|
||||
local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
|
||||
range = {
|
||||
start = { args.line1, 0 },
|
||||
["end"] = { args.line2, end_line:len() },
|
||||
}
|
||||
end
|
||||
require("conform").format({ async = true, lsp_format = "fallback", range = range })
|
||||
end, { range = true })
|
||||
'';
|
||||
};
|
||||
};
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>f";
|
||||
action = "<CMD>Format<CR>";
|
||||
options = {
|
||||
desc = "Format";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
170
nixos/nvim/plugins/dap/default.nix
Normal file
170
nixos/nvim/plugins/dap/default.nix
Normal file
|
@ -0,0 +1,170 @@
|
|||
{
|
||||
imports = [
|
||||
./dotnet.nix
|
||||
];
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
dap.enable = true;
|
||||
dap-python.enable = true;
|
||||
dap-ui = {
|
||||
enable = true;
|
||||
settings = {
|
||||
controls = {
|
||||
enable = true;
|
||||
element = "repl";
|
||||
};
|
||||
layouts = [
|
||||
{
|
||||
elements = [
|
||||
{
|
||||
id = "breakpoints";
|
||||
size = 0.25;
|
||||
}
|
||||
{
|
||||
id = "repl";
|
||||
size = 0.75;
|
||||
}
|
||||
];
|
||||
position = "bottom";
|
||||
size = 10;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<F6>";
|
||||
action = "<CMD>lua require('dapui').toggle()<CR>";
|
||||
options = {
|
||||
desc = "Toggle Debugging UI";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<F5>";
|
||||
action = "<CMD>DapContinue<CR>";
|
||||
options = {
|
||||
desc = "Continue Debugging";
|
||||
silent = false;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<F10>";
|
||||
action = "<CMD>DapStepOver<CR>";
|
||||
options = {
|
||||
desc = "Step Over (Debugger)";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<F11>";
|
||||
action = "<CMD>DapStepInto<CR>";
|
||||
options = {
|
||||
desc = "Step Into (Debugger)";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<F12>";
|
||||
action = "<CMD>DapStepOut<CR>";
|
||||
options = {
|
||||
desc = "Step Out (Debugger)";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>b";
|
||||
action = "<CMD>DapToggleBreakpoint<CR>";
|
||||
options = {
|
||||
desc = "Toggle Breakpoint (Debugger)";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>B";
|
||||
action = "<CMD>DapSetBreakpoint<CR>";
|
||||
options = {
|
||||
desc = "Set Breakpoint (Debugger)";
|
||||
silent = false;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>lp";
|
||||
action = "<CMD>lua require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>";
|
||||
options = {
|
||||
desc = "Set Log Point (Debugger)";
|
||||
silent = false;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dr";
|
||||
action = "<CMD>DapToggleRepl<CR>";
|
||||
options = {
|
||||
desc = "Toggle REPL";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dl";
|
||||
action = "<CMD>lua require('dap').run_last()<CR>";
|
||||
options = {
|
||||
desc = "Run Last (Debugger)";
|
||||
silent = false;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = [
|
||||
"n"
|
||||
"v"
|
||||
];
|
||||
key = "<leader>dh";
|
||||
action = "<CMD>lua require('dap.ui.widgets').hover()<CR>";
|
||||
options = {
|
||||
desc = "TODO";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = [
|
||||
"n"
|
||||
"v"
|
||||
];
|
||||
key = "<leader>dh";
|
||||
action = "<CMD>lua require('dap.ui.widgets').preview()<CR>";
|
||||
options = {
|
||||
desc = "TODO";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>df";
|
||||
action = "<CMD>lua require('dap.ui.widgets').centered_float(widgets.frames)<CR>";
|
||||
options = {
|
||||
desc = "TODO";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ds";
|
||||
action = "<CMD>lua require('dap.ui.widgets').centered_float(widgets.scopes)<CR>";
|
||||
options = {
|
||||
desc = "TODO";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
75
nixos/nvim/plugins/dap/dotnet.nix
Normal file
75
nixos/nvim/plugins/dap/dotnet.nix
Normal file
|
@ -0,0 +1,75 @@
|
|||
{ pkgs, lib, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
extraPackages = with pkgs; [
|
||||
netcoredbg
|
||||
];
|
||||
plugins.dap = {
|
||||
adapters = {
|
||||
executables = {
|
||||
coreclr = {
|
||||
command = "${lib.getExe pkgs.netcoredbg}";
|
||||
args = [ "--interpreter=vscode" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
configurations =
|
||||
let
|
||||
dotnet_config = {
|
||||
type = "coreclr";
|
||||
name = "launch - netcoredbg";
|
||||
request = "launch";
|
||||
program.__raw = # lua
|
||||
''
|
||||
function()
|
||||
if vim.fn.confirm("Should I recompile first?", "&yes\n&no", 2) == 1 then
|
||||
vim.g.dotnet_build_project()
|
||||
end
|
||||
return vim.g.dotnet_get_dll_path()
|
||||
end
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
cs = [ dotnet_config ];
|
||||
fsharp = [ dotnet_config ];
|
||||
};
|
||||
luaConfig.pre = # lua
|
||||
''
|
||||
vim.g.dotnet_build_project = function()
|
||||
local default_path = vim.fn.getcwd() .. '/'
|
||||
if vim.g['dotnet_last_proj_path'] ~= nil then
|
||||
default_path = vim.g['dotnet_last_proj_path']
|
||||
end
|
||||
local path = vim.fn.input('Path to your *proj file', default_path, 'file')
|
||||
vim.g['dotnet_last_proj_path'] = path
|
||||
local cmd = 'dotnet build -c Debug ' .. path .. ' > /dev/null'
|
||||
print("")
|
||||
print('Cmd to execute: ' .. cmd)
|
||||
local f = os.execute(cmd)
|
||||
if f == 0 then
|
||||
print('\nBuild: ✔️ ')
|
||||
else
|
||||
print('\nBuild: ❌ (code: ' .. f .. ')')
|
||||
end
|
||||
end
|
||||
|
||||
vim.g.dotnet_get_dll_path = function()
|
||||
local request = function()
|
||||
return vim.fn.input('Path to dll', vim.fn.getcwd() .. '/bin/Debug/', 'file')
|
||||
end
|
||||
|
||||
if vim.g['dotnet_last_dll_path'] == nil then
|
||||
vim.g['dotnet_last_dll_path'] = request()
|
||||
else
|
||||
if vim.fn.confirm('Do you want to change the path to dll?\n' .. vim.g['dotnet_last_dll_path'], '&yes\n&no', 2) == 1 then
|
||||
vim.g['dotnet_last_dll_path'] = request()
|
||||
end
|
||||
end
|
||||
|
||||
return vim.g['dotnet_last_dll_path']
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
45
nixos/nvim/plugins/dashboard.nix
Normal file
45
nixos/nvim/plugins/dashboard.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
programs.nixvim.plugins = {
|
||||
dashboard = {
|
||||
enable = true;
|
||||
settings = {
|
||||
change_to_vcs_root = true;
|
||||
config = {
|
||||
header = [
|
||||
"███╗ ██╗██╗██╗ ██╗██╗ ██╗██╗███╗ ███╗"
|
||||
"████╗ ██║██║╚██╗██╔╝██║ ██║██║████╗ ████║"
|
||||
"██╔██╗ ██║██║ ╚███╔╝ ██║ ██║██║██╔████╔██║"
|
||||
"██║╚██╗██║██║ ██╔██╗ ╚██╗ ██╔╝██║██║╚██╔╝██║"
|
||||
"██║ ╚████║██║██╔╝ ██╗ ╚████╔╝ ██║██║ ╚═╝ ██║"
|
||||
"╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝"
|
||||
];
|
||||
mru = {
|
||||
limit = 20;
|
||||
};
|
||||
project = {
|
||||
enable = true;
|
||||
};
|
||||
shortcut = [
|
||||
{
|
||||
action = {
|
||||
__raw = "function(path) vim.cmd('Telescope find_files') end";
|
||||
};
|
||||
desc = "Files";
|
||||
group = "Label";
|
||||
icon = " ";
|
||||
icon_hl = "@variable";
|
||||
key = "f";
|
||||
}
|
||||
{
|
||||
action = "Telescope project display_type=full hide_workspace=true";
|
||||
desc = " Projects";
|
||||
group = "DiagnosticHint";
|
||||
key = "p";
|
||||
}
|
||||
];
|
||||
};
|
||||
theme = "hyper";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
85
nixos/nvim/plugins/devcontainer.nix
Normal file
85
nixos/nvim/plugins/devcontainer.nix
Normal file
|
@ -0,0 +1,85 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
extraPackages = with pkgs; [ devcontainer ];
|
||||
extraPlugins = [
|
||||
(pkgs.vimUtils.buildVimPlugin {
|
||||
# https://codeberg.org/esensar/nvim-dev-container
|
||||
name = "devcontainer";
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://codeberg.org/esensar/nvim-dev-container";
|
||||
rev = "ba9666bdaec23cfe8087c0b6bb0a15c93ec8ba87";
|
||||
sha256 = "sha256-x1+HxC/wDsR1MukXzteIcoOeUJ8XxXvbujL5/XPvf6Q=";
|
||||
};
|
||||
})
|
||||
];
|
||||
extraConfigLua = ''
|
||||
require("devcontainer").setup({})
|
||||
'';
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dcs";
|
||||
action = "<CMD>DevcontainerStart<CR>";
|
||||
options = {
|
||||
desc = "Start Dev Container";
|
||||
silent = false;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dcc";
|
||||
action = "<CMD>DevcontainerStopAll<CR>";
|
||||
options = {
|
||||
desc = "Stop Dev Container";
|
||||
silent = false;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dcr";
|
||||
action = "<CMD>DevcontainerRemoveAll<CR>";
|
||||
options = {
|
||||
desc = "Remove Dev Container";
|
||||
silent = false;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dca";
|
||||
action = "<CMD>DevcontainerAttach<CR>";
|
||||
options = {
|
||||
desc = "Attach to Dev Container";
|
||||
silent = false;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dce";
|
||||
action = ":DevcontainerExec ";
|
||||
options = {
|
||||
desc = "Execute Command in Dev Container";
|
||||
silent = false;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dcl";
|
||||
action = "<CMD>DevcontainerLogs<CR>";
|
||||
options = {
|
||||
desc = "Open Dev Container Logs";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>dcz";
|
||||
action = "<CMD>DevcontainerEditNearestConfig<CR>";
|
||||
options = {
|
||||
desc = "Edit Nearest devcontainer.json";
|
||||
silent = false;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
39
nixos/nvim/plugins/floatterm.nix
Normal file
39
nixos/nvim/plugins/floatterm.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
extraPlugins = [
|
||||
(pkgs.vimUtils.buildVimPlugin {
|
||||
# https://github.com/EmilOhlsson/FloatTerm.nvim
|
||||
name = "FloatTerm";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "EmilOhlsson";
|
||||
repo = "FloatTerm.nvim";
|
||||
rev = "b6b8f43c097d9edd923a6442e9aca71949cfe6ea";
|
||||
sha256 = "sha256-g6qQn2NA3nsTVE8+/9Vc2BCLCcZnKJfryRUXCw/Lp4g=";
|
||||
};
|
||||
})
|
||||
];
|
||||
extraConfigLua = # lua
|
||||
''
|
||||
require("FloatTerm").setup({
|
||||
window_config = {
|
||||
border = 'shadow',
|
||||
title = "Terminal",
|
||||
},
|
||||
pad_vertical = 5,
|
||||
pad_horizontal = 10,
|
||||
})
|
||||
'';
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>s";
|
||||
action = "<CMD>FloatTerm<CR>";
|
||||
options = {
|
||||
desc = "Toggle Floating Terminal";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
91
nixos/nvim/plugins/hover.nix
Normal file
91
nixos/nvim/plugins/hover.nix
Normal file
|
@ -0,0 +1,91 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
hover-nvim
|
||||
];
|
||||
extraConfigLua = # lua
|
||||
''
|
||||
require("hover").setup({
|
||||
init = function()
|
||||
require("hover.providers.lsp")
|
||||
require("hover.providers.diagnostic")
|
||||
require("hover.providers.man")
|
||||
require("hover.providers.dictionary")
|
||||
end,
|
||||
preview_opts = {
|
||||
border = 'single',
|
||||
},
|
||||
preview_window = true,
|
||||
title = true,
|
||||
mouse_providers = {
|
||||
'LSP',
|
||||
},
|
||||
mouse_delay = 400
|
||||
})
|
||||
vim.o.mousemoveevent = false -- enable this if you want to use mouse hover for some reason (are you crazy???? this shit sucks)
|
||||
'';
|
||||
# autoCmd = [
|
||||
# {
|
||||
# desc = "Open Hover window when hovering over a word";
|
||||
# event = "CursorHold";
|
||||
# pattern = "*";
|
||||
# callback.__raw = ''
|
||||
# function(_)
|
||||
# local word = vim.fn.expand("<cword>")
|
||||
# if word ~= "" then
|
||||
# require('hover').hover()
|
||||
# end
|
||||
# end
|
||||
# '';
|
||||
# }
|
||||
# ];
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "K";
|
||||
action = "<CMD>lua require('hover').hover()<CR>";
|
||||
options = {
|
||||
desc = "Open Hover Window";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "gK";
|
||||
action = "<CMD>lua require('hover').hover()<CR>";
|
||||
options = {
|
||||
desc = "Select Hover Source";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-p>";
|
||||
action = "<CMD>lua require('hover').hover_switch('previous')<CR>";
|
||||
options = {
|
||||
desc = "Previous Hover Source";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-n>";
|
||||
action = "<CMD>lua require('hover').hover_switch('next')<CR>";
|
||||
options = {
|
||||
desc = "Next Hover Source";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<MouseMove>";
|
||||
action = "<CMD>lua require('hover').hover_mouse()<CR>";
|
||||
options = {
|
||||
desc = "Hover Mouse Support";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
59
nixos/nvim/plugins/indent-blankline.nix
Normal file
59
nixos/nvim/plugins/indent-blankline.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
rainbow-delimiters = {
|
||||
enable = true;
|
||||
highlight.__raw = "highlight";
|
||||
};
|
||||
indent-blankline = {
|
||||
enable = true;
|
||||
settings = {
|
||||
exclude = {
|
||||
buftypes = [
|
||||
"terminal"
|
||||
"quickfix"
|
||||
];
|
||||
filetypes = [
|
||||
""
|
||||
"checkhealth"
|
||||
"help"
|
||||
"lspinfo"
|
||||
"packer"
|
||||
"TelescopePrompt"
|
||||
"TelescopeResults"
|
||||
"yaml"
|
||||
];
|
||||
};
|
||||
scope = {
|
||||
show_start = false;
|
||||
show_end = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
extraConfigLuaPre = # lua
|
||||
''
|
||||
local highlight = {
|
||||
"RainbowRed",
|
||||
"RainbowYellow",
|
||||
"RainbowBlue",
|
||||
"RainbowPeach",
|
||||
"RainbowGreen",
|
||||
"RainbowMauve",
|
||||
"RainbowTeal",
|
||||
}
|
||||
local hooks = require("ibl.hooks")
|
||||
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
|
||||
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#f38ba8" })
|
||||
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#f9e2af" })
|
||||
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#89b4fa" })
|
||||
vim.api.nvim_set_hl(0, "RainbowPeach", { fg = "#fab387" })
|
||||
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#a6e3a1" })
|
||||
vim.api.nvim_set_hl(0, "RainbowMauve", { fg = "#cba6f7" })
|
||||
vim.api.nvim_set_hl(0, "RainbowTeal", { fg = "#94e2d5" })
|
||||
end)
|
||||
--vim.g.rainbow_delimiters = { highlight = highlight }
|
||||
'';
|
||||
extraConfigLuaPost = "hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)";
|
||||
};
|
||||
}
|
19
nixos/nvim/plugins/lazygit.nix
Normal file
19
nixos/nvim/plugins/lazygit.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
programs.nixvim = {
|
||||
plugins.lazygit = {
|
||||
enable = true;
|
||||
};
|
||||
extraConfigLua = ''require("telescope").load_extension("lazygit")'';
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>g";
|
||||
action = "<CMD>LazyGit<CR>";
|
||||
options = {
|
||||
desc = "LazyGit";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
164
nixos/nvim/plugins/lsp.nix
Normal file
164
nixos/nvim/plugins/lsp.nix
Normal file
|
@ -0,0 +1,164 @@
|
|||
{ pkgs, lib, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
extraPackages = with pkgs; [
|
||||
nixfmt-rfc-style
|
||||
];
|
||||
plugins = {
|
||||
luasnip = {
|
||||
enable = true;
|
||||
};
|
||||
lsp-status = {
|
||||
enable = true;
|
||||
};
|
||||
schemastore = {
|
||||
enable = true;
|
||||
json.enable = true;
|
||||
yaml.enable = true;
|
||||
};
|
||||
lsp = {
|
||||
enable = true;
|
||||
capabilities = # lua
|
||||
''capabilities.textDocument.completion.completionItem.snippetSupport = true'';
|
||||
inlayHints = true;
|
||||
servers = {
|
||||
basedpyright = {
|
||||
enable = true; # Python
|
||||
settings = {
|
||||
pyright.disableOrganizeImports = true;
|
||||
};
|
||||
};
|
||||
ruff.enable = true; # Python
|
||||
omnisharp = {
|
||||
enable = true; # C#
|
||||
package = pkgs.omnisharp-roslyn;
|
||||
cmd = [ "${lib.getExe pkgs.omnisharp-roslyn}" ];
|
||||
};
|
||||
nil_ls = {
|
||||
enable = true; # Nix
|
||||
settings.formatting.command = [ "${lib.getExe pkgs.nixfmt-rfc-style}" ];
|
||||
};
|
||||
luau_lsp = {
|
||||
enable = true;
|
||||
package = pkgs.callPackage ../../../packages/luau-lsp.nix { inherit pkgs; };
|
||||
};
|
||||
lua_ls.enable = true;
|
||||
html.enable = true;
|
||||
jsonls.enable = true;
|
||||
yamlls.enable = true;
|
||||
taplo.enable = true; # TOML
|
||||
cssls.enable = true;
|
||||
tailwindcss.enable = true;
|
||||
dockerls.enable = true;
|
||||
docker_compose_language_service.enable = true;
|
||||
bashls.enable = true;
|
||||
ts_ls.enable = true;
|
||||
denols.enable = true; # JavaScript / TypeScript (Deno)
|
||||
eslint.enable = true; # JavaScript / TypeScript
|
||||
typos_lsp.enable = true;
|
||||
};
|
||||
preConfig = # lua
|
||||
''
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup('lsp_attach_disable_ruff_hover', { clear = true }),
|
||||
callback = function(args)
|
||||
local client = vim.lsp.get_client_by_id(args.data.client_id)
|
||||
if client == nil then
|
||||
return
|
||||
end
|
||||
if client.name == 'ruff' then
|
||||
-- Disable hover in favor of basedpyright
|
||||
client.server_capabilities.hoverProvider = false
|
||||
end
|
||||
end,
|
||||
desc = 'LSP: Disable hover capability from Ruff',
|
||||
})
|
||||
'';
|
||||
};
|
||||
trouble = {
|
||||
enable = true;
|
||||
settings = {
|
||||
auto_refresh = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
vim-csharp
|
||||
# (pkgs.vimUtils.buildVimPlugin {
|
||||
# # https://github.com/OrangeT/vim-csharp
|
||||
# name = "vim-csharp";
|
||||
# src = pkgs.fetchFromGitHub {
|
||||
# owner = "OrangeT";
|
||||
# repo = "vim-csharp";
|
||||
# rev = "b5982fc69bba7d507638a308d6875b031054280d";
|
||||
# sha256 = "";
|
||||
# };
|
||||
# })
|
||||
];
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>x";
|
||||
action = "<CMD>Trouble<CR>";
|
||||
options = {
|
||||
desc = "Trouble";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xx";
|
||||
action = "<CMD>Trouble diagnostics toggle<CR>";
|
||||
options = {
|
||||
desc = "Diagnostics (Trouble)";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xX";
|
||||
action = "<CMD>Trouble diagnostics toggle filter.buf=0<CR>";
|
||||
options = {
|
||||
desc = "Buffer Diagnostics (Trouble)";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xs";
|
||||
action = "<CMD>Trouble symbols toggle focus=false<CR>";
|
||||
options = {
|
||||
desc = "Symbols (Trouble)";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xd";
|
||||
action = "<CMD>Trouble lsp_definitions toggle<CR>";
|
||||
options = {
|
||||
desc = "LSP Definitions / references / ... (Trouble)";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xl";
|
||||
action = "<CMD>Trouble loclist toggle<CR>";
|
||||
options = {
|
||||
desc = "Location List (Trouble)";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>xq";
|
||||
action = "<CMD>Trouble qflist toggle<CR>";
|
||||
options = {
|
||||
desc = "Quickfix (Trouble)";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
114
nixos/nvim/plugins/lualine.nix
Normal file
114
nixos/nvim/plugins/lualine.nix
Normal file
|
@ -0,0 +1,114 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins.lualine = {
|
||||
enable = true;
|
||||
autoLoad = true;
|
||||
settings = {
|
||||
options = {
|
||||
globalstatus = true;
|
||||
ignore_focus = [
|
||||
"neo-tree"
|
||||
"nvim-tree"
|
||||
"mini-files"
|
||||
"TelescopePrompt"
|
||||
];
|
||||
};
|
||||
sections = {
|
||||
lualine_a = [
|
||||
"mode"
|
||||
];
|
||||
lualine_b = [
|
||||
"branch"
|
||||
];
|
||||
lualine_c = [
|
||||
{
|
||||
__unkeyed-1 = "filename";
|
||||
newfile_status = true;
|
||||
path = 3;
|
||||
shorting_target = 150;
|
||||
}
|
||||
"diff"
|
||||
];
|
||||
lualine_x = [
|
||||
"diagnostics"
|
||||
{
|
||||
__unkeyed-1 = {
|
||||
__raw = ''
|
||||
function()
|
||||
local msg = ""
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
if next(clients) == nil then
|
||||
return msg
|
||||
end
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
return client.name
|
||||
end
|
||||
end
|
||||
return msg
|
||||
end
|
||||
'';
|
||||
};
|
||||
icon = "";
|
||||
}
|
||||
"copilot"
|
||||
"encoding"
|
||||
"fileformat"
|
||||
"filetype"
|
||||
];
|
||||
lualine_y = [
|
||||
{
|
||||
__unkeyed-1 = "aerial";
|
||||
colored = true;
|
||||
cond = {
|
||||
__raw = ''
|
||||
function()
|
||||
local buf_size_limit = 1024 * 1024
|
||||
if vim.api.nvim_buf_get_offset(0, vim.api.nvim_buf_line_count(0)) > buf_size_limit then
|
||||
return false
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
'';
|
||||
};
|
||||
dense = false;
|
||||
dense_sep = ".";
|
||||
depth = {
|
||||
__raw = "nil";
|
||||
};
|
||||
sep = " ) ";
|
||||
}
|
||||
];
|
||||
lualine_z = [
|
||||
{
|
||||
__unkeyed-1 = "location";
|
||||
}
|
||||
];
|
||||
};
|
||||
tabline = {
|
||||
lualine_a = [
|
||||
{
|
||||
__unkeyed-1 = "buffers";
|
||||
symbols = {
|
||||
alternate_file = "";
|
||||
};
|
||||
disabled_filetypes = [
|
||||
"TelescopePrompt"
|
||||
];
|
||||
}
|
||||
];
|
||||
lualine_z = [
|
||||
"tabs"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
copilot-lualine
|
||||
];
|
||||
};
|
||||
}
|
9
nixos/nvim/plugins/lz-n.nix
Normal file
9
nixos/nvim/plugins/lz-n.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
lz-n = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
62
nixos/nvim/plugins/profile.nix
Normal file
62
nixos/nvim/plugins/profile.nix
Normal file
|
@ -0,0 +1,62 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
extraPlugins = [
|
||||
(pkgs.vimUtils.buildVimPlugin {
|
||||
# https://github.com/stevearc/profile.nvim
|
||||
name = "profile";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "stevearc";
|
||||
repo = "profile.nvim";
|
||||
rev = "f2d2cf5eae9ba3b9ca6bc148507d153f3e6ae282";
|
||||
sha256 = "sha256-xnScKSrlm1N3cw+hPmUd97b1gjue7FG+1f9genzw5yM=";
|
||||
};
|
||||
})
|
||||
];
|
||||
extraConfigLuaPre = # lua
|
||||
''
|
||||
local should_profile = os.getenv("NVIM_PROFILE")
|
||||
if should_profile then
|
||||
require("profile").instrument_autocmds()
|
||||
if should_profile:lower():match("^start") then
|
||||
require("profile").start("*")
|
||||
else
|
||||
require("profile").instrument("*")
|
||||
end
|
||||
end
|
||||
|
||||
vim.g.toggle_profile = function()
|
||||
local prof = require("profile")
|
||||
if prof.is_recording() then
|
||||
prof.stop()
|
||||
vim.ui.input({ prompt = "Save profile to:", completion = "file", default = "profile.json" }, function(filename)
|
||||
if filename then
|
||||
prof.export(filename)
|
||||
vim.notify(string.format("Wrote %s", filename))
|
||||
end
|
||||
end)
|
||||
else
|
||||
vim.ui.select({ "yes", "no" }, { prompt = "Would you like to start profiling?", format_item = function(item)
|
||||
return item
|
||||
end,
|
||||
}, function(choice)
|
||||
if choice == "yes" then
|
||||
prof.start("*")
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
'';
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>p";
|
||||
action = "<CMD>lua vim.g.toggle_profile()<CR>";
|
||||
options = {
|
||||
desc = "Toggle Profiling";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
11
nixos/nvim/plugins/rooter.nix
Normal file
11
nixos/nvim/plugins/rooter.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
extraPlugins = [
|
||||
pkgs.vimPlugins.vim-rooter
|
||||
];
|
||||
globals = {
|
||||
rooter_patterns = [ ".git" ];
|
||||
};
|
||||
};
|
||||
}
|
14
nixos/nvim/plugins/snacks.nix
Normal file
14
nixos/nvim/plugins/snacks.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
programs.nixvim = {
|
||||
plugins.snacks = {
|
||||
enable = true;
|
||||
settings = {
|
||||
bigfile.enabled = true;
|
||||
notifier = {
|
||||
enable = true;
|
||||
timeout = 3000;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
9
nixos/nvim/plugins/surround.nix
Normal file
9
nixos/nvim/plugins/surround.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
nvim-surround = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
234
nixos/nvim/plugins/telescope.nix
Normal file
234
nixos/nvim/plugins/telescope.nix
Normal file
|
@ -0,0 +1,234 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
extraPackages = with pkgs; [
|
||||
ripgrep
|
||||
fd
|
||||
plocate
|
||||
glow
|
||||
];
|
||||
plugins = {
|
||||
aerial.enable = true;
|
||||
neoclip.enable = true;
|
||||
telescope = {
|
||||
enable = true;
|
||||
extensions = {
|
||||
fzf-native.enable = true;
|
||||
file-browser = {
|
||||
enable = true;
|
||||
settings = {
|
||||
hijack_netrw = false;
|
||||
grouped = true;
|
||||
hidden = true;
|
||||
};
|
||||
};
|
||||
project = {
|
||||
enable = true;
|
||||
settings = {
|
||||
base_dirs = [
|
||||
{
|
||||
path = "~/Projects";
|
||||
max_depth = 3;
|
||||
}
|
||||
{
|
||||
path = "/etc/nixos";
|
||||
max_depth = 1;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
settings = {
|
||||
defaults = {
|
||||
prompt_prefix = "🔍";
|
||||
layout_config = {
|
||||
prompt_position = "bottom";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
# https://github.com/nvim-telescope/telescope.nvim/issues/2806#issuecomment-1904877188
|
||||
autoGroups.find_files_hijack_netrw.clear = true;
|
||||
autoCmd = [
|
||||
{
|
||||
event = "VimEnter";
|
||||
pattern = "*";
|
||||
once = true;
|
||||
callback.__raw = # lua
|
||||
''
|
||||
function()
|
||||
pcall(vim.api.nvim_clear_autocmds, { group = "FileExplorer" })
|
||||
end
|
||||
'';
|
||||
}
|
||||
{
|
||||
event = "BufEnter";
|
||||
group = "find_files_hijack_netrw";
|
||||
pattern = "*";
|
||||
callback.__raw = # lua
|
||||
''
|
||||
function()
|
||||
vim.schedule(function()
|
||||
-- Early return if netrw or not a directory
|
||||
if vim.bo[0].filetype == "netrw" or vim.fn.isdirectory(vim.fn.expand("%:p")) == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_buf_set_option(0, "bufhidden", "wipe")
|
||||
|
||||
require("telescope.builtin").find_files({
|
||||
cwd = vim.fn.expand("%:p:h"),
|
||||
find_command = {
|
||||
"rg",
|
||||
"--ignore",
|
||||
"--hidden",
|
||||
"--files",
|
||||
"--glob=!.git/",
|
||||
},
|
||||
})
|
||||
end)
|
||||
end
|
||||
'';
|
||||
}
|
||||
];
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tf";
|
||||
action = "<CMD>Telescope find_files find_command=rg,--ignore,--hidden,--files,--glob=!.git/<CR>";
|
||||
options = {
|
||||
desc = "Find Files";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>te";
|
||||
action = "<CMD>Telescope file_browser path=%:p:h select_buffer=true<CR>";
|
||||
options = {
|
||||
desc = "File Explorer";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tr";
|
||||
action = "<CMD>Telescope live_grep<CR>";
|
||||
options = {
|
||||
desc = "Live Grep";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ta";
|
||||
action = "<CMD>Telescope aerial<CR>";
|
||||
options = {
|
||||
desc = "Aerial";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tb";
|
||||
action = "<CMD>Telescope buffers<CR>";
|
||||
options = {
|
||||
desc = "Buffers";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tt";
|
||||
action = "<CMD>Telescope colorscheme<CR>";
|
||||
options = {
|
||||
desc = "Color Schemes";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tk";
|
||||
action = "<CMD>Telescope keymaps<CR>";
|
||||
options = {
|
||||
desc = "Keymaps";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tp";
|
||||
action = "<CMD>Telescope project display_type=full hide_workspace=true<CR>";
|
||||
options = {
|
||||
desc = "Projects";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tc";
|
||||
action = "<CMD>Telescope commands<CR>";
|
||||
options = {
|
||||
desc = "Commands";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tm";
|
||||
action = "<CMD>Telescope man_pages<CR>";
|
||||
options = {
|
||||
desc = "Man Pages";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tn";
|
||||
action = "<CMD>Telescope vim_options<CR>";
|
||||
options = {
|
||||
desc = "Vim Options";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
# Git
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tgc";
|
||||
action = "<CMD>Telescope git_commits<CR>";
|
||||
options = {
|
||||
desc = "Git Commits";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tgb";
|
||||
action = "<CMD>Telescope git_branches<CR>";
|
||||
options = {
|
||||
desc = "Git Branches";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tgs";
|
||||
action = "<CMD>Telescope git_status<CR>";
|
||||
options = {
|
||||
desc = "Git Status";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>tgS";
|
||||
action = "<CMD>Telescope git_stash<CR>";
|
||||
options = {
|
||||
desc = "Git Stash";
|
||||
silent = true;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
71
nixos/nvim/plugins/treesitter.nix
Normal file
71
nixos/nvim/plugins/treesitter.nix
Normal file
|
@ -0,0 +1,71 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
plugins = {
|
||||
treesitter-refactor = {
|
||||
enable = true;
|
||||
highlightCurrentScope.enable = false;
|
||||
highlightDefinitions.enable = true;
|
||||
navigation = {
|
||||
enable = true;
|
||||
keymaps = {
|
||||
gotoDefinition = null;
|
||||
gotoDefinitionLspFallback = "gnd";
|
||||
gotoNextUsage = "<a-*>";
|
||||
gotoPreviousUsage = "<a-#>";
|
||||
listDefinitions = "gnD";
|
||||
listDefinitionsToc = "gO";
|
||||
};
|
||||
};
|
||||
smartRename = {
|
||||
enable = true;
|
||||
keymaps.smartRename = "grr";
|
||||
};
|
||||
};
|
||||
treesitter-context = {
|
||||
enable = true;
|
||||
};
|
||||
treesitter = {
|
||||
enable = true;
|
||||
settings = {
|
||||
indent.enable = true;
|
||||
incremental_selection = {
|
||||
enable = true;
|
||||
keymaps = {
|
||||
init_selection = "gnn";
|
||||
node_incremental = "grn";
|
||||
scope_incremental = "grc";
|
||||
node_decremental = "grm";
|
||||
};
|
||||
};
|
||||
highlight = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
||||
bash
|
||||
c
|
||||
cpp
|
||||
c_sharp
|
||||
css
|
||||
dockerfile
|
||||
go
|
||||
graphql
|
||||
html
|
||||
javascript
|
||||
json
|
||||
jsonc
|
||||
lua
|
||||
python
|
||||
regex
|
||||
ruby
|
||||
rust
|
||||
svelte
|
||||
toml
|
||||
typescript
|
||||
yaml
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
97
nixos/nvim/settings.nix
Executable file
97
nixos/nvim/settings.nix
Executable file
|
@ -0,0 +1,97 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.nixvim = {
|
||||
extraPackages = with pkgs; [ fd ];
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
clipboard.register = [
|
||||
"unnamed"
|
||||
"unnamedplus"
|
||||
];
|
||||
performance = {
|
||||
byteCompileLua = {
|
||||
enable = true;
|
||||
configs = true;
|
||||
initLua = false;
|
||||
nvimRuntime = true;
|
||||
plugins = true;
|
||||
};
|
||||
};
|
||||
# extraFiles = {
|
||||
# "queries/nix/injections.scm".text = lib.mkForce ''
|
||||
# (string_literal
|
||||
# (string_fragment) @lua
|
||||
# (#match? @lua ".*")
|
||||
# )
|
||||
# '';
|
||||
# };
|
||||
colorscheme = "catppuccin";
|
||||
colorschemes.catppuccin = {
|
||||
enable = true;
|
||||
#lazyLoad.enable = true;
|
||||
settings = {
|
||||
transparent_background = false;
|
||||
term_colors = false;
|
||||
styles = {
|
||||
conditionals = null;
|
||||
};
|
||||
custom_highlights = # lua
|
||||
''
|
||||
function(colors)
|
||||
return {
|
||||
Comment = { fg = "#f4b8e4", style = { "italic" } },
|
||||
["@punctuation.comment"] = { fg = "#f4b8e4", style = { "italic" } },
|
||||
["@variable"] = { fg = "#82eaf0" },
|
||||
["@operator"] = { fg = "#EBA0AC" },
|
||||
["@meta.block.paradox"] = { fg = "#EBA0AC" },
|
||||
["@comment.shebang"] = { fg = "#ef9f76", style = { "italic", "bold" } },
|
||||
["@punctuation.comment.shebang"] = { fg = "#ef9f76", style = { "italic", "bold" } },
|
||||
["@string.special.shell"] = { fg = "#82e5f0" },
|
||||
["@property.ts"] = { fg = "#32d5e7" },
|
||||
}
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
plugins = {
|
||||
aerial.enable = true;
|
||||
direnv.enable = true;
|
||||
web-devicons.enable = true;
|
||||
glow.enable = true;
|
||||
gitblame.enable = true;
|
||||
git-conflict.enable = true;
|
||||
nix.enable = true;
|
||||
nix-develop.enable = true;
|
||||
image.enable = true;
|
||||
which-key.enable = true;
|
||||
neocord.enable = false;
|
||||
lazydev.enable = true;
|
||||
neoconf.enable = true;
|
||||
colorizer = {
|
||||
enable = true;
|
||||
settings.user_default_options = {
|
||||
names = false;
|
||||
};
|
||||
};
|
||||
comment.enable = true;
|
||||
dotnet.enable = true;
|
||||
sqlite-lua.enable = true;
|
||||
};
|
||||
userCommands = {
|
||||
ViewInit = {
|
||||
desc = "Open the Neovim init.lua file";
|
||||
command = "lua vim.cmd('view '.. InitPath)";
|
||||
};
|
||||
};
|
||||
extraConfigLua = # lua
|
||||
''
|
||||
InitPath = debug.getinfo(1, "S").source:sub(2)
|
||||
print("Neovim init file location: " .. InitPath)
|
||||
'';
|
||||
extraConfigVim = ''
|
||||
set number " enable number lines
|
||||
set relativenumber " enable relative number lines
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -13,7 +13,6 @@ let
|
|||
curl
|
||||
git
|
||||
hub
|
||||
(nnn.override { withNerdIcons = true; })
|
||||
fzf
|
||||
ripgrep
|
||||
fastfetch
|
||||
|
@ -67,7 +66,10 @@ let
|
|||
python311Packages.python-lsp-server
|
||||
python311Packages.rich
|
||||
];
|
||||
flakePackages = with inputs; [ compose2nix.packages.${system}.default ];
|
||||
flakePackages = with inputs; [
|
||||
compose2nix.packages.${system}.default
|
||||
forgejo-cli.packages.${system}.default
|
||||
];
|
||||
in
|
||||
{
|
||||
environment.systemPackages = lib.lists.unique (packages ++ flakePackages);
|
||||
|
|
128
nixos/shell.nix
128
nixos/shell.nix
|
@ -1,54 +1,98 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
# enable bash completions
|
||||
# even though we don't use bash as our shell, xonsh uses bash completion scripts
|
||||
programs.bash.completion.enable = true;
|
||||
|
||||
programs.command-not-found.enable = false;
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
any-nix-shell
|
||||
];
|
||||
|
||||
users.defaultUserShell = pkgs.xonsh;
|
||||
programs.xonsh =
|
||||
let
|
||||
bashcfg = config.programs.bash;
|
||||
#xontrib-cd = pkgs.callPackage ../packages/xontribs/xontrib-cd.nix { inherit pkgs; };
|
||||
xontrib-clp = pkgs.callPackage ../packages/xontribs/xontrib-clp.nix { inherit pkgs; };
|
||||
xontrib-direnv = pkgs.callPackage ../packages/xontribs/xontrib-direnv.nix { inherit pkgs; };
|
||||
xontrib-sh = pkgs.callPackage ../packages/xontribs/xontrib-sh.nix { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
users.defaultUserShell = pkgs.zsh;
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
config = ''
|
||||
$BASH_COMPLETIONS = ('${bashcfg.completion.package}/etc/profile.d/bash_completion.sh')
|
||||
$UPDATE_OS_ENVIRON = True
|
||||
$XONTRIB_CLP_ALIAS = 'shutil'
|
||||
#xontrib load cd
|
||||
xontrib load clp
|
||||
xontrib load direnv
|
||||
xontrib load sh
|
||||
source-bash ${pkgs.nix-index}/etc/profile.d/command-not-found.sh
|
||||
tmpfile = $(mktemp)
|
||||
gh copilot alias -- bash > @(tmpfile)
|
||||
source-bash @(tmpfile)
|
||||
execx($(${pkgs.any-nix-shell}/bin/any-nix-shell xonsh --info-right))
|
||||
enableBashCompletion = true;
|
||||
enableCompletion = true;
|
||||
autosuggestions.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
|
||||
shellInit = # zsh
|
||||
''
|
||||
# Directory containing the Python scripts
|
||||
SCRIPT_DIR="/etc/nixos/scripts/py"
|
||||
|
||||
# Ensure the directory exists
|
||||
if [[ ! -d "$SCRIPT_DIR" ]]; then
|
||||
echo "Directory $SCRIPT_DIR does not exist."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Register aliases for each .py file in the directory
|
||||
for script in "$SCRIPT_DIR"/*.py; do
|
||||
[[ -f "$script" ]] || continue # Skip if no .py files found
|
||||
script_name="''${script##*/}" # Extract filename
|
||||
alias_name="''${script_name%.py}" # Strip .py extension
|
||||
alias "$alias_name"="\"$script\""
|
||||
done
|
||||
|
||||
_edit() {
|
||||
local args=("$@")
|
||||
if [[ ''${#args[@]} -eq 0 ]]; then
|
||||
args=(".")
|
||||
fi
|
||||
if [[ -n "$SSH_CONNECTION" ]]; then
|
||||
command "$EDITOR" "''${args[@]}"
|
||||
else
|
||||
command "$VISUAL" "''${args[@]}"
|
||||
fi
|
||||
}
|
||||
|
||||
if (( $+commands[kitten] )); then
|
||||
alias "ssh"="kitten ssh"
|
||||
fi
|
||||
|
||||
source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh
|
||||
'';
|
||||
package = pkgs.xonsh.override {
|
||||
extraPackages = ps: [
|
||||
pkgs.python311Packages.rich
|
||||
xontrib-clp
|
||||
xontrib-direnv
|
||||
xontrib-sh
|
||||
];
|
||||
};
|
||||
|
||||
promptInit = # zsh
|
||||
''
|
||||
${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin
|
||||
'';
|
||||
|
||||
shellAliases = {
|
||||
ff = "fastfetch";
|
||||
neofetch = "fastfetch";
|
||||
nf = "fastfetch";
|
||||
lg = "lazygit";
|
||||
lad = "lazydocker";
|
||||
clip = "wl-copy";
|
||||
clp = "clip";
|
||||
paste = "wl-paste";
|
||||
cat = "bat";
|
||||
git = "hub";
|
||||
cc = "fj --host=https://c.csw.im --style=fancy";
|
||||
cb = "fj --host https://codeberg.org --style=fancy";
|
||||
eza = "eza --time-style=long-iso --icons=auto --hyperlink";
|
||||
l = "eza -lhg";
|
||||
la = "eza -lAh";
|
||||
ll = "l";
|
||||
ls = "eza";
|
||||
lsa = "eza -lah";
|
||||
tree = "eza --tree --git-ignore";
|
||||
nixpkgs-update = "nix run ;--option extra-substituters 'https://nix-community.cachix.org/' --option extra-trusted-public-keys 'nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=' github:ryantm/nixpkgs-update --";
|
||||
nixrc = "edit /etc/nixos";
|
||||
taildrop = "tailscale file";
|
||||
forgejo-runner = "act_runner";
|
||||
runactions = "act_runner exec --default-actions-url=https://c.csw.im --gitea-instance=https://c.csw.im";
|
||||
uvr = "uv run";
|
||||
ns = "nix-shell";
|
||||
edit = "_edit";
|
||||
e = "edit";
|
||||
c = "clear";
|
||||
sudo = "sudo ";
|
||||
s = "sudo";
|
||||
};
|
||||
|
||||
#TODO: Submit a PR to nixpkgs to add xonsh support to the Starship module
|
||||
# After that, we can remove this import and the disabledModules line
|
||||
disabledModules = [ "programs/starship.nix" ];
|
||||
imports = [ /bulk/home/cswimr/Projects/nixpkgs/nixos/modules/programs/starship.nix ];
|
||||
histSize = 10000;
|
||||
histFile = "$HOME/.zsh_history";
|
||||
};
|
||||
|
||||
# starship - a customizable prompt for any shell
|
||||
programs.starship = {
|
||||
|
|
|
@ -8,6 +8,10 @@
|
|||
owner = user;
|
||||
path = "/home/${user}/.secrets/coastalcommits";
|
||||
};
|
||||
"codeberg" = {
|
||||
owner = user;
|
||||
path = "/home/${user}/.secrets/codeberg";
|
||||
};
|
||||
"zipline" = {
|
||||
owner = user;
|
||||
path = "/home/${user}/.secrets/zipline";
|
||||
|
|
|
@ -5,7 +5,7 @@ pkgs.stdenv.mkDerivation {
|
|||
version = "1.0";
|
||||
|
||||
src = pkgs.fetchurl {
|
||||
url = "https://www.coastalcommits.com/cswimr/fonts/archive/master.tar.gz";
|
||||
url = "https://c.csw.im/cswimr/fonts/archive/master.tar.gz";
|
||||
sha256 = "sha256-XBRNu1DxjhfloJkQrFy4Wz4IUD6abhKcZKkX/snyxs4";
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
{ pkgs, lib, ...
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
pname = "luau-lsp";
|
||||
|
@ -12,8 +15,7 @@ pkgs.stdenv.mkDerivation rec {
|
|||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkgs.cmake ]
|
||||
++ lib.optional pkgs.stdenv.isLinux pkgs.gcc9;
|
||||
nativeBuildInputs = [ pkgs.cmake ] ++ lib.optional pkgs.stdenv.isLinux pkgs.gcc9;
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
|
3
pyrightconfig.json
Normal file
3
pyrightconfig.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"typeCheckingMode": "off"
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
{
|
||||
"extends": [
|
||||
"config:best-practices"
|
||||
],
|
||||
"extends": ["config:best-practices"],
|
||||
"lockFileMaintenance": {
|
||||
"enabled": true
|
||||
},
|
||||
|
|
|
@ -3,13 +3,21 @@ let
|
|||
config = { };
|
||||
overlays = [ ];
|
||||
};
|
||||
pythonPackages = with pkgs.python312Packages; [
|
||||
requests
|
||||
pyperclip
|
||||
pillow
|
||||
pyside6
|
||||
];
|
||||
in
|
||||
pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
packages =
|
||||
with pkgs;
|
||||
pkgs.lib.lists.unique (
|
||||
[
|
||||
libnotify
|
||||
python312
|
||||
python312Packages.requests
|
||||
python312Packages.pyperclip
|
||||
python312Packages.pillow
|
||||
];
|
||||
]
|
||||
++ pythonPackages
|
||||
);
|
||||
}
|
||||
|
|
49
scripts/py/common/colors.py
Normal file
49
scripts/py/common/colors.py
Normal file
|
@ -0,0 +1,49 @@
|
|||
# SGR color constants
|
||||
# rene-d 2018
|
||||
# https://gist.github.com/rene-d/9e584a7dd2935d0f461904b9f2950007
|
||||
|
||||
|
||||
class Colors:
|
||||
"""ANSI color codes"""
|
||||
|
||||
BLACK = "\033[0;30m"
|
||||
RED = "\033[0;31m"
|
||||
GREEN = "\033[0;32m"
|
||||
BROWN = "\033[0;33m"
|
||||
BLUE = "\033[0;34m"
|
||||
PURPLE = "\033[0;35m"
|
||||
CYAN = "\033[0;36m"
|
||||
LIGHT_GRAY = "\033[0;37m"
|
||||
DARK_GRAY = "\033[1;30m"
|
||||
LIGHT_RED = "\033[1;31m"
|
||||
LIGHT_GREEN = "\033[1;32m"
|
||||
YELLOW = "\033[1;33m"
|
||||
LIGHT_BLUE = "\033[1;34m"
|
||||
LIGHT_PURPLE = "\033[1;35m"
|
||||
LIGHT_CYAN = "\033[1;36m"
|
||||
LIGHT_WHITE = "\033[1;37m"
|
||||
BOLD = "\033[1m"
|
||||
FAINT = "\033[2m"
|
||||
ITALIC = "\033[3m"
|
||||
UNDERLINE = "\033[4m"
|
||||
BLINK = "\033[5m"
|
||||
NEGATIVE = "\033[7m"
|
||||
CROSSED = "\033[9m"
|
||||
END = "\033[0m"
|
||||
# cancel SGR codes if we don't write to a terminal
|
||||
if not __import__("sys").stdout.isatty():
|
||||
for _ in dir():
|
||||
if isinstance(_, str) and _[0] != "_":
|
||||
locals()[_] = ""
|
||||
else:
|
||||
# set Windows console in VT mode
|
||||
if __import__("platform").system() == "Windows":
|
||||
kernel32 = __import__("ctypes").windll.kernel32
|
||||
kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)
|
||||
del kernel32
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
for i in dir(Colors):
|
||||
if i[0:1] != "_" and i != "END":
|
||||
print("{:>16} {}".format(i, getattr(Colors, i) + i + Colors.END))
|
|
@ -3,6 +3,50 @@ import subprocess
|
|||
from pathlib import Path
|
||||
from shutil import which
|
||||
|
||||
from common.colors import Colors as c
|
||||
|
||||
|
||||
def format_link(link: str, text: str) -> str:
|
||||
return f"\033]8;;{link}\033\\{text}\033]8;;\033\\"
|
||||
|
||||
|
||||
def get_environment() -> dict[str, str]:
|
||||
env = dict(os.environ)
|
||||
env["DIRENV_DISABLE"] = "1"
|
||||
return env
|
||||
|
||||
|
||||
def run(
|
||||
cmd: list[str],
|
||||
cwd: Path = Path.cwd(),
|
||||
exit_on_error: bool = True,
|
||||
env: dict[str, str] | None = None,
|
||||
**kwargs,
|
||||
) -> subprocess.CompletedProcess:
|
||||
if not env:
|
||||
env = get_environment()
|
||||
|
||||
print(f"{c.GREEN}Running command: {c.PURPLE}'{' '.join(cmd)}'{c.END}")
|
||||
if cwd != Path.cwd():
|
||||
print(
|
||||
f"{c.GREEN} in directory: {c.YELLOW}'{format_link(link='file://' + str(cwd), text=cwd)}'{c.END}"
|
||||
)
|
||||
|
||||
result = subprocess.run(cmd, cwd=cwd, check=False, env=env, **kwargs)
|
||||
|
||||
if result.returncode != 0:
|
||||
print(
|
||||
f"{c.RED}Command exited with non-zero exit code {c.CYAN}{c.BOLD}{result.returncode}{c.END}"
|
||||
)
|
||||
if exit_on_error is True:
|
||||
result.check_returncode()
|
||||
else:
|
||||
print(
|
||||
f"{c.GREEN}Command exited with exit code {c.CYAN}{c.BOLD}{result.returncode}{c.END}"
|
||||
)
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def notify(
|
||||
application_name: str,
|
||||
|
@ -30,7 +74,7 @@ def notify(
|
|||
args.append(title)
|
||||
args.append(message)
|
||||
print(args)
|
||||
subprocess.run(args)
|
||||
run(cmd=args)
|
||||
|
||||
|
||||
def read_secret_file(secret: str, home: bool = False) -> str:
|
||||
|
@ -57,8 +101,8 @@ def does_desktop_entry_exist(desktop_entry: str, show_all_paths: bool = True) ->
|
|||
entry_paths = []
|
||||
|
||||
if which("qtpaths"):
|
||||
result = subprocess.run(
|
||||
["qtpaths", "--paths", "ApplicationsLocation"],
|
||||
result = run(
|
||||
cmd=["qtpaths", "--paths", "ApplicationsLocation"],
|
||||
stdout=subprocess.PIPE,
|
||||
text=True,
|
||||
)
|
||||
|
|
|
@ -8,11 +8,15 @@ import tempfile
|
|||
from pathlib import Path
|
||||
from shutil import which
|
||||
|
||||
from common.common import notify # type: ignore
|
||||
from common.common import notify, run
|
||||
from PySide6.QtGui import QImageWriter # type: ignore
|
||||
|
||||
|
||||
def spectacle_screenshot(
|
||||
url: str | None = None, record: bool = False, file_path: Path | None = None
|
||||
url: str | None = None,
|
||||
record: bool = False,
|
||||
file_path: Path | None = None,
|
||||
format: str | None = None,
|
||||
) -> None:
|
||||
try:
|
||||
if not which("spectacle"):
|
||||
|
@ -23,10 +27,23 @@ def spectacle_screenshot(
|
|||
'File already exists. Please provide a different file path, or use the zipline function to upload the file.\nExample: zipline "{file_path}"'
|
||||
)
|
||||
|
||||
accepted_formats = [
|
||||
f.data().decode() for f in QImageWriter.supportedImageFormats()
|
||||
]
|
||||
accepted_formats.extend(("webm", "mp4"))
|
||||
print(accepted_formats)
|
||||
if not format:
|
||||
format = "mp4" if record else "png"
|
||||
if format.lower() not in accepted_formats:
|
||||
raise ValueError(
|
||||
f"Invalid format. Accepted formats are: {', '.join(accepted_formats)}"
|
||||
)
|
||||
else:
|
||||
format = f".{str(format)}"
|
||||
|
||||
if not file_path:
|
||||
use_temp_file = True
|
||||
suffix = ".webm" if record else ".png"
|
||||
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=suffix)
|
||||
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=format)
|
||||
file_path = Path(temp_file.name)
|
||||
temp_file.close()
|
||||
else:
|
||||
|
@ -39,7 +56,7 @@ def spectacle_screenshot(
|
|||
"--pointer",
|
||||
"--copy-image",
|
||||
"--output",
|
||||
file_path,
|
||||
str(file_path),
|
||||
]
|
||||
|
||||
if record:
|
||||
|
@ -48,7 +65,7 @@ def spectacle_screenshot(
|
|||
command.append("--region")
|
||||
|
||||
try:
|
||||
subprocess.run(command, check=True) # type: ignore
|
||||
run(command)
|
||||
except subprocess.CalledProcessError as e:
|
||||
if Path(file_path).exists() and use_temp_file:
|
||||
os.remove(file_path)
|
||||
|
@ -61,7 +78,7 @@ def spectacle_screenshot(
|
|||
try:
|
||||
opts = [
|
||||
"/etc/nixos/scripts/py/zipline.py",
|
||||
file_path,
|
||||
str(file_path),
|
||||
"--application-name",
|
||||
"Spectacle",
|
||||
"--desktop-entry",
|
||||
|
@ -69,7 +86,7 @@ def spectacle_screenshot(
|
|||
]
|
||||
if url:
|
||||
opts.extend(["--url", url])
|
||||
subprocess.run(opts) # type: ignore
|
||||
run(cmd=opts) # type: ignore
|
||||
finally:
|
||||
if Path(file_path).exists() and use_temp_file:
|
||||
os.remove(file_path)
|
||||
|
@ -96,6 +113,11 @@ if __name__ == "__main__":
|
|||
help="The URL of the Zipline instance to upload the screenshot or recording to. Defaults to 'https://csw.im'.",
|
||||
default="https://csw.im",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--format",
|
||||
help="The format of the screenshot. Defaults to 'png' if `--record` is not set, and 'mp4' if `--record` is set.",
|
||||
default=None,
|
||||
)
|
||||
parser.add_argument(
|
||||
"--record",
|
||||
help="If this is set, Spectacle will record the region instead of taking a screenshot.",
|
||||
|
@ -113,4 +135,5 @@ if __name__ == "__main__":
|
|||
url=args.url,
|
||||
record=args.record,
|
||||
file_path=args.file_path,
|
||||
format=args.format,
|
||||
)
|
||||
|
|
133
scripts/py/upd.py
Executable file
133
scripts/py/upd.py
Executable file
|
@ -0,0 +1,133 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell /etc/nixos/scripts/nix/python.nix -i python
|
||||
|
||||
from argparse import ArgumentParser
|
||||
from pathlib import Path
|
||||
from socket import gethostname
|
||||
|
||||
from common.colors import Colors as c
|
||||
from common.common import run
|
||||
|
||||
|
||||
def _upd(
|
||||
subcommand: str = "switch",
|
||||
pull: bool = False,
|
||||
lock: bool = False,
|
||||
rewrite_hardware_configuration: bool = False,
|
||||
purge_vscode_extensions: bool = False,
|
||||
extra_args: list = [],
|
||||
):
|
||||
path = Path("/etc/nixos")
|
||||
if subcommand not in ("switch", "boot", "test", "build-vm"):
|
||||
raise ValueError(f"{subcommand} is not a valid subcommand!")
|
||||
if path.exists():
|
||||
files_to_delete = {
|
||||
"Visual Studio Code user settings": ".config/Code/User/settings.json.bak",
|
||||
"fontconfig": ".config/fontconfig/conf.d/10-hm-fonts.conf.bak",
|
||||
}
|
||||
if pull:
|
||||
print(
|
||||
f"{c.BLUE}Pulling {c.YELLOW}NixOS{c.BLUE} configuration from remote{c.END}"
|
||||
)
|
||||
run(["git", "pull"], cwd=path)
|
||||
if lock:
|
||||
print(f"{c.BLUE}Updating {c.YELLOW}Nix Flake{c.BLUE} lock file{c.END}")
|
||||
run(["nix", "flake", "update", *extra_args], cwd=path)
|
||||
if rewrite_hardware_configuration:
|
||||
print(
|
||||
f"{c.BLUE}Updating {c.YELLOW}NixOS{c.BLUE} hardware configuration file for {c.YELLOW}{gethostname()}{c.BLUE}{c.END}"
|
||||
)
|
||||
run(
|
||||
[
|
||||
"sudo",
|
||||
"nixos-generate-config",
|
||||
"--dir",
|
||||
".",
|
||||
],
|
||||
cwd=path / "hosts",
|
||||
)
|
||||
print(
|
||||
f"{c.BLUE}Deleting redundant {c.YELLOW}NixOS{c.BLUE} configuration file{c.END}"
|
||||
)
|
||||
run(["sudo", "rm", "configuration.nix"], cwd=path / "hosts")
|
||||
print(
|
||||
f"{c.BLUE}Moving {c.YELLOW}NixOS{c.BLUE} hardware configuration file{c.END}"
|
||||
)
|
||||
run(
|
||||
[
|
||||
"sudo",
|
||||
"mv",
|
||||
"hardware-configuration.nix",
|
||||
"{hostname}.nix".format(hostname=gethostname()),
|
||||
],
|
||||
cwd=path / "hosts",
|
||||
)
|
||||
print(
|
||||
f"{c.BLUE}Adding {c.YELLOW}NixOS{c.BLUE} hardware configuration file for {c.YELLOW}{gethostname()}{c.BLUE} to git{c.END}"
|
||||
)
|
||||
run(
|
||||
["git", "add", "hosts/{hostname}.nix".format(hostname=gethostname())],
|
||||
cwd=path,
|
||||
)
|
||||
for file_description, file_path in files_to_delete.items():
|
||||
print(
|
||||
f"{c.BLUE}Deleting {c.YELLOW}{file_description}{c.BLUE} backup file{c.END}"
|
||||
)
|
||||
run(["rm", file_path], exit_on_error=False, cwd="/home/cswimr")
|
||||
if purge_vscode_extensions:
|
||||
print(
|
||||
f"{c.BLUE}Killing {c.YELLOW}Visual Studio Code{c.BLUE} processes{c.END}"
|
||||
)
|
||||
run(["killall", "code"], exit_on_error=False)
|
||||
print(
|
||||
f"{c.BLUE}Purging {c.YELLOW}Visual Studio Code{c.BLUE} extensions{c.END}"
|
||||
)
|
||||
run(["rm", "-rf", ".vscode/extensions"], cwd="/home/cswimr")
|
||||
print(f"{c.BLUE}Rebuilding {c.YELLOW}NixOS{c.BLUE} configuration{c.END}")
|
||||
if "--impure" in extra_args:
|
||||
print(f"{c.RED}WARNING: The --impure flag is set!{c.END}")
|
||||
run(["sudo", "nixos-rebuild", subcommand, *extra_args], cwd=path)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = ArgumentParser(
|
||||
prog="upd.py",
|
||||
description="Update your NixOS system via a convenient wrapper script.",
|
||||
epilog="Example usage: upd.py",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--subcommand",
|
||||
help="Which subcommand of `nixos-rebuild` to run.",
|
||||
default="switch",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--pull",
|
||||
help="If this is set, the script will run `git pull` in the flake directory before updating.",
|
||||
action="store_true",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--lock",
|
||||
help="If this is set, `nix flake update` will be ran before the system is updated.",
|
||||
action="store_true",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--rewrite-hardware-configuration",
|
||||
help="If this is set, `nixos-generate-config` will be ran before the system is updated.",
|
||||
action="store_true",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--purge-vscode-extensions",
|
||||
help="If this is set, extensions in the `~/.vscode/extensions` folder will be deleted before the system is updated.",
|
||||
action="store_true",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
_upd(
|
||||
subcommand=args.subcommand,
|
||||
pull=args.pull,
|
||||
lock=args.lock,
|
||||
rewrite_hardware_configuration=args.rewrite_hardware_configuration,
|
||||
purge_vscode_extensions=args.purge_vscode_extensions,
|
||||
# extra_args = args.extra_args
|
||||
)
|
41
scripts/py/vm.py
Executable file
41
scripts/py/vm.py
Executable file
|
@ -0,0 +1,41 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell /etc/nixos/scripts/nix/python.nix -i python
|
||||
|
||||
from argparse import ArgumentParser
|
||||
from pathlib import Path
|
||||
|
||||
from common.colors import Colors as c
|
||||
from common.common import run
|
||||
|
||||
|
||||
def _vm(name: str = "nixpkgs", args: list = []):
|
||||
if name == "nixpkgs":
|
||||
args.extend(["-I", "nixpkgs=/bulk/home/cswimr/Projects/nixpkgs"])
|
||||
path = Path(f"/etc/nixos/hosts/virtual-machines/{name}")
|
||||
if path.exists():
|
||||
if (path / "flake.nix").exists():
|
||||
args.extend(["--flake", f"{path}#nixos"])
|
||||
elif (path / "default.nix").exists():
|
||||
args.extend(["-I", f"nixos-config={path}/default.nix", "--no-flake"])
|
||||
print(f"{c.BLUE}Building virtual machine {c.YELLOW}{name}{c.END}")
|
||||
run(["nixos-rebuild", "build-vm", *args], cwd=path)
|
||||
print(f"{c.BLUE}Starting virtual vachine {c.YELLOW}{name}{c.END}")
|
||||
run(["./result/bin/run-nixos-vm"], cwd=path)
|
||||
print(
|
||||
f"{c.BLUE}Virtual machine {c.YELLOW}{name} {c.BLUE}has {c.RED}stopped.{c.END}"
|
||||
)
|
||||
else:
|
||||
raise FileNotFoundError(f"Virtual machine {name} does not exist.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = ArgumentParser(
|
||||
prog="vm.py",
|
||||
description="Run a NixOS virtual machine from the system flake.",
|
||||
epilog="Example usage: vm.py nixpkgs",
|
||||
)
|
||||
parser.add_argument("name", help="Which virtual machine to run.")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
_vm(name=args.name)
|
Loading…
Add table
Reference in a new issue