48 Commits

Author SHA1 Message Date
2d8a84c286 remove old neovim lua config 2023-04-10 14:49:17 -04:00
319106364a add keybase back as homebrew package 2023-04-08 12:26:14 -04:00
fd5d6ab141 update lockfile, neovim tf filetype working again 2023-04-07 13:00:35 -04:00
4df1132eb7 switch to babelfish to improve fish macos startup 2023-04-05 14:11:44 -04:00
f4d9897f21 reset lookinglass hostname and email 2023-04-05 14:10:54 -04:00
634baf0a7e fix: keep polybar mail updated 2023-04-04 08:32:01 -04:00
600fd06974 fix nautilus and xdg mimetypes
discovered sushi is not working, however
2023-04-03 21:54:53 -04:00
c9ab46696d reenable mbsync timer with notmuch
fixes polybar mail indicator
2023-04-03 20:36:05 -04:00
b5790a2795 disable long running command notifications 2023-04-03 20:35:30 -04:00
61f26315d5 setup ultrawide curved monitor 2023-04-03 11:51:04 -04:00
4fefe54435 add email notifications
not required to run aerc, uses imapnotify and notmuch/polybar

closes #10
2023-04-02 23:16:44 -04:00
0833a0009c enable dunst notifications
also rebuilds with shortcuts
2023-04-02 19:19:40 -04:00
e349ac35b8 fix: flake app for rebuilds 2023-04-02 18:47:06 -04:00
49c2c013a2 update polybar spacing 2023-04-02 18:46:22 -04:00
985b8bf13b polybar audio and power buttons
also switched from systemd because it breaks rofi
2023-04-02 16:53:01 -04:00
8283480fd1 rofi brightness menu 2023-04-02 15:52:45 -04:00
d6611ca7a2 rofi power menu 2023-04-02 12:25:33 -04:00
a13083a264 now really fix sleep 2023-04-02 08:22:28 -04:00
ff4db1463e finally fix sleep on tempest 2023-04-01 20:21:26 -04:00
afedfcf187 i3 focus or run browser and mail 2023-04-01 09:41:45 -04:00
2e3c376d73 add prs shortcut 2023-03-31 12:39:10 -04:00
59824adb3a much improved speed in fzf project switcher 2023-03-30 10:24:19 -04:00
8e32c16fd3 try to fix timezone failure 2023-03-27 13:45:23 -04:00
76c80dd31d fix: samba don't use force group 2023-03-26 20:52:28 +00:00
57de089baf add mpv delete file script 2023-03-25 10:51:20 -04:00
f9c09deb2a compile all grammars for nvim-treesitter 2023-03-24 16:20:47 -04:00
b06b6490f4 start working on readme table
fill out readme table

more readme links and move installation

clean up

add more flake comments

hosts and modules readmes

fix: macos readme link

switch links to relative file
2023-03-22 21:38:39 -04:00
514244476d adjust rofi themes 2023-03-22 21:33:06 -04:00
47590abc3a lazy evaluated let for rofi 2023-03-22 21:17:15 -04:00
f69d233c39 switch audio with rofi and add extraLib 2023-03-22 21:15:41 -04:00
9b97c9ac84 update lockfile, fix darwin 2023-03-22 16:20:38 -04:00
bda59eeb4a enable num lock on login 2023-03-21 18:37:22 -04:00
e7468ecc46 fix: swan globals not included 2023-03-20 03:36:15 +00:00
1b798f5af0 grant permissions to service directories 2023-03-20 03:35:54 +00:00
4406116203 adjust fan curve 2023-03-19 23:35:06 -04:00
c53f1470ee allow rofi-systemd to use kitty terminal 2023-03-19 12:49:41 -04:00
da89732001 switch to nsxiv and set media for aerc 2023-03-19 10:45:52 -04:00
2176a53c4a setup amd gpu fancontrol curve 2023-03-18 09:29:20 -04:00
28576c1b8f update lockfile 2023-03-16 14:52:20 -04:00
64590c539b reorder utilities alphabetically
also add bc
2023-03-12 20:09:56 -04:00
78b364afd7 launch aerc with super+E 2023-03-12 20:09:41 -04:00
f219ce45c8 enable actual bash support 2023-03-12 19:00:59 -04:00
5002c881f7 fix: mail not syncing read and deleted 2023-03-12 17:08:21 -04:00
5859377802 fix: arr options when not used 2023-03-12 17:08:21 -04:00
e6dbed2e17 enable caddy logfile 2023-03-12 13:24:25 +00:00
86076f0844 add arr services 2023-03-12 13:24:16 +00:00
2aea76c0e3 switch mpv to managed settings 2023-03-11 14:14:45 -05:00
42a5ad40de add heroic game launcher 2023-03-11 14:14:25 -05:00
72 changed files with 1061 additions and 1279 deletions

118
README.md
View File

@ -6,21 +6,56 @@ hosts.
They are organized and managed by [Nix](https://nixos.org), so some of the They are organized and managed by [Nix](https://nixos.org), so some of the
configuration may be difficult to translate to a non-Nix system. configuration may be difficult to translate to a non-Nix system.
However, some of the configurations are easier to lift directly: ## System Features
- [Neovim](https://github.com/nmasur/dotfiles/tree/master/modules/common/neovim/config) | Feature | Program | Configuration |
- [Fish functions](https://github.com/nmasur/dotfiles/tree/master/modules/common/shell/fish/functions) | --- | --- | --- |
- [More fish aliases](https://github.com/nmasur/dotfiles/blob/master/modules/common/shell/fish/default.nix) | OS | [NixOS](https://nixos.org) | [Link](./modules/nixos) |
- [Git aliases](https://github.com/nmasur/dotfiles/blob/master/modules/common/shell/git.nix) | Display Server | [X11](https://www.x.org/wiki/) | [Link](./modules/nixos/graphical/xorg.nix) |
- [Hammerspoon](https://github.com/nmasur/dotfiles/tree/master/modules/darwin/hammerspoon) | Compositor | [Picom](https://github.com/yshui/picom) | [Link](./modules/nixos/graphical/picom.nix) |
| Window Manager | [i3](https://i3wm.org/) | [Link](./modules/nixos/graphical/i3.nix) |
| Panel | [Polybar](https://polybar.github.io/) | [Link](./modules/nixos/graphical/polybar.nix) |
| Font | [Victor Mono](https://rubjo.github.io/victor-mono/) | [Link](./modules/nixos/graphical/fonts.nix) |
| Launcher | [Rofi](https://github.com/davatorium/rofi) | [Link](./modules/nixos/graphical/rofi.nix) |
Try out my Neovim config (requires [nix](https://nixos.org/download.html)): ## User Features
| Feature | Program | Configuration |
| --- | --- | --- |
| Dotfiles | [Home-Manager](https://github.com/nix-community/home-manager) | [Link](./modules/common) |
| Terminal | [Kitty](https://sw.kovidgoyal.net/kitty/) | [Link](./modules/common/applications/kitty.nix) |
| Shell | [Fish](https://fishshell.com/) | [Link](./modules/common/shell/fish) |
| Shell Prompt | [Starship](https://starship.rs/) | [Link](./modules/common/shell/starhip.nix) |
| Colorscheme | [Gruvbox](https://github.com/morhetz/gruvbox) | [Link](./colorscheme/gruvbox) |
| Wallpaper | [Road](https://gitlab.com/exorcist365/wallpapers/-/blob/master/gruvbox/road.jpg) | [Link](./hosts/tempest/default.nix)
| Text Editor | [Neovim](https://neovim.io/) | [Link](./modules/common/neovim/config) |
| Browser | [Firefox](https://www.mozilla.org/en-US/firefox/new/) | [Link](./modules/common/applications/firefox.nix) |
| E-Mail | [Aerc](https://aerc-mail.org/) | [Link](./modules/common/mail/aerc.nix) |
| File Manager | [Nautilus](https://wiki.gnome.org/action/show/Apps/Files) | [Link](./modules/common/applications/nautilus.nix) |
| PDF Reader | [Zathura](https://pwmt.org/projects/zathura/) | [Link](./modules/common/applications/media.nix) |
| Video Player | [mpv](https://mpv.io/) | [Link](./modules/common/applications/media.nix) |
## macOS Features
| Feature | Program | Configuration |
| --- | --- | --- |
| Keybinds | [Hammerspoon](https://www.hammerspoon.org/) | [Link](./modules/darwin/hammerspoon) |
---
# Installation
Click [here](./docs/installation.md) for detailed installation instructions.
# Neovim
Try out my Neovim config with nix:
```bash ```bash
nix run github:nmasur/dotfiles#neovim nix run github:nmasur/dotfiles#neovim
``` ```
Or build it as a package (requires [nix](https://nixos.org/download.html)): Or build it as a package:
```bash ```bash
nix build github:nmasur/dotfiles#neovim nix build github:nmasur/dotfiles#neovim
@ -30,73 +65,6 @@ If you already have a Neovim configuration, you may need to move it out of
`~/.config/nvim` or set `XDG_CONFIG_HOME` to another value; otherwise both `~/.config/nvim` or set `XDG_CONFIG_HOME` to another value; otherwise both
configs might conflict with each other. configs might conflict with each other.
---
# Full Installation
## NixOS - From Live Disk
Format drives and build system from any NixOS host, including the live
installer disk:
**This will erase your drives; use at your own risk!**
```bash
lsblk # Choose the disk you want to wipe
nix-shell -p nixVersions.stable
nix run github:nmasur/dotfiles#installer -- nvme0n1 tempest
```
## NixOS - From Existing System
If you're already running NixOS, you can switch to this configuration with the
following command:
```bash
nix-shell -p nixVersions.stable
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#tempest
```
## Windows - From NixOS WSL
After [installing NixOS on
WSL](https://xeiaso.net/blog/nix-flakes-4-wsl-2022-05-01), you can switch to
the WSL configuration:
```
nix-shell -p nixVersions.stable
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#hydra
```
You should also download the
[FiraCode](https://github.com/ryanoasis/nerd-fonts/releases/download/v2.2.2/FiraCode.zip)
font and install it on Windows. Install [Alacritty](https://alacritty.org/) and
move the `windows/alacritty.yml` file to
`C:\Users\<user>\AppData\Roaming\alacritty`.
## macOS
To get started on a bare macOS installation, first install Nix:
```bash
sh -c "$(curl -L https://nixos.org/nix/install)"
```
Then use Nix to build nix-darwin:
```bash
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
./result/bin/darwin-installer
```
Then switch to the macOS configuration:
```bash
darwin-rebuild switch --flake github:nmasur/dotfiles#lookingglass
```
---
# Flake Templates # Flake Templates
You can also use the [templates](./templates/) as flakes for starting new You can also use the [templates](./templates/) as flakes for starting new

View File

@ -6,9 +6,9 @@
echo ${pkgs.system} echo ${pkgs.system}
SYSTEM=${if pkgs.stdenv.isDarwin then "darwin" else "linux"} SYSTEM=${if pkgs.stdenv.isDarwin then "darwin" else "linux"}
if [ "$SYSTEM" == "darwin" ]; then if [ "$SYSTEM" == "darwin" ]; then
darwin-rebuild switch --flake github:nmasur/dotfiles#lookingglass sudo darwin-rebuild switch --flake ${builtins.toString ../.}
else else
nixos-rebuild switch --flake github:nmasur/dotfiles doas nixos-rebuild switch --flake ${builtins.toString ../.}
fi fi
''); '');

67
docs/installation.md Normal file
View File

@ -0,0 +1,67 @@
[Back to README](../README.md)
---
# Installation
## NixOS - From Live Disk
Format drives and build system from any NixOS host, including the live
installer disk:
**This will erase your drives; use at your own risk!**
```bash
lsblk # Choose the disk you want to wipe
nix-shell -p nixVersions.stable
nix run github:nmasur/dotfiles#installer -- nvme0n1 tempest
```
## NixOS - From Existing System
If you're already running NixOS, you can switch to this configuration with the
following command:
```bash
nix-shell -p nixVersions.stable
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#tempest
```
## Windows - From NixOS WSL
After [installing NixOS on
WSL](https://xeiaso.net/blog/nix-flakes-4-wsl-2022-05-01), you can switch to
the WSL configuration:
```
nix-shell -p nixVersions.stable
sudo nixos-rebuild switch --flake github:nmasur/dotfiles#hydra
```
You should also download the
[FiraCode](https://github.com/ryanoasis/nerd-fonts/releases/download/v2.2.2/FiraCode.zip)
font and install it on Windows. Install [Alacritty](https://alacritty.org/) and
move the `windows/alacritty.yml` file to
`C:\Users\<user>\AppData\Roaming\alacritty`.
## macOS
To get started on a bare macOS installation, first install Nix:
```bash
sh -c "$(curl -L https://nixos.org/nix/install)"
```
Then use Nix to build nix-darwin:
```bash
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
./result/bin/darwin-installer
```
Then switch to the macOS configuration:
```bash
darwin-rebuild switch --flake github:nmasur/dotfiles#lookingglass
```

145
flake.lock generated
View File

@ -3,11 +3,11 @@
"Comment-nvim-src": { "Comment-nvim-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1674040818, "lastModified": 1678452935,
"narHash": "sha256-7UtZAE9tPlnpeHS2LLol/LGVOxptDXNKWXHNHvFBNk4=", "narHash": "sha256-mVJJJ9fUJYgVyGZnW8e6P5QWB0K8nuhTwSWzlBvxv2M=",
"owner": "numToStr", "owner": "numToStr",
"repo": "Comment.nvim", "repo": "Comment.nvim",
"rev": "eab2c83a0207369900e92783f56990808082eac2", "rev": "8d3aa5c22c2d45e788c7a5fe13ad77368b783c20",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -19,11 +19,11 @@
"bufferline-nvim-src": { "bufferline-nvim-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1676130961, "lastModified": 1677796018,
"narHash": "sha256-3LT45i0eSMfUV9EBrtdtzHxFKRATIhRy/faDd3lI3mA=", "narHash": "sha256-tuGitJQ2eXB9/SIHAyPrEVgy2n++GOlBOPLvFv3Ds4E=",
"owner": "akinsho", "owner": "akinsho",
"repo": "bufferline.nvim", "repo": "bufferline.nvim",
"rev": "84b0822b2af478d0b4f7b0f9249ca218855331db", "rev": "3677aceb9a72630b0613e56516c8f7151b86f95c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -55,11 +55,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1673295039, "lastModified": 1680266963,
"narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", "narHash": "sha256-IW/lzbUCOcldLHWHjNSg1YoViDnZOmz0ZJL7EH9OkV8=",
"owner": "lnl7", "owner": "lnl7",
"repo": "nix-darwin", "repo": "nix-darwin",
"rev": "87b9d090ad39b25b2400029c64825fc2a8868943", "rev": "99d4187d11be86b49baa3a1aec0530004072374f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -76,11 +76,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1677116397, "lastModified": 1678912468,
"narHash": "sha256-2OHwhv4k1SDEuNxhq+zluvrd5pbW8d4TP9NKW4B8iO8=", "narHash": "sha256-oUo6ZrsuqymuMLLvGfgnQ464OMKnUONv+ryea07iGrE=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "8fddb2fd721365fa77ff68b709539639d4dc65d7", "rev": "e8650fc36bf9d2acb411ba0047f863b8e481e3bb",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -94,11 +94,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1676854489, "lastModified": 1679446046,
"narHash": "sha256-hWmx3JFLNPGMtflyjgEn5GZydbLW3msjXvarS1NsBDM=", "narHash": "sha256-CBjVE3Sj7Ls1pffxGavqPXRkaLYy1+O88NzBwNdgNcY=",
"owner": "bandithedoge", "owner": "bandithedoge",
"repo": "nixpkgs-firefox-darwin", "repo": "nixpkgs-firefox-darwin",
"rev": "6a5cca0ea8dfab4718e1e43e243c80ba110c2364", "rev": "1531f1477881e76c67b123a55f3d44ed7f83a4ba",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -125,11 +125,11 @@
}, },
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1667395993, "lastModified": 1678901627,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -155,11 +155,11 @@
}, },
"flake-utils_3": { "flake-utils_3": {
"locked": { "locked": {
"lastModified": 1667395993, "lastModified": 1676283394,
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -176,11 +176,11 @@
"utils": "utils" "utils": "utils"
}, },
"locked": { "locked": {
"lastModified": 1678271387, "lastModified": 1680667162,
"narHash": "sha256-H2dv/i1LRlunRtrESirELzfPWdlG/6ElDB1ksO529H4=", "narHash": "sha256-2vgxK4j42y73S3XB2cThz1dSEyK9J9tfu4mhuEfAw68=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "36999b8d19eb6eebb41983ef017d7e0095316af2", "rev": "440faf5ae472657ef2d8cc7756d77b6ab0ace68d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -197,11 +197,11 @@
"rust-overlay": "rust-overlay" "rust-overlay": "rust-overlay"
}, },
"locked": { "locked": {
"lastModified": 1676110678, "lastModified": 1680544266,
"narHash": "sha256-hemg8rMKS2me2Wua9ZG/0aQ8fEOfytjyKB+WYcXfEKE=", "narHash": "sha256-d/TusDXmIo8IT5DNRA21lN+nOVSER8atIx9TJteR6LQ=",
"owner": "oxalica", "owner": "oxalica",
"repo": "nil", "repo": "nil",
"rev": "ce2e0b5d60fe497134050796f7d12ffb6b50eb28", "rev": "56a1fa87b98a9508920f4b0ab8fe36d5b54b2362",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -233,11 +233,11 @@
}, },
"nixlib": { "nixlib": {
"locked": { "locked": {
"lastModified": 1636849918, "lastModified": 1677373009,
"narHash": "sha256-nzUK6dPcTmNVrgTAC1EOybSMsrcx+QrVPyqRdyKLkjA=", "narHash": "sha256-kxhz4QUP8tXa/yVSpEzDDZSEp9FvhzRqZzb+SeUaekw=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixpkgs.lib", "repo": "nixpkgs.lib",
"rev": "28a5b0557f14124608db68d3ee1f77e9329e9dd5", "rev": "c9d4f2476046c6a7a2ce3c2118c48455bf0272ea",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -254,11 +254,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1674666581, "lastModified": 1678351966,
"narHash": "sha256-KNI2s/xrL7WOYaPJAWKBtb7cCH3335rLfsL+B+ssuGY=", "narHash": "sha256-tRFEU0lu3imZb3dtELBY+UbEhWXbb0xlBrsIlpICb+A=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixos-generators", "repo": "nixos-generators",
"rev": "6a5dc1d3d557ea7b5c19b15ff91955124d0400fa", "rev": "0c043999b16caba6fb571af2d228775729829943",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -285,11 +285,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1675309347, "lastModified": 1680487167,
"narHash": "sha256-D3CQ6HRDT2m3XJlrzb5jKq4vNFR5xFTEFKC7iSjlFpM=", "narHash": "sha256-9FNIqrxDZgSliGGN2XJJSvcDYmQbgOANaZA4UWnTdg4=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "006c3bd4dd2f5d1d2094047f307cbf9e2b73d9c5", "rev": "53dad94e874c9586e71decf82d972dfb640ef044",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -301,11 +301,11 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1676885936, "lastModified": 1680758185,
"narHash": "sha256-ZRKb6zBfTvdCOXI7nGC1L9UWSU5ay2ltxg+f5UIzBOU=", "narHash": "sha256-sCVWwfnk7zEX8Z+OItiH+pcSklrlsLZ4TJTtnxAYREw=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b69883faca9542d135fa6bab7928ff1b233c167f", "rev": "0e19daa510e47a40e06257e205965f3b96ce0ac9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -317,11 +317,11 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1674868155, "lastModified": 1677779205,
"narHash": "sha256-eFNm2h6fNbgD7ZpO4MHikCB5pSnCJ7DTmwPisjetmwc=", "narHash": "sha256-6DBjL9wjq86p2GczmwnHtFRnWPBPItc67gapWENBgX8=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "ce20e9ebe1903ea2ba1ab006ec63093020c761cb", "rev": "96e18717904dfedcd884541e5a92bf9ff632cf39",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -334,11 +334,11 @@
"null-ls-nvim-src": { "null-ls-nvim-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1676246878, "lastModified": 1679325581,
"narHash": "sha256-hAUEa2zNsYXQ+TsHYHBzcW67lCxhiD7x+uPbdOZwY8o=", "narHash": "sha256-ixhy8qgP2GEPqrMdI+GsHzeHxESwhRw6cjf5hcpwP1w=",
"owner": "jose-elias-alvarez", "owner": "jose-elias-alvarez",
"repo": "null-ls.nvim", "repo": "null-ls.nvim",
"rev": "d4594231a06cecce73a78a256b0d7c7ab51f7dd5", "rev": "13dd1fc13063681ca7e039436c88f6eca7e3e937",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -349,11 +349,11 @@
}, },
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1676251563, "lastModified": 1679482366,
"narHash": "sha256-itLKR2Haeh5wQ6dxkuZ8L5gwp3+CAggpN+w2e7cLQPg=", "narHash": "sha256-88K2ABCsdsVwq6Go/uEn/fds1fUeeeoixOALjrrUI0Q=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nur", "repo": "nur",
"rev": "9a8b28a9d6611f6af9f7abb3e690fc755d6906fe", "rev": "e9088dc6f9f289fbff984744ad04dccbd5c1f8ac",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -365,11 +365,11 @@
"nvim-lspconfig-src": { "nvim-lspconfig-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1676175675, "lastModified": 1680847306,
"narHash": "sha256-Wg3NatT4DRBMF6hCxK4C2DC+geFMpfFUFogPbqeMt6E=", "narHash": "sha256-oQBVjsUjAfJpxCN48c2bsL/P0tyb2goZmgAKjQH7QRs=",
"owner": "neovim", "owner": "neovim",
"repo": "nvim-lspconfig", "repo": "nvim-lspconfig",
"rev": "1712672e4da3003a0dd9f771d30389600b360f42", "rev": "1ec6f5cbf6ffc44c84783d70039df5295ca22b4e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -381,11 +381,11 @@
"nvim-tree-lua-src": { "nvim-tree-lua-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1676244722, "lastModified": 1678748807,
"narHash": "sha256-xoSekdZhWr59qTOM0/ihYiuKiwHiKYb42Ep5JHn65UM=", "narHash": "sha256-u9ZLBL4FY/bkvl4+ofKifyEHM9+KhqeYovhr9VQYG7c=",
"owner": "kyazdani42", "owner": "kyazdani42",
"repo": "nvim-tree.lua", "repo": "nvim-tree.lua",
"rev": "ba1778e061f25814bc5940be886a7f41d7d7736e", "rev": "1d79a64a88af47ddbb55f4805ab537d11d5b908e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -397,15 +397,16 @@
"nvim-treesitter-src": { "nvim-treesitter-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1676240774, "lastModified": 1677248832,
"narHash": "sha256-eRSU/9ysSvTyYxBrp9Whg0eXgAOsCdmIHMlYZK7bjRg=", "narHash": "sha256-4TmtrufxjVpnSNfFpn6GQStEhq3KQb3JfmfMEJnSI8k=",
"owner": "nvim-treesitter", "owner": "nvim-treesitter",
"repo": "nvim-treesitter", "repo": "nvim-treesitter",
"rev": "7eb5f1a2e3949496f26c4084b521b30f2d08137a", "rev": "b401b7423d18c78371c5ff1a5f8d3c14292b2047",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nvim-treesitter", "owner": "nvim-treesitter",
"ref": "v0.8.5.2",
"repo": "nvim-treesitter", "repo": "nvim-treesitter",
"type": "github" "type": "github"
} }
@ -447,11 +448,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1675391458, "lastModified": 1680488274,
"narHash": "sha256-ukDKZw922BnK5ohL9LhwtaDAdCsJL7L6ScNEyF1lO9w=", "narHash": "sha256-0vYMrZDdokVmPQQXtFpnqA2wEgCCUXf5a3dDuDVshn0=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "383a4acfd11d778d5c2efcf28376cbd845eeaedf", "rev": "7ec2ff598a172c6e8584457167575b3a1a5d80d8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -463,11 +464,11 @@
"telescope-nvim-src": { "telescope-nvim-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1675149856, "lastModified": 1677414372,
"narHash": "sha256-L4Kw94CUy6N7zcyy9INuR/O0fxQ7sp0IvGd/u7fHxMA=", "narHash": "sha256-QmyVJ/LZFtb/qqD5Q5fHsqAGgqaOT9XkVoLyOcqM14w=",
"owner": "nvim-telescope", "owner": "nvim-telescope",
"repo": "telescope.nvim", "repo": "telescope.nvim",
"rev": "203bf5609137600d73e8ed82703d6b0e320a5f36", "rev": "a3f17d3baf70df58b9d3544ea30abe52a7a832c2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -495,11 +496,11 @@
"toggleterm-nvim-src": { "toggleterm-nvim-src": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1675358836, "lastModified": 1680290314,
"narHash": "sha256-9O7p/7tRStg51OFhMc88M5ewYquiYC9x9CV4s5veVP8=", "narHash": "sha256-862KtB9oqktx/mPI0wSauF7eJIJogqgG6wTTYlCSo9U=",
"owner": "akinsho", "owner": "akinsho",
"repo": "toggleterm.nvim", "repo": "toggleterm.nvim",
"rev": "19aad0f41f47affbba1274f05e3c067e6d718e1e", "rev": "b86982429325112d2b20c6d0cc7a5c4b182ab705",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -510,11 +511,11 @@
}, },
"utils": { "utils": {
"locked": { "locked": {
"lastModified": 1676283394, "lastModified": 1678901627,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -546,11 +547,11 @@
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1676126384, "lastModified": 1678648312,
"narHash": "sha256-3aAnN891Cb1pizewAgaHIo3W1WbAjXtoWuX8n3j8YoI=", "narHash": "sha256-aY3CBNyenTUkStQhwigm30+BjXQyA8rCChGD+Z98qqE=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NixOS-WSL", "repo": "NixOS-WSL",
"rev": "a1c7e8bebac32cfac7aa8498bdfc60cbff13eb50", "rev": "c6f663e8583912059605b55c07583b6e96b5e690",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -16,7 +16,7 @@
# Used for Windows Subsystem for Linux compatibility # Used for Windows Subsystem for Linux compatibility
wsl.url = "github:nix-community/NixOS-WSL"; wsl.url = "github:nix-community/NixOS-WSL";
# Used for user packages # Used for user packages and dotfiles
home-manager = { home-manager = {
url = "github:nix-community/home-manager/master"; url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = inputs.nixpkgs.follows =
@ -74,7 +74,7 @@
flake = false; flake = false;
}; };
nvim-treesitter-src = { nvim-treesitter-src = {
url = "github:nvim-treesitter/nvim-treesitter"; url = "github:nvim-treesitter/nvim-treesitter/v0.8.5.2";
flake = false; flake = false;
}; };
telescope-nvim-src = { telescope-nvim-src = {
@ -111,6 +111,8 @@
gitName = fullName; gitName = fullName;
gitEmail = "7386960+nmasur@users.noreply.github.com"; gitEmail = "7386960+nmasur@users.noreply.github.com";
mail.server = "noahmasur.com"; mail.server = "noahmasur.com";
mail.imapHost = "imap.purelymail.com";
mail.smtpHost = "smtp.purelymail.com";
dotfilesRepo = "git@github.com:nmasur/dotfiles"; dotfilesRepo = "git@github.com:nmasur/dotfiles";
}; };
@ -119,6 +121,7 @@
inputs.nur.overlay inputs.nur.overlay
inputs.nix2vim.overlay inputs.nix2vim.overlay
(import ./overlays/neovim-plugins.nix inputs) (import ./overlays/neovim-plugins.nix inputs)
(import ./overlays/lib.nix)
(import ./overlays/calibre-web.nix) (import ./overlays/calibre-web.nix)
]; ];
@ -131,6 +134,8 @@
in rec { in rec {
# Contains my full system builds, including home-manager
# nixos-rebuild switch --flake .#tempest
nixosConfigurations = { nixosConfigurations = {
tempest = import ./hosts/tempest { inherit inputs globals overlays; }; tempest = import ./hosts/tempest { inherit inputs globals overlays; };
hydra = import ./hosts/hydra { inherit inputs globals overlays; }; hydra = import ./hosts/hydra { inherit inputs globals overlays; };
@ -138,6 +143,8 @@
swan = import ./hosts/swan { inherit inputs globals overlays; }; swan = import ./hosts/swan { inherit inputs globals overlays; };
}; };
# Contains my full Mac system builds, including home-manager
# darwin-rebuild switch --flake .#lookingglass
darwinConfigurations = { darwinConfigurations = {
lookingglass = lookingglass =
import ./hosts/lookingglass { inherit inputs globals overlays; }; import ./hosts/lookingglass { inherit inputs globals overlays; };
@ -152,23 +159,24 @@
darwinConfigurations.lookingglass.config.home-manager.users."Noah.Masur".home; darwinConfigurations.lookingglass.config.home-manager.users."Noah.Masur".home;
}; };
# Disk formatting # Disk formatting, only used once
diskoConfigurations = { root = import ./disks/root.nix; }; diskoConfigurations = { root = import ./disks/root.nix; };
# Package servers into images with a generator # Other packages, such as system images or programs
packages = forAllSystems (system: { packages = forAllSystems (system: {
# Package servers into images with a generator
aws = { aws = {
"${system}" = "${system}" =
import ./generators/aws { inherit inputs globals system overlays; }; import ./generators/aws { inherit inputs globals system overlays; };
}; };
staff = { staff = {
"${system}" = import ./generators/staff { "${system}" = import ./generators/staff {
inherit inputs globals system overlays; inherit inputs globals system overlays;
}; };
}; };
# Package Neovim config into standalone package
neovim = let pkgs = import nixpkgs { inherit system overlays; }; neovim = let pkgs = import nixpkgs { inherit system overlays; };
in import ./modules/common/neovim/package { in import ./modules/common/neovim/package {
inherit pkgs; inherit pkgs;
@ -178,6 +186,7 @@
}); });
# Programs that can be run by calling this flake
apps = forAllSystems (system: apps = forAllSystems (system:
let let
pkgs = import nixpkgs { pkgs = import nixpkgs {
@ -190,6 +199,7 @@
}; };
in import ./apps { inherit pkgs; }); in import ./apps { inherit pkgs; });
# Development environments
devShells = forAllSystems (system: devShells = forAllSystems (system:
let pkgs = import nixpkgs { inherit system overlays; }; let pkgs = import nixpkgs { inherit system overlays; };
in { in {
@ -199,6 +209,8 @@
buildInputs = with pkgs; [ git stylua nixfmt shfmt shellcheck ]; buildInputs = with pkgs; [ git stylua nixfmt shfmt shellcheck ];
}; };
test = pkgs.mkShell { buildInputs = with pkgs; [ age ]; };
# Used for cloud and systems development and administration # Used for cloud and systems development and administration
devops = pkgs.mkShell { devops = pkgs.mkShell {
buildInputs = with pkgs; [ buildInputs = with pkgs; [

10
hosts/README.md Normal file
View File

@ -0,0 +1,10 @@
# Hosts
| Host | Purpose |
| --- | --- |
| [flame](./flame/default.nix) | Oracle cloud server |
| [hydra](./hydra/default.nix) | WSL config |
| [lookingglass](./lookingglass/default.nix) | Work macOS |
| [swan](./swan/default.nix) | Home NAS and server |
| [tempest](./tempest/default.nix) | Desktop |

View File

@ -11,14 +11,14 @@ darwin.lib.darwinSystem {
modules = [ modules = [
../../modules/common ../../modules/common
../../modules/darwin ../../modules/darwin
(globals // { (globals // rec {
user = "Noah.Masur"; user = "Noah.Masur";
gitName = "Noah-Masur_1701"; gitName = "Noah-Masur_1701";
gitEmail = "Noah.Masur@take2games.com"; gitEmail = "${user}@take2games.com";
}) })
home-manager.darwinModules.home-manager home-manager.darwinModules.home-manager
{ {
networking.hostName = "noah-masur-mac"; networking.hostName = "lookingglass";
identityFile = "/Users/Noah.Masur/.ssh/id_ed25519"; identityFile = "/Users/Noah.Masur/.ssh/id_ed25519";
gui.enable = true; gui.enable = true;
theme = { theme = {

View File

@ -12,7 +12,7 @@ nixpkgs.lib.nixosSystem {
./hardware-configuration.nix ./hardware-configuration.nix
../../modules/common ../../modules/common
../../modules/nixos ../../modules/nixos
(removeAttrs globals [ "mail.server" ]) globals
wsl.nixosModules.wsl wsl.nixosModules.wsl
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
disko.nixosModules.disko disko.nixosModules.disko
@ -42,6 +42,7 @@ nixpkgs.lib.nixosSystem {
streamServer = "stream.masu.rs"; streamServer = "stream.masu.rs";
nextcloudServer = "cloud.masu.rs"; nextcloudServer = "cloud.masu.rs";
bookServer = "books.masu.rs"; bookServer = "books.masu.rs";
arrServer = "download.masu.rs";
samba.enable = true; samba.enable = true;
backup.s3 = { backup.s3 = {

View File

@ -37,4 +37,20 @@
powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
hardware.cpu.amd.updateMicrocode = hardware.cpu.amd.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware; lib.mkDefault config.hardware.enableRedistributableFirmware;
hardware.fancontrol.enable = true;
hardware.fancontrol.config = ''
# Configuration file generated by pwmconfig, changes will be lost
INTERVAL=10
DEVPATH=hwmon0=devices/pci0000:00/0000:00:03.1/0000:06:00.0/0000:07:00.0/0000:08:00.0
DEVNAME=hwmon0=amdgpu
FCTEMPS=hwmon0/pwm1=hwmon0/temp1_input
FCFANS= hwmon0/pwm1=hwmon0/fan1_input
MINTEMP=hwmon0/pwm1=50
MAXTEMP=hwmon0/pwm1=70
MINSTART=hwmon0/pwm1=100
MINSTOP=hwmon0/pwm1=10
MINPWM=hwmon0/pwm1=10
MAXPWM=hwmon0/pwm1=240
'';
} }

8
modules/README.md Normal file
View File

@ -0,0 +1,8 @@
# Modules
| Module | Purpose |
| --- | --- |
| [common](./common/default.nix) | User programs and OS-agnostic configuration |
| [darwin](./darwin/default.nix) | macOS-specific configuration |
| [nixos](./nixos/default.nix) | NixOS-specific configuration |

View File

@ -157,6 +157,24 @@
}; };
}; };
xsession.windowManager.i3.config.keybindings =
lib.mkIf pkgs.stdenv.isLinux {
"${
config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier
}+Shift+b" = "exec ${
# Don't name the script `firefox` or it will affect grep
builtins.toString (pkgs.writeShellScript "focus-ff.sh" ''
count=$(ps aux | grep -c firefox)
if [ "$count" -eq 1 ]; then
i3-msg "exec --no-startup-id firefox"
sleep 0.5
fi
i3-msg "[class=firefox] focus"
'')
}";
};
}; };
}; };

View File

@ -10,9 +10,24 @@
}; };
config = lib.mkIf (config.gui.enable && config.kitty.enable) { config = lib.mkIf (config.gui.enable && config.kitty.enable) {
# Set the Rofi-Systemd terminal for viewing logs
# Using optionalAttrs because only available in NixOS
environment = { } // lib.attrsets.optionalAttrs
(builtins.hasAttr "sessionVariables" config.environment) {
sessionVariables.ROFI_SYSTEMD_TERM = "${pkgs.kitty}/bin/kitty";
};
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
# xsession.windowManager.i3.config.terminal = "kitty";
# programs.rofi.terminal = "${pkgs.kitty}/bin/kitty"; # Set the i3 terminal
xsession.windowManager.i3.config.terminal =
lib.mkIf pkgs.stdenv.isLinux "kitty";
# Set the Rofi terminal for running programs
programs.rofi.terminal =
lib.mkIf pkgs.stdenv.isLinux "${pkgs.kitty}/bin/kitty";
programs.kitty = { programs.kitty = {
enable = true; enable = true;
environment = { }; environment = { };

View File

@ -12,22 +12,54 @@
config = lib.mkIf (config.gui.enable && config.media.enable) { config = lib.mkIf (config.gui.enable && config.media.enable) {
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ home.packages = with pkgs; [
mpv # Video viewer nsxiv # Image viewer
sxiv # Image viewer
mupdf # PDF viewer mupdf # PDF viewer
zathura # PDF viewer zathura # PDF viewer
]; ];
# Video player
programs.mpv = {
enable = true;
bindings = { };
config = { image-display-duration = 2; };
scripts = [
# Automatically load playlist entries before and after current file
pkgs.mpvScripts.autoload
# Delete current file after quitting
(pkgs.stdenv.mkDerivation rec {
pname = "mpv-delete-file";
version = "0.1"; # made-up
src = pkgs.fetchFromGitHub {
owner = "zenyd";
repo = "mpv-scripts";
rev = "19ea069abcb794d1bf8fac2f59b50d71ab992130";
sha256 = "sha256-OBCuzCtgfSwj0i/rBNranuu4LRc47jObwQIJgQQoerg=";
} + "/delete_file.lua";
dontBuild = true;
dontUnpack = true;
installPhase =
"install -Dm644 ${src} $out/share/mpv/scripts/delete_file.lua";
passthru.scriptName = "delete_file.lua";
})
];
};
# Set default for opening PDFs # Set default for opening PDFs
xdg.mimeApps = { xdg.mimeApps = {
associations.added = { associations.added = {
"application/pdf" = [ "pwmt.zathura-cb.desktop" ]; "application/pdf" = [ "pwmt.zathura-cb.desktop" ];
"image/*" = [ "sxiv.desktop" ]; "image/jpeg" = [ "nsxiv.desktop" ];
"image/*" = [ "nsxiv.desktop" ];
};
associations.removed = {
"application/pdf" = [ "mupdf.desktop" "wine-extension-pdf.desktop" ];
}; };
associations.removed = { "application/pdf" = [ "mupdf.desktop" ]; };
defaultApplications = { defaultApplications = {
"application/pdf" = [ "pwmt.zathura-cb.desktop" ]; "application/pdf" = [ "pwmt.zathura-cb.desktop" ];
"image/*" = [ "sxiv.desktop" ]; "image/jpeg" = [ "nsxiv.desktop" ];
"image/*" = [ "nsxiv.desktop" ];
}; };
}; };

View File

@ -17,9 +17,11 @@
gnome.sushi # Quick preview with spacebar gnome.sushi # Quick preview with spacebar
]; ];
# Set default for opening directories xsession.windowManager.i3.config.keybindings = {
xdg.mimeApps.defaultApplications."inode/directory" = "${
[ "nautilus.desktop" ]; config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier
}+n" = "exec --no-startup-id ${pkgs.gnome.nautilus}/bin/nautilus";
};
programs.fish.functions = { programs.fish.functions = {
qr = { qr = {
@ -27,8 +29,26 @@
"${pkgs.qrencode}/bin/qrencode $argv[1] -o /tmp/qr.png | ${pkgs.gnome.sushi}/bin/sushi /tmp/qr.png"; "${pkgs.qrencode}/bin/qrencode $argv[1] -o /tmp/qr.png | ${pkgs.gnome.sushi}/bin/sushi /tmp/qr.png";
}; };
}; };
# Set default for opening directories
xdg.mimeApps = {
associations.added."inode/directory" = [ "org.gnome.Nautilus.desktop" ];
# associations.removed = {
# "inode/directory" = [ "kitty-open.desktop" ];
# };
defaultApplications."inode/directory" =
lib.mkBefore [ "org.gnome.Nautilus.desktop" ];
};
}; };
# # Set default for opening directories
# xdg.mime = {
# addedAssociations."inode/directory" = [ "org.gnome.Nautilus.desktop" ];
# removedAssociations = { "inode/directory" = [ "kitty-open.desktop" ]; };
# defaultApplications."inode/directory" =
# lib.mkForce [ "org.gnome.Nautilus.desktop" ];
# };
}; };
} }

View File

@ -44,11 +44,6 @@
default = true; default = true;
}; };
}; };
# colorscheme = lib.mkOption {
# type = types.attrs;
# description = "Base16 color scheme";
# };
homePath = lib.mkOption { homePath = lib.mkOption {
type = lib.types.path; type = lib.types.path;
description = "Path of user's home directory."; description = "Path of user's home directory.";
@ -57,7 +52,6 @@
else else
"/home/${config.user}"); "/home/${config.user}");
}; };
dotfilesPath = lib.mkOption { dotfilesPath = lib.mkOption {
type = lib.types.path; type = lib.types.path;
description = "Path of dotfiles repository."; description = "Path of dotfiles repository.";
@ -95,7 +89,8 @@
]; ];
# Scans and hard links identical files in the store # Scans and hard links identical files in the store
auto-optimise-store = true; # Not working with macOS: https://github.com/NixOS/nix/issues/7273
auto-optimise-store = lib.mkIf (!pkgs.stdenv.isDarwin) true;
}; };

View File

@ -170,6 +170,8 @@
"${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/colorize"; "${pkgs.gawk}/bin/awk -f ${pkgs.aerc}/share/aerc/filters/colorize";
"application/x-sh" = "${pkgs.bat}/bin/bat -fP -l sh"; "application/x-sh" = "${pkgs.bat}/bin/bat -fP -l sh";
"application/pdf" = "${pkgs.zathura}/bin/zathura -"; "application/pdf" = "${pkgs.zathura}/bin/zathura -";
"audio/*" = "${pkgs.mpv}/bin/mpv -";
"image/*" = "${pkgs.feh}/bin/feh -";
}; };
}; };
}; };
@ -181,6 +183,27 @@
}; };
}; };
xdg.desktopEntries.aerc = lib.mkIf pkgs.stdenv.isLinux {
name = "aerc";
exec = "kitty aerc %u";
};
xsession.windowManager.i3.config.keybindings =
lib.mkIf pkgs.stdenv.isLinux {
"${
config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier
}+Shift+e" = "exec ${
# Don't name the script `aerc` or it will affect grep
builtins.toString (pkgs.writeShellScript "focus-mail.sh" ''
count=$(ps aux | grep -c aerc)
if [ "$count" -eq 1 ]; then
i3-msg "exec --no-startup-id kitty --class aerc aerc"
sleep 0.25
fi
i3-msg "[class=aerc] focus"
'')
}";
};
programs.fish.shellAbbrs = { ae = "aerc"; }; programs.fish.shellAbbrs = { ae = "aerc"; };
}; };

View File

@ -10,9 +10,17 @@
default = config.user; default = config.user;
}; };
mail.server = lib.mkOption { mail.server = lib.mkOption {
type = lib.types.str; type = lib.types.nullOr lib.types.str;
description = "Server name for the email address."; description = "Server name for the email address.";
}; };
mail.imapHost = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "Server host for IMAP (reading mail).";
};
mail.smtpHost = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "Server host for SMTP (sending mail).";
};
}; };
config = lib.mkIf config.mail.enable { config = lib.mkIf config.mail.enable {
@ -22,7 +30,10 @@
services.mbsync = lib.mkIf pkgs.stdenv.isLinux { services.mbsync = lib.mkIf pkgs.stdenv.isLinux {
enable = true; enable = true;
frequency = "*:0/5"; frequency = "*:0/5";
postExec = "${pkgs.notmuch}/bin/notmuch new";
}; };
services.imapnotify.enable = pkgs.stdenv.isLinux && config.physical;
programs.notmuch.enable = true;
accounts.email = { accounts.email = {
maildirBasePath = "${config.homePath}/mail"; maildirBasePath = "${config.homePath}/mail";
accounts = { accounts = {
@ -42,35 +53,36 @@
folders = { }; folders = { };
getmail = { }; getmail = { };
imap = { imap = {
host = "imap.purelymail.com"; host = config.mail.imapHost;
port = 993; port = 993;
tls.enable = true; tls.enable = true;
}; };
imapnotify = { imapnotify = {
enable = false; enable = true;
boxes = [ ]; boxes = [ "Inbox" ];
onNotify = ""; onNotify = "${pkgs.isync}/bin/mbsync -a";
onNotifyPost = ""; onNotifyPost =
"${pkgs.libnotify}/bin/notify-send 'New mail arrived'";
}; };
maildir = { path = "main"; }; maildir = { path = "main"; };
mbsync = { mbsync = {
enable = true; enable = true;
create = "maildir"; create = "both";
expunge = "none"; expunge = "both";
remove = "none"; remove = "both";
patterns = [ "*" ]; patterns = [ "*" ];
extraConfig.channel = { extraConfig.channel = {
CopyArrivalDate = "yes"; # Sync time of original message CopyArrivalDate = "yes"; # Sync time of original message
}; };
}; };
mu.enable = false; mu.enable = false;
notmuch.enable = false; notmuch.enable = true;
passwordCommand = passwordCommand =
"${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${ "${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${
builtins.toString ../../../private/mailpass.age builtins.toString ../../../private/mailpass.age
}"; }";
smtp = { smtp = {
host = "smtp.purelymail.com"; host = config.mail.smtpHost;
port = 465; port = 465;
tls.enable = true; tls.enable = true;
}; };

View File

@ -1,17 +1,7 @@
{ pkgs, ... }: { { pkgs, ... }: {
plugins = [ plugins = [
(pkgs.vimPlugins.nvim-treesitter.withPlugins (_plugins: pkgs.vimPlugins.nvim-treesitter.withAllGrammars
with pkgs.tree-sitter-grammars; [
tree-sitter-hcl
tree-sitter-python
tree-sitter-lua
tree-sitter-nix
tree-sitter-fish
tree-sitter-toml
tree-sitter-yaml
tree-sitter-json
]))
pkgs.vimPlugins.vim-matchup # Better % jumping in languages pkgs.vimPlugins.vim-matchup # Better % jumping in languages
pkgs.vimPlugins.nginx-vim pkgs.vimPlugins.nginx-vim
pkgs.vimPlugins.vim-helm pkgs.vimPlugins.vim-helm

View File

@ -38,8 +38,9 @@ in {
name = "Neovim wrapper"; name = "Neovim wrapper";
exec = "kitty nvim %F"; exec = "kitty nvim %F";
}; };
xdg.mimeApps = lib.mkIf pkgs.stdenv.isLinux { xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux {
defaultApplications."text/markdown" = [ "nvim.desktop" ]; "text/plain" = [ "nvim.desktop" ];
"text/markdown" = [ "nvim.desktop" ];
}; };
}; };

View File

@ -1,4 +0,0 @@
require("packer_init")
require("settings")
require("keybinds")
require("background")

View File

@ -1,78 +0,0 @@
-- ===========================================================================
-- Key Mapping
-- ===========================================================================
-- Function to cut down config boilerplate
local key = function(mode, key_sequence, action, params)
params = params or {}
vim.keymap.set(mode, key_sequence, action, params)
end
-- Remap space as leader key
key("", "<Space>", "<Nop>", { silent = true })
vim.g.mapleader = " "
vim.g.maplocalleader = " "
-- Keep selection when changing indentation
key("v", "<", "<gv")
key("v", ">", ">gv")
-- Clear search register
key("n", "<CR>", ":noh<CR><CR>", { silent = true })
-- Shuffle lines around
key("n", "<A-j>", ":m .+1<CR>==")
key("n", "<A-k>", ":m .-2<CR>==")
key("v", "<A-j>", ":m '>+1<CR>gv=gv")
key("v", "<A-k>", ":m '<-2<CR>gv=gv")
-- Better window navigation
key("n", "<C-h>", "<C-w>h")
key("n", "<C-j>", "<C-w>j")
key("n", "<C-k>", "<C-w>k")
key("n", "<C-l>", "<C-w>l")
-- File commands
key("n", "<Leader>q", ":quit<CR>")
key("n", "<Leader>Q", ":quitall<CR>")
key("n", "<Leader>fs", ":write<CR>")
key("n", "<Leader>fd", ":lcd %:p:h<CR>", { silent = true })
key("n", "<Leader>fu", ":lcd ..<CR>", { silent = true })
key("n", "<Leader><Tab>", ":b#<CR>", { silent = true })
key("n", "<Leader>gr", ":!gh repo view -w<CR><CR>", { silent = true })
key("n", "<Leader>tt", [[<Cmd>exe 'edit $NOTES_PATH/journal/'.strftime("%Y-%m-%d_%a").'.md'<CR>]])
key("n", "<Leader>jj", ":!journal<CR>:e<CR>")
-- Window commands
key("n", "<Leader>wv", ":vsplit<CR>")
key("n", "<Leader>wh", ":split<CR>")
key("n", "<Leader>wm", ":only<CR>")
-- Vimrc editing
key("n", "<Leader>rr", ":luafile $HOME/.config/nvim/init.lua<CR>")
key("n", "<Leader>rp", ":luafile $HOME/.config/nvim/init.lua<CR>:PackerInstall<CR>:")
key("n", "<Leader>rc", ":luafile $HOME/.config/nvim/init.lua<CR>:PackerCompile<CR>")
-- Keep cursor in place
key("n", "n", "nzz")
key("n", "N", "Nzz")
key("n", "J", "mzJ`z") --- Mark and jump back to it
-- Add undo breakpoints
key("i", ",", ",<C-g>u")
key("i", ".", ".<C-g>u")
key("i", "!", "!<C-g>u")
key("i", "?", "?<C-g>u")
-- Resize with arrows
key("n", "<C-Up>", ":resize +2<CR>", { silent = true })
key("n", "<C-Down>", ":resize -2<CR>", { silent = true })
key("n", "<C-Left>", ":vertical resize -2<CR>", { silent = true })
key("n", "<C-Right>", ":vertical resize +2<CR>", { silent = true })
-- Other
key("n", "<A-CR>", ":noh<CR>", { silent = true }) --- Clear search in VimWiki
key("n", "Y", "y$") --- Copy to end of line
key("v", "<C-r>", "y<Esc>:%s/<C-r>+//gc<left><left><left>") --- Substitute selected
key("v", "D", "y'>gp") --- Duplicate selected
key("x", "<Leader>p", '"_dP') --- Paste but keep register

View File

@ -1,164 +0,0 @@
-- =======================================================================
-- Completion System
-- =======================================================================
local M = {}
M.packer = function(use)
-- Completion sources
use("hrsh7th/cmp-nvim-lsp") --- Language server completion plugin
use("hrsh7th/cmp-buffer") --- Generic text completion
use("hrsh7th/cmp-path") --- Local file completion
use("hrsh7th/cmp-cmdline") --- Command line completion
use("hrsh7th/cmp-nvim-lua") --- Nvim lua api completion
use("saadparwaiz1/cmp_luasnip") --- Luasnip completion
use("lukas-reineke/cmp-rg") --- Ripgrep completion
use("rafamadriz/friendly-snippets") -- Lots of pre-generated snippets
-- Completion engine
use({
"hrsh7th/nvim-cmp",
requires = { "L3MON4D3/LuaSnip" },
config = function()
local cmp = require("cmp")
local kind_icons = {
Text = "",
Method = "m",
Function = "",
Constructor = "",
Field = "",
Variable = "",
Class = "",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "",
Event = "",
Operator = "",
TypeParameter = "",
}
cmp.setup({
-- Only enable on non-prompt buffers
-- So don't use in telescope
enabled = function()
if vim.bo.buftype == "prompt" then
return false
end
return true
end,
-- Setup snippet completion
snippet = {
expand = function(args)
require("luasnip").lsp_expand(args.body)
end,
},
-- Setup completion keybinds
mapping = {
["<C-n>"] = cmp.mapping(cmp.mapping.select_next_item(), { "i", "c" }),
["<C-p>"] = cmp.mapping(cmp.mapping.select_prev_item(), { "i", "c" }),
["<C-d>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
["<C-e>"] = cmp.mapping(cmp.mapping.abort(), { "i", "c" }),
["<Esc>"] = function(_)
cmp.mapping({
i = cmp.mapping.abort(),
c = cmp.mapping.close(),
})
vim.cmd("stopinsert") --- Abort and leave insert mode
end,
["<CR>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
["<C-r>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
}),
["<C-l>"] = cmp.mapping(function(_)
if require("luasnip").expand_or_jumpable() then
require("luasnip").expand_or_jump()
end
end, { "i", "s" }),
},
-- Setup completion engines
sources = {
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "path" },
{ name = "buffer", keyword_length = 3, max_item_count = 10 },
{
name = "rg",
keyword_length = 6,
max_item_count = 10,
option = { additional_arguments = "--ignore-case" },
},
},
-- Visual presentation
formatting = {
fields = { "kind", "abbr", "menu" },
format = function(entry, vim_item)
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
vim_item.menu = ({
luasnip = "[Snippet]",
buffer = "[Buffer]",
path = "[Path]",
rg = "[Grep]",
nvim_lsp = "[LSP]",
nvim_lua = "[Lua]",
})[entry.source.name]
return vim_item
end,
},
-- Docs
-- window = {
-- completion = cmp.config.window.bordered(),
-- documentation = cmp.config.window.bordered(),
-- },
-- Extra features
experimental = {
native_menu = false, --- Use cmp menu instead of Vim menu
ghost_text = true, --- Show preview auto-completion
},
})
-- Use buffer source for `/`
cmp.setup.cmdline("/", {
sources = {
{ name = "buffer", keyword_length = 5 },
},
})
-- Use cmdline & path source for ':'
cmp.setup.cmdline(":", {
sources = cmp.config.sources({
{ name = "path" },
}, {
{ name = "cmdline" },
}),
})
end,
})
end
return M

View File

@ -1,153 +0,0 @@
-- =======================================================================
-- Language Server
-- =======================================================================
local M = {}
M.packer = function(use)
-- Language server engine
use({
"neovim/nvim-lspconfig",
requires = { "hrsh7th/cmp-nvim-lsp" },
config = function()
local function on_path(program)
return vim.fn.executable(program) == 1
end
local capabilities = require("cmp_nvim_lsp").default_capabilities()
if on_path("lua-language-server") then
require("lspconfig").sumneko_lua.setup({
capabilities = capabilities,
-- Turn off errors for vim global variable
settings = {
Lua = {
diagnostics = {
globals = { "vim", "hs" },
},
},
},
})
end
if on_path("rust-analyzer") then
require("lspconfig").rust_analyzer.setup({ capabilities = capabilities })
end
if on_path("tflint") then
require("lspconfig").tflint.setup({ capabilities = capabilities })
end
if on_path("terraform-ls") then
require("lspconfig").terraformls.setup({ capabilities = capabilities })
end
if on_path("pyright") then
require("lspconfig").pyright.setup({
on_attach = function()
-- set keymaps (requires 0.7.0)
-- vim.keymap.set("n", "", "", {buffer=0})
end,
capabilities = capabilities,
})
end
if on_path("nil") then
require("lspconfig").nil_ls.setup({ capabilities = capabilities })
end
vim.keymap.set("n", "gd", vim.lsp.buf.definition)
vim.keymap.set("n", "gT", vim.lsp.buf.type_definition)
vim.keymap.set("n", "gi", vim.lsp.buf.implementation)
vim.keymap.set("n", "gh", vim.lsp.buf.hover)
-- vim.keymap.set("n", "gr", telescope.lsp_references)
vim.keymap.set("n", "<Leader>R", vim.lsp.buf.rename)
vim.keymap.set("n", "]e", vim.diagnostic.goto_next)
vim.keymap.set("n", "[e", vim.diagnostic.goto_prev)
vim.keymap.set("n", "<Leader>de", vim.diagnostic.open_float)
vim.keymap.set("n", "<Leader>E", vim.lsp.buf.code_action)
end,
})
-- Pretty highlights
use("folke/lsp-colors.nvim")
-- Linting
use({
"jose-elias-alvarez/null-ls.nvim",
branch = "main",
requires = {
"nvim-lua/plenary.nvim",
"neovim/nvim-lspconfig",
},
config = function()
local function on_path(program)
return vim.fn.executable(program) == 1
end
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
require("null-ls").setup({
sources = {
require("null-ls").builtins.formatting.stylua.with({
condition = function()
return on_path("stylua")
end,
}),
require("null-ls").builtins.formatting.black.with({
condition = function()
return on_path("black")
end,
}),
require("null-ls").builtins.diagnostics.flake8.with({
condition = function()
return on_path("flake8")
end,
}),
require("null-ls").builtins.formatting.fish_indent.with({
condition = function()
return on_path("fish_indent")
end,
}),
require("null-ls").builtins.formatting.nixfmt.with({
condition = function()
return on_path("nixfmt")
end,
}),
require("null-ls").builtins.formatting.rustfmt.with({
condition = function()
return on_path("rustfmt")
end,
}),
require("null-ls").builtins.diagnostics.shellcheck.with({
condition = function()
return on_path("shellcheck")
end,
}),
require("null-ls").builtins.formatting.shfmt.with({
extra_args = { "-i", "4", "-ci" },
condition = function()
return on_path("shfmt")
end,
}),
require("null-ls").builtins.formatting.terraform_fmt.with({
condition = function()
return on_path("terraform")
end,
}),
-- require("null-ls").builtins.diagnostics.luacheck,
-- require("null-ls").builtins.diagnostics.markdownlint,
-- require("null-ls").builtins.diagnostics.pylint,
},
-- Format on save
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ bufnr = bufnr })
end,
})
end
end,
})
end,
})
end
return M

View File

@ -1,67 +0,0 @@
local M = {}
M.packer = function(use)
-- Important tweaks
use("tpope/vim-surround") --- Manipulate parentheses
-- Convenience tweaks
use("tpope/vim-eunuch") --- File manipulation in Vim
use("tpope/vim-vinegar") --- Fixes netrw file explorer
use("tpope/vim-fugitive") --- Git commands and syntax
use("tpope/vim-repeat") --- Actually repeat using .
-- Use gc or gcc to add comments
use({
"numToStr/Comment.nvim",
config = function()
require("Comment").setup()
end,
})
-- Alignment tool
use({
"godlygeek/tabular",
config = function()
vim.keymap.set("", "<Leader>ta", ":Tabularize /")
vim.keymap.set("", "<Leader>t#", ":Tabularize /#<CR>")
vim.keymap.set("", "<Leader>tl", ":Tabularize /---<CR>")
end,
})
-- Markdown renderer / wiki notes
-- use("vimwiki/vimwiki")
use({
"jakewvincent/mkdnflow.nvim",
config = function()
require("mkdnflow").setup({
modules = {
bib = false,
conceal = true,
folds = false,
},
perspective = {
priority = "current",
fallback = "first",
nvim_wd_heel = false, -- Don't change working dir
},
links = {
style = "markdown",
conceal = true,
},
wrap = true,
to_do = {
symbols = { " ", "-", "x" },
},
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown",
callback = function()
vim.o.autowriteall = true -- Save in new buffer
vim.o.wrapmargin = 79 -- Wrap text automatically
end,
})
end,
})
end
return M

View File

@ -1,13 +0,0 @@
local M = {}
M.packer = function(use)
-- Startup speed hacks
use({
"lewis6991/impatient.nvim",
config = function()
require("impatient")
end,
})
end
return M

View File

@ -1,72 +0,0 @@
-- =======================================================================
-- Syntax
-- =======================================================================
local M = {}
M.packer = function(use)
-- Syntax engine
use({
"nvim-treesitter/nvim-treesitter",
commit = "9ada5f70f98d51e9e3e76018e783b39fd1cd28f7",
run = ":TSUpdate",
config = function()
require("nvim-treesitter.configs").setup({
ensure_installed = {
"hcl",
"python",
"lua",
"nix",
"fish",
"toml",
"yaml",
"json",
},
auto_install = true,
highlight = { enable = true },
indent = { enable = true },
})
end,
})
-- Syntax-aware Textobjects
use({
"nvim-treesitter/nvim-treesitter-textobjects",
requires = { "nvim-treesitter/nvim-treesitter" },
config = function()
require("nvim-treesitter.configs").setup({
textobjects = {
select = {
enable = true,
lookahead = true, -- Jump forward automatically
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
["aa"] = "@call.outer",
["ia"] = "@call.inner",
["ar"] = "@parameter.outer",
["ir"] = "@parameter.inner",
["aC"] = "@comment.outer",
["iC"] = "@comment.outer",
["a/"] = "@comment.outer",
["i/"] = "@comment.outer",
["a;"] = "@statement.outer",
["i;"] = "@statement.outer",
},
},
},
})
end,
})
-- Additional syntax sources
use("chr4/nginx.vim") --- Nginx syntax
use("towolf/vim-helm") --- Helm syntax
use("rodjek/vim-puppet") --- Puppet syntax
end
return M

View File

@ -1,139 +0,0 @@
-- =======================================================================
-- Fuzzy Launcher
-- =======================================================================
local M = {}
M.packer = function(use)
use({
"nvim-telescope/telescope.nvim",
branch = "master",
requires = { "nvim-lua/plenary.nvim" },
config = function()
-- Telescope: quit instantly with escape
local actions = require("telescope.actions")
require("telescope").setup({
defaults = {
mappings = {
i = {
["<esc>"] = actions.close,
["<C-h>"] = "which_key",
},
},
},
pickers = {
find_files = { theme = "ivy" },
oldfiles = { theme = "ivy" },
buffers = { theme = "dropdown" },
},
extensions = {
fzy_native = {},
zoxide = {},
project = {
base_dirs = { "~/dev" },
},
},
})
local telescope = require("telescope.builtin")
vim.keymap.set("n", "<Leader>k", telescope.keymaps)
vim.keymap.set("n", "<Leader>/", telescope.live_grep)
vim.keymap.set("n", "<Leader>ff", telescope.find_files)
vim.keymap.set("n", "<Leader>fp", telescope.git_files)
vim.keymap.set("n", "<Leader>fw", telescope.grep_string)
vim.keymap.set("n", "<Leader>b", telescope.buffers)
vim.keymap.set("n", "<Leader>hh", telescope.help_tags)
vim.keymap.set("n", "<Leader>fr", telescope.oldfiles)
vim.keymap.set("n", "<Leader>cc", telescope.commands)
vim.keymap.set("n", "<Leader>gc", telescope.git_commits)
vim.keymap.set("n", "<Leader>gf", telescope.git_bcommits)
vim.keymap.set("n", "<Leader>gb", telescope.git_branches)
vim.keymap.set("n", "<Leader>gs", telescope.git_status)
vim.keymap.set("n", "<Leader>s", telescope.current_buffer_fuzzy_find)
vim.keymap.set("n", "<Leader>N", function()
local opts = {
prompt_title = "Search Notes",
cwd = "$NOTES_PATH",
}
telescope.live_grep(opts)
end)
vim.keymap.set("n", "<Leader>fN", function()
local opts = {
prompt_title = "Find Notes",
cwd = "$NOTES_PATH",
}
telescope.find_files(opts)
end)
vim.keymap.set("n", "<Leader>cr", function()
local opts = require("telescope.themes").get_ivy({
layout_config = {
bottom_pane = {
height = 15,
},
},
})
telescope.command_history(opts)
end)
end,
})
-- Faster sorting
use("nvim-telescope/telescope-fzy-native.nvim")
-- Jump around tmux sessions
-- use("camgraff/telescope-tmux.nvim")
-- Jump directories
use({
"jvgrootveld/telescope-zoxide",
requires = { "nvim-lua/popup.nvim", "nvim-telescope/telescope.nvim" },
config = function()
vim.keymap.set("n", "<Leader>fz", require("telescope").extensions.zoxide.list)
end,
})
-- Jump projects
use({
"nvim-telescope/telescope-project.nvim",
requires = { "nvim-telescope/telescope.nvim" },
config = function()
require("telescope").load_extension("project")
vim.keymap.set("n", "<C-p>", function()
local opts = require("telescope.themes").get_ivy({
layout_config = {
bottom_pane = {
height = 10,
},
},
})
require("telescope").extensions.project.project(opts)
end)
end,
})
-- File browser
use({
"nvim-telescope/telescope-file-browser.nvim",
requires = { "nvim-telescope/telescope.nvim" },
config = function()
require("telescope").load_extension("file_browser")
vim.keymap.set("n", "<Leader>fa", require("telescope").extensions.file_browser.file_browser)
vim.keymap.set("n", "<Leader>fD", function()
local opts = {
prompt_title = "Find Downloads",
cwd = "~/downloads",
}
require("telescope").extensions.file_browser.file_browser(opts)
end)
end,
})
end
return M

View File

@ -1,79 +0,0 @@
local M = {}
M.packer = function(use)
use({
"akinsho/toggleterm.nvim",
tag = "v2.1.0",
config = function()
require("toggleterm").setup({
open_mapping = [[<c-\>]],
hide_numbers = true,
direction = "float",
})
vim.keymap.set("t", "<A-CR>", "<C-\\><C-n>") --- Exit terminal mode
-- Only set these keymaps for toggleterm
vim.api.nvim_create_autocmd("TermOpen", {
pattern = "term://*toggleterm#*",
callback = function()
-- vim.keymap.set("t", "<Esc>", "<C-\\><C-n>") --- Exit terminal mode
vim.keymap.set("t", "<C-h>", "<C-\\><C-n><C-w>h")
vim.keymap.set("t", "<C-j>", "<C-\\><C-n><C-w>j")
vim.keymap.set("t", "<C-k>", "<C-\\><C-n><C-w>k")
vim.keymap.set("t", "<C-l>", "<C-\\><C-n><C-w>l")
end,
})
local terminal = require("toggleterm.terminal").Terminal
local basicterminal = terminal:new()
function TERM_TOGGLE()
basicterminal:toggle()
end
local nixpkgs = terminal:new({ cmd = "nix repl '<nixpkgs>'" })
function NIXPKGS_TOGGLE()
nixpkgs:toggle()
end
local gitwatch = terminal:new({ cmd = "fish --interactive --init-command 'gh run watch'" })
function GITWATCH_TOGGLE()
gitwatch:toggle()
end
local k9s = terminal:new({ cmd = "k9s" })
function K9S_TOGGLE()
k9s:toggle()
end
vim.keymap.set("n", "<Leader>t", TERM_TOGGLE)
vim.keymap.set("n", "<Leader>P", NIXPKGS_TOGGLE)
vim.keymap.set("n", "<Leader>gw", GITWATCH_TOGGLE)
vim.keymap.set("n", "<Leader>9", K9S_TOGGLE)
end,
})
-- Connect to telescope
-- use({
-- "https://git.sr.ht/~havi/telescope-toggleterm.nvim",
-- event = "TermOpen",
-- requires = {
-- "akinsho/nvim-toggleterm.lua",
-- "nvim-telescope/telescope.nvim",
-- "nvim-lua/popup.nvim",
-- "nvim-lua/plenary.nvim",
-- },
-- config = function()
-- require("telescope").load_extension("toggleterm")
-- require("telescope-toggleterm").setup({
-- telescope_mappings = {
-- -- <ctrl-c> : kill the terminal buffer (default) .
-- ["<C-c>"] = require("telescope-toggleterm").actions.exit_terminal,
-- },
-- })
-- end,
-- })
end
return M

View File

@ -1,164 +0,0 @@
local M = {}
M.packer = function(use)
-- Git next to line numbers
use({
"lewis6991/gitsigns.nvim",
branch = "main",
requires = { "nvim-lua/plenary.nvim" },
config = function()
local gitsigns = require("gitsigns")
gitsigns.setup()
vim.keymap.set("n", "<Leader>gB", gitsigns.blame_line)
vim.keymap.set("n", "<Leader>gp", gitsigns.preview_hunk)
vim.keymap.set("v", "<Leader>gp", gitsigns.preview_hunk)
vim.keymap.set("n", "<Leader>gd", gitsigns.diffthis)
vim.keymap.set("v", "<Leader>gd", gitsigns.diffthis)
vim.keymap.set("n", "<Leader>rgf", gitsigns.reset_buffer)
vim.keymap.set("v", "<Leader>hs", gitsigns.stage_hunk)
vim.keymap.set("v", "<Leader>hr", gitsigns.reset_hunk)
vim.keymap.set("v", "<Leader>hr", gitsigns.reset_hunk)
-- Navigation
vim.keymap.set("n", "]g", function()
if vim.wo.diff then
return "]g"
end
vim.schedule(function()
gitsigns.next_hunk()
end)
return "<Ignore>"
end, { expr = true })
vim.keymap.set("n", "[g", function()
if vim.wo.diff then
return "[g"
end
vim.schedule(function()
gitsigns.prev_hunk()
end)
return "<Ignore>"
end, { expr = true })
end,
})
-- Status bar
use({
"hoob3rt/lualine.nvim",
requires = { "kyazdani42/nvim-web-devicons", opt = true },
config = function()
require("lualine").setup({
options = {
theme = "gruvbox",
icons_enabled = true,
},
})
end,
})
-- Buffer line ("tabs")
use({
"akinsho/bufferline.nvim",
tag = "v2.4.0",
requires = { "kyazdani42/nvim-web-devicons", "moll/vim-bbye" },
config = function()
require("bufferline").setup({
options = {
diagnostics = "nvim_lsp",
always_show_bufferline = false,
separator_style = "slant",
offsets = { { filetype = "NvimTree" } },
},
})
-- Move buffers
vim.keymap.set("n", "L", ":BufferLineCycleNext<CR>", { silent = true })
vim.keymap.set("n", "H", ":BufferLineCyclePrev<CR>", { silent = true })
-- Kill buffer
vim.keymap.set("n", "<Leader>x", " :Bdelete<CR>", { silent = true })
-- Shift buffers
-- vim.keymap.set("n", "<C-L>", ":BufferLineMoveNext<CR>")
-- vim.keymap.set("i", "<C-L>", "<Esc>:BufferLineMoveNext<CR>i")
-- vim.keymap.set("n", "<C-H>", ":BufferLineMovePrev<CR>")
-- vim.keymap.set("i", "<C-H>", "<Esc>:BufferLineMovePrev<CR>i")
end,
})
-- File explorer
use({
"kyazdani42/nvim-tree.lua",
requires = { "kyazdani42/nvim-web-devicons" },
config = function()
require("nvim-tree").setup({
disable_netrw = true,
hijack_netrw = true,
update_focused_file = {
enable = true,
update_cwd = true,
ignore_list = {},
},
diagnostics = {
enable = true,
icons = {
hint = "",
info = "",
warning = "",
error = "",
},
},
renderer = {
icons = {
glyphs = {
git = {
unstaged = "~",
staged = "+",
unmerged = "",
renamed = "",
deleted = "",
untracked = "?",
ignored = "",
},
},
},
},
view = {
width = 30,
hide_root_folder = false,
side = "left",
mappings = {
custom_only = false,
list = {
{
key = { "l", "<CR>", "o" },
cb = require("nvim-tree.config").nvim_tree_callback("edit"),
},
{ key = "h", cb = require("nvim-tree.config").nvim_tree_callback("close_node") },
{ key = "v", cb = require("nvim-tree.config").nvim_tree_callback("vsplit") },
},
},
number = false,
relativenumber = false,
},
})
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
-- https://github.com/kyazdani42/nvim-tree.lua/commit/fb8735e96cecf004fbefb086ce85371d003c5129
vim.g.loaded = 1
vim.g.loaded_netrwPlugin = 1
end,
})
-- Markdown pretty view
use("ellisonleao/glow.nvim")
-- Hex color previews
use({
"norcalli/nvim-colorizer.lua",
config = function()
require("colorizer").setup()
end,
})
end
return M

View File

@ -1,34 +0,0 @@
-- Bootstrap the Packer plugin manager
local fn = vim.fn
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then
PACKER_BOOTSTRAP = fn.system({
"git",
"clone",
"--depth",
"1",
"https://github.com/wbthomason/packer.nvim",
install_path,
})
end
require("packer").startup(function(use)
-- Maintain plugin manager
use("wbthomason/packer.nvim")
-- Include other files initialized by packer
require("packer.speed").packer(use)
require("packer.misc").packer(use)
require("packer.colors").packer(use)
require("packer.visuals").packer(use)
require("packer.lsp").packer(use)
require("packer.completion").packer(use)
require("packer.syntax").packer(use)
require("packer.telescope").packer(use)
require("packer.toggleterm").packer(use)
-- Auto-install after bootstrapping
if PACKER_BOOTSTRAP then
require("packer").sync()
end
end)

View File

@ -1,17 +0,0 @@
-- ===========================================================================
-- Settings
-- ===========================================================================
vim.filetype.add({
pattern = {
[".*%.tfvars"] = "hcl",
[".*%.tf"] = "hcl",
},
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "*.eml",
callback = function()
vim.o.wrapmargin = 79 -- Wrap text automatically
end,
})

View File

@ -0,0 +1,20 @@
{ config, pkgs, lib, ... }: {
config = {
home-manager.users.${config.user} = {
programs.bash = {
enable = true;
shellAliases =
config.home-manager.users.${config.user}.programs.fish.shellAliases;
initExtra = "";
profileExtra = "";
};
programs.starship.enableBashIntegration = false;
programs.zoxide.enableBashIntegration = true;
programs.fzf.enableBashIntegration = true;
};
};
}

View File

@ -1,5 +1,6 @@
{ ... }: { { ... }: {
imports = [ imports = [
./bash
./charm.nix ./charm.nix
./direnv.nix ./direnv.nix
./fish ./fish

View File

@ -76,7 +76,6 @@
set -g fish_cursor_replace_one underscore set -g fish_cursor_replace_one underscore
''; '';
loginShellInit = ""; loginShellInit = "";
shellAliases = { };
shellAbbrs = { shellAbbrs = {
# Directory aliases # Directory aliases

View File

@ -13,9 +13,8 @@
fd \ fd \
--search-path $HOME/dev \ --search-path $HOME/dev \
--type directory \ --type directory \
--hidden \ --exact-depth 2 \
"^.git\$" \ | sed 's/\\/$//' \
| xargs dirname \
| fzf \ | fzf \
--delimiter '/' \ --delimiter '/' \
--with-nth 6.. \ --with-nth 6.. \

View File

@ -19,6 +19,9 @@
grf = "gh run view --log-failed"; grf = "gh run view --log-failed";
grl = "gh run view --log"; grl = "gh run view --log";
ghpr = "gh pr create && sleep 3 && gh run watch"; ghpr = "gh pr create && sleep 3 && gh run watch";
# https://github.com/cli/cli/discussions/4067
prs = "gh search prs --state=open --review-requested=@me";
}; };
functions = { functions = {
repos = { repos = {

View File

@ -1,4 +1,4 @@
{ config, lib, ... }: { { config, pkgs, lib, ... }: {
home-manager.users.${config.user}.programs.starship = { home-manager.users.${config.user}.programs.starship = {
enable = true; enable = true;
@ -21,7 +21,7 @@
}; };
cmd_duration = { cmd_duration = {
min_time = 5000; min_time = 5000;
show_notifications = true; show_notifications = if pkgs.stdenv.isLinux then false else true;
min_time_to_notify = 30000; min_time_to_notify = 30000;
format = "[$duration]($style) "; format = "[$duration]($style) ";
}; };

View File

@ -18,21 +18,22 @@ in {
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; [ home.packages = with pkgs; [
unzip # Extract zips age # Encryption
bc # Calculator
dig # DNS lookup
fd # find
htop # Show system processes
inetutils # Includes telnet, whois
jq # JSON manipulation
lf # File viewer
qrencode # Generate qr codes
rsync # Copy folders rsync # Copy folders
ripgrep # grep ripgrep # grep
fd # find
sd # sed sd # sed
jq # JSON manipulation
tealdeer # Cheatsheets tealdeer # Cheatsheets
tree # View directory hierarchy tree # View directory hierarchy
htop # Show system processes
qrencode # Generate qr codes
vimv-rs # Batch rename files vimv-rs # Batch rename files
dig # DNS lookup unzip # Extract zips
lf # File viewer
inetutils # Includes telnet, whois
age # Encryption
]; ];
programs.zoxide.enable = true; # Shortcut jump command programs.zoxide.enable = true; # Shortcut jump command

View File

@ -2,6 +2,7 @@
imports = [ imports = [
./alacritty.nix ./alacritty.nix
./fish.nix
./fonts.nix ./fonts.nix
./hammerspoon.nix ./hammerspoon.nix
./homebrew.nix ./homebrew.nix

11
modules/darwin/fish.nix Normal file
View File

@ -0,0 +1,11 @@
{ pkgs, ... }: {
config = {
# MacOS-specific settings for Fish
programs.fish.useBabelfish = true;
programs.fish.babelfishPackage = pkgs.babelfish;
};
}

View File

@ -90,6 +90,7 @@ function obj:init()
self:switch("System Preferences.app") self:switch("System Preferences.app")
end) end)
self.launcher:bind("", "R", function() self.launcher:bind("", "R", function()
hs.console.clearConsole()
hs.reload() hs.reload()
end) end)
self.launcher:bind("", "S", function() self.launcher:bind("", "S", function()

View File

@ -29,6 +29,7 @@ function obj:init()
win:moveToScreen(screen:previous(), true, true, 0) win:moveToScreen(screen:previous(), true, true, 0)
end) end)
-- Maximize
hs.hotkey.bind({ "alt", "ctrl", "cmd" }, "m", function() hs.hotkey.bind({ "alt", "ctrl", "cmd" }, "m", function()
-- get the focused window -- get the focused window
local win = hs.window.focusedWindow() local win = hs.window.focusedWindow()
@ -47,6 +48,34 @@ function obj:init()
-- win:maximize() -- win:maximize()
-- end -- end
end) end)
-- Half-maximize (right)
hs.hotkey.bind({ "alt", "ctrl", "cmd" }, "o", function()
-- get the focused window
local win = hs.window.focusedWindow()
local frame = win:frame()
-- maximize if possible
local max = win:screen():fullFrame()
frame.x = max.w / 2
frame.y = max.y
frame.w = max.w / 2
frame.h = max.h
win:setFrame(frame)
end)
-- Half-maximize (left)
hs.hotkey.bind({ "alt", "ctrl", "cmd" }, "u", function()
-- get the focused window
local win = hs.window.focusedWindow()
local frame = win:frame()
-- maximize if possible
local max = win:screen():fullFrame()
frame.x = max.x
frame.y = max.y
frame.w = max.w / 2
frame.h = max.h
win:setFrame(frame)
end)
end end
return obj return obj

View File

@ -4,28 +4,27 @@
-- License is also available: -- License is also available:
-- https://github.com/anishathalye/dotfiles-local/blob/ffdadd313e58514eb622736b09b91a7d7eb7c6c9/LICENSE.md -- https://github.com/anishathalye/dotfiles-local/blob/ffdadd313e58514eb622736b09b91a7d7eb7c6c9/LICENSE.md
WORK_LEFT_MONITOR = "DELL U2415 (2)" WORK_ONLY_MONITOR = "DELL U4021QW"
WORK_RIGHT_MONITOR = "DELL U2415 (1)"
LAPTOP_MONITOR = "Built-in Retina Display" LAPTOP_MONITOR = "Built-in Retina Display"
-- Used to find out the name of the monitor in Hammerspoon -- Used to find out the name of the monitor in Hammerspoon
-- local function dump(o) local function dump(o)
-- if type(o) == "table" then if type(o) == "table" then
-- local s = "{ " local s = "{ "
-- for k, v in pairs(o) do for k, v in pairs(o) do
-- if type(k) ~= "number" then if type(k) ~= "number" then
-- k = '"' .. k .. '"' k = '"' .. k .. '"'
-- end end
-- s = s .. "[" .. k .. "] = " .. dump(v) .. "," s = s .. "[" .. k .. "] = " .. dump(v) .. ","
-- end end
-- return s .. "} " return s .. "} "
-- else else
-- return tostring(o) return tostring(o)
-- end end
-- end end
-- Turn on when looking for the monitor name -- Turn on when looking for the monitor name
-- print(dump(hs.screen.allScreens())) print(dump(hs.screen.allScreens()))
local function concat(...) local function concat(...)
local res = {} local res = {}
@ -42,15 +41,16 @@ local function worklayout()
local u = hs.geometry.unitrect local u = hs.geometry.unitrect
-- set the layout -- set the layout
local left = { local left = {
{ "kitty", nil, WORK_LEFT_MONITOR, u(0, 0, 1, 1), nil, nil, visible = true }, { "kitty", nil, WORK_ONLY_MONITOR, u(0, 0, 1 / 2, 1), nil, nil, visible = true },
} }
local right = { local right = {
{ "Slack", nil, WORK_RIGHT_MONITOR, u(0, 0, 1, 1), nil, nil, visible = true }, { "Slack", nil, WORK_ONLY_MONITOR, u(1 / 2, 0, 1 / 2, 1), nil, nil, visible = true },
{ "Mail", nil, WORK_RIGHT_MONITOR, u(0, 0, 1, 1), nil, nil, visible = true }, { "Mail", nil, WORK_ONLY_MONITOR, u(1 / 2, 0, 1 / 2, 1), nil, nil, visible = true },
{ "zoom.us", nil, WORK_RIGHT_MONITOR, u(1 / 4, 1 / 4, 1 / 2, 1 / 2), nil, nil, visible = true }, { "zoom.us", nil, WORK_ONLY_MONITOR, u(5 / 8, 1 / 4, 1 / 4, 1 / 2), nil, nil, visible = true },
} }
local laptop = { local laptop = {
{ "Firefox", nil, LAPTOP_MONITOR, u(0, 0, 1, 1), nil, nil, visible = true }, { "Firefox", nil, LAPTOP_MONITOR, u(0, 0, 1, 1), nil, nil, visible = true },
{ "Obsidian", nil, LAPTOP_MONITOR, u(0, 0, 1, 1), nil, nil, visible = true },
} }
local layout = concat(left, right, laptop) local layout = concat(left, right, laptop)
hs.layout.apply(layout) hs.layout.apply(layout)

View File

@ -34,14 +34,15 @@
]; ];
casks = [ casks = [
"1password" # 1Password packaging on Nix is broken for macOS "1password" # 1Password packaging on Nix is broken for macOS
"scroll-reverser" # Different scroll style for mouse vs. trackpad "apache-directory-studio" # Packaging on Nix is not available for macOS
"meetingbar" # Show meetings in menu bar
"gitify" # Git notifications in menu bar "gitify" # Git notifications in menu bar
"keybase" # GUI on Nix not available for macOS
"logitech-g-hub" # Mouse and keyboard management "logitech-g-hub" # Mouse and keyboard management
"meetingbar" # Show meetings in menu bar
"mimestream" # Gmail client "mimestream" # Gmail client
"obsidian" # Obsidian packaging on Nix is not available for macOS "obsidian" # Obsidian packaging on Nix is not available for macOS
"scroll-reverser" # Different scroll style for mouse vs. trackpad
"steam" # Not packaged for Nix "steam" # Not packaged for Nix
"apache-directory-studio" # Packaging on Nix is not available for macOS
]; ];
}; };

View File

@ -1,19 +1,6 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let {
# Quickly package shell scripts with their dependencies
# From https://discourse.nixos.org/t/how-to-create-a-script-with-dependencies/7970/6
mkScript = { name, file, env ? [ ] }:
pkgs.writeScriptBin name ''
for i in ${lib.concatStringsSep " " env}; do
export PATH="$i/bin:$PATH"
done
exec ${pkgs.bash}/bin/bash ${file} $@
'';
in {
home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin { home-manager.users.${config.user} = lib.mkIf pkgs.stdenv.isDarwin {
@ -32,7 +19,7 @@ in {
consul consul
noti # Create notifications programmatically noti # Create notifications programmatically
ipcalc # Make IP network calculations ipcalc # Make IP network calculations
(mkScript { (pkgs.extraLib.mkScript {
name = "ocr"; name = "ocr";
file = ../../modules/common/shell/bash/scripts/ocr.sh; file = ../../modules/common/shell/bash/scripts/ocr.sh;
env = [ tesseract ]; env = [ tesseract ];

View File

@ -10,8 +10,8 @@ in {
config = lib.mkIf config.gaming.legendary.enable { config = lib.mkIf config.gaming.legendary.enable {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
legendary-gl legendary-gl
rare # GUI for Legendary (not working)
wineWowPackages.stable # 32-bit and 64-bit wineWowPackages, see https://nixos.wiki/wiki/Wine wineWowPackages.stable # 32-bit and 64-bit wineWowPackages, see https://nixos.wiki/wiki/Wine
heroic # GUI launcher
]; ];
home-manager.users.${config.user} = { home-manager.users.${config.user} = {

View File

@ -1,7 +1,14 @@
{ lib, ... }: { { lib, ... }: {
imports = imports = [
[ ./xorg.nix ./fonts.nix ./i3.nix ./polybar.nix ./picom.nix ./rofi.nix ]; ./dunst.nix
./fonts.nix
./i3.nix
./picom.nix
./polybar.nix
./rofi.nix
./xorg.nix
];
options = { options = {
@ -17,10 +24,22 @@
type = lib.types.str; type = lib.types.str;
description = "Command to use for choosing windows"; description = "Command to use for choosing windows";
}; };
audioSwitchCommand = lib.mkOption {
type = lib.types.str;
description = "Command to use for switching audio sink";
};
brightnessCommand = lib.mkOption {
type = lib.types.str;
description = "Command to use for adjusting brightness";
};
toggleBarCommand = lib.mkOption { toggleBarCommand = lib.mkOption {
type = lib.types.str; type = lib.types.str;
description = "Command to hide and show the status bar."; description = "Command to hide and show the status bar.";
}; };
powerCommand = lib.mkOption {
type = lib.types.str;
description = "Command to use for power options menu";
};
wallpaper = lib.mkOption { wallpaper = lib.mkOption {
type = lib.types.path; type = lib.types.path;
description = "Wallpaper background image file"; description = "Wallpaper background image file";

View File

@ -0,0 +1,31 @@
{ config, ... }:
{
config = {
home-manager.users.${config.user}.services.dunst = {
enable = true;
settings = {
global = {
width = 300;
height = 200;
offset = "30x50";
origin = "top-right";
transparency = 0;
padding = 20;
horizontal_padding = 20;
frame_color = config.theme.colors.base03;
};
urgency_normal = {
background = config.theme.colors.base00;
foreground = config.theme.colors.base05;
timeout = 10;
};
};
};
};
}

View File

@ -22,6 +22,7 @@ in {
programs.rofi.font = "Hack Nerd Font 14"; programs.rofi.font = "Hack Nerd Font 14";
programs.alacritty.settings.font.normal.family = fontName; programs.alacritty.settings.font.normal.family = fontName;
programs.kitty.font.name = fontName; programs.kitty.font.name = fontName;
services.dunst.settings.global.font = "Hack Nerd Font 14";
}; };
}; };

View File

@ -39,7 +39,11 @@ in {
modifier = modifier; modifier = modifier;
assigns = { assigns = {
"${ws1}" = [{ class = "Firefox"; }]; "${ws1}" = [{ class = "Firefox"; }];
"${ws2}" = [{ class = "kitty"; }]; "${ws2}" = [
{ class = "kitty"; }
{ class = "aerc"; }
{ class = "obsidian"; }
];
"${ws3}" = [{ class = "discord"; }]; "${ws3}" = [{ class = "discord"; }];
"${ws4}" = [{ class = "Steam"; }]; "${ws4}" = [{ class = "Steam"; }];
}; };
@ -112,12 +116,22 @@ in {
"exec --no-startup-id ${config.launcherCommand}"; "exec --no-startup-id ${config.launcherCommand}";
"${modifier}+Shift+s" = "${modifier}+Shift+s" =
"exec --no-startup-id ${config.systemdSearch}"; "exec --no-startup-id ${config.systemdSearch}";
"${modifier}+Shift+a" =
"exec --no-startup-id ${config.audioSwitchCommand}";
"Mod1+Tab" = "exec --no-startup-id ${config.altTabCommand}"; "Mod1+Tab" = "exec --no-startup-id ${config.altTabCommand}";
"${modifier}+Shift+period" =
"exec --no-startup-id ${config.powerCommand}";
"${modifier}+Shift+m" =
"exec --no-startup-id ${config.brightnessCommand}";
"${modifier}+Shift+c" = "reload"; "${modifier}+Shift+c" = "reload";
"${modifier}+Shift+r" = "restart"; "${modifier}+Shift+r" = "restart";
"${modifier}+Shift+q" = '' "${modifier}+Shift+q" = ''
exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"''; exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"'';
"${modifier}+Shift+x" = "exec ${lockCmd}"; "${modifier}+Shift+x" = "exec ${lockCmd}";
"${modifier}+Mod1+h" =
"exec --no-startup-id kitty sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} && ${pkgs.libnotify}/bin/notify-send --transient --expire-time 3000 \"Rebuilt home.\" || read'";
"${modifier}+Mod1+r" =
"exec --no-startup-id kitty sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} && ${pkgs.libnotify}/bin/notify-send --transient --expire-time 3000 \"Rebuilt NixOS.\" || read'";
# Window options # Window options
"${modifier}+q" = "kill"; "${modifier}+q" = "kill";

View File

@ -36,7 +36,7 @@
module-margin = 1; module-margin = 1;
modules-left = "i3"; modules-left = "i3";
modules-center = "xwindow"; modules-center = "xwindow";
modules-right = "pulseaudio date"; modules-right = "mailcount pulseaudio date power";
cursor-click = "pointer"; cursor-click = "pointer";
cursor-scroll = "ns-resize"; cursor-scroll = "ns-resize";
enable-ipc = true; enable-ipc = true;
@ -101,6 +101,23 @@
# label-unmounted = "%mountpoint% not mounted"; # label-unmounted = "%mountpoint% not mounted";
# label-unmounted-foreground = colors.disabled; # label-unmounted-foreground = colors.disabled;
# }; # };
"module/mailcount" = {
type = "custom/script";
interval = 10;
format = "<label>";
exec = builtins.toString (pkgs.writeShellScript "mailcount.sh" ''
${pkgs.notmuch}/bin/notmuch new > /dev/null
UNREAD=$(${pkgs.notmuch}/bin/notmuch count is:inbox and is:unread)
if [ $UNREAD = "0" ]; then
echo "%{T3}%{T-} "
else
echo "%{T2}%{T-} $UNREAD "
fi
'');
click-left =
"i3-msg 'exec --no-startup-id kitty --class aerc aerc'; sleep 0.15; i3-msg '[class=aerc] focus'";
};
"module/pulseaudio" = { "module/pulseaudio" = {
type = "internal/pulseaudio"; type = "internal/pulseaudio";
# format-volume-prefix = "VOL "; # format-volume-prefix = "VOL ";
@ -115,6 +132,7 @@
ramp-volume-0 = ""; ramp-volume-0 = "";
ramp-volume-1 = ""; ramp-volume-1 = "";
ramp-volume-2 = ""; ramp-volume-2 = "";
click-right = config.audioSwitchCommand;
}; };
# "module/xkeyboard" = { # "module/xkeyboard" = {
# type = "internal/xkeyboard"; # type = "internal/xkeyboard";
@ -160,12 +178,18 @@
"module/date" = { "module/date" = {
type = "internal/date"; type = "internal/date";
interval = 1; interval = 1;
date = "%d %b %l:%M %p"; date = "%d %b %l:%M %p";
date-alt = "%Y-%m-%d %H:%M:%S"; date-alt = "%Y-%m-%d %H:%M:%S";
label = "%date%"; label = "%date%";
label-foreground = config.theme.colors.base0A; label-foreground = config.theme.colors.base0A;
# format-background = colors.background; # format-background = colors.background;
}; };
"module/power" = {
type = "custom/text";
content = " ";
click-left = config.powerCommand;
content-foreground = config.theme.colors.base04;
};
"settings" = { "settings" = {
screenchange-reload = true; screenchange-reload = true;
pseudo-transparency = false; pseudo-transparency = false;
@ -174,7 +198,7 @@
}; };
xsession.windowManager.i3.config.startup = [{ xsession.windowManager.i3.config.startup = [{
command = "systemctl --user restart polybar"; command = "pkill polybar; polybar -r main";
always = true; always = true;
notification = false; notification = false;
}]; }];

View File

@ -1,9 +1,19 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ let
rofi = config.home-manager.users.${config.user}.programs.rofi.finalPackage;
in {
imports = [ ./rofi/power.nix ./rofi/brightness.nix ];
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) { config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
# Set the Rofi-Systemd terminal for viewing logs
environment.sessionVariables.ROFI_SYSTEMD_TERM =
lib.mkIf config.kitty.enable "${pkgs.kitty}/bin/kitty";
home-manager.users.${config.user} = { home-manager.users.${config.user} = {
home.packages = with pkgs; home.packages = with pkgs;
@ -70,7 +80,7 @@
placeholder-color = mkLiteral config.theme.colors.base03; placeholder-color = mkLiteral config.theme.colors.base03;
expand = true; expand = true;
horizontal-align = "0"; horizontal-align = "0";
placeholder = "Launch Program"; placeholder = "";
padding = mkLiteral "0px 0px 0px 5px"; padding = mkLiteral "0px 0px 0px 5px";
blink = true; blink = true;
}; };
@ -139,15 +149,29 @@
show-icons = true; show-icons = true;
kb-cancel = "Escape,Super+space"; kb-cancel = "Escape,Super+space";
modi = "window,run,ssh,emoji,calc,systemd"; modi = "window,run,ssh,emoji,calc,systemd";
sort = true;
# levenshtein-sort = true;
}; };
}; };
home.file.".local/share/rofi/themes" = {
recursive = true;
source = ./rofi/themes;
};
}; };
launcherCommand = "${pkgs.rofi}/bin/rofi -show run -modi run"; launcherCommand = ''
${rofi}/bin/rofi -modes drun -show drun -theme-str '@import "launcher.rasi"' '';
systemdSearch = "${pkgs.rofi-systemd}/bin/rofi-systemd"; systemdSearch = "${pkgs.rofi-systemd}/bin/rofi-systemd";
altTabCommand = "${pkgs.rofi}/bin/rofi -show window -modi window"; altTabCommand = "${rofi}/bin/rofi -show window -modi window";
audioSwitchCommand = "${
(pkgs.extraLib.mkScript {
name = "switch-audio";
file = ./rofi/pulse-sink.sh;
env = [ pkgs.ponymix rofi ];
})
}/bin/switch-audio";
}; };
} }

View File

@ -0,0 +1,49 @@
{ config, pkgs, ... }:
let
rofi = config.home-manager.users.${config.user}.programs.rofi.finalPackage;
in {
# Adapted from:
# A rofi powered menu to execute brightness choices.
config.brightnessCommand = builtins.toString
(pkgs.writeShellScript "brightness" ''
dimmer=""
medium=""
brighter=""
chosen=$(printf '%s;%s;%s\n' \
"$dimmer" \
"$medium" \
"$brighter" \
| ${rofi}/bin/rofi \
-theme-str '@import "brightness.rasi"' \
-hover-select \
-me-select-entry ''' \
-me-accept-entry MousePrimary \
-dmenu \
-sep ';' \
-selected-row 1)
case "$chosen" in
"$dimmer")
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 25; ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 25
;;
"$medium")
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 75; ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 75
;;
"$brighter")
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 100; ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 100
;;
*) exit 1 ;;
esac
'');
}

View File

@ -1,10 +0,0 @@
#!/usr/bin/env bash
# THEME="$HOME/.config/rofi/config.rasi"
ICON_UP=""
ICON_DOWN=""
ICON_OPT=""
options="$ICON_UP\n$ICON_OPT\n$ICON_DOWN"
chosen="$(echo -e "$options" | rofi -theme-str 'listview { layout:horizontal; }' -dmenu)"
echo "$chosen"

View File

@ -0,0 +1,61 @@
{ config, pkgs, ... }:
let
rofi = config.home-manager.users.${config.user}.programs.rofi.finalPackage;
in {
# Adapted from:
# https://gitlab.com/vahnrr/rofi-menus/-/blob/b1f0e8a676eda5552e27ef631b0d43e660b23b8e/scripts/rofi-power
# A rofi powered menu to execute power related action.
config.powerCommand = builtins.toString (pkgs.writeShellScript "powermenu" ''
power_off=''
reboot=''
lock=''
suspend=''
log_out=''
chosen=$(printf '%s;%s;%s;%s;%s\n' \
"$power_off" \
"$reboot" \
"$lock" \
"$suspend" \
"$log_out" \
| ${rofi}/bin/rofi \
-theme-str '@import "power.rasi"' \
-hover-select \
-me-select-entry ''' \
-me-accept-entry MousePrimary \
-dmenu \
-sep ';' \
-selected-row 2)
case "$chosen" in
"$power_off")
${
builtins.toString ./rofi-prompt.sh
} 'Shutdown?' && doas shutdown now
;;
"$reboot")
${builtins.toString ./rofi-prompt.sh} 'Reboot?' && doas reboot
;;
"$lock")
${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span
;;
"$suspend")
systemctl suspend
;;
"$log_out")
${builtins.toString ./rofi-prompt.sh} 'Logout?' && i3-msg exit
;;
*) exit 1 ;;
esac
'');
}

View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
# Credit: https://gist.github.com/Nervengift/844a597104631c36513c
sink=$(
ponymix -t sink list |
awk '/^sink/ {s=$1" "$2;getline;gsub(/^ +/,"",$0);print s" "$0}' |
rofi \
-dmenu \
-p 'pulseaudio sink:' \
-width 100 \
-hover-select \
-me-select-entry '' \
-me-accept-entry MousePrimary \
-theme-str 'inputbar { enabled: false; }' |
grep -Po '[0-9]+(?=:)'
) &&
ponymix set-default -d "$sink" &&
for input in $(ponymix list -t sink-input | grep -Po '[0-9]+(?=:)'); do
echo "$input -> $sink"
ponymix -t sink-input -d "$input" move "$sink"
done

View File

@ -0,0 +1,47 @@
#!/usr/bin/env sh
# Credit: https://gitlab.com/vahnrr/rofi-menus/-/blob/b1f0e8a676eda5552e27ef631b0d43e660b23b8e/scripts/rofi-prompt
# Rofi powered menu to prompt a message and get a yes/no answer.
# Uses: rofi
yes='Confirm'
no='Cancel'
query='Are you sure?'
while [ $# -ne 0 ]; do
case "$1" in
-y | --yes)
[ -n "$2" ] && yes="$2" || yes=''
shift
;;
-n | --no)
[ -n "$2" ] && no="$2" || no=''
shift
;;
-q | --query)
[ -n "$2" ] && query="$2"
shift
;;
esac
shift
done
chosen=$(printf '%s;%s\n' "$yes" "$no" |
rofi -theme-str '@import "prompt.rasi"' \
-hover-select \
-me-select-entry '' \
-me-accept-entry MousePrimary \
-p "$query" \
-dmenu \
-sep ';' \
-a 0 \
-u 1 \
-selected-row 1)
case "$chosen" in
"$yes") exit 0 ;;
*) exit 1 ;;
esac

View File

@ -0,0 +1,6 @@
@import "common.rasi"
#window {
width: 605px;
height: 230px;
}

View File

@ -0,0 +1,57 @@
/**
* Allows to change the settings of every menu simply by editing this file
* https://gitlab.com/vahnrr/rofi-menus/-/blob/b1f0e8a676eda5552e27ef631b0d43e660b23b8e/themes/shared/settings.rasi
*/
* {
/* General */
font: "Hack Nerd Font 60";
/* option menus: i3-layout, music, power and screenshot
*
* Values bellow are 'no-padding' ones for a size 60 (@icon-font) font, played
* around using this character: ■
* We then add add 100 actual padding around the icons.
* -12px 0px -19px -96px */
option-element-padding: 1% 1% 1% 1%;
option-5-window-padding: 4% 4%;
option-5-listview-spacing: 15px;
prompt-text-font: "Hack Nerd Font 18";
prompt-window-height: 300px;
prompt-window-width: 627px;
prompt-window-border: 2px;
prompt-prompt-padding: 20px 30px;
prompt-prompt-margin: 8px;
prompt-listview-padding: 60px 114px 0px 114px;
/* Values bellow are 'no-padding' ones for a size 18 (@prompt-text-font) font,
* played around using this character: ■
* We then add add 30 actual padding around the text.
* -4px -1px -6px -28px */
prompt-element-padding: 26px 29px 24px 2px;
vpn-textbox-prompt-colon-padding: @network-textbox-prompt-colon-padding;
}
/**
* Settings used in every rofi option menu:
*/
#window {
children: [ horibox ];
}
#horibox {
children: [ listview ];
}
#listview {
layout: horizontal;
}
element {
padding: 40px 68px 43px 30px;
}
#window {
padding: 20px;
}
#listview {
spacing: 10px;
lines: 5;
}

View File

@ -0,0 +1,3 @@
#entry {
placeholder: "Launch Program";
}

View File

@ -0,0 +1,6 @@
@import "common.rasi"
#window {
width: 980px;
height: 230px;
}

View File

@ -0,0 +1,49 @@
/**
* This theme is intended for a 2 items option menu with a headerbar.
* https://gitlab.com/vahnrr/rofi-menus/-/blob/b1f0e8a676eda5552e27ef631b0d43e660b23b8e/themes/prompt.rasi
*/
@import "common.rasi"
* {
font: @text-font;
}
#window {
height: @prompt-window-height;
width: @prompt-window-width;
children: [ inputbar, horibox ];
border: @prompt-window-border;
border-color: @accent;
}
#inputbar {
enabled: false;
}
#prompt {
padding: @prompt-prompt-padding;
margin: @prompt-prompt-margin;
background-color: @accent;
text-color: @background-light;
}
#listview {
padding: @prompt-listview-padding;
spacing: @option-5-listview-spacing;
lines: 2;
}
#element {
font: @prompt-text-font;
padding: @prompt-element-padding;
}
element.alternate.active,
element.normal.active,
element.alternate.urgent,
element.normal.urgent {
background-color: @background-light;
text-color: @foreground;
}
element.selected.urgent {
background-color: @off;
text-color: @background;
}
element.selected.active {
background-color: @on;
text-color: @background;
}

View File

@ -1,15 +1,22 @@
{ ... }: { { config, ... }: {
services.xserver = { config = {
layout = "us"; services.xserver = {
# Keyboard responsiveness layout = "us";
autoRepeatDelay = 250;
autoRepeatInterval = 40;
# Swap escape key with caps lock key # Keyboard responsiveness
xkbOptions = "eurosign:e,caps:swapescape"; autoRepeatDelay = 250;
autoRepeatInterval = 40;
# Swap escape key with caps lock key
xkbOptions = "eurosign:e,caps:swapescape";
};
# Enable num lock on login
home-manager.users.${config.user}.xsession.numlock.enable = true;
}; };

View File

@ -4,16 +4,22 @@
# Prevent wake from keyboard # Prevent wake from keyboard
powerManagement.powerDownCommands = '' powerManagement.powerDownCommands = ''
# for power in /sys/bus/usb/devices/*/power; do echo disabled > ''${power}/wakeup; done set +e
# AMD issue: https://wiki.archlinux.org/title/Power_management/Suspend_and_hibernate#Instantaneous_wakeups_from_suspend for power in /sys/bus/i2c/devices/i2c-*/device/power; do echo disabled > ''${power}/wakeup || true; done
for power in /sys/bus/i2c/devices/i2c-*/device/power; do echo disabled > ''${power}/wakeup; done for power in /sys/bus/usb/devices/1-*/power; do echo disabled > ''${power}/wakeup || true; done
# Fix for Gigabyte motherboard
# /r/archlinux/comments/y7b97e/my_computer_wakes_up_immediately_after_i_suspend/isu99sr/
echo GPP0 > /proc/acpi/wakeup
set -e
''; '';
# From here: https://www.reddit.com/r/NixOS/comments/wcu34f/how_would_i_do_this_in_nix/ services.udev.extraRules = ''
# services.udev.extraRules = '' ACTION=="add", SUBSYSTEM=="usb", DRIVER=="usb", ATTR{power/wakeup}="disabled"
# ACTION=="add", SUBSYSTEM=="i2c", ATTRS{idVendor}=="<vendor>", ATTRS{idProduct}=="<product>" RUN+="${pkgs.bash}/bin/bash -c 'echo disabled > /sys/bus/i2c/devices/i2c-*/power/wakeup'" ACTION=="add", SUBSYSTEM=="i2c", ATTR{power/wakeup}="disabled"
# ''; '';
}; };

View File

@ -0,0 +1,74 @@
{ config, lib, ... }: {
options = {
arrServer = lib.mkOption {
type = lib.types.nullOr lib.types.str;
description = "Hostname for arr services";
default = null;
};
};
config = lib.mkIf (config.arrServer != null) {
services.sonarr.enable = true;
services.radarr.enable = true;
services.bazarr.enable = true;
services.prowlarr.enable = true;
# Grant users access to destination directories
users.users.sonarr.extraGroups = [ "jellyfin" ];
users.users.radarr.extraGroups = [ "jellyfin" ];
users.users.bazarr.extraGroups = [ "jellyfin" ];
# Requires updating the base_url config value in each service
# If you try to rewrite the URL, the service won't redirect properly
caddy.routes = [
{
group = "download";
match = [{
host = [ config.arrServer ];
path = [ "/sonarr*" ];
}];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:8989"; }];
}];
}
{
group = "download";
match = [{
host = [ config.arrServer ];
path = [ "/radarr*" ];
}];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:7878"; }];
}];
}
{
group = "download";
match = [{
host = [ config.arrServer ];
path = [ "/prowlarr*" ];
}];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:9696"; }];
}];
}
{
group = "download";
match = [{
host = [ config.arrServer ];
path = [ "/bazarr*" ];
}];
handle = [{
handler = "reverse_proxy";
upstreams = [{ dial = "localhost:6767"; }];
}];
}
];
};
}

View File

@ -24,6 +24,16 @@
listen = [ ":443" ]; listen = [ ":443" ];
routes = config.caddy.routes; routes = config.caddy.routes;
errors.routes = config.caddy.blocks; errors.routes = config.caddy.blocks;
# logs = { }; # Uncomment to collect access logs
};
logging.logs.main = {
encoder = { format = "console"; };
writer = {
output = "file";
filename = "${config.services.caddy.logDir}/caddy.log";
roll = true;
};
level = "INFO";
}; };
}); });

View File

@ -41,6 +41,9 @@ in {
}]; }];
}]; }];
# Grant user access to Calibre directories
users.users.${config.user}.extraGroups = [ "calibre-web" ];
# Run a backup on a schedule # Run a backup on a schedule
systemd.timers.calibre-backup = lib.mkIf config.backups.calibre { systemd.timers.calibre-backup = lib.mkIf config.backups.calibre {
timerConfig = { timerConfig = {

View File

@ -1,6 +1,7 @@
{ ... }: { { ... }: {
imports = [ imports = [
./arr.nix
./backups.nix ./backups.nix
./caddy.nix ./caddy.nix
./calibre.nix ./calibre.nix

View File

@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }: { { config, lib, ... }: {
options = { samba.enable = lib.mkEnableOption "Enable Samba sharing."; }; options = { samba.enable = lib.mkEnableOption "Enable Samba sharing."; };
@ -12,8 +12,6 @@
browseable = "yes"; browseable = "yes";
"read only" = "no"; "read only" = "no";
"guest ok" = "no"; "guest ok" = "no";
"force user" = config.user;
"force group" = config.user;
comment = "NAS"; comment = "NAS";
}; };
}; };

View File

@ -41,7 +41,9 @@
}; };
# Create reverse proxy for web UI # Create reverse proxy for web UI
caddy.routes = [{ caddy.routes = lib.mkAfter [{
group =
lib.mkIf (config.arrServer == config.transmissionServer) "download";
match = [{ host = [ config.transmissionServer ]; }]; match = [{ host = [ config.transmissionServer ]; }];
handle = [{ handle = [{
handler = "reverse_proxy"; handler = "reverse_proxy";

View File

@ -14,6 +14,10 @@
services.geoclue2.appConfig.localtimed.isSystem = true; services.geoclue2.appConfig.localtimed.isSystem = true;
services.geoclue2.appConfig.localtimed.isAllowed = true; services.geoclue2.appConfig.localtimed.isAllowed = true;
# Fix "Failed to set timezone"
# https://github.com/NixOS/nixpkgs/issues/68489#issuecomment-1484030107
services.geoclue2.enableDemoAgent = lib.mkForce true;
}; };
} }

16
overlays/lib.nix Normal file
View File

@ -0,0 +1,16 @@
_final: prev: {
extraLib = prev.lib // {
# Quickly package shell scripts with their dependencies
# From https://discourse.nixos.org/t/how-to-create-a-script-with-dependencies/7970/6
mkScript = { name, file, env ? [ ] }:
prev.pkgs.writeScriptBin name ''
for i in ${prev.lib.concatStringsSep " " env}; do
export PATH="$i/bin:$PATH"
done
exec ${prev.pkgs.bash}/bin/bash ${file} $@
'';
};
}