├── .direnvrc ├── .envrc ├── .github └── workflows │ └── nixos.yml ├── .gitignore ├── .luarc.json ├── LICENSE ├── README.md ├── assets ├── archive │ ├── boar_2022-09-26_10-41.png │ ├── neofetch-boar-2022.png │ └── neofetch-nixbox.png ├── boar_2024-04-01_22-55.png ├── flexbox_2024-04-02.png ├── neofetch-boar.png └── nix-valley-of-despair.png ├── configuration.nix ├── devenv.lock ├── devenv.nix ├── devenv.yaml ├── doc ├── INSTALL.md ├── MOVING.md └── upgrades │ ├── 2405 │ ├── NixOS-24.05.md │ └── assets │ │ ├── Uakari.png │ │ ├── brave-asking-for-kde-wallet.png │ │ ├── luks-race-condition-2405.png │ │ ├── networkmanager-mullvad-coredump.png │ │ ├── nix-tree.png │ │ ├── nixos-generations.png │ │ └── tty-pinentry.png │ ├── 2411 │ ├── NixOS-24.11.md │ └── assets │ │ ├── Toillama.png │ │ └── uakavolution.webp │ └── Checklist.md ├── flake.lock ├── flake.nix ├── home ├── aichat │ └── default.nix ├── alacritty │ └── default.nix ├── aliases │ └── default.nix ├── aws │ └── default.nix ├── bash │ └── default.nix ├── bitwarden │ └── default.nix ├── bluetuith │ └── default.nix ├── brave-browser │ └── default.nix ├── broot │ └── default.nix ├── btop │ └── default.nix ├── calibre │ └── default.nix ├── cliphist │ ├── default.nix │ └── scripts │ │ └── cliphist-fuzzel-img.sh ├── cpu-profile-toggler │ ├── default.nix │ └── scripts │ │ └── cpu-profile-toggler.sh ├── dconf │ └── default.nix ├── ddc-backlight │ ├── default.nix │ └── scripts │ │ └── ddc-backlight.sh ├── default.nix ├── devenv │ └── default.nix ├── direnv │ └── default.nix ├── discord │ └── default.nix ├── dunst │ └── default.nix ├── easyeffects │ ├── default.nix │ └── presets │ │ ├── irs │ │ └── razor-surround-48k-z-edition-stereo-plus20-bass.irs │ │ └── output │ │ └── bass-enhancing-perfect-eq.json ├── email │ └── default.nix ├── firefox │ └── default.nix ├── fish │ └── default.nix ├── fix-flexbox-mike │ ├── default.nix │ └── scripts │ │ └── xps-9700-mic-fixer.sh ├── flameshot │ └── default.nix ├── fuzzel │ └── default.nix ├── fzf │ └── default.nix ├── galaxy-buds-client │ └── default.nix ├── gimp │ └── default.nix ├── git │ ├── default.nix │ └── github-cli │ │ └── gh.config.yml ├── gtk-qt │ ├── default.nix │ └── qtct.conf ├── i3status-rust │ └── default.nix ├── impermanence │ └── default.nix ├── isd │ └── default.nix ├── k9s │ └── default.nix ├── kanshi │ └── default.nix ├── kind-with-local-registry │ ├── default.nix │ └── scripts │ │ └── kind-with-local-registry.sh ├── kubernetes-tools │ └── default.nix ├── less │ └── default.nix ├── lf │ ├── default.nix │ └── pistol │ │ └── pistol.conf ├── libation │ └── default.nix ├── libreoffice │ └── default.nix ├── lnav │ └── default.nix ├── localsend │ └── default.nix ├── mic-levels-maintainer │ ├── default.nix │ └── scripts │ │ ├── mic-levels-maintainer-flexbox.sh │ │ └── mic-levels-maintainer-numenor.sh ├── mpv │ └── default.nix ├── nautilus │ └── default.nix ├── neovim │ ├── avante │ │ ├── avante.lua │ │ └── default.nix │ ├── bookmarks-nvim │ │ └── default.nix │ ├── carbon │ │ └── default.nix │ ├── chatgpt-nvim │ │ ├── chatgpt-nvim.lua │ │ └── default.nix │ ├── cmp │ │ ├── cmp.lua │ │ └── default.nix │ ├── copilot │ │ └── default.nix │ ├── dadbod │ │ └── default.nix │ ├── dap │ │ ├── dap-ui.lua │ │ ├── dap.lua │ │ └── default.nix │ ├── default.nix │ ├── fidget │ │ └── default.nix │ ├── folds │ │ ├── default.nix │ │ └── ufo.lua │ ├── fugitive │ │ ├── default.nix │ │ └── fugitive.lua │ ├── git-conflict-nvim │ │ └── default.nix │ ├── gruvbox │ │ └── default.nix │ ├── jdtls │ │ ├── default.nix │ │ └── jdtls.lua │ ├── lspsaga │ │ └── default.nix │ ├── lualine │ │ └── default.nix │ ├── mason-lsp │ │ ├── default.nix │ │ ├── mason.lua │ │ └── shared_lsp_config.lua │ ├── mini-icons │ │ └── default.nix │ ├── mini-operators │ │ └── default.nix │ ├── neotest │ │ ├── default.nix │ │ └── neotest.lua │ ├── noice │ │ └── default.nix │ ├── none-ls │ │ ├── default.nix │ │ └── none-ls.lua │ ├── notify │ │ └── default.nix │ ├── nui │ │ └── default.nix │ ├── nvim-tree-lua │ │ └── default.nix │ ├── obsidian-nvim │ │ └── default.nix │ ├── oil │ │ └── default.nix │ ├── overseer │ │ ├── default.nix │ │ ├── overseer.lua │ │ ├── overseer_lib.lua │ │ └── templates │ │ │ ├── gmailctl_apply.lua │ │ │ ├── java_gradle │ │ │ ├── bootRun.lua │ │ │ ├── build.lua │ │ │ ├── clean.lua │ │ │ ├── init.lua │ │ │ ├── spotlessApply.lua │ │ │ └── test.lua │ │ │ ├── java_maven │ │ │ ├── clean_package.lua │ │ │ ├── init.lua │ │ │ └── test.lua │ │ │ ├── nixos_rebuild_boot.lua │ │ │ ├── nixos_rebuild_switch.lua │ │ │ ├── nixos_update_secrets.lua │ │ │ └── skaffold_dev.lua │ ├── plenary │ │ └── default.nix │ ├── rainbow-csv │ │ └── default.nix │ ├── render-markdown │ │ └── default.nix │ ├── telescope │ │ └── default.nix │ ├── toggleterm │ │ └── default.nix │ ├── treesitter │ │ ├── default.nix │ │ ├── queries │ │ │ └── nix │ │ │ │ └── injections.scm │ │ └── treesitter.lua │ ├── trouble │ │ ├── default.nix │ │ └── trouble.lua │ └── vim-visual-multi │ │ └── default.nix ├── networkmanager-dmenu │ ├── config.ini │ └── default.nix ├── nh │ └── default.nix ├── nix-index │ └── default.nix ├── nushell │ ├── config.nu │ ├── default.nix │ └── env.nu ├── obs │ └── default.nix ├── obsidian │ └── default.nix ├── pavucontrol │ └── default.nix ├── portfolio-performance │ └── default.nix ├── psql │ ├── default.nix │ └── psqlrc ├── pulsemixer │ ├── default.nix │ └── pulsemixer.cfg ├── qalculate │ └── default.nix ├── remmina │ └── default.nix ├── rofi │ └── default.nix ├── rofimoji │ ├── default.nix │ └── rofimoji.rc ├── signal │ ├── default.nix │ └── scripts │ │ └── signal-desktop-launcher-workaround.sh ├── solaar │ └── default.nix ├── sound-switcher │ ├── default.nix │ └── scripts │ │ ├── sound-switcher-flexbox.sh │ │ └── sound-switcher-numenor.sh ├── ssh │ └── default.nix ├── starship │ └── default.nix ├── stylix │ └── default.nix ├── sway │ └── default.nix ├── syncthing │ └── default.nix ├── systemd-errors-and-warnings-counter │ ├── default.nix │ └── scripts │ │ └── systemd-errors-and-warnings-counter.sh ├── tealdeer │ └── default.nix ├── telegram │ └── default.nix ├── thefuck │ └── default.nix ├── todoist │ └── default.nix ├── trash-cli │ └── default.nix ├── udiskie │ └── default.nix ├── urxvt │ └── default.nix ├── variety │ ├── default.nix │ └── variety.conf ├── virtual-cable │ ├── default.nix │ └── scripts │ │ └── obs-mic.sh ├── vlc │ └── default.nix ├── wlsunset │ └── default.nix ├── xdg │ └── default.nix ├── ytmdesktop │ └── default.nix ├── yubico │ ├── default.nix │ └── modules │ │ └── yubikey-touch-detector │ │ └── default.nix ├── zoom │ └── default.nix └── zoxide │ └── default.nix ├── machines ├── boar-server.nix ├── flexbox │ ├── hardware-scan.nix │ └── system.nix └── numenor │ ├── hardware-scan.nix │ └── system.nix ├── nix └── default.nix ├── specialisations └── light │ └── default.nix └── system ├── amd └── default.nix ├── audio └── default.nix ├── bluetooth └── default.nix ├── boot └── default.nix ├── btrfs └── default.nix ├── cachix └── default.nix ├── default.nix ├── desktop └── default.nix ├── dns └── default.nix ├── firmware └── default.nix ├── fonts └── default.nix ├── impermanence └── default.nix ├── io └── default.nix ├── kernel └── default.nix ├── kind-killer └── default.nix ├── networking └── default.nix ├── nix-ld └── default.nix ├── nvidia └── default.nix ├── performance └── default.nix ├── power └── default.nix ├── printing └── default.nix ├── security └── default.nix ├── stylix ├── default.nix ├── gruvbox-dark-rainbow.png └── gruvbox-light-rainbow.png ├── syncthing └── default.nix ├── users └── default.nix ├── various └── default.nix ├── video └── default.nix └── virtualisation └── default.nix /.direnvrc: -------------------------------------------------------------------------------- 1 | # ---------------------------------------------------------------- 2 | # From: https://github.com/direnv/direnv/issues/73#issuecomment-392342423 3 | # ---------------------------------------------------------------- 4 | export_function() { 5 | local name=$1 6 | local alias_dir=$PWD/.direnv/aliases 7 | mkdir -p "$alias_dir" 8 | PATH_add "$alias_dir" 9 | local target="$alias_dir/$name" 10 | if declare -f "$name" >/dev/null; then 11 | echo "#!/usr/bin/env bash" > "$target" 12 | declare -f "$name" >> "$target" 2>/dev/null 13 | # Notice that we add shell variables to the function trigger. 14 | echo "$name \$*" >> "$target" 15 | chmod +x "$target" 16 | fi 17 | } 18 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | source_url "https://raw.githubusercontent.com/cachix/devenv/95f329d49a8a5289d31e0982652f7058a189bfca/direnvrc" "sha256-d+8cBpDfDBj41inrADaJt+bDWhOktwslgoP5YiGJ1v0=" 2 | 3 | use devenv -------------------------------------------------------------------------------- /.github/workflows/nixos.yml: -------------------------------------------------------------------------------- 1 | name: NixOS 2 | concurrency: nixos 3 | 4 | on: 5 | pull_request: 6 | push: 7 | branches: 8 | - main 9 | paths-ignore: 10 | - "README.md" 11 | - "NOTES.md" 12 | - ".gitignore" 13 | 14 | jobs: 15 | build-numenor: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: "Create Dir for Mounting moar Disk Space ❄" 19 | run: | 20 | sudo mkdir /nix 21 | 22 | - name: "Maximize Disk Space" 23 | run: | 24 | sudo rm -rf $AGENT_TOOLSDIRECTORY 25 | sudo rm -rf /usr/local/.ghcup 26 | sudo rm -rf /usr/local/share/powershell 27 | sudo rm -rf /usr/local/share/chromium 28 | sudo rm -rf /usr/local/lib/node_modules 29 | sudo rm -rf /usr/local/lib/heroku 30 | sudo rm -rf /var/lib/docker/overlay2 31 | sudo rm -rf /home/linuxbrew 32 | sudo rm -rf /home/runner/.rustup 33 | 34 | - name: "Maximize Disk Space 😈" 35 | uses: easimon/maximize-build-space@v8 36 | with: 37 | root-reserve-mb: 8192 38 | swap-size-mb: 1024 39 | build-mount-path: /nix 40 | remove-dotnet: "true" 41 | remove-android: "true" 42 | remove-haskell: "true" 43 | remove-codeql: "true" 44 | remove-docker-images: "true" 45 | 46 | - uses: actions/checkout@v4 47 | 48 | - name: "Install Nix ❄️" 49 | uses: cachix/install-nix-action@v27 50 | with: 51 | extra_nix_config: | 52 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 53 | 54 | - name: "Install Cachix ❄️" 55 | uses: cachix/cachix-action@v15 56 | with: 57 | name: workflow-nixos-config 58 | authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" 59 | 60 | # - name: Setup tmate session 61 | # uses: mxschmitt/action-tmate@v3 62 | 63 | - name: "Build NixOS config ❄️" 64 | run: | 65 | nix build .#nixosConfigurations.numenor.config.system.build.toplevel --override-input secrets nixpkgs 66 | 67 | build-flexbox: 68 | runs-on: ubuntu-latest 69 | needs: [build-numenor] 70 | steps: 71 | - name: "Create Dir for Mounting moar Disk Space ❄" 72 | run: | 73 | sudo mkdir /nix 74 | 75 | - name: "Maximize Disk Space" 76 | run: | 77 | sudo rm -rf $AGENT_TOOLSDIRECTORY 78 | sudo rm -rf /usr/local/.ghcup 79 | sudo rm -rf /usr/local/share/powershell 80 | sudo rm -rf /usr/local/share/chromium 81 | sudo rm -rf /usr/local/lib/node_modules 82 | sudo rm -rf /usr/local/lib/heroku 83 | sudo rm -rf /var/lib/docker/overlay2 84 | sudo rm -rf /home/linuxbrew 85 | sudo rm -rf /home/runner/.rustup 86 | 87 | - name: "Maximize Disk Space 😈" 88 | uses: easimon/maximize-build-space@v8 89 | with: 90 | root-reserve-mb: 24432 91 | swap-size-mb: 512 92 | build-mount-path: /nix 93 | remove-dotnet: "true" 94 | remove-android: "true" 95 | remove-haskell: "true" 96 | remove-codeql: "true" 97 | remove-docker-images: "true" 98 | 99 | - uses: actions/checkout@v4 100 | 101 | - name: "Install Nix ❄️" 102 | uses: cachix/install-nix-action@v27 103 | with: 104 | extra_nix_config: | 105 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 106 | 107 | - name: "Install Cachix ❄️" 108 | uses: cachix/cachix-action@v15 109 | with: 110 | name: workflow-nixos-config 111 | authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" 112 | 113 | # - name: Setup tmate session 114 | # uses: mxschmitt/action-tmate@v3 115 | 116 | - name: "Build NixOS config ❄️" 117 | run: | 118 | nix build .#nixosConfigurations.flexbox.config.system.build.toplevel --override-input secrets nixpkgs 119 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | result 2 | result-* 3 | 4 | # Direnv temp files 5 | .direnv/ 6 | # Devenv 7 | .devenv* 8 | devenv.local.nix 9 | 10 | # direnv 11 | .direnv 12 | 13 | # pre-commit 14 | .pre-commit-config.yaml 15 | -------------------------------------------------------------------------------- /.luarc.json: -------------------------------------------------------------------------------- 1 | { 2 | "diagnostics.globals": [ 3 | "vim" 4 | ] 5 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dotfiles-on-steroids [NixOS Config] 2 | 3 | [![built with nix](https://builtwithnix.org/badge.svg)](https://builtwithnix.org) 4 | [![NixOS Systems Build](https://github.com/workflow/nixos-config/actions/workflows/nixos.yml/badge.svg)](https://github.com/workflow/nixos-config/actions/) 5 | 6 | Workflow's current, and immutably evolving, NixOS configuration files, home-manager, neovim, etc. 7 | 8 | ![neofetch boar](assets/neofetch-boar.png) 9 | 10 | ![boar](assets/boar_2024-04-01_22-55.png) 11 | 12 | ![flexbox](assets/flexbox_2024-04-02.png) 13 | 14 | Used as daily driver since 2020. 😎 15 | 16 | ## Programs 17 | 18 | Checkout the `home` directory for an up-to-date list of installed goodies. Here's a few shoutouts: 19 | 20 | | Type | Program | 21 | | :--------------- | :---------------------------------------------------------------------: | 22 | | AI IDE | [Avante](https://github.com/yetone/avante.nvim) | 23 | | Animal | [Raccoon](https://duckduckgo.com/?hps=1&q=raccoon&iax=images&ia=images) | 24 | | Backups | [Restic](https://github.com/restic/restic) | 25 | | Display Manager | [Ly](https://codeberg.org/AnErrupTion/ly) | 26 | | Editor | [NeoVim](https://neovim.io/) | 27 | | File Manager | [Lf](https://github.com/gokcehan/lf) | 28 | | File Syncing | [Syncthing](https://github.com/syncthing/syncthing) | 29 | | Impermanence | [Impermanence](https://github.com/nix-community/impermanence) | 30 | | Launcher | [Fuzzel](https://codeberg.org/dnkl/fuzzel) | 31 | | Nix Builds | [Nh](https://github.com/viperML/nh) | 32 | | Notifications | [Dunst](https://github.com/dunst-project/dunst) | 33 | | Prompt | [Starship](https://github.com/starship/starship) | 34 | | Power Management | [Auto-Cpufreq](https://github.com/AdnanHodzic/auto-cpufreq) | 35 | | Shell | [Fish](https://fishshell.com/) | 36 | | Shell when data | [Nushell](https://www.nushell.sh/) | 37 | | Status Bar | [i3status-rust](https://github.com/greshake/i3status-rust) | 38 | | Style Manager | [stylix](https://github.com/danth/stylix) | 39 | | Terminal | [Alacritty](https://github.com/alacritty/alacritty) | 40 | | Window Manager | [Sway](https://github.com/swaywm/sway) | 41 | 42 | ## Lack of Aesthetics 43 | 44 | | Type | Name | 45 | | :------------- | :-----------------------------------------------------------: | 46 | | Monospace Font | [FiraCode](https://github.com/tonsky/FiraCode) | 47 | | Emoji Font | [Noto Color Emoji](https://github.com/googlefonts/noto-emoji) | 48 | | Dark Theme | [Gruvbox](https://github.com/morhetz/gruvbox) | 49 | | Light Theme | [Catppuccin Latte](https://github.com/catppuccin/catppuccin) | 50 | 51 | Switching between Light and Dark theme is currently done via [NixOS Specialisation](specialisations/light/default.nix). 52 | 53 | ## I Wanna Install 54 | 55 | You likely don't want to, as this config is heavily customized to my needs. 56 | 57 | But here's a rough guide: 58 | 59 | [Setup Instructions](doc/INSTALL.md) 60 | 61 | ![nix-valley-of-doom](assets/nix-valley-of-despair.png) 62 | 63 | ## Notes 64 | 65 | - [NixOS 24.11 Upgrade Adventures](doc/upgrades/2411/NixOS-24.11.md) 66 | - [NixOS 24.05 Upgrade Adventures](doc/upgrades/2405/NixOS-24.05.md) 67 | - [NixOS Upgrade Checklist](doc/upgrades/Checklist.md) 68 | - [Moving an Existing Installation to a new Disk](doc/MOVING.md) 69 | 70 | ## Acknowledgements 71 | 72 | - A lot of this was initially looted from https://github.com/alexpeits/nixos-config. Thank you! 73 | 74 | - CI build and many other goodies ~stolen from~ inspired by https://github.com/gvolpe/nix-config 75 | 76 | - Vimjoyer's fantastic YouTube channel: https://www.youtube.com/@vimjoyer 77 | 78 | ## History 79 | 80 | ![neofetch nixbox](assets/archive/neofetch-nixbox.png) 81 | ![boar-2022](assets/archive/boar_2022-09-26_10-41.png) 82 | -------------------------------------------------------------------------------- /assets/archive/boar_2022-09-26_10-41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/assets/archive/boar_2022-09-26_10-41.png -------------------------------------------------------------------------------- /assets/archive/neofetch-boar-2022.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/assets/archive/neofetch-boar-2022.png -------------------------------------------------------------------------------- /assets/archive/neofetch-nixbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/assets/archive/neofetch-nixbox.png -------------------------------------------------------------------------------- /assets/boar_2024-04-01_22-55.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/assets/boar_2024-04-01_22-55.png -------------------------------------------------------------------------------- /assets/flexbox_2024-04-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/assets/flexbox_2024-04-02.png -------------------------------------------------------------------------------- /assets/neofetch-boar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/assets/neofetch-boar.png -------------------------------------------------------------------------------- /assets/nix-valley-of-despair.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/assets/nix-valley-of-despair.png -------------------------------------------------------------------------------- /configuration.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | imports = [ 3 | ./nix 4 | ./specialisations/light 5 | ./system 6 | ]; 7 | } 8 | -------------------------------------------------------------------------------- /devenv.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "devenv": { 4 | "locked": { 5 | "dir": "src/modules", 6 | "lastModified": 1743025451, 7 | "owner": "cachix", 8 | "repo": "devenv", 9 | "rev": "686aaf88c9c095fc49dadc620d1a814830c78206", 10 | "type": "github" 11 | }, 12 | "original": { 13 | "dir": "src/modules", 14 | "owner": "cachix", 15 | "repo": "devenv", 16 | "type": "github" 17 | } 18 | }, 19 | "flake-compat": { 20 | "flake": false, 21 | "locked": { 22 | "lastModified": 1733328505, 23 | "owner": "edolstra", 24 | "repo": "flake-compat", 25 | "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", 26 | "type": "github" 27 | }, 28 | "original": { 29 | "owner": "edolstra", 30 | "repo": "flake-compat", 31 | "type": "github" 32 | } 33 | }, 34 | "gitignore": { 35 | "inputs": { 36 | "nixpkgs": [ 37 | "pre-commit-hooks", 38 | "nixpkgs" 39 | ] 40 | }, 41 | "locked": { 42 | "lastModified": 1709087332, 43 | "owner": "hercules-ci", 44 | "repo": "gitignore.nix", 45 | "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", 46 | "type": "github" 47 | }, 48 | "original": { 49 | "owner": "hercules-ci", 50 | "repo": "gitignore.nix", 51 | "type": "github" 52 | } 53 | }, 54 | "nixpkgs": { 55 | "locked": { 56 | "lastModified": 1733477122, 57 | "owner": "cachix", 58 | "repo": "devenv-nixpkgs", 59 | "rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857", 60 | "type": "github" 61 | }, 62 | "original": { 63 | "owner": "cachix", 64 | "ref": "rolling", 65 | "repo": "devenv-nixpkgs", 66 | "type": "github" 67 | } 68 | }, 69 | "pre-commit-hooks": { 70 | "inputs": { 71 | "flake-compat": "flake-compat", 72 | "gitignore": "gitignore", 73 | "nixpkgs": [ 74 | "nixpkgs" 75 | ] 76 | }, 77 | "locked": { 78 | "lastModified": 1742649964, 79 | "owner": "cachix", 80 | "repo": "pre-commit-hooks.nix", 81 | "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", 82 | "type": "github" 83 | }, 84 | "original": { 85 | "owner": "cachix", 86 | "repo": "pre-commit-hooks.nix", 87 | "type": "github" 88 | } 89 | }, 90 | "root": { 91 | "inputs": { 92 | "devenv": "devenv", 93 | "nixpkgs": "nixpkgs", 94 | "pre-commit-hooks": "pre-commit-hooks" 95 | } 96 | } 97 | }, 98 | "root": "root", 99 | "version": 7 100 | } 101 | -------------------------------------------------------------------------------- /devenv.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | # https://devenv.sh/basics/ 3 | env.GREET = "NixOS config"; 4 | 5 | # https://devenv.sh/packages/ 6 | packages = [ 7 | pkgs.alejandra 8 | pkgs.git 9 | pkgs.shellcheck 10 | ]; 11 | 12 | # https://devenv.sh/scripts/ 13 | scripts.hello.exec = "echo hello from $GREET"; 14 | 15 | enterShell = '' 16 | hello 17 | ''; 18 | 19 | # https://devenv.sh/tests/ 20 | enterTest = '' 21 | echo "Running tests" 22 | git --version | grep "2.42.0" 23 | ''; 24 | 25 | # https://devenv.sh/services/ 26 | # services.postgres.enable = true; 27 | 28 | # https://devenv.sh/languages/ 29 | # languages.nix.enable = true; 30 | 31 | # https://devenv.sh/pre-commit-hooks/ 32 | pre-commit.hooks = { 33 | alejandra = { 34 | enable = true; 35 | settings = { 36 | check = true; 37 | }; 38 | }; 39 | shellcheck = { 40 | enable = true; 41 | entry = "shellcheck -s bash"; 42 | }; 43 | }; 44 | 45 | # https://devenv.sh/processes/ 46 | # processes.ping.exec = "ping example.com"; 47 | 48 | # See full reference at https://devenv.sh/reference/options/ 49 | } 50 | -------------------------------------------------------------------------------- /devenv.yaml: -------------------------------------------------------------------------------- 1 | # yaml-language-server: $schema=https://devenv.sh/devenv.schema.json 2 | inputs: 3 | nixpkgs: 4 | url: github:cachix/devenv-nixpkgs/rolling 5 | 6 | # If you're using non-OSS software, you can set allowUnfree to true. 7 | # allowUnfree: true 8 | 9 | # If you're willing to use a package that's vulnerable 10 | # permittedInsecurePackages: 11 | # - "openssl-1.1.1w" 12 | 13 | # If you have more than one devenv you can merge them 14 | #imports: 15 | # - ./backend 16 | -------------------------------------------------------------------------------- /doc/MOVING.md: -------------------------------------------------------------------------------- 1 | # Moving to a new disk 2 | 3 | 1. Prepare the new disk according to the [Partitioning Information](https://github.com/workflow/dotfiles?tab=readme-ov-file#fresh-install) up to the point just before mounting the swap/disks 4 | 1. Update the hardware configuration (e.g. `nixos-config/machines/my-machine/hardware-scan.nix` and maybe `nixos-config/machines/my-machine/system.nix`) to point to the new partitions 5 | 1. Mount the new boot partition in-place: `sudo mount $NEWBOOT /boot` 6 | 1. Install the new configuration, including bootloader: `sudo nixos-rebuild boot --install-bootloader --flake .#my-machine` 7 | 1. Reboot into an installation disk 8 | 1. Mount the old root parition at `/mnt/old` 9 | 1. Mount the new root parition at `/mnt/new` 10 | 1. Copy everything over, preserving creation times with `-N` for syncthing: 11 | ```bash 12 | rsync -aAXvN --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} /mnt/old/ /mnt/new 13 | ``` 14 | 1. Reboot into the new drive and enjoy =) 15 | 16 | 17 | -------------------------------------------------------------------------------- /doc/upgrades/2405/assets/Uakari.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/doc/upgrades/2405/assets/Uakari.png -------------------------------------------------------------------------------- /doc/upgrades/2405/assets/brave-asking-for-kde-wallet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/doc/upgrades/2405/assets/brave-asking-for-kde-wallet.png -------------------------------------------------------------------------------- /doc/upgrades/2405/assets/luks-race-condition-2405.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/doc/upgrades/2405/assets/luks-race-condition-2405.png -------------------------------------------------------------------------------- /doc/upgrades/2405/assets/networkmanager-mullvad-coredump.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/doc/upgrades/2405/assets/networkmanager-mullvad-coredump.png -------------------------------------------------------------------------------- /doc/upgrades/2405/assets/nix-tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/doc/upgrades/2405/assets/nix-tree.png -------------------------------------------------------------------------------- /doc/upgrades/2405/assets/nixos-generations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/doc/upgrades/2405/assets/nixos-generations.png -------------------------------------------------------------------------------- /doc/upgrades/2405/assets/tty-pinentry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/doc/upgrades/2405/assets/tty-pinentry.png -------------------------------------------------------------------------------- /doc/upgrades/2411/assets/Toillama.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/doc/upgrades/2411/assets/Toillama.png -------------------------------------------------------------------------------- /doc/upgrades/2411/assets/uakavolution.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/doc/upgrades/2411/assets/uakavolution.webp -------------------------------------------------------------------------------- /doc/upgrades/Checklist.md: -------------------------------------------------------------------------------- 1 | # NixOS Upgrade Checklist 2 | 3 | 1. Start writing a new adventure 4 | 2. Go through release manual 5 | 3. Go through `home-manager` news: https://github.com/nix-community/home-manager/blob/master/modules/misc/news.nix 6 | 4. Build config with `sudo nixos-rebuild build --flake .#` (don't use `nh` for this one) 7 | 5. Test on next boot: `nh os boot` 8 | 6. Reboot 9 | 7. After everything is more or less working, check for any new hardware settings in `nixos-generate-config --show-hardware-config` 10 | 8. Re-evaluate `unstable` and other overrides 11 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "nixos configuration using flakes"; 3 | 4 | inputs = { 5 | home-manager = { 6 | url = "github:nix-community/home-manager/release-24.11"; 7 | inputs.nixpkgs.follows = "nixpkgs"; 8 | }; 9 | impermanence.url = "github:nix-community/impermanence"; 10 | nix-index-database = { 11 | url = "github:nix-community/nix-index-database"; 12 | inputs.nixpkgs.follows = "nixpkgs"; 13 | }; 14 | nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; 15 | nixos-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; 16 | nixos-hardware.url = "github:nixos/nixos-hardware/master"; 17 | nur.url = "github:nix-community/nur"; 18 | rmob.url = "https://flakehub.com/f/workflow/rmob/*.tar.gz"; 19 | secrets.url = "path:/home/farlion/code/nixos-secrets"; 20 | stylix.url = "github:danth/stylix/release-24.11"; 21 | }; 22 | 23 | outputs = { 24 | nixpkgs, 25 | nixos-unstable, 26 | home-manager, 27 | impermanence, 28 | nur, 29 | secrets, 30 | stylix, 31 | ... 32 | } @ inputs: let 33 | overlays = { 34 | unstable = import nixos-unstable { 35 | system = "x86_64-linux"; 36 | config.allowUnfree = true; 37 | }; 38 | }; 39 | in { 40 | nixosConfigurations.flexbox = nixpkgs.lib.nixosSystem { 41 | system = "x86_64-linux"; 42 | specialArgs = { 43 | inherit inputs; 44 | inherit secrets; 45 | waylandScaleFactor = 2.0; 46 | isImpermanent = false; 47 | }; 48 | modules = [ 49 | { 50 | nixpkgs.overlays = [(_: _: overlays)]; 51 | } 52 | nixpkgs.nixosModules.notDetected 53 | ./machines/flexbox/hardware-scan.nix 54 | ./machines/flexbox/system.nix 55 | ./system/nvidia 56 | ./configuration.nix 57 | nur.modules.nixos.default 58 | impermanence.nixosModules.impermanence 59 | home-manager.nixosModules.home-manager 60 | { 61 | home-manager = { 62 | useGlobalPkgs = true; 63 | useUserPackages = true; 64 | backupFileExtension = "home-manager-backup"; 65 | users.farlion = import ./home; 66 | extraSpecialArgs = { 67 | isAmd = false; 68 | isImpermanent = false; 69 | isLaptop = true; 70 | isNvidia = true; 71 | waylandScaleFactor = 2.0; 72 | inherit inputs; 73 | inherit secrets; 74 | }; 75 | }; 76 | } 77 | stylix.nixosModules.stylix 78 | ]; 79 | }; 80 | 81 | nixosConfigurations.numenor = nixpkgs.lib.nixosSystem { 82 | system = "x86_64-linux"; 83 | specialArgs = { 84 | inherit inputs; 85 | inherit secrets; 86 | isImpermanent = true; 87 | waylandScaleFactor = 1.5; 88 | }; 89 | modules = [ 90 | { 91 | nixpkgs.overlays = [(_: _: overlays)]; 92 | } 93 | nixpkgs.nixosModules.notDetected 94 | ./machines/numenor/hardware-scan.nix 95 | ./machines/numenor/system.nix 96 | ./system/amd 97 | ./system/btrfs 98 | ./configuration.nix 99 | nur.modules.nixos.default 100 | impermanence.nixosModules.impermanence 101 | home-manager.nixosModules.home-manager 102 | { 103 | home-manager = { 104 | useGlobalPkgs = true; 105 | useUserPackages = true; 106 | backupFileExtension = "home-manager-backup"; 107 | users.farlion = import ./home; 108 | extraSpecialArgs = { 109 | isAmd = true; 110 | isImpermanent = true; 111 | isLaptop = false; 112 | isNvidia = false; 113 | waylandScaleFactor = 1.5; 114 | inherit inputs; 115 | inherit secrets; 116 | }; 117 | }; 118 | } 119 | stylix.nixosModules.stylix 120 | ]; 121 | }; 122 | }; 123 | } 124 | -------------------------------------------------------------------------------- /home/aichat/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/aichat" 10 | ]; 11 | }; 12 | home.packages = [ 13 | pkgs.unstable.aichat 14 | ]; 15 | } 16 | -------------------------------------------------------------------------------- /home/alacritty/default.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | programs.alacritty = { 3 | enable = true; 4 | 5 | settings = { 6 | cursor = { 7 | vi_mode_style = { 8 | shape = "Beam"; 9 | blinking = "Always"; 10 | }; 11 | }; 12 | 13 | keyboard.bindings = [ 14 | { 15 | key = "Return"; 16 | mods = "Control|Super"; 17 | action = "SpawnNewInstance"; 18 | } 19 | { 20 | key = "Escape"; 21 | mods = "Alt"; 22 | action = "ToggleViMode"; 23 | } 24 | { 25 | key = "Semicolon"; 26 | mode = "Vi|~Search"; 27 | action = "Right"; 28 | } 29 | { 30 | key = "L"; 31 | mode = "Vi|~Search"; 32 | action = "Up"; 33 | } 34 | { 35 | key = "K"; 36 | mode = "Vi|~Search"; 37 | action = "Down"; 38 | } 39 | { 40 | key = "J"; 41 | mode = "Vi|~Search"; 42 | action = "Left"; 43 | } 44 | { 45 | key = 53; 46 | mode = "Vi|~Search"; 47 | mods = "Shift"; 48 | action = "SearchBackward"; 49 | } 50 | ]; 51 | 52 | env = { 53 | # Better color support in some apps 54 | TERM = "xterm-256color"; 55 | }; 56 | 57 | scrolling = { 58 | history = 100000; 59 | }; 60 | }; 61 | }; 62 | } 63 | -------------------------------------------------------------------------------- /home/aliases/default.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | home.shellAliases = { 3 | ".." = "cd .."; 4 | "..." = "cd ../.."; 5 | "...." = "cd ../../.."; 6 | "....." = "cd ../../../.."; 7 | 8 | caffeinate = "systemctl --user stop swayidle"; 9 | decaffeinate = "systemctl --user start swayidle"; 10 | 11 | c = "wl-copy"; 12 | cc = "tee /dev/tty | wl-copy"; 13 | 14 | cdn = "cd ~/nixos-config"; 15 | cdc = "cd ~/code"; 16 | 17 | dira = "direnv allow"; 18 | dird = "direnv deny"; 19 | dirr = "direnv reload"; 20 | dark-theme = "nh os test --no-specialisation"; 21 | dr = "direnv reload"; 22 | 23 | ga = "git add -p"; 24 | gaa = "git add --all"; 25 | gaf = "git add -N *"; 26 | gc = "git checkout"; 27 | gca = "git commit --amend"; 28 | gcb = "git checkout -b"; 29 | gcf = "git commit --fixup"; 30 | gcm = "git commit -m"; 31 | gd = "git diff"; 32 | gdc = "git diff --cached"; 33 | gf = "git fetch --prune"; 34 | gfo = "git fetch origin main:main || git fetch origin master:master"; 35 | gl = "git log"; 36 | glcs = "git rev-parse HEAD | wl-copy"; # Get Latest Commit SHA 37 | gm = "git checkout main || git checkout master"; 38 | gp = "git pull --prune"; 39 | gpf = "git push --force-with-lease"; 40 | gpn = "git push -u origin HEAD"; 41 | gr = "git rebase"; 42 | grc = "git rebase --continue"; 43 | grm = "git rebase main || git rebase master"; 44 | gs = "git status"; 45 | gst = "git stash"; 46 | gsa = "git stash apply"; 47 | gsp = "git stash pop"; 48 | 49 | ghco = "gh pr checkout"; 50 | ghpa = "gh pr review --approve"; 51 | ghmr = "gh pr merge -r"; 52 | 53 | k9s-kind = "k9s --context kind-kind"; 54 | 55 | kc = "kubectl"; 56 | kc-kind = "kubectl --context kind-kind"; 57 | 58 | lh = "/run/current-system/sw/bin/ls -ah"; 59 | light-theme = "nh os test --specialisation light"; 60 | 61 | myip = "dig @resolver1.opendns.com ANY myip.opendns.com +short"; 62 | 63 | n = "nh os switch"; 64 | 65 | nl = "sudo nix-env --list-generations --profile /nix/var/nix/profiles/system"; 66 | ngc = "sudo nix-env --delete-generations 30d --profile /nix/var/nix/profiles/system"; 67 | 68 | nsn = "nh search"; 69 | 70 | pa = "pw-play ~/Music/Own\\ Speech/IckbinArschratte.WAV"; 71 | 72 | paste = "wl-paste"; 73 | 74 | ra = "systemctl restart --user pipewire"; 75 | 76 | rm = "trash-put"; 77 | 78 | stern-kind = "stern --context kind-kind"; 79 | 80 | tailup = "sudo tailscale up --accept-routes --accept-dns=false"; 81 | taildown = "sudo tailscale down"; 82 | 83 | x = "exit"; 84 | }; 85 | } 86 | -------------------------------------------------------------------------------- /home/aws/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | isImpermanent, 3 | lib, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".aws" 10 | ]; 11 | }; 12 | 13 | home.packages = [pkgs.awscli2]; 14 | } 15 | -------------------------------------------------------------------------------- /home/bash/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | ... 5 | }: { 6 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 7 | files = [ 8 | ".bash_history" 9 | ]; 10 | }; 11 | programs.bash.enable = true; 12 | } 13 | -------------------------------------------------------------------------------- /home/bitwarden/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/Bitwarden" 10 | ]; 11 | }; 12 | 13 | home.packages = [ 14 | pkgs.bitwarden 15 | pkgs.bitwarden-cli 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /home/bluetuith/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/bluetuith" 10 | ]; 11 | }; 12 | 13 | home.packages = [ 14 | pkgs.bluetuith 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /home/brave-browser/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | osConfig, 5 | pkgs, 6 | ... 7 | }: let 8 | isFlexbox = osConfig.networking.hostName == "flexbox"; 9 | in { 10 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 11 | directories = [ 12 | ".config/BraveSoftware" 13 | ".cache/BraveSoftware" 14 | ]; 15 | }; 16 | 17 | home.packages = [ 18 | pkgs.brave 19 | ]; 20 | 21 | home.sessionVariables = { 22 | BROWSER = 23 | if isFlexbox 24 | then "brave --enable-features='VaapiVideoDecoder,VaapiVideoEncoder' --enable-raw-draw --password-store=seahorse" 25 | else "brave"; 26 | DEFAULT_BROWSER = 27 | if isFlexbox 28 | then "brave --enable-features='VaapiVideoDecoder,VaapiVideoEncoder' --enable-raw-draw --password-store=seahorse" 29 | else "brave"; 30 | }; 31 | 32 | xdg.desktopEntries = { 33 | brave-browser = { 34 | exec = 35 | if isFlexbox 36 | then "${pkgs.brave}/bin/brave --enable-features=VaapiVideoDecoder,VaapiVideoEncoder --enable-raw-draw %U" 37 | else "${pkgs.brave}/bin/brave"; 38 | name = "Brave Browser"; 39 | comment = "Access the Internet"; 40 | genericName = "Web Browser"; 41 | categories = ["Network" "WebBrowser"]; 42 | icon = "brave-browser"; 43 | mimeType = ["application/pdf" "application/rdf+xml" "application/rss+xml" "application/xhtml+xml" "application/xhtml_xml" "application/xml" "image/gif" "image/jpeg" "image/png" "image/webp" "text/html" "text/xml" "x-scheme-handler/http" "x-scheme-handler/https" "x-scheme-handler/ipfs" "x-scheme-handler/ipns"]; 44 | startupNotify = true; 45 | terminal = true; 46 | type = "Application"; 47 | }; 48 | }; 49 | } 50 | -------------------------------------------------------------------------------- /home/broot/default.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | programs.broot = { 3 | enable = true; 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /home/btop/default.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | programs.btop = { 3 | enable = true; 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /home/calibre/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | "Calibre Library" 10 | ".config/calibre" 11 | ".cache/calibre" 12 | ]; 13 | }; 14 | 15 | home.packages = [ 16 | pkgs.calibre 17 | ]; 18 | } 19 | -------------------------------------------------------------------------------- /home/cliphist/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | isImpermanent, 3 | lib, 4 | pkgs, 5 | ... 6 | }: let 7 | cliphist-fuzzel-img = pkgs.writeShellApplication { 8 | bashOptions = [ 9 | "nounset" 10 | "pipefail" 11 | ]; 12 | name = "cliphist-fuzzel-img"; 13 | runtimeInputs = [pkgs.unstable.fuzzel pkgs.cliphist pkgs.imagemagick]; 14 | text = builtins.readFile ./scripts/cliphist-fuzzel-img.sh; 15 | }; 16 | in { 17 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 18 | directories = [ 19 | ".cache/cliphist" 20 | ]; 21 | }; 22 | 23 | services.cliphist = { 24 | enable = true; 25 | systemdTarget = "sway-session.target"; 26 | }; 27 | 28 | home.packages = [cliphist-fuzzel-img pkgs.xdg-utils]; # For image copy/pasting 29 | } 30 | -------------------------------------------------------------------------------- /home/cliphist/scripts/cliphist-fuzzel-img.sh: -------------------------------------------------------------------------------- 1 | # https://github.com/sentriz/cliphist/blob/master/contrib/cliphist-fuzzel-img 2 | thumbnail_size=64 3 | thumbnail_dir="${XDG_CACHE_HOME:-$HOME/.cache}/cliphist/thumbnails" 4 | 5 | cliphist_list=$(cliphist list) 6 | if [ -z "$cliphist_list" ]; then 7 | fuzzel -d --placeholder "cliphist: please store something first" --lines 0 8 | rm -rf "$thumbnail_dir" 9 | exit 10 | fi 11 | 12 | [ -d "$thumbnail_dir" ] || mkdir -p "$thumbnail_dir" 13 | 14 | # Write square shaped thumbnail to cache if it doesn't exist 15 | read -r -d '' thumbnail </dev/null 2>&1 8 | echo "{\"icon\": \"performance\", \"text\": \"\", \"state\": \"Good\"}" 9 | elif [ "$current_mode" == "performance" ]; then 10 | sudo auto-cpufreq --force powersave >/dev/null 2>&1 11 | echo "{\"icon\": \"powersave\", \"text\": \"\", \"state\": \"Good\"}" 12 | fi 13 | else 14 | if [ "$current_mode" == "powersave" ]; then 15 | echo "{\"icon\": \"powersave\", \"text\": \"\", \"state\": \"Good\"}" 16 | elif [ "$current_mode" == "performance" ]; then 17 | echo "{\"icon\": \"performance\", \"text\": \"\", \"state\": \"Good\"}" 18 | fi 19 | fi 20 | -------------------------------------------------------------------------------- /home/dconf/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | ... 5 | }: { 6 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 7 | directories = [ 8 | ".config/dconf" 9 | ]; 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /home/ddc-backlight/default.nix: -------------------------------------------------------------------------------- 1 | # Toggle CPU profiles 2 | {pkgs, ...}: let 3 | ddc-backlight = pkgs.writeShellApplication { 4 | name = "ddc-backlight"; 5 | runtimeInputs = [pkgs.ddcutil pkgs.coreutils pkgs.utillinux]; 6 | text = builtins.readFile ./scripts/ddc-backlight.sh; 7 | }; 8 | in { 9 | home.packages = [ddc-backlight pkgs.ddcutil]; 10 | } 11 | -------------------------------------------------------------------------------- /home/ddc-backlight/scripts/ddc-backlight.sh: -------------------------------------------------------------------------------- 1 | # Usage: ./ddc_backlight.sh 2 | BUS="$1" 3 | ICONS=("moon_empty" "moon_1" "moon_2" "moon_3" "moon_full") 4 | 5 | LOCK_FILE="/tmp/ddc_backlight.lock" 6 | 7 | # Deterministic delay based on bus number to stagger execution 8 | # Each bus will delay a different amount (0-59 seconds) 9 | DELAY=$((BUS * 7 % 60)) 10 | sleep "$DELAY" 11 | 12 | # Prevent parallel execution, which can crash the kernel  13 | if ! flock --nonblock 9; then 14 | # Return a temporary placeholder instead of waiting 15 | echo "{\"icon\":\"${ICONS[0]}\",\"text\":\"...\",\"short_text\":\"\"}" 16 | exit 0 17 | fi 9>"$LOCK_FILE" 18 | 19 | # Check if monitor is connected and turned on - with better error handling 20 | # 1. Attempt to read the power state of the monitor using VCP code 0xD6 (Power Mode) 21 | { 22 | timeout 2 ddcutil getvcp D6 -b "$BUS" --noverify --sleep-multiplier 2.0 >/dev/null 23 | power_status=$? 24 | } || { 25 | power_status=1 26 | } 27 | 28 | if [ $power_status -ne 0 ]; then 29 | # Failed to read power state -> no monitor or unresponsive 30 | echo "{\"icon\":\"${ICONS[0]}\",\"text\":\"0\",\"short_text\":\"\"}" 31 | exit 0 32 | fi 33 | 34 | # Otherwise, we can safely get brightness value without overloading the kernel... 35 | { 36 | output=$(timeout 2 ddcutil getvcp 10 -b "$BUS" --noverify --sleep-multiplier 2.0 2>&1) 37 | status=$? 38 | } || { 39 | status=1 40 | } 41 | 42 | if [ $status -ne 0 ]; then 43 | echo "{\"icon\":\"${ICONS[0]}\",\"text\":\"err\",\"short_text\":\"\",\"state\":\"critical\"}" 44 | exit 0 45 | fi 46 | 47 | # Extract percentage 48 | percent=$(echo "$output" | awk -F'=' '/current value/ {gsub(/,.*$/, "", $2); print $2+0}') 49 | 50 | # Calculate icon index 51 | index=$((percent / 20)) 52 | [ $index -gt 4 ] && index=4 53 | 54 | echo "{\"icon\":\"${ICONS[$index]}\",\"text\":\"${percent}\",\"short_text\":\"\"}" 55 | -------------------------------------------------------------------------------- /home/devenv/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".local/share/devenv" 10 | ]; 11 | }; 12 | 13 | home.packages = [ 14 | pkgs.devenv 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /home/direnv/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | ... 5 | }: { 6 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 7 | directories = [ 8 | ".local/share/direnv" 9 | ]; 10 | }; 11 | 12 | programs.direnv = { 13 | enable = true; 14 | nix-direnv.enable = true; 15 | config.strict_env = true; # Forces all .envrc scripts through set -euo pipefail 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /home/discord/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/discord" 10 | ]; 11 | }; 12 | 13 | home.packages = [ 14 | pkgs.discord 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /home/dunst/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | services.dunst = { 3 | enable = true; 4 | 5 | iconTheme = { 6 | name = "Papirus-Dark"; 7 | package = pkgs.papirus-icon-theme; 8 | }; 9 | 10 | settings = { 11 | global = { 12 | browser = "brave"; 13 | dmenu = "fuzzel --dmenu"; 14 | }; 15 | 16 | ignore_flameshot_warning = { 17 | appname = "flameshot"; 18 | body = "*implemented based on wlroots*"; 19 | skip_display = true; 20 | }; 21 | }; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /home/easyeffects/default.nix: -------------------------------------------------------------------------------- 1 | # GUI for PipeWire effects 2 | { 3 | isImpermanent, 4 | lib, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/easyeffects" 10 | ]; 11 | }; 12 | 13 | # Preset from https://github.com/JackHack96/EasyEffects-Presets/blob/master/Bass%20Enhancing%20%2B%20Perfect%20EQ.json 14 | home.file.".config/easyeffects/autoload/output/bass-enhancing-perfect-eq.json".source = ./presets/output/bass-enhancing-perfect-eq.json; 15 | # IRS file from the same repo above 16 | home.file.".config/easyeffects/irs/Razor Surround ((48k Z-Edition)) 2.Stereo +20 bass.irs".source = ./presets/irs/razor-surround-48k-z-edition-stereo-plus20-bass.irs; 17 | 18 | services.easyeffects = { 19 | enable = true; 20 | preset = "bass-enhancing-perfect-eq"; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /home/easyeffects/presets/irs/razor-surround-48k-z-edition-stereo-plus20-bass.irs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/home/easyeffects/presets/irs/razor-surround-48k-z-edition-stereo-plus20-bass.irs -------------------------------------------------------------------------------- /home/email/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | isImpermanent, 3 | lib, 4 | ... 5 | }: { 6 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 7 | directories = [ 8 | ".thunderbird" 9 | ".cache/thunderbird" 10 | ]; 11 | }; 12 | 13 | programs.thunderbird = { 14 | enable = true; 15 | profiles = { 16 | "main" = { 17 | isDefault = true; 18 | settings = { 19 | "calendar.alarms.showmissed" = false; 20 | "calendar.alarms.playsound" = false; 21 | "calendar.alarms.show" = false; 22 | }; 23 | }; 24 | }; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /home/firefox/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | isImpermanent, 3 | lib, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".mozilla/firefox" 10 | ".cache/mozilla/firefox" 11 | ]; 12 | }; 13 | 14 | programs.firefox = { 15 | enable = true; 16 | profiles = { 17 | main = { 18 | extensions = with pkgs.nur.repos.rycee.firefox-addons; [ 19 | bitwarden 20 | ]; 21 | id = 0; 22 | isDefault = true; 23 | settings = { 24 | # Hardware Video Decoding, see https://wiki.archlinux.org/title/Firefox 25 | "gfx.webrender.all" = true; 26 | "media.ffmpeg.vaapi.enabled" = true; 27 | "media.hardware-video-decoding.force-enabled" = true; 28 | }; 29 | }; 30 | }; 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /home/fix-flexbox-mike/default.nix: -------------------------------------------------------------------------------- 1 | # Fix ALSA not detecting microphone on XPS 9700, see https://github.com/NixOS/nixpkgs/issues/130882#issuecomment-2584286824 2 | { 3 | lib, 4 | osConfig, 5 | pkgs, 6 | ... 7 | }: let 8 | isFlexbox = osConfig.networking.hostName == "flexbox"; 9 | xps-9700-mic-fixer = pkgs.writeShellApplication { 10 | name = "xps-9700-mic-fixer"; 11 | runtimeInputs = [pkgs.alsa-utils]; 12 | text = builtins.readFile ./scripts/xps-9700-mic-fixer.sh; 13 | }; 14 | in { 15 | systemd.user.services.fixXPS9700Mike = lib.mkIf isFlexbox { 16 | Unit = { 17 | Description = "Fix ALSA settings for internal mic on Dell XPS 9700"; 18 | }; 19 | Install.WantedBy = ["pipewire.service"]; 20 | Service = { 21 | Environment = "PATH=$PATH:/run/current-system/sw/bin"; 22 | ExecStart = "${xps-9700-mic-fixer}/bin/xps-9700-mic-fixer"; 23 | Type = "oneshot"; 24 | RemainAfterExit = true; 25 | }; 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /home/fix-flexbox-mike/scripts/xps-9700-mic-fixer.sh: -------------------------------------------------------------------------------- 1 | amixer --card 1 set "rt715 ADC 24 Mux" "DMIC3" 2 | amixer --card 1 set "rt715 DMIC3 Boost" 3 3 | amixer --card 1 set "PGA2.0 2 Master" 80 unmute 4 | -------------------------------------------------------------------------------- /home/flameshot/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | isImpermanent, 3 | lib, 4 | pkgs, 5 | ... 6 | }: let 7 | flameshotWithWaylandSupport = pkgs.flameshot.override { 8 | enableWlrSupport = true; 9 | }; 10 | in { 11 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 12 | directories = [ 13 | ".cache/flameshot" 14 | ]; 15 | }; 16 | 17 | services.flameshot = { 18 | enable = true; 19 | package = flameshotWithWaylandSupport; 20 | settings = { 21 | General = { 22 | copyPathAfterSave = true; 23 | disabledTrayIcon = true; 24 | }; 25 | }; 26 | }; 27 | 28 | # Fix timing issue on start 29 | systemd.user.services.flameshot = { 30 | # Remove existing graphical-session.target 31 | Install = lib.mkForce { 32 | WantedBy = ["sway-session.target"]; 33 | }; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /home/fuzzel/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.fuzzel = { 3 | enable = true; 4 | package = pkgs.unstable.fuzzel; 5 | }; 6 | } 7 | -------------------------------------------------------------------------------- /home/fzf/default.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | programs.fzf = { 3 | enable = true; 4 | defaultCommand = "rg --files --no-ignore-vcs --hidden"; 5 | }; 6 | } 7 | -------------------------------------------------------------------------------- /home/galaxy-buds-client/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".local/share/GalaxyBudsClient" 10 | ]; 11 | }; 12 | 13 | home.packages = [ 14 | pkgs.galaxy-buds-client 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /home/gimp/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/GIMP" 10 | ".cache/gimp" 11 | ]; 12 | }; 13 | 14 | home.packages = [ 15 | pkgs.gimp 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /home/git/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/glab-cli" 10 | ]; 11 | }; 12 | 13 | home.packages = with pkgs; [ 14 | delta # Syntax highlighter for git 15 | github-cli 16 | glab 17 | ]; 18 | 19 | home.file.".config/gh/config.yml".source = ./github-cli/gh.config.yml; 20 | 21 | programs.git = { 22 | aliases = { 23 | c = "commit"; 24 | 25 | # Difftastic 26 | dlog = "-c diff.external=difft log --ext-diff"; 27 | dshow = "-c diff.external=difft show --ext-diff"; 28 | ddiff = "-c diff.external=difft diff"; 29 | # `git log` with patches shown with difftastic. 30 | dl = "-c diff.external=difft log -p --ext-diff"; 31 | # Show the most recent commit with difftastic. 32 | ds = "-c diff.external=difft show --ext-diff"; 33 | # `git diff` with difftastic. 34 | dft = "-c diff.external=difft diff"; 35 | 36 | p = "push"; 37 | rim = "rebase -i main"; 38 | rimm = "rebase -i master"; 39 | }; 40 | 41 | difftastic = { 42 | enable = true; 43 | }; 44 | 45 | enable = true; 46 | 47 | extraConfig = { 48 | pull = { 49 | ff = "only"; 50 | rebase = true; 51 | }; 52 | init = { 53 | defaultBranch = "main"; 54 | }; 55 | rebase = { 56 | autoStash = true; 57 | autoSquash = true; 58 | }; 59 | # https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/javascript.section.md#git-protocol-error 60 | url = { 61 | "https://github.com" = { 62 | insteadOf = "git://github.com"; 63 | }; 64 | }; 65 | core = { 66 | pager = "delta"; 67 | }; 68 | interactive = { 69 | diffFilter = "delta --color-only"; 70 | }; 71 | merge = { 72 | conflictstyle = "diff3"; 73 | }; 74 | diff = { 75 | colorMoved = "default"; 76 | }; 77 | }; 78 | 79 | includes = [ 80 | { 81 | path = "~/code/dlh/.gitconfig"; 82 | condition = "gitdir:~/code/dlh/"; 83 | } 84 | { 85 | path = "~/code/dlh/plansee/.gitconfig"; 86 | condition = "gitdir:~/code/dlh/plansee/"; 87 | } 88 | ]; 89 | 90 | signing = { 91 | signByDefault = true; 92 | key = "24575DB93F6CEC16"; 93 | }; 94 | 95 | ignores = [".idea" "nohup.out" "mzdata" ".vimspector.json"]; 96 | 97 | userEmail = "4farlion@gmail.com"; 98 | 99 | userName = "workflow"; 100 | }; 101 | } 102 | -------------------------------------------------------------------------------- /home/git/github-cli/gh.config.yml: -------------------------------------------------------------------------------- 1 | # What protocol to use when performing git operations. Supported values: ssh, https 2 | git_protocol: ssh 3 | # What editor gh should run when creating issues, pull requests, etc. If blank, will refer to environment. 4 | editor: 5 | # When to interactively prompt. This is a global config that cannot be overridden by hostname. Supported values: enabled, disabled 6 | prompt: enabled 7 | # A pager program to send command output to, e.g. "less". Set the value to "cat" to disable the pager. 8 | pager: 9 | # Aliases allow you to create nicknames for gh commands 10 | aliases: 11 | co: pr checkout 12 | -------------------------------------------------------------------------------- /home/gtk-qt/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | isImpermanent, 3 | lib, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | files = [ 9 | ".config/QtProject.conf" # Stuff like history and lastVisited 10 | ]; 11 | }; 12 | 13 | gtk = { 14 | enable = true; 15 | gtk3 = { 16 | extraConfig = { 17 | gtk-application-prefer-dark-theme = true; 18 | }; 19 | }; 20 | }; 21 | 22 | qt = { 23 | enable = true; 24 | platformTheme.name = "qtct"; 25 | style.name = "kvantum"; 26 | }; 27 | 28 | xdg.configFile = { 29 | "qt5ct/qt5ct.conf".source = ./qtct.conf; 30 | "qt6ct/qt6ct.conf".source = ./qtct.conf; 31 | }; 32 | 33 | home.packages = with pkgs; [ 34 | lxappearance # GTK Theme testing + tweaking 35 | libsForQt5.qt5ct # Qt 5 Theme testing + tweaking 36 | qt6ct # Qt 6 Theme testing + tweaking 37 | ]; 38 | 39 | # https://wiki.archlinux.org/title/HiDPI 40 | home.sessionVariables = { 41 | QT_AUTO_SCREEN_SCALE_FACTOR = "1"; 42 | QT_ENABLE_HIGHDPI_SCALING = "1"; 43 | }; 44 | } 45 | -------------------------------------------------------------------------------- /home/gtk-qt/qtct.conf: -------------------------------------------------------------------------------- 1 | [Appearance] 2 | icon_theme=Pop 3 | standard_dialogs=gtk3 4 | style=kvantum-dark 5 | 6 | [Fonts] 7 | fixed="FiraCode Nerd Font Mono,9,-1,5,25,0,0,0,0,0" 8 | general="Fira Code,9,-1,5,50,0,0,0,0,0" 9 | -------------------------------------------------------------------------------- /home/impermanence/default.nix: -------------------------------------------------------------------------------- 1 | # General home-manager impermanence setup 2 | # Note: specifics should live with their respective modules, where possible! 3 | { 4 | home.persistence."/persist/home/farlion" = { 5 | enable = true; 6 | directories = [ 7 | ".config/helm" # Helm repositories 8 | ".config/nix" # cachix repositories and such 9 | ".local/share/nix" # Nix Repl History 10 | ]; 11 | allowOther = true; # For root (docker) and Docker to access bind-mounted `directories` 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /home/isd/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/isd_tui" 10 | ".local/share/isd_tui" 11 | ".cache/isd_tui" 12 | ]; 13 | }; 14 | 15 | home.packages = [ 16 | pkgs.unstable.isd 17 | ]; 18 | } 19 | -------------------------------------------------------------------------------- /home/k9s/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.k9s = { 3 | enable = true; 4 | package = pkgs.unstable.k9s; 5 | }; 6 | } 7 | -------------------------------------------------------------------------------- /home/kanshi/default.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | services.kanshi = { 3 | enable = true; 4 | settings = [ 5 | { 6 | output = { 7 | alias = "leftLG27"; 8 | criteria = "HDMI-A-2"; 9 | mode = "3840x2160@60.000Hz"; 10 | position = "0,0"; 11 | scale = 2.0; 12 | transform = "90"; 13 | }; 14 | } 15 | { 16 | output = { 17 | alias = "middleLG34"; 18 | criteria = "DP-1"; 19 | mode = "3840x2160@144.050Hz"; 20 | position = "1080,208"; 21 | scale = 1.5; 22 | transform = "normal"; 23 | }; 24 | } 25 | { 26 | output = { 27 | alias = "rightLG27"; 28 | criteria = "HDMI-A-1"; 29 | mode = "3840x2160@60.000Hz"; 30 | position = "3640,0"; 31 | scale = 2.0; 32 | transform = "90"; 33 | }; 34 | } 35 | { 36 | profile = { 37 | name = "numenor"; 38 | outputs = [ 39 | { 40 | criteria = "$leftLG27"; 41 | status = "enable"; 42 | } 43 | { 44 | criteria = "$middleLG34"; 45 | status = "enable"; 46 | } 47 | { 48 | criteria = "$rightLG27"; 49 | status = "enable"; 50 | } 51 | ]; 52 | }; 53 | } 54 | { 55 | profile = { 56 | name = "numenor-movie"; 57 | outputs = [ 58 | { 59 | criteria = "$leftLG27"; 60 | status = "enable"; 61 | position = "0,272"; 62 | transform = "normal"; 63 | } 64 | { 65 | criteria = "$middleLG34"; 66 | status = "enable"; 67 | position = "1920,132"; 68 | } 69 | { 70 | criteria = "$rightLG27"; 71 | status = "disable"; 72 | } 73 | ]; 74 | }; 75 | } 76 | ]; 77 | systemdTarget = "sway-session.target"; 78 | }; 79 | } 80 | -------------------------------------------------------------------------------- /home/kind-with-local-registry/default.nix: -------------------------------------------------------------------------------- 1 | # Local registry for faster image iteration, i.e. with Skaffold 2 | # To use local registry, prefix images with localhost:5001/ and make sure `docker push` is enabled 3 | # See https://kind.sigs.k8s.io/docs/user/local-registry/ 4 | {pkgs, ...}: let 5 | kind-with-local-registry = pkgs.writers.writeBashBin "kind-with-local-registry" ( 6 | builtins.readFile ./scripts/kind-with-local-registry.sh 7 | ); 8 | in { 9 | home.packages = [kind-with-local-registry]; 10 | } 11 | -------------------------------------------------------------------------------- /home/kind-with-local-registry/scripts/kind-with-local-registry.sh: -------------------------------------------------------------------------------- 1 | set -o errexit 2 | 3 | # 1. Create registry container unless it already exists 4 | reg_name='kind-registry' 5 | reg_port='5001' 6 | if [ "$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)" != 'true' ]; then 7 | docker run \ 8 | -d --restart=always -p "127.0.0.1:${reg_port}:5000" --network bridge --name "${reg_name}" --log-driver json-file \ 9 | registry:2 10 | fi 11 | 12 | # 2. Create kind cluster with containerd registry config dir enabled 13 | # TODO: kind will eventually enable this by default and this patch will 14 | # be unnecessary. 15 | # 16 | # See: 17 | # https://github.com/kubernetes-sigs/kind/issues/2875 18 | # https://github.com/containerd/containerd/blob/main/docs/cri/config.md#registry-configuration 19 | # See: https://github.com/containerd/containerd/blob/main/docs/hosts.md 20 | cat <a", group = "[A]vante" }, 28 | { "", "AvanteToggle", desc = "Toggle Avante", mode = { "n", "v" } }, 29 | { "", "AvanteToggle", desc = "Toggle Avante", mode = { "i" } }, 30 | }, 31 | } 32 | ) 33 | -------------------------------------------------------------------------------- /home/neovim/avante/default.nix: -------------------------------------------------------------------------------- 1 | # Cursor style AI IDE 2 | {pkgs, ...}: { 3 | programs.neovim = { 4 | extraLuaConfig = '' 5 | -- views can only be fully collapsed with the global statusline 6 | vim.opt.laststatus = 3 7 | ''; 8 | plugins = with pkgs.vimPlugins; [ 9 | { 10 | plugin = avante-nvim; 11 | config = builtins.readFile ./avante.lua; 12 | type = "lua"; 13 | } 14 | ]; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /home/neovim/bookmarks-nvim/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | isImpermanent, 3 | lib, 4 | pkgs, 5 | ... 6 | }: let 7 | bookmarks-nvim = pkgs.vimUtils.buildVimPlugin { 8 | name = "bookmarks-nvim"; 9 | src = pkgs.fetchFromGitHub { 10 | owner = "tomasky"; 11 | repo = "bookmarks.nvim"; 12 | rev = "12bf1b32990c49192ff6e0622ede2177ac836f11"; 13 | sha256 = "DWtYdAioIrNLZg3nnkAXDo1MPZDbpA2F/KlKjS8kVls="; 14 | }; 15 | }; 16 | in { 17 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 18 | directories = [ 19 | ".local/share/nvim-bookmarks" 20 | ]; 21 | }; 22 | 23 | programs.neovim = { 24 | plugins = [ 25 | { 26 | plugin = bookmarks-nvim; 27 | config = '' 28 | require("bookmarks").setup({ 29 | save_file = vim.fn.expand "$HOME/.local/share/nvim-bookmarks/bookmarks.nvim", 30 | on_attach = function(bufnr) 31 | local bm = require("bookmarks") 32 | local wk = require("which-key") 33 | wk.add( 34 | { 35 | { "m", group = "Book[m]arks" }, 36 | { "ma", bm.bookmark_ann, desc = "Toggle [a]nnotation at current line" }, 37 | { "mc", bm.bookmark_clean, desc = "Clean all marks in local buffer" }, 38 | { "ml", bm.bookmark_list, desc = "Show marked file list in quickfix list" }, 39 | { "mm", bm.bookmark_toggle, desc = "Toggle [m]ark at current line" }, 40 | { "mn", bm.bookmark_next, desc = "Jump to next mark in local buffer" }, 41 | { "mp", bm.bookmark_prev, desc = "Jump to previous mark in local buffer" }, 42 | } 43 | ) 44 | require('telescope').load_extension('bookmarks') 45 | end 46 | }) 47 | ''; 48 | type = "lua"; 49 | } 50 | ]; 51 | }; 52 | } 53 | -------------------------------------------------------------------------------- /home/neovim/carbon/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: let 2 | carbon-now = pkgs.vimUtils.buildVimPlugin { 3 | name = "carbon-now"; 4 | src = pkgs.fetchFromGitHub { 5 | owner = "ellisonleao"; 6 | repo = "carbon-now.nvim"; 7 | rev = "4524d2b347830257bb9357d45c4f934960058476"; 8 | sha256 = "id9KSrv683eb03ZB9VZ+ERBKuAlWbypjx0kEzCeiL0c="; 9 | }; 10 | }; 11 | in { 12 | programs.neovim.plugins = [ 13 | { 14 | plugin = carbon-now; 15 | config = '' 16 | require('carbon-now').setup({ 17 | options = { 18 | bg = "purple", 19 | drop_shadow_blur = "68px", 20 | drop_shadow = false, 21 | drop_shadow_offset_y = "20px", 22 | font_family = "Fira Code", 23 | font_size = "18px", 24 | line_height = "133%", 25 | line_numbers = true, 26 | theme = "one-dark", 27 | titlebar = "Made with carbon-now.nvim", 28 | watermark = false, 29 | window_theme = "sharp", 30 | padding_horizontal = "5px", 31 | padding_vertical = "5px", 32 | }, 33 | }) 34 | 35 | vim.keymap.set("v", "s", ":CarbonNow", { silent = true }) 36 | local wk = require("which-key") 37 | wk.add( 38 | { 39 | { "s", desc = "[S]creenshot", mode = "v" }, 40 | } 41 | ) 42 | ''; 43 | type = "lua"; 44 | } 45 | ]; 46 | } 47 | -------------------------------------------------------------------------------- /home/neovim/chatgpt-nvim/chatgpt-nvim.lua: -------------------------------------------------------------------------------- 1 | require("chatgpt").setup({ 2 | openai_params = { 3 | model = "gpt-4-turbo", 4 | frequency_penalty = 0, 5 | presence_penalty = 0, 6 | max_tokens = 800, 7 | temperature = 0, 8 | top_p = 1, 9 | n = 1, 10 | }, 11 | openai_edit_params = { 12 | model = "gpt-4-turbo", 13 | temperature = 0, 14 | top_p = 1, 15 | n = 1, 16 | }, 17 | popup_input = { 18 | submit = "" 19 | }, 20 | edit_with_instructions = { 21 | keymaps = { 22 | toggle_help = "", 23 | use_output_as_input = "", 24 | } 25 | }, 26 | 27 | }) 28 | local wk = require("which-key") 29 | wk.add( 30 | { 31 | { "c", group = "[C]hatGPT" }, 32 | { "cc", "ChatGPT", desc = "ChatGPT" }, 33 | { 34 | mode = { "n", "v" }, 35 | { "ca", "ChatGPTRun add_tests", desc = "Add Tests" }, 36 | { "cd", "ChatGPTRun docstring", desc = "Docstring" }, 37 | { "ce", "ChatGPTEditWithInstruction", desc = "Edit with instruction" }, 38 | { "cf", "ChatGPTRun fix_bugs", desc = "Fix Bugs" }, 39 | { "cg", "ChatGPTRun grammar_correction", desc = "Grammar Correction" }, 40 | { "ck", "ChatGPTRun keywords", desc = "Keywords" }, 41 | { "cl", "ChatGPTRun code_readability_analysis", desc = "Code Readability Analysis" }, 42 | { "co", "ChatGPTRun optimize_code", desc = "Optimize Code" }, 43 | { "cr", "ChatGPTRun roxygen_edit", desc = "Roxygen Edit" }, 44 | { "cs", "ChatGPTRun summarize", desc = "Summarize" }, 45 | { "ct", "ChatGPTRun translate", desc = "Translate" }, 46 | { "cx", "ChatGPTRun explain_code", desc = "Explain Code" }, 47 | }, 48 | } 49 | ) 50 | -------------------------------------------------------------------------------- /home/neovim/chatgpt-nvim/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = ChatGPT-nvim; 5 | config = builtins.readFile ./chatgpt-nvim.lua; 6 | type = "lua"; 7 | } 8 | ]; 9 | } 10 | -------------------------------------------------------------------------------- /home/neovim/cmp/cmp.lua: -------------------------------------------------------------------------------- 1 | local cmp = require 'cmp' 2 | local luasnip = require 'luasnip' 3 | require('luasnip.loaders.from_vscode').lazy_load() 4 | luasnip.config.setup {} 5 | 6 | cmp.setup { 7 | snippet = { 8 | expand = function(args) 9 | luasnip.lsp_expand(args.body) 10 | end, 11 | }, 12 | completion = { 13 | completeopt = 'menu,menuone,noinsert', 14 | }, 15 | mapping = cmp.mapping.preset.insert { 16 | -- Select the [n]ext item 17 | [''] = cmp.mapping.select_next_item(), 18 | -- Select the [p]revious item 19 | [''] = cmp.mapping.select_prev_item(), 20 | 21 | -- Scroll the documentation window [b]ack / [f]orward 22 | [''] = cmp.mapping.scroll_docs(-4), 23 | [''] = cmp.mapping.scroll_docs(-4), 24 | [''] = cmp.mapping.scroll_docs(4), 25 | [''] = cmp.mapping.scroll_docs(4), 26 | 27 | -- Exit completion 28 | [''] = cmp.mapping.abort(), 29 | 30 | -- Accept ([y]es) the completion. 31 | -- This will auto-import if your LSP supports it. 32 | -- This will expand snippets if the LSP sent a snippet. 33 | [''] = cmp.mapping.confirm { select = true }, 34 | [''] = cmp.mapping.confirm { select = true }, 35 | 36 | [''] = cmp.mapping.complete {}, 37 | }, 38 | sources = { 39 | { name = 'nvim_lsp' }, 40 | { name = 'luasnip' }, 41 | { name = 'path' }, 42 | { name = 'buffer' }, 43 | }, 44 | } 45 | 46 | -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). 47 | cmp.setup.cmdline({ '/', '?' }, { 48 | mapping = cmp.mapping.preset.cmdline(), 49 | sources = { 50 | { name = 'buffer' } 51 | } 52 | }) 53 | 54 | -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). 55 | cmp.setup.cmdline(':', { 56 | mapping = cmp.mapping.preset.cmdline(), 57 | sources = cmp.config.sources({ 58 | { name = 'path' } 59 | }, { 60 | { name = 'cmdline' } 61 | }), 62 | matching = { disallow_symbol_nonprefix_matching = false } 63 | }) 64 | 65 | local lspkind = require('lspkind') 66 | cmp.setup { 67 | formatting = { 68 | format = lspkind.cmp_format({ 69 | mode = 'symbol', -- show only symbol annotations 70 | maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) 71 | -- can also be a function to dynamically calculate max width such as 72 | -- maxwidth = function() return math.floor(0.45 * vim.o.columns) end, 73 | ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) 74 | show_labelDetails = true, -- show labelDetails in menu. Disabled by default 75 | 76 | -- The function below will be called before any actual modifications from lspkind 77 | -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30)) 78 | before = function(entry, vim_item) 79 | vim_item.menu = ({ 80 | buffer = "[Buffer]", 81 | nvim_lsp = "[LSP]", 82 | luasnip = "[Snippet]", 83 | path = "[Path]", 84 | -- Specify the name for other sources you may have 85 | })[entry.source.name] 86 | 87 | return vim_item 88 | end 89 | }) 90 | } 91 | } 92 | 93 | -- nvim-dadbod (SQL) setup 94 | cmp.setup.filetype({ "sql" }, { 95 | sources = { 96 | { name = 'vim-dadbod-completion' }, 97 | { name = 'buffer' }, 98 | }, 99 | }) 100 | -------------------------------------------------------------------------------- /home/neovim/cmp/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = nvim-cmp; # Autocompletion 5 | config = builtins.readFile ./cmp.lua; 6 | type = "lua"; 7 | } 8 | { 9 | plugin = cmp_luasnip; # Autocompletion for luasnip 10 | } 11 | { 12 | plugin = cmp-nvim-lsp; # Autocompletion Additions 13 | } 14 | { 15 | plugin = cmp-path; # Path completions 16 | } 17 | { 18 | plugin = cmp-buffer; # Buffer completions 19 | } 20 | { 21 | plugin = cmp-cmdline; # Commandline completions 22 | } 23 | { 24 | plugin = lspkind-nvim; # VSCode-like pictograms for LSP completions 25 | } 26 | ]; 27 | } 28 | -------------------------------------------------------------------------------- /home/neovim/copilot/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | isImpermanent, 3 | lib, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/github-copilot" 10 | ]; 11 | }; 12 | programs.neovim.plugins = with pkgs.vimPlugins; [ 13 | { 14 | plugin = copilot-vim; 15 | } 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /home/neovim/dadbod/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | isImpermanent, 3 | lib, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".local/share/db_ui" 10 | ]; 11 | }; 12 | programs.neovim.plugins = with pkgs.vimPlugins; [ 13 | { 14 | plugin = vim-dadbod; # SQL Fu 15 | } 16 | { 17 | plugin = vim-dadbod-completion; 18 | } 19 | { 20 | plugin = vim-dadbod-ui; 21 | config = '' 22 | vim.g.db_ui_use_nerd_fonts = 1 23 | 24 | local wk = require("which-key") 25 | wk.add( 26 | { 27 | { "D", group = "[D]atabase" }, 28 | { "Dn", "tab DBUI", desc = "open in [n]ew tab" }, 29 | { "Dt", "DBUIToggle", desc = "[t]oggle" }, 30 | } 31 | ) 32 | ''; 33 | type = "lua"; 34 | } 35 | ]; 36 | } 37 | -------------------------------------------------------------------------------- /home/neovim/dap/dap-ui.lua: -------------------------------------------------------------------------------- 1 | local wk = require("which-key") 2 | local dap, dapui = require("dap"), require("dapui") 3 | dapui.setup({ 4 | wk.add( 5 | { 6 | { "dt", require('dapui').toggle, desc = "[T]oggle UI" }, 7 | { "", require('dapui').toggle, desc = "[T]oggle UI" }, 8 | } 9 | ) 10 | }) 11 | 12 | -- Events to auto-open/close the UI 13 | dap.listeners.before.attach.dapui_config = function() 14 | dapui.open() 15 | end 16 | dap.listeners.before.launch.dapui_config = function() 17 | dapui.open() 18 | end 19 | dap.listeners.before.event_terminated.dapui_config = function() 20 | dapui.close() 21 | end 22 | dap.listeners.before.event_exited.dapui_config = function() 23 | dapui.close() 24 | end 25 | -------------------------------------------------------------------------------- /home/neovim/dap/dap.lua: -------------------------------------------------------------------------------- 1 | local wk = require("which-key") 2 | local dap = require("dap") 3 | wk.add( 4 | { 5 | { "d", group = "[D]ebug" }, 6 | { "dB", function() dap.set_breakpoint(vim.fn.input('Breakpoint condition: ')) end, desc = "Set conditional [B]reakpoint" }, 7 | { "db", function() dap.toggle_breakpoint() end, desc = "Toggle [B]reakpoint" }, 8 | { "dc", function() dap.continue() end, desc = "[C]ontinue" }, 9 | { "", function() dap.continue() end, desc = "Continue" }, 10 | { "di", function() dap.step_into() end, desc = "Step [I]nto" }, 11 | { "", function() dap.step_into() end, desc = "Step Into" }, 12 | { "do", function() dap.step_over() end, desc = "Step [O]ver" }, 13 | { "", function() dap.step_over() end, desc = "Step Over" }, 14 | { "dq", function() dap.close() end, desc = "[Q]uit/Close dap" }, 15 | { "", function() dap.close() end, desc = "Quit/Close dap" }, 16 | { "dr", function() dap.repl.open() end, desc = "Open [R]epl" }, 17 | { "du", function() dap.step_out() end, desc = "Step O[u]t" }, 18 | { "", function() dap.step_out() end, desc = "Step Out" }, 19 | } 20 | ) 21 | 22 | -- Fix color highlighting for stopped DAP line 23 | -- See https://github.com/mfussenegger/nvim-dap/discussions/355#discussioncomment-8389225 24 | vim.api.nvim_create_autocmd("ColorScheme", { 25 | pattern = "*", 26 | desc = "Prevent colorscheme clearing self-defined DAP marker colors", 27 | callback = function() 28 | -- Reuse current SignColumn background (except for DapStoppedLine) 29 | local sign_column_hl = vim.api.nvim_get_hl(0, { name = 'SignColumn' }) 30 | -- if bg or ctermbg aren't found, use bg = 'bg' (which means current Normal) and ctermbg = 'Black' 31 | -- convert to 6 digit hex value starting with # 32 | local sign_column_bg = (sign_column_hl.bg ~= nil) and ('#%06x'):format(sign_column_hl.bg) or 'bg' 33 | local sign_column_ctermbg = (sign_column_hl.ctermbg ~= nil) and sign_column_hl.ctermbg or 'Black' 34 | 35 | vim.api.nvim_set_hl(0, 'DapStopped', { fg = '#00ff00', bg = sign_column_bg, ctermbg = sign_column_ctermbg }) 36 | vim.api.nvim_set_hl(0, 'DapStoppedLine', { bg = '#2e4d3d', ctermbg = 'Green' }) 37 | vim.api.nvim_set_hl(0, 'DapBreakpoint', { fg = '#c23127', bg = sign_column_bg, ctermbg = sign_column_ctermbg }) 38 | vim.api.nvim_set_hl(0, 'DapBreakpointRejected', 39 | { fg = '#888ca6', bg = sign_column_bg, ctermbg = sign_column_ctermbg }) 40 | vim.api.nvim_set_hl(0, 'DapLogPoint', { fg = '#61afef', bg = sign_column_bg, ctermbg = sign_column_ctermbg }) 41 | 42 | vim.fn.sign_define('DapStopped', { 43 | text = '→', 44 | texthl = 'DapStopped', 45 | linehl = 'DapStoppedLine', 46 | numhl = 'DapStoppedLine', 47 | }) 48 | end 49 | }) 50 | 51 | dap.adapters.codelldb = { 52 | type = "executable", 53 | command = "codelldb", 54 | }; 55 | 56 | dap.configurations.cpp = { 57 | { 58 | name = "Launch file", 59 | type = "codelldb", 60 | request = "launch", 61 | program = function() 62 | return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') 63 | end, 64 | cwd = '${workspaceFolder}', 65 | stopOnEntry = false, 66 | }, 67 | } 68 | dap.configurations.c = dap.configurations.cpp 69 | dap.configurations.rust = dap.configurations.cpp 70 | -------------------------------------------------------------------------------- /home/neovim/dap/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = nvim-dap; # Debug Adapter Protocol 5 | config = builtins.readFile ./dap.lua; 6 | type = "lua"; 7 | } 8 | { 9 | plugin = nvim-dap-ui; # DAP UI 10 | config = builtins.readFile ./dap-ui.lua; 11 | type = "lua"; 12 | } 13 | { 14 | plugin = nvim-dap-virtual-text; # Virtual text showing values using Treesitter 15 | config = '' 16 | require("nvim-dap-virtual-text").setup() 17 | ''; 18 | type = "lua"; 19 | } 20 | ]; 21 | } 22 | -------------------------------------------------------------------------------- /home/neovim/fidget/default.nix: -------------------------------------------------------------------------------- 1 | # Sidebar notifications for LSP 2 | {pkgs, ...}: { 3 | programs.neovim.plugins = with pkgs.vimPlugins; [ 4 | { 5 | plugin = fidget-nvim; 6 | config = '' 7 | require('fidget').setup() 8 | ''; 9 | type = "lua"; 10 | } 11 | ]; 12 | } 13 | -------------------------------------------------------------------------------- /home/neovim/folds/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = [ 3 | { 4 | plugin = pkgs.vimPlugins.nvim-ufo; 5 | config = builtins.readFile ./ufo.lua; 6 | type = "lua"; 7 | } 8 | ]; 9 | } 10 | -------------------------------------------------------------------------------- /home/neovim/folds/ufo.lua: -------------------------------------------------------------------------------- 1 | vim.o.foldcolumn = '0' -- '1' makes it visible, but is kinda ugly and interferes with stuff like lspsaga 2 | vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value 3 | vim.o.foldlevelstart = 99 4 | vim.o.foldenable = true 5 | 6 | vim.keymap.set('n', 'zR', require('ufo').openAllFolds) 7 | vim.keymap.set('n', 'zM', require('ufo').closeAllFolds) 8 | 9 | require('ufo').setup() 10 | -------------------------------------------------------------------------------- /home/neovim/fugitive/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = fugitive; 5 | config = builtins.readFile ./fugitive.lua; 6 | type = "lua"; 7 | } 8 | { 9 | plugin = vim-fubitive; 10 | config = '' 11 | let g:fubitive_domain_pattern = 'bitbucket-ssh\.plansee-group\.com' 12 | ''; 13 | } 14 | { 15 | plugin = fugitive-gitlab-vim; 16 | config = '' 17 | let g:fugitive_gitlab_domains = ['https://git.datalabhell.at', 'https://gitlab.k8s.plansee-group.com'] 18 | ''; 19 | } 20 | vim-rhubarb # github bindings for fugitive 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /home/neovim/fugitive/fugitive.lua: -------------------------------------------------------------------------------- 1 | local function showFugitiveGit() 2 | if vim.fn.FugitiveHead() ~= '' then 3 | vim.cmd [[ 4 | Git 5 | setlocal nonumber 6 | setlocal norelativenumber 7 | ]] 8 | end 9 | end 10 | local function toggleFugitiveGit() 11 | if vim.fn.buflisted(vim.fn.bufname('fugitive:///*/.git//$')) ~= 0 then 12 | vim.cmd [[ execute ":bdelete" bufname('fugitive:///*/.git//$') ]] 13 | else 14 | showFugitiveGit() 15 | end 16 | end 17 | local function toggleFugitiveFromInsert() 18 | vim.cmd.stopinsert() 19 | toggleFugitiveGit() 20 | end 21 | 22 | 23 | local wk = require("which-key") 24 | wk.add( 25 | { 26 | { "", toggleFugitiveGit, desc = "Toggle Fugitive", mode = { "n", "v" } }, 27 | { "", toggleFugitiveFromInsert, desc = "Toggle Fugitive", mode = { "i" } }, 28 | { "g", group = "[G]it", silent = false }, 29 | { "gB", ":Git blame", desc = "[B]lame", silent = false }, 30 | { "gb", ":Git checkout -b", desc = "New [b]ranch", silent = false }, 31 | { "gc", ":Git checkout", desc = "[C]heckout branch/tag", silent = false }, 32 | { "gd", group = "[D]iff", silent = false }, 33 | { "gdd", ":Gdiff", desc = "[D]iff", silent = false }, 34 | { "gds", ":Gdiffsplit!", desc = "[S]plit diff", silent = false }, 35 | { "ge", ":Gedit", desc = "Ch[e]ckout any branch/sha/file", silent = false }, 36 | { "gh", ":0Gclog", desc = "[H]istory for entire file", silent = false }, 37 | { "gl", ":Gclog", desc = "[L]og", silent = false }, 38 | { "gm", ":GMove", desc = "[M]ove", silent = false }, 39 | { "gp", group = "[P]ush/pull", silent = false }, 40 | { 41 | "gpf", 42 | function() 43 | vim.cmd( 44 | 'TermExec cmd="git push --force-with-lease" | call fugitive#ReloadStatus()') 45 | end, 46 | desc = "[F]orce push with lease", 47 | silent = false 48 | }, 49 | { "gpl", function() vim.cmd('TermExec cmd="git pull" | call fugitive#ReloadStatus()') end, desc = "[P]ull", silent = false }, 50 | { 51 | "gpn", 52 | function() 53 | vim.cmd( 54 | 'TermExec cmd="git push -u origin HEAD" | call fugitive#ReloadStatus()') 55 | end, 56 | desc = "Push [n]ew branch", 57 | silent = false 58 | }, 59 | { "gps", function() vim.cmd('TermExec cmd="git push" | call fugitive#ReloadStatus()') end, desc = "Pu[s]h", silent = false }, 60 | { "gr", ":Gread", desc = "[R]evert to working tree/index copy of file", silent = false }, 61 | { "gw", ":Gwrite", desc = "[W]rite to index", silent = false }, 62 | } 63 | ) 64 | 65 | wk.add( 66 | { 67 | { "g", group = "[G]it", mode = "v" }, 68 | { "gh", ":Gclog", desc = "[H]istory for selection", mode = "v" }, 69 | } 70 | ) 71 | 72 | 73 | -- Fugitive only mappings 74 | vim.api.nvim_create_autocmd("BufReadPost", { 75 | pattern = "*", 76 | callback = function() 77 | local bufnr = vim.api.nvim_get_current_buf() 78 | local bufname = vim.api.nvim_buf_get_name(bufnr) 79 | 80 | if string.match(bufname, "^fugitive://") then 81 | vim.api.nvim_buf_set_keymap(bufnr, "n", "gj", ":diffget //2", 82 | { noremap = true, silent = false }) 83 | vim.api.nvim_buf_set_keymap(bufnr, "n", "g;", ":diffget //3", 84 | { noremap = true, silent = false }) 85 | end 86 | end, 87 | }) 88 | -------------------------------------------------------------------------------- /home/neovim/git-conflict-nvim/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = git-conflict-nvim; 5 | config = '' 6 | require('git-conflict').setup({}) 7 | ''; 8 | type = "lua"; 9 | } 10 | ]; 11 | } 12 | -------------------------------------------------------------------------------- /home/neovim/gruvbox/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim = { 3 | extraConfig = '' 4 | " Colorscheme 5 | autocmd vimenter * ++nested colorscheme gruvbox 6 | nnoremap [oh :call gruvbox#hls_show() 7 | nnoremap ]oh :call gruvbox#hls_hide() 8 | nnoremap coh :call gruvbox#hls_toggle() 9 | 10 | nnoremap * :let @/ = "":call gruvbox#hls_show()* 11 | nnoremap / :let @/ = "":call gruvbox#hls_show()/ 12 | nnoremap ? :let @/ = "":call gruvbox#hls_show()? 13 | ''; 14 | plugins = with pkgs.vimPlugins; [ 15 | gruvbox 16 | ]; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /home/neovim/jdtls/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = [ 3 | { 4 | plugin = pkgs.vimPlugins.nvim-jdtls; 5 | runtime = { 6 | "ftplugin/java.lua".source = ./jdtls.lua; 7 | }; 8 | type = "lua"; 9 | } 10 | ]; 11 | } 12 | -------------------------------------------------------------------------------- /home/neovim/jdtls/jdtls.lua: -------------------------------------------------------------------------------- 1 | local shared_lsp_config = require('shared_lsp_config') 2 | local root_dir = require('jdtls.setup').find_root({ '.git' }); 3 | local project_name = vim.fn.fnamemodify(root_dir, ':p:h:t') 4 | local data_dir = vim.fn.expand('$HOME/.cache/nvim/jdtls/workspaces/') .. project_name 5 | 6 | local jdtls_path = vim.fn.expand('$HOME/.local/share/nvim/mason/packages/jdtls') 7 | local jdebug_path = vim.fn.expand('$HOME/.local/share/nvim/mason/packages/java-debug-adapter') 8 | local jtest_path = vim.fn.expand('$HOME/.local/share/nvim/mason/packages/java-test') 9 | 10 | 11 | local bundles = { 12 | vim.fn.glob(jdebug_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", true), 13 | } 14 | vim.list_extend(bundles, vim.split(vim.fn.glob(jtest_path .. "/extension/server/*.jar", true), "\n")) 15 | 16 | local extendedClientCapabilities = require('jdtls').extendedClientCapabilities 17 | extendedClientCapabilities.resolveAdditionalTextEditsSupport = true 18 | 19 | local on_attach = function(_, bufnr) 20 | shared_lsp_config.on_attach(_, bufnr) 21 | 22 | local nmap = function(keys, func, desc) 23 | if desc then 24 | desc = 'LSP: ' .. desc 25 | end 26 | 27 | vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) 28 | end 29 | 30 | local wk = require("which-key") 31 | wk.add({ 32 | { "e", group = "[E]xtract" }, 33 | { "t", group = "[T]est" }, 34 | }) 35 | nmap('o', require('jdtls').organize_imports, '[O]rganize Imports') 36 | nmap('ev', require('jdtls').extract_variable, '[V]ariable') 37 | nmap('ec', require('jdtls').extract_constant, '[C]onstant') 38 | nmap('em', require('jdtls').extract_method, '[M]ethod') 39 | 40 | -- DAP specific keybindings, since not yet compatible wit neotest 41 | nmap('tc', require('jdtls').test_class, 'Debug Test [C]lass') 42 | nmap('tn', require('jdtls').test_nearest_method, 'Debug Test [N]earest') 43 | 44 | require('jdtls').setup_dap({ hotcodereplace = "auto" }) 45 | require('jdtls.dap').setup_dap_main_class_configs() 46 | require('jdtls.setup').add_commands() 47 | end 48 | 49 | 50 | -- See `:help vim.lsp.start_client` for an overview of the supported `config` options. 51 | local config = { 52 | -- The command that starts the language server 53 | -- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line 54 | cmd = { 55 | 'java', -- or '/path/to/java17_or_newer/bin/java' 56 | -- depends on if `java` is in your $PATH env variable and if it points to the right version. 57 | 58 | '-Declipse.application=org.eclipse.jdt.ls.core.id1', 59 | '-Dosgi.bundles.defaultStartLevel=4', 60 | '-Declipse.product=org.eclipse.jdt.ls.core.product', 61 | '-Dlog.protocol=true', 62 | '-Dlog.level=ALL', 63 | '-Xmx1g', 64 | '-javaagent:' .. jdtls_path .. '/lombok.jar', 65 | '--add-modules=ALL-SYSTEM', 66 | '--add-opens', 'java.base/java.util=ALL-UNNAMED', 67 | '--add-opens', 'java.base/java.lang=ALL-UNNAMED', 68 | '-jar', vim.fn.glob(jdtls_path .. '/plugins/org.eclipse.equinox.launcher_*.jar'), 69 | '-configuration', jdtls_path .. '/config_linux', 70 | '-data', data_dir, 71 | }, 72 | 73 | on_attach = on_attach, 74 | 75 | -- This is the default if not provided, you can remove it. Or adjust as needed. 76 | -- One dedicated LSP server & client will be started per unique root_dir 77 | root_dir = root_dir, 78 | 79 | -- Here you can configure eclipse.jdt.ls specific settings 80 | -- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request 81 | -- for a list of options 82 | settings = { 83 | java = { 84 | } 85 | }, 86 | 87 | -- Language server `initializationOptions` 88 | -- You need to extend the `bundles` with paths to jar files 89 | -- if you want to use additional eclipse.jdt.ls plugins. 90 | -- 91 | -- See https://github.com/mfussenegger/nvim-jdtls#java-debug-installation 92 | -- 93 | -- If you don't plan on using the debugger or other eclipse.jdt.ls plugins you can remove this 94 | init_options = { 95 | bundles = bundles, 96 | extendedClientCapabilities = extendedClientCapabilities, 97 | }, 98 | } 99 | -- This starts a new client & server, 100 | -- or attaches to an existing client & server depending on the `root_dir`. 101 | require('jdtls').start_or_attach(config) 102 | -------------------------------------------------------------------------------- /home/neovim/lspsaga/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = lspsaga-nvim; 5 | config = '' 6 | require('lspsaga').setup({ 7 | lightbulb = { 8 | enable = true, 9 | sign = false, -- disable the sign in signcolumn, which creates bouncy shit 10 | }, 11 | }) 12 | ''; 13 | type = "lua"; 14 | } 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /home/neovim/lualine/default.nix: -------------------------------------------------------------------------------- 1 | # Status line for neovim 2 | {pkgs, ...}: { 3 | programs.neovim.plugins = with pkgs.vimPlugins; [ 4 | { 5 | plugin = lualine-nvim; 6 | config = '' 7 | require('lualine').setup({ 8 | options = { 9 | theme = 'gruvbox', 10 | }, 11 | extensions = { 12 | 'fugitive', 13 | 'mason', 14 | 'nvim-tree', 15 | 'oil', 16 | 'overseer', 17 | 'quickfix', 18 | 'toggleterm', 19 | 'trouble', 20 | }, 21 | sections = { 22 | lualine_a = {'mode'}, 23 | lualine_b = {'branch', 'diff', 'fugitive_branch', 'diagnostics'}, 24 | lualine_c = {'filename'}, 25 | lualine_x = { 26 | { 27 | require("noice").api.status.message.get_hl, 28 | cond = require("noice").api.status.message.has, 29 | }, 30 | { 31 | require("noice").api.status.command.get, 32 | cond = require("noice").api.status.command.has, 33 | color = { fg = "#ff9e64" }, 34 | }, 35 | { 36 | require("noice").api.status.mode.get, 37 | cond = require("noice").api.status.mode.has, 38 | color = { fg = "#ff9e64" }, 39 | }, 40 | { 41 | require("noice").api.status.search.get, 42 | cond = require("noice").api.status.search.has, 43 | color = { fg = "#ff9e64" }, 44 | }, 45 | 'overseer', 46 | 'encoding', 47 | 'fileformat', 48 | 'filetype' 49 | }, 50 | lualine_y = {'progress'}, 51 | lualine_z = {'location'} 52 | }, 53 | }) 54 | ''; 55 | type = "lua"; 56 | } 57 | ]; 58 | } 59 | -------------------------------------------------------------------------------- /home/neovim/mason-lsp/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: let 2 | mason-nvim-dap = pkgs.vimUtils.buildVimPlugin { 3 | name = "mason-nvim-dap"; 4 | src = pkgs.fetchFromGitHub { 5 | owner = "jay-babu"; 6 | repo = "mason-nvim-dap.nvim"; 7 | rev = "67210c0e775adec55de9826b038e8b62de554afc"; 8 | sha256 = "KhTAomLm57MWWNvLaOeaMGGHJK7uLiNBY0XCyQ1TLSY="; 9 | }; 10 | }; 11 | in { 12 | # home.packages = [pkgs.nodejs]; # Pyright and other LSPs need a global npm :( 13 | programs.neovim.plugins = with pkgs.vimPlugins; [ 14 | { 15 | plugin = mason-nvim; # Automatically install LSP servers 16 | config = builtins.readFile ./mason.lua; 17 | runtime = { 18 | "lua/shared_lsp_config.lua".source = ./shared_lsp_config.lua; 19 | }; 20 | type = "lua"; 21 | } 22 | { 23 | plugin = mason-lspconfig-nvim; # Automatically install LSP servers 24 | } 25 | { 26 | plugin = mason-nvim-dap; # Automatically install LSP servers 27 | } 28 | ]; 29 | } 30 | -------------------------------------------------------------------------------- /home/neovim/mason-lsp/shared_lsp_config.lua: -------------------------------------------------------------------------------- 1 | local M = { 2 | } 3 | 4 | -- Shared keybindings between Mason-setup LSP clients and jtdls-nvim 5 | M.on_attach = function(_, bufnr) 6 | local nmap = function(keys, func, desc) 7 | if desc then 8 | desc = 'LSP: ' .. desc 9 | end 10 | 11 | vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) 12 | end 13 | 14 | nmap('r', vim.lsp.buf.rename, '[R]e[n]ame') 15 | nmap('a', vim.lsp.buf.code_action, '[C]ode [A]ction') 16 | nmap('x', function() vim.api.nvim_command('LspRestart') end, '[R]estart LSP Client') 17 | 18 | nmap('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition') 19 | nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration') 20 | nmap('gR', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') 21 | nmap('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation') 22 | nmap('gy', require('telescope.builtin').lsp_type_definitions, '[G]oto T[y]pe Definition') 23 | nmap('s', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols') 24 | nmap('w', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols') 25 | 26 | nmap('K', vim.lsp.buf.hover, 'Hover Documentation') 27 | nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') 28 | 29 | -- Workspace Fu 30 | nmap('wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder') 31 | nmap('wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder') 32 | nmap('wl', function() 33 | print(vim.inspect(vim.lsp.buf.list_workspace_folders())) 34 | end, '[W]orkspace [L]ist Folders') 35 | 36 | -- Create a command `:Format` local to the LSP buffer 37 | vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) 38 | vim.lsp.buf.format() 39 | end, { desc = 'Format current buffer with LSP' }) 40 | end 41 | 42 | 43 | return M 44 | -------------------------------------------------------------------------------- /home/neovim/mini-icons/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = [ 3 | { 4 | plugin = pkgs.vimPlugins.mini-icons; 5 | config = '' 6 | ''; 7 | type = "lua"; 8 | } 9 | ]; 10 | } 11 | -------------------------------------------------------------------------------- /home/neovim/mini-operators/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: let 2 | mini-operators = pkgs.vimUtils.buildVimPlugin { 3 | name = "mini-operators"; 4 | src = pkgs.fetchFromGitHub { 5 | owner = "echasnovski"; 6 | repo = "mini.operators"; 7 | rev = "2edc808e32fbf3e0d4759bdef26a7a143a19f509"; 8 | sha256 = "OFZyzhOTK+vUYejjdUMQoc905auZP/x6iqIZaS5KBVY="; 9 | }; 10 | }; 11 | in { 12 | programs.neovim.plugins = [ 13 | { 14 | plugin = mini-operators; 15 | config = '' 16 | require('mini.operators').setup({ 17 | exchange = { 18 | prefix = 'gX', -- default is 'gx' which overrides gx as open link from neovim/netRW 19 | }, 20 | }) 21 | ''; 22 | type = "lua"; 23 | } 24 | ]; 25 | } 26 | -------------------------------------------------------------------------------- /home/neovim/neotest/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: let 2 | neotest-vim-test = pkgs.vimUtils.buildVimPlugin { 3 | name = "neotest-vim-test"; 4 | src = pkgs.fetchFromGitHub { 5 | owner = "nvim-neotest"; 6 | repo = "neotest-vim-test"; 7 | rev = "75c4228882ae4883b11bfce9b8383e637eb44192"; 8 | sha256 = "fFm5Yt2Sus5jLSapHUtLlDkBWPLLKfWsj2NSXD8NPYo="; 9 | }; 10 | }; 11 | in { 12 | programs.neovim.plugins = with pkgs.vimPlugins; [ 13 | { 14 | plugin = FixCursorHold-nvim; 15 | } 16 | { 17 | plugin = neotest; 18 | config = builtins.readFile ./neotest.lua; 19 | type = "lua"; 20 | } 21 | { 22 | plugin = neotest-java; 23 | } 24 | { 25 | plugin = neotest-rust; 26 | } 27 | { 28 | plugin = neotest-vim-test; 29 | } 30 | { 31 | plugin = nvim-nio; 32 | } 33 | ]; 34 | } 35 | -------------------------------------------------------------------------------- /home/neovim/neotest/neotest.lua: -------------------------------------------------------------------------------- 1 | require("neotest").setup({ 2 | adapters = { 3 | require("neotest-rust") { 4 | }, 5 | require("neotest-vim-test")({ 6 | -- ignore_file_types = { "java" }, 7 | }), 8 | }, 9 | consumers = { 10 | overseer = require("neotest.consumers.overseer"), 11 | }, 12 | }) 13 | 14 | local wk = require("which-key") 15 | wk.add( 16 | { 17 | { "t", group = "neo[T]est" }, 18 | { "ta", require("neotest").run.attach, desc = "[A]ttach to nearest" }, 19 | { "td", function() require("neotest").run.run({ strategy = "dap" }) end, desc = "[D]ebug nearest" }, 20 | { "tf", function() require("neotest").run.run(vim.fn.expand("%")) end, desc = "[F]ile" }, 21 | { "tn", require("neotest").run.run, desc = "[N]earest" }, 22 | { 23 | "to", 24 | function() 25 | require("neotest").output_panel.toggle() 26 | vim.cmd("wincmd p") 27 | end, 28 | desc = "Toggle [O]utput Panel" 29 | }, 30 | { "ts", function() require("neotest").summary.toggle({ enter = true }) end, desc = "Toggle [S]ummary" }, 31 | } 32 | ) 33 | -------------------------------------------------------------------------------- /home/neovim/noice/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = noice-nvim; 5 | config = '' 6 | require("noice").setup({ 7 | lsp = { 8 | -- override markdown rendering so that **cmp** and other plugins use **Treesitter** 9 | override = { 10 | ["vim.lsp.util.convert_input_to_markdown_lines"] = true, 11 | ["vim.lsp.util.stylize_markdown"] = true, 12 | ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp 13 | }, 14 | }, 15 | -- you can enable a preset for easier configuration 16 | presets = { 17 | bottom_search = true, -- use a classic bottom cmdline for search 18 | command_palette = true, -- position the cmdline and popupmenu together 19 | long_message_to_split = true, -- long messages will be sent to a split 20 | inc_rename = false, -- enables an input dialog for inc-rename.nvim 21 | lsp_doc_border = false, -- add a border to hover docs and signature help 22 | }, 23 | }) 24 | 25 | local wk = require("which-key") 26 | wk.add( 27 | { 28 | { "n", group = "[N]oice" }, 29 | { "nd", "NoiceDismiss", desc = "[D]ismiss Notifications" }, 30 | { "nl", "NoiceLast", desc = "[L]ast Notifiation" }, 31 | { "nn", "Noice", desc = "Show all [N]otifications" }, 32 | } 33 | ) 34 | ''; 35 | type = "lua"; 36 | } 37 | ]; 38 | } 39 | -------------------------------------------------------------------------------- /home/neovim/none-ls/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs, 4 | ... 5 | }: let 6 | none-ls = pkgs.vimUtils.buildVimPlugin { 7 | name = "none-ls"; 8 | src = pkgs.fetchFromGitHub { 9 | owner = "nvimtools"; 10 | repo = "none-ls.nvim"; 11 | rev = "a117163db44c256d53c3be8717f3e1a2a28e6299"; 12 | sha256 = "KP/mS6HfVbPA5javQdj/x8qnYYk0G6oT0RZaPTAPseM="; 13 | }; 14 | }; 15 | none-ls-extras = pkgs.vimUtils.buildVimPlugin { 16 | name = "none-ls-extras"; 17 | src = pkgs.fetchFromGitHub { 18 | owner = "nvimtools"; 19 | repo = "none-ls-extras.nvim"; 20 | rev = "1214d729e3408470a7b7a428415a395e5389c13c"; 21 | sha256 = "5wQHdV2lmxMegN/BPg+qfGTNGv/T9u+hy4Yaj41PchI="; 22 | }; 23 | }; 24 | in { 25 | programs.neovim.plugins = [ 26 | { 27 | plugin = none-ls; # Automatically install LSP servers 28 | config = builtins.readFile ./none-ls.lua; 29 | type = "lua"; 30 | } 31 | { 32 | plugin = none-ls-extras; 33 | } 34 | ]; 35 | } 36 | -------------------------------------------------------------------------------- /home/neovim/none-ls/none-ls.lua: -------------------------------------------------------------------------------- 1 | local null_ls = require("null-ls") 2 | null_ls.setup({ 3 | sources = { 4 | null_ls.builtins.formatting.shfmt, 5 | null_ls.builtins.formatting.prettierd.with({ 6 | filetypes = { "html", "json", "yaml", "markdown" }, 7 | }), 8 | null_ls.builtins.formatting.yapf, 9 | require("none-ls.diagnostics.eslint") 10 | } 11 | }) 12 | -------------------------------------------------------------------------------- /home/neovim/notify/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim = { 3 | extraLuaConfig = '' 4 | vim.notify = require("notify") 5 | ''; 6 | plugins = with pkgs.vimPlugins; [ 7 | { 8 | plugin = nvim-notify; 9 | config = '' 10 | require('notify').setup() 11 | ''; 12 | type = "lua"; 13 | } 14 | ]; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /home/neovim/nui/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = nui-nvim; 5 | config = '' 6 | ''; 7 | type = "lua"; 8 | } 9 | ]; 10 | } 11 | -------------------------------------------------------------------------------- /home/neovim/nvim-tree-lua/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = nvim-tree-lua; 5 | config = '' 6 | local function my_on_attach(bufnr) 7 | local api = require "nvim-tree.api" 8 | local function opts(desc) 9 | return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } 10 | end 11 | -- default mappings 12 | api.config.mappings.default_on_attach(bufnr) 13 | -- custom mappings 14 | vim.keymap.set('n', '', api.node.open.horizontal, opts('Open: Horizontal Split')) 15 | vim.keymap.set('n', '?', api.tree.toggle_help, opts('Help')) 16 | end 17 | require("nvim-tree").setup({ 18 | on_attach = my_on_attach, 19 | disable_netrw = false, -- keeping netrw for :GBrowse from fugitive to work 20 | hijack_netrw = true, -- once no longer needed, check :he nvim-tree-netrw 21 | -- Dynamic width 22 | view = { 23 | width = { 24 | min = 30, 25 | max = -1, 26 | }, 27 | }, 28 | }) 29 | local wk = require("which-key") 30 | wk.add( 31 | { 32 | { "f", group = "[F]iles(NvimTree)" }, 33 | { "fc", "NvimTreeCollapse", desc = "[C]ollapse NVimTree Node Recursively" }, 34 | { "ff", "NvimTreeFindFile", desc = "Move the cursor in the tree for the current buffer, opening [f]olders if needed." }, 35 | { "ft", "NvimTreeToggle", desc = "[T]oggle NvimTree" }, 36 | { "", "NvimTreeToggle", desc = "Toggle NvimTree", mode = { "n", "v" } }, 37 | { "", "NvimTreeToggle", desc = "Toggle NvimTree", mode = { "i" } }, 38 | } 39 | ) 40 | -- Autoclose, see https://github.com/nvim-tree/nvim-tree.lua/wiki/Auto-Close 41 | local function tab_win_closed(winnr) 42 | local api = require"nvim-tree.api" 43 | local tabnr = vim.api.nvim_win_get_tabpage(winnr) 44 | local bufnr = vim.api.nvim_win_get_buf(winnr) 45 | local buf_info = vim.fn.getbufinfo(bufnr)[1] 46 | local tab_wins = vim.tbl_filter(function(w) return w~=winnr end, vim.api.nvim_tabpage_list_wins(tabnr)) 47 | local tab_bufs = vim.tbl_map(vim.api.nvim_win_get_buf, tab_wins) 48 | if buf_info.name:match(".*NvimTree_%d*$") then -- close buffer was nvim tree 49 | -- Close all nvim tree on :q 50 | if not vim.tbl_isempty(tab_bufs) then -- and was not the last window (not closed automatically by code below) 51 | api.tree.close() 52 | end 53 | else -- else closed buffer was normal buffer 54 | if #tab_bufs == 1 then -- if there is only 1 buffer left in the tab 55 | local last_buf_info = vim.fn.getbufinfo(tab_bufs[1])[1] 56 | if last_buf_info.name:match(".*NvimTree_%d*$") then -- and that buffer is nvim tree 57 | vim.schedule(function () 58 | if #vim.api.nvim_list_wins() == 1 then -- if its the last buffer in vim 59 | vim.cmd "quit" -- then close all of vim 60 | else -- else there are more tabs open 61 | vim.api.nvim_win_close(tab_wins[1], true) -- then close only the tab 62 | end 63 | end) 64 | end 65 | end 66 | end 67 | end 68 | vim.api.nvim_create_autocmd("WinClosed", { 69 | callback = function () 70 | local winnr = tonumber(vim.fn.expand("")) 71 | vim.schedule_wrap(tab_win_closed(winnr)) 72 | end, 73 | nested = true 74 | }) 75 | ''; 76 | type = "lua"; 77 | } 78 | ]; 79 | } 80 | -------------------------------------------------------------------------------- /home/neovim/obsidian-nvim/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = obsidian-nvim; 5 | config = '' 6 | require("obsidian").setup({ 7 | follow_img_func = function(img) 8 | vim.fn.jobstart({"xdg-open", url}) 9 | end, 10 | workspaces = { 11 | { 12 | name = "main", 13 | path = "~/Obsidian", 14 | } 15 | }, 16 | -- Clashes with render-markdown.nvim 17 | ui = { 18 | enable = false, 19 | }, 20 | }) 21 | 22 | local wk = require("which-key") 23 | wk.add({ 24 | { "o", "ObsidianSearch", desc = "Search [O]bsidian" }, 25 | }) 26 | ''; 27 | type = "lua"; 28 | } 29 | ]; 30 | } 31 | -------------------------------------------------------------------------------- /home/neovim/oil/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = oil-nvim; 5 | config = '' 6 | require('oil').setup({ 7 | default_file_explorer = false, 8 | delete_to_trash = true, 9 | skip_confirm_for_simple_edits = true, 10 | view_options = { 11 | show_hidden = true, 12 | natural_order = true, 13 | is_always_hidden = function(name, _) 14 | return name == '..' or name == '.git' 15 | end, 16 | }, 17 | win_options = { 18 | wrap = true, 19 | }, 20 | }) 21 | 22 | vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" }) 23 | ''; 24 | type = "lua"; 25 | } 26 | ]; 27 | } 28 | -------------------------------------------------------------------------------- /home/neovim/overseer/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | home.file = { 3 | ".config/nvim/lua/overseer/template/user/gmailctl_apply.lua".source = ./templates/gmailctl_apply.lua; 4 | 5 | ".config/nvim/lua/overseer/template/user/java_gradle/init.lua".source = ./templates/java_gradle/init.lua; 6 | ".config/nvim/lua/overseer/template/user/java_gradle/bootRun.lua".source = ./templates/java_gradle/bootRun.lua; 7 | ".config/nvim/lua/overseer/template/user/java_gradle/build.lua".source = ./templates/java_gradle/build.lua; 8 | ".config/nvim/lua/overseer/template/user/java_gradle/clean.lua".source = ./templates/java_gradle/clean.lua; 9 | ".config/nvim/lua/overseer/template/user/java_gradle/spotlessApply.lua".source = ./templates/java_gradle/spotlessApply.lua; 10 | ".config/nvim/lua/overseer/template/user/java_gradle/test.lua".source = ./templates/java_gradle/test.lua; 11 | 12 | ".config/nvim/lua/overseer/template/user/java_maven/init.lua".source = ./templates/java_maven/init.lua; 13 | ".config/nvim/lua/overseer/template/user/java_maven/clean_package.lua".source = ./templates/java_maven/clean_package.lua; 14 | ".config/nvim/lua/overseer/template/user/java_maven/test.lua".source = ./templates/java_maven/test.lua; 15 | 16 | ".config/nvim/lua/overseer/template/user/nixos_rebuild_switch.lua".source = ./templates/nixos_rebuild_switch.lua; 17 | ".config/nvim/lua/overseer/template/user/nixos_rebuild_boot.lua".source = ./templates/nixos_rebuild_boot.lua; 18 | ".config/nvim/lua/overseer/template/user/nixos_update_secrets.lua".source = ./templates/nixos_update_secrets.lua; 19 | ".config/nvim/lua/overseer/template/user/skaffold_dev.lua".source = ./templates/skaffold_dev.lua; 20 | }; 21 | 22 | programs.neovim.plugins = [ 23 | { 24 | config = builtins.readFile ./overseer.lua; 25 | plugin = pkgs.vimPlugins.overseer-nvim; 26 | runtime = { 27 | "lua/overseer_lib.lua".source = ./overseer_lib.lua; 28 | }; 29 | type = "lua"; 30 | } 31 | ]; 32 | } 33 | -------------------------------------------------------------------------------- /home/neovim/overseer/overseer.lua: -------------------------------------------------------------------------------- 1 | require('overseer').setup({ 2 | strategy = "toggleterm", 3 | templates = { 4 | "builtin", 5 | "user.gmailctl_apply", 6 | "user.java_gradle", 7 | "user.java_maven", 8 | "user.nixos_rebuild_switch", 9 | "user.nixos_rebuild_boot", 10 | "user.nixos_update_secrets", 11 | "user.skaffold_dev", 12 | }, 13 | }) 14 | local wk = require("which-key") 15 | wk.add( 16 | { 17 | { "o", group = "[O]verseer" }, 18 | { "or", "OverseerRun", desc = "[R]un" }, 19 | { "ot", "OverseerToggle", desc = "[T]oggle List" }, 20 | } 21 | ) 22 | -------------------------------------------------------------------------------- /home/neovim/overseer/overseer_lib.lua: -------------------------------------------------------------------------------- 1 | local M = {} 2 | 3 | M.is_gradle_project = function(dir) 4 | while dir ~= "" and dir ~= "/" do 5 | if vim.fn.filereadable(dir .. "/gradlew") == 1 then 6 | return true 7 | end 8 | dir = vim.fn.fnamemodify(dir, ":h") 9 | end 10 | 11 | return false 12 | end 13 | 14 | M.is_maven_project = function(dir) 15 | while dir ~= "" and dir ~= "/" do 16 | if vim.fn.filereadable(dir .. "/pom.xml") == 1 then 17 | return true 18 | end 19 | dir = vim.fn.fnamemodify(dir, ":h") 20 | end 21 | 22 | return false 23 | end 24 | 25 | return M 26 | -------------------------------------------------------------------------------- /home/neovim/overseer/templates/gmailctl_apply.lua: -------------------------------------------------------------------------------- 1 | return { 2 | name = "gmailctl apply", 3 | builder = function() 4 | return { 5 | cmd = { "gmailctl" }, 6 | args = { "apply" }, 7 | } 8 | end, 9 | condition = { 10 | filetype = { "jsonnet" }, 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /home/neovim/overseer/templates/java_gradle/bootRun.lua: -------------------------------------------------------------------------------- 1 | local overseer_lib = require("overseer_lib") 2 | 3 | return { 4 | name = "gradlew: bootRun", 5 | builder = function() 6 | return { 7 | cmd = { "./gradlew" }, 8 | args = { "bootRun" }, 9 | } 10 | end, 11 | condition = { 12 | callback = function(search) 13 | return overseer_lib.is_gradle_project(search.dir) 14 | end, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /home/neovim/overseer/templates/java_gradle/build.lua: -------------------------------------------------------------------------------- 1 | local overseer_lib = require("overseer_lib") 2 | 3 | return { 4 | name = "gradlew: build", 5 | builder = function() 6 | return { 7 | cmd = { "./gradlew" }, 8 | args = { "build" }, 9 | } 10 | end, 11 | condition = { 12 | callback = function(search) 13 | return overseer_lib.is_gradle_project(search.dir) 14 | end, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /home/neovim/overseer/templates/java_gradle/clean.lua: -------------------------------------------------------------------------------- 1 | local overseer_lib = require("overseer_lib") 2 | 3 | return { 4 | name = "gradlew: clean", 5 | builder = function() 6 | return { 7 | cmd = { "./gradlew" }, 8 | args = { "clean" }, 9 | } 10 | end, 11 | condition = { 12 | callback = function(search) 13 | return overseer_lib.is_gradle_project(search.dir) 14 | end, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /home/neovim/overseer/templates/java_gradle/init.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "user.java_gradle.bootRun", 3 | "user.java_gradle.build", 4 | "user.java_gradle.clean", 5 | "user.java_gradle.test", 6 | "user.java_gradle.spotlessApply", 7 | } 8 | -------------------------------------------------------------------------------- /home/neovim/overseer/templates/java_gradle/spotlessApply.lua: -------------------------------------------------------------------------------- 1 | local overseer_lib = require("overseer_lib") 2 | 3 | return { 4 | name = "gradlew: spotlessApply", 5 | builder = function() 6 | return { 7 | cmd = { "./gradlew" }, 8 | args = { "spotlessApply" }, 9 | } 10 | end, 11 | condition = { 12 | callback = function(search) 13 | return overseer_lib.is_gradle_project(search.dir) 14 | end, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /home/neovim/overseer/templates/java_gradle/test.lua: -------------------------------------------------------------------------------- 1 | local overseer_lib = require("overseer_lib") 2 | 3 | return { 4 | name = "gradlew: test", 5 | builder = function() 6 | return { 7 | cmd = { "./gradlew" }, 8 | args = { "test" }, 9 | } 10 | end, 11 | condition = { 12 | callback = function(search) 13 | return overseer_lib.is_gradle_project(search.dir) 14 | end, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /home/neovim/overseer/templates/java_maven/clean_package.lua: -------------------------------------------------------------------------------- 1 | local overseer_lib = require("overseer_lib") 2 | 3 | return { 4 | name = "mvn: clean package", 5 | builder = function() 6 | return { 7 | cmd = { "mvn" }, 8 | args = { "clean", "package" }, 9 | } 10 | end, 11 | condition = { 12 | callback = function(search) 13 | return overseer_lib.is_maven_project(search.dir) 14 | end, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /home/neovim/overseer/templates/java_maven/init.lua: -------------------------------------------------------------------------------- 1 | return { 2 | "user.java_maven.clean_package", 3 | "user.java_maven.test", 4 | } 5 | -------------------------------------------------------------------------------- /home/neovim/overseer/templates/java_maven/test.lua: -------------------------------------------------------------------------------- 1 | local overseer_lib = require("overseer_lib") 2 | 3 | return { 4 | name = "mvn: test", 5 | builder = function() 6 | return { 7 | cmd = { "mvn" }, 8 | args = { "test" }, 9 | } 10 | end, 11 | condition = { 12 | callback = function(search) 13 | return overseer_lib.is_maven_project(search.dir) 14 | end, 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /home/neovim/overseer/templates/nixos_rebuild_boot.lua: -------------------------------------------------------------------------------- 1 | return { 2 | name = "nixos rebuild boot", 3 | builder = function() 4 | return { 5 | cmd = { "nh" }, 6 | args = { "os", "boot" }, 7 | } 8 | end, 9 | condition = { 10 | dir = "~/code/nixos-config", 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /home/neovim/overseer/templates/nixos_rebuild_switch.lua: -------------------------------------------------------------------------------- 1 | return { 2 | name = "nixos rebuild switch", 3 | builder = function() 4 | return { 5 | cmd = { "nh" }, 6 | args = { "os", "switch" }, 7 | } 8 | end, 9 | condition = { 10 | dir = "~/code/nixos-config", 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /home/neovim/overseer/templates/nixos_update_secrets.lua: -------------------------------------------------------------------------------- 1 | return { 2 | name = "update secrets", 3 | builder = function() 4 | return { 5 | cmd = { "nix" }, 6 | args = { "flake", "lock", "--update-input", "secrets" }, 7 | } 8 | end, 9 | condition = { 10 | dir = "~/code/nixos-config", 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /home/neovim/overseer/templates/skaffold_dev.lua: -------------------------------------------------------------------------------- 1 | return { 2 | name = "skaffold dev", 3 | builder = function() 4 | return { 5 | cmd = { "skaffold" }, 6 | args = { "dev" }, 7 | } 8 | end, 9 | condition = { 10 | filetype = "yaml", 11 | }, 12 | } 13 | -------------------------------------------------------------------------------- /home/neovim/plenary/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = plenary-nvim; 5 | config = '' 6 | ''; 7 | type = "lua"; 8 | } 9 | ]; 10 | } 11 | -------------------------------------------------------------------------------- /home/neovim/rainbow-csv/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: let 2 | rainbow-csv-nvim = pkgs.vimUtils.buildVimPlugin { 3 | name = "rainbow-csv-nvim"; 4 | src = pkgs.fetchFromGitHub { 5 | owner = "cameron-wags"; 6 | repo = "rainbow_csv.nvim"; 7 | rev = "7f3fddfe813641035fac2cdf94c2ff69bb0bf0b9"; 8 | sha256 = "sha256-/XHQd/+sqhVeeMAkcKNvFDKFuFecChrgp56op3KQAhs="; 9 | }; 10 | }; 11 | in { 12 | programs.neovim.plugins = [ 13 | { 14 | plugin = rainbow-csv-nvim; 15 | config = '' 16 | require('rainbow_csv').setup({}) 17 | ''; 18 | type = "lua"; 19 | } 20 | ]; 21 | } 22 | -------------------------------------------------------------------------------- /home/neovim/render-markdown/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = render-markdown-nvim; 5 | config = '' 6 | require('render-markdown').setup({ 7 | file_types = {'markdown', 'Avante'}, 8 | }) 9 | ''; 10 | type = "lua"; 11 | } 12 | ]; 13 | } 14 | -------------------------------------------------------------------------------- /home/neovim/telescope/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = telescope-nvim; 5 | config = '' 6 | local builtin = require("telescope.builtin") 7 | local utils = require("telescope.utils") 8 | require("telescope").setup({ 9 | defaults = { 10 | mappings = { 11 | i = { 12 | [""] = require("telescope.actions").select_horizontal, 13 | }, 14 | n = { 15 | [""] = require("telescope.actions").select_horizontal, 16 | }, 17 | }, 18 | }, 19 | pickers = { 20 | find_files = { 21 | hidden = true, 22 | }, 23 | }, 24 | }) 25 | require("telescope").load_extension("fzf") 26 | local wk = require("which-key") 27 | wk.add( 28 | { 29 | { "", group = "Find[ ](Telescope)" }, 30 | { ".", function() builtin.find_files({ cwd = utils.buffer_dir() }) end, desc = "Files in CWD" }, 31 | { "", "Telescope git_files", desc = "Version Controlled Files" }, 32 | { "?", "Telescope keymaps", desc = "Vim Keymap Cheatsheet" }, 33 | { "b", "Telescope buffers", desc = "[B]uffers" }, 34 | { "c", "Telescope commands", desc = "[C]ommands" }, 35 | { "d", "Telescope command_history", desc = "Comman[d] History" }, 36 | { "e", "Telescope help_tags", desc = "H[e]lp Tags" }, 37 | { "f", "Telescope find_files", desc = "All [F]iles" }, 38 | { "g", "Telescope live_grep", desc = "[G]rep" }, 39 | { "m", "Telescope bookmarks list", desc = "Book[m]arks" }, 40 | } 41 | ) 42 | ''; 43 | type = "lua"; 44 | } 45 | { 46 | plugin = telescope-fzf-native-nvim; 47 | } 48 | { 49 | plugin = telescope-frecency-nvim; 50 | config = '' 51 | require("telescope").setup({ 52 | extensions = { 53 | frecency = { 54 | show_scores = true, 55 | auto_validate = false, -- manually gc with :FrecencyValidate 56 | }, 57 | }, 58 | }) 59 | require("telescope").load_extension("frecency") 60 | local wk = require("which-key") 61 | wk.add( 62 | { 63 | { "h", "Telescope frecency workspace=CWD", desc = "History (Frecency)" }, 64 | } 65 | ) 66 | ''; 67 | type = "lua"; 68 | } 69 | { 70 | plugin = telescope-undo-nvim; 71 | config = '' 72 | require("telescope").setup({ 73 | extensions = { 74 | undo = {}; 75 | }, 76 | }) 77 | require("telescope").load_extension("undo") 78 | local wk = require("which-key") 79 | wk.add( 80 | { 81 | { "u", "Telescope undo", desc = "[U]ndo Tree" }, 82 | } 83 | ) 84 | ''; 85 | type = "lua"; 86 | } 87 | ]; 88 | } 89 | -------------------------------------------------------------------------------- /home/neovim/toggleterm/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = toggleterm-nvim; 5 | config = '' 6 | require("toggleterm").setup({ 7 | open_mapping = [[]], 8 | direction = 'float', 9 | }) 10 | ''; 11 | type = "lua"; 12 | } 13 | ]; 14 | } 15 | -------------------------------------------------------------------------------- /home/neovim/treesitter/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.extraPackages = [pkgs.gcc]; 3 | 4 | programs.neovim.plugins = with pkgs.vimPlugins; [ 5 | # TODO: This is Neovim-Native after 0.10, see https://github.com/nvim-treesitter/playground 6 | { 7 | plugin = playground; 8 | config = '' 9 | ''; 10 | type = "lua"; 11 | } 12 | { 13 | plugin = nvim-treesitter.withAllGrammars; 14 | config = builtins.readFile ./treesitter.lua; 15 | runtime = { 16 | "after/queries/nix/injections.scm".source = ./queries/nix/injections.scm; 17 | }; 18 | type = "lua"; 19 | } 20 | { 21 | plugin = nvim-treesitter-context; # ip, ap, etc... from treesitter! 22 | config = '' 23 | ''; 24 | type = "lua"; 25 | } 26 | { 27 | plugin = nvim-treesitter-textobjects; # ip, ap, etc... from treesitter! 28 | config = '' 29 | ''; 30 | type = "lua"; 31 | } 32 | ]; 33 | } 34 | -------------------------------------------------------------------------------- /home/neovim/treesitter/queries/nix/injections.scm: -------------------------------------------------------------------------------- 1 | ;extends 2 | ; extraLuaConfig -> Lua 3 | (binding 4 | attrpath: (attrpath 5 | (identifier) @_path) 6 | expression: [ 7 | (string_expression 8 | ((string_fragment) @injection.content 9 | (#set! injection.language "lua"))) 10 | (indented_string_expression 11 | ((string_fragment) @injection.content 12 | (#set! injection.language "lua"))) 13 | ] 14 | (#match? @_path "^extraLuaConfig$") 15 | (#set! injection.combined)) 16 | 17 | ; neovim.extraConfig -> Vim 18 | (binding 19 | ( 20 | (attrpath 21 | (identifier) @_outer 22 | (identifier) @_inner 23 | ) 24 | ) 25 | (attrset_expression 26 | (binding_set 27 | (binding 28 | attrpath: (attrpath 29 | (identifier) @_path) 30 | expression: [ 31 | (string_expression 32 | ((string_fragment) @injection.content 33 | (#set! injection.language "vim"))) 34 | (indented_string_expression 35 | ((string_fragment) @injection.content 36 | (#set! injection.language "vim"))) 37 | ] 38 | (#match? @_path "^extraConfig$") 39 | (#match? @_inner "^neovim$") 40 | (#set! injection.combined) 41 | ) 42 | ) 43 | ) 44 | ) 45 | 46 | ; inline vim plugin configs of type Lua 47 | (binding_set 48 | binding: (binding 49 | attrpath: (attrpath 50 | (identifier) @_path) 51 | expression: [ 52 | (string_expression 53 | ((string_fragment) @injection.content 54 | (#set! injection.language "lua"))) 55 | (indented_string_expression 56 | ((string_fragment) @injection.content 57 | (#set! injection.language "lua"))) 58 | ] 59 | ) 60 | binding: (binding 61 | attrpath: (attrpath 62 | (identifier) @_typearg) 63 | expression: [ 64 | (string_expression 65 | ((string_fragment) @_typeval 66 | )) 67 | (indented_string_expression 68 | ((string_fragment) @_typeval 69 | )) 70 | ] 71 | ) 72 | (#match? @_typearg "^type$") 73 | (#match? @_typeval "^lua$") 74 | (#match? @_path "^config$") 75 | (#set! injection.combined) 76 | ) 77 | -------------------------------------------------------------------------------- /home/neovim/treesitter/treesitter.lua: -------------------------------------------------------------------------------- 1 | local function ts_disable_long_files(_, bufnr) 2 | return vim.api.nvim_buf_line_count(bufnr) > 5000 3 | end 4 | 5 | local disabled_languages = { 6 | "csv", -- In favor of rainbow-csv-nvim 7 | } 8 | 9 | -- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}' 10 | vim.defer_fn(function() 11 | require('nvim-treesitter.configs').setup { 12 | auto_install = false, 13 | highlight = { 14 | enable = true, 15 | disable = function(lang, bufnr) 16 | return vim.tbl_contains(disabled_languages, lang) or ts_disable_long_files(lang, bufnr) 17 | end, 18 | }, 19 | indent = { enable = true }, 20 | incremental_selection = { 21 | enable = true, 22 | keymaps = { 23 | init_selection = '', 24 | node_incremental = '', 25 | node_decremental = '', 26 | }, 27 | }, 28 | } 29 | end, 0) 30 | -------------------------------------------------------------------------------- /home/neovim/trouble/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = trouble-nvim; 5 | config = builtins.readFile ./trouble.lua; 6 | type = "lua"; 7 | } 8 | ]; 9 | } 10 | -------------------------------------------------------------------------------- /home/neovim/trouble/trouble.lua: -------------------------------------------------------------------------------- 1 | local wk = require("which-key") 2 | wk.add( 3 | { 4 | { "x", group = "Trouble" }, 5 | { "xx", "Trouble diagnostics toggle", desc = "Diagnostics", mode = { "n", "v" } }, 6 | { "xX", "Trouble diagnostics toggle filter.buf=0", desc = "Buffer Diagnostics", mode = { "n", "v" } }, 7 | { "xl", "Trouble loclist toggle", desc = "[L]ocation List" }, 8 | { "xq", "Trouble quickfix toggle", desc = "[Q]uickfix" }, 9 | { "xs", "Trouble symbols toggle focus=false", desc = "[S]ymbols" }, 10 | } 11 | ) 12 | require("trouble").setup({ 13 | action_keys = { -- key mappings for actions in the trouble list 14 | open_split = { "" }, -- open buffer in new split 15 | open_vsplit = { "" }, -- open buffer in new vsplit 16 | previous = "l", -- previous item 17 | next = "k" -- next item 18 | }, 19 | }) 20 | -------------------------------------------------------------------------------- /home/neovim/vim-visual-multi/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.neovim.plugins = with pkgs.vimPlugins; [ 3 | { 4 | plugin = vim-visual-multi; 5 | config = '' 6 | let g:VM_maps = {} 7 | let g:VM_maps['Motion ,'] = ',,' " Removes conflict with , as LSP Leader 8 | let g:VM_maps['Goto Prev'] = '[[' " Removes conflict with vim-unimpaired 9 | let g:VM_maps['Goto Next'] = ']]' " Removes conflict with vim-unimpaired 10 | ''; 11 | } 12 | ]; 13 | } 14 | -------------------------------------------------------------------------------- /home/networkmanager-dmenu/config.ini: -------------------------------------------------------------------------------- 1 | [dmenu] 2 | dmenu_command = fuzzel --dmenu 3 | # # Note that dmenu_command can contain arguments as well like: 4 | # # `dmenu_command = rofi -dmenu -i -theme nmdm` 5 | # # `dmenu_command = rofi -dmenu -width 30 -i` 6 | # # `dmenu_command = dmenu -i -l 25 -b -nb #909090 -nf #303030` 7 | # # `dmenu_command = fuzzel --dmenu` 8 | # # `dmenu_command = wofi --dmenu` 9 | # active_chars = == 10 | # highlight = # (Default: False) use highlighting instead of active_chars (only applicable to Rofi / Wofi) 11 | # highlight_fg = # (Default: None) foreground color of active connection (only applicable to Wofi) 12 | # highlight_bg = # (Default: None) background color of active connection (only applicable to Wofi) 13 | # highlight_bold = # (Default: True) make active connection bold (only applicable to Wofi) 14 | # compact = # (Default: False). Remove extra spacing from display 15 | # pinentry = # (Default: None) e.g. `pinentry-gtk` 16 | # wifi_chars = 17 | # wifi_chars = ▂▄▆█ 18 | # wifi_icons = 19 | # wifi_icons = 󰤯󰤟󰤢󰤥󰤨 20 | # format = 21 | # format = {name} {sec} {bars} 22 | # # Available variables are: 23 | # # * {name} - Access point name 24 | # # * {sec} - Security type 25 | # # * {signal} - Signal strength on a scale of 0-100 26 | # # * {bars} - Bar-based display of signal strength (see wifi_chars) 27 | # # * {icon} - Icon-based display of signal strength (see wifi_icons) 28 | # # * {max_len_name} and {max_len_sec} are the maximum lengths of {name} / {sec} 29 | # # respectively and may be useful for formatting. 30 | # list_saved = # (Default: False) list saved connections 31 | 32 | [dmenu_passphrase] 33 | # # Uses the -password flag for Rofi, -x for bemenu. For dmenu, sets -nb and 34 | # # -nf to the same color or uses -P if the dmenu password patch is applied 35 | # # https://tools.suckless.org/dmenu/patches/password/ 36 | # obscure = True 37 | # obscure_color = #222222 38 | 39 | [pinentry] 40 | # description = (Default: Get network password) 41 | # prompt = (Default: Password:) 42 | 43 | [editor] 44 | # terminal = 45 | # gui_if_available = (Default: True) 46 | 47 | [nmdm] 48 | # rescan_delay = # (seconds to wait after a wifi rescan before redisplaying the results) 49 | -------------------------------------------------------------------------------- /home/networkmanager-dmenu/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | home.packages = [pkgs.networkmanager_dmenu]; 3 | xdg.configFile."networkmanager-dmenu/config.ini".source = ./config.ini; 4 | } 5 | -------------------------------------------------------------------------------- /home/nh/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | home.packages = [pkgs.nh]; 3 | 4 | home.sessionVariables = { 5 | FLAKE = "/home/farlion/code/nixos-config"; 6 | }; 7 | } 8 | -------------------------------------------------------------------------------- /home/nix-index/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | inputs, 3 | isImpermanent, 4 | lib, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | files = [ 9 | ".local/state/comma-choices" # For , 10 | ]; 11 | }; 12 | imports = [ 13 | inputs.nix-index-database.hmModules.nix-index 14 | ]; 15 | 16 | programs.nix-index = { 17 | enable = true; 18 | }; 19 | 20 | programs.nix-index-database.comma.enable = true; 21 | } 22 | -------------------------------------------------------------------------------- /home/nushell/config.nu: -------------------------------------------------------------------------------- 1 | # Nushell Config File 2 | # 3 | # Defaults: https://github.com/nushell/nushell/blob/main/docs/sample_config/default_config.nu 4 | 5 | # The default config record. This is where much of your global configuration is setup. 6 | $env.config = { 7 | history: { 8 | max_size: 1_000_000 # Session has to be reloaded for this to take effect 9 | } 10 | 11 | keybindings: [ 12 | #{ 13 | # name: completion_menu 14 | # modifier: control 15 | # keycode: char_s 16 | # mode: [vi_insert vi_normal] 17 | # event: { 18 | # until: [ 19 | # { send: menu name: completion_menu } 20 | # { send: menupagenext } 21 | # ] 22 | # } 23 | #} 24 | #{ 25 | # name: history_menu 26 | # modifier: control 27 | # keycode: char_h 28 | # mode: [vi_insert vi_normal] 29 | # event: { 30 | # until: [ 31 | # { send: menu name: history_menu } 32 | # { send: menupagenext } 33 | # ] 34 | # } 35 | #} 36 | { 37 | name: open_command_editor 38 | modifier: control 39 | keycode: char_e 40 | mode: [emacs, vi_normal, vi_insert] 41 | event: { send: openeditor } 42 | } 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /home/nushell/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | isImpermanent, 3 | lib, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | files = [ 9 | ".config/nushell/history.txt" 10 | ]; 11 | }; 12 | programs.nushell = { 13 | enable = true; 14 | configFile.source = ./config.nu; 15 | envFile.source = ./env.nu; 16 | package = pkgs.unstable.nushell; 17 | }; 18 | } 19 | -------------------------------------------------------------------------------- /home/nushell/env.nu: -------------------------------------------------------------------------------- 1 | # Nushell Environment Config File 2 | -------------------------------------------------------------------------------- /home/obs/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | isImpermanent, 3 | lib, 4 | pkgs, 5 | osConfig, 6 | ... 7 | }: let 8 | isFlexbox = osConfig.networking.hostName == "flexbox"; 9 | in { 10 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 11 | directories = [ 12 | ".config/obs-studio" 13 | ]; 14 | }; 15 | programs.obs-studio = { 16 | enable = true; 17 | plugins = with pkgs.obs-studio-plugins; [ 18 | obs-backgroundremoval 19 | obs-pipewire-audio-capture 20 | obs-vintage-filter 21 | ]; 22 | }; 23 | xdg.desktopEntries = { 24 | obs = { 25 | name = 26 | if isFlexbox 27 | then "OBS Studio (NVIDIA GPU)" 28 | else "OBS Studio"; 29 | exec = 30 | if isFlexbox 31 | then "nvidia-offload obs" 32 | else "obs"; 33 | genericName = "Streaming/Recording Software"; 34 | terminal = false; 35 | type = "Application"; 36 | categories = ["AudioVideo" "Recorder"]; 37 | icon = "com.obsproject.Studio"; 38 | startupNotify = true; 39 | }; 40 | }; 41 | } 42 | -------------------------------------------------------------------------------- /home/obsidian/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/obsidian" 10 | "Obsidian" 11 | ]; 12 | }; 13 | 14 | home.packages = [ 15 | pkgs.obsidian 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /home/pavucontrol/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | files = [ 9 | ".config/pavucontrol.ini" 10 | ]; 11 | }; 12 | 13 | home.packages = [ 14 | pkgs.pavucontrol 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /home/portfolio-performance/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".PortfolioPerformance" 10 | ]; 11 | }; 12 | 13 | home.packages = [ 14 | pkgs.unstable.portfolio 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /home/psql/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | home.packages = [ 3 | pkgs.postgresql 4 | ]; 5 | home.file.".psqlrc".source = ./psqlrc; 6 | } 7 | -------------------------------------------------------------------------------- /home/psql/psqlrc: -------------------------------------------------------------------------------- 1 | \x auto 2 | \pset pager 0 3 | -------------------------------------------------------------------------------- /home/pulsemixer/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | home.file = { 3 | ".config/pulsemixer.cfg".source = ./pulsemixer.cfg; 4 | }; 5 | 6 | home.packages = [ 7 | pkgs.pulsemixer 8 | ]; 9 | } 10 | -------------------------------------------------------------------------------- /home/pulsemixer/pulsemixer.cfg: -------------------------------------------------------------------------------- 1 | [keys] 2 | ;; To bind "special keys" such as arrows see "Key constant" table in 3 | ;; https://docs.python.org/3/library/curses.html#constants 4 | up = l, KEY_UP, KEY_PPAGE 5 | down = k, KEY_DOWN, KEY_NPAGE 6 | left = j, KEY_LEFT 7 | right = ';', KEY_RIGHT 8 | -------------------------------------------------------------------------------- /home/qalculate/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/qalculate" 10 | ".local/share/qalculate" 11 | ]; 12 | }; 13 | 14 | home.packages = [ 15 | pkgs.qalculate-gtk 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /home/remmina/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/freerdp" # server keys connected to 10 | ".config/remmina" 11 | ".local/share/remmina" 12 | ".cache/remmina" 13 | ]; 14 | }; 15 | 16 | home.packages = [ 17 | pkgs.remmina 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /home/rofi/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.rofi = { 3 | enable = true; 4 | 5 | # package = pkgs.rofi-wayland; 6 | plugins = with pkgs; [rofi-calc]; 7 | 8 | terminal = "${pkgs.alacritty}/bin/alacritty"; 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /home/rofimoji/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | home.packages = [ 3 | pkgs.rofimoji 4 | pkgs.wtype # insert emojis directly 5 | ]; 6 | 7 | xdg.configFile."rofimoji.rc".source = ./rofimoji.rc; 8 | } 9 | -------------------------------------------------------------------------------- /home/rofimoji/rofimoji.rc: -------------------------------------------------------------------------------- 1 | files = [emojis, math, currency_symbols, combining_diacritical_marks, fontawesome6] 2 | skin-tone = "neutral" 3 | selector = "fuzzel" 4 | action = "clipboard" # workaround to work in browser windows etc... under Wayland since direct typing doesn't work reliably 5 | -------------------------------------------------------------------------------- /home/signal/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: let 7 | signal-desktop-launcher-workaround = pkgs.writeShellApplication { 8 | name = "signal-desktop-launcher-workaround"; 9 | runtimeInputs = [pkgs.signal-desktop pkgs.coreutils]; 10 | text = builtins.readFile ./scripts/signal-desktop-launcher-workaround.sh; 11 | }; 12 | in { 13 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 14 | directories = [ 15 | ".config/Signal" 16 | ]; 17 | }; 18 | 19 | home.packages = [ 20 | pkgs.signal-desktop 21 | ]; 22 | 23 | # Workaround for "launch twice" bug under wayland, see https://github.com/signalapp/Signal-Desktop/issues/6368 24 | xdg.desktopEntries = { 25 | signal-desktop = { 26 | exec = "${signal-desktop-launcher-workaround}/bin/signal-desktop-launcher-workaround"; 27 | name = "Signal"; 28 | comment = "Private messaging from your desktop"; 29 | categories = ["Network"]; 30 | icon = "signal-desktop"; 31 | mimeType = ["x-scheme-handler/sgnl" "x-scheme-handler/signalcaptcha"]; 32 | type = "Application"; 33 | }; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /home/signal/scripts/signal-desktop-launcher-workaround.sh: -------------------------------------------------------------------------------- 1 | signal-desktop & 2 | sleep 1 3 | signal-desktop 4 | -------------------------------------------------------------------------------- /home/solaar/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/solaar" 10 | ]; 11 | }; 12 | 13 | home.packages = [ 14 | pkgs.hicolor-icon-theme 15 | pkgs.solaar 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /home/sound-switcher/default.nix: -------------------------------------------------------------------------------- 1 | # Rofi-based sound switcher 2 | { 3 | pkgs, 4 | osConfig, 5 | ... 6 | }: let 7 | isNumenor = osConfig.networking.hostName == "numenor"; 8 | sound-switcher = pkgs.writers.writeBashBin "sound-switcher" ( 9 | if isNumenor 10 | then (builtins.readFile ./scripts/sound-switcher-numenor.sh) 11 | else (builtins.readFile ./scripts/sound-switcher-flexbox.sh) 12 | ); 13 | in { 14 | home.packages = [sound-switcher]; 15 | } 16 | -------------------------------------------------------------------------------- /home/sound-switcher/scripts/sound-switcher-numenor.sh: -------------------------------------------------------------------------------- 1 | chosen="$(echo -e "🎧oh\n\ 2 | 🔊creative\n\ 3 | 🎧sony\n\ 4 | 🍿movie\n\ 5 |  buds(listen)\n\ 6 |  buds(talk)\n\ 7 | 📢boombox\n\ 8 | " | fuzzel --dmenu --prompt "🎶 [M]usic and 🎤 Switch")" 9 | 10 | oh() { 11 | local card_name_pattern="ThinkPad_Thunderbolt" 12 | local sink="alsa_output.usb-Lenovo_ThinkPad_Thunderbolt_3_Dock_USB_Audio_000000000000-00.analog-stereo" 13 | local card_profile="output:analog-stereo" 14 | 15 | set_default_sink "$card_name_pattern" "$sink" "$card_profile" 16 | 17 | localmike 18 | } 19 | 20 | creative() { 21 | local card_name_pattern="usb-Generic_USB_Audio-00" 22 | local sink="alsa_output.usb-Generic_USB_Audio-00.analog-stereo" 23 | local card_profile="output:analog-stereo" 24 | 25 | set_default_sink "$card_name_pattern" "$sink" "$card_profile" 26 | 27 | localmike 28 | } 29 | 30 | movie() { 31 | local card_name_pattern="0000_03_00" 32 | local sink="alsa_output.pci-0000_03_00.1.hdmi-stereo-extra3" 33 | local card_profile="output:hdmi-stereo-extra3" 34 | 35 | set_default_sink "$card_name_pattern" "$sink" "$card_profile" 36 | 37 | localmike 38 | } 39 | 40 | boombox() { 41 | local card_name_pattern="04_21" 42 | local sink="bluez_sink.04_21_44_B6_92_39.a2dp_sink" 43 | local card_profile="?" 44 | 45 | local bd_address="04:21:44:B6:92:39" 46 | local card_id 47 | if [[ -z $card_id ]]; then 48 | connect_bluetooth "$bd_address" 49 | fi 50 | 51 | set_default_sink "$card_name_pattern" "$sink" "$card_profile" 52 | 53 | localmike 54 | } 55 | 56 | budslisten() { 57 | local card_name_pattern="DC_69" 58 | local sink="bluez_output.DC_69_E2_9A_6E_30.1" 59 | local card_profile="a2dp-sink-sbc" 60 | 61 | set_default_sink "$card_name_pattern" "$sink" "$card_profile" 62 | 63 | localmike 64 | } 65 | 66 | budstalk() { 67 | local card_name_pattern="DC_69" 68 | local sink="bluez_output.DC_69_E2_9A_6E_30.1" 69 | local card_profile="headset-head-unit" 70 | 71 | set_default_sink "$card_name_pattern" "$sink" "$card_profile" 72 | 73 | budsmike 74 | } 75 | 76 | sony() { 77 | local card_name_pattern="14_3F" 78 | local sink="bluez_output.14_3F_A6_28_DC_51.1" 79 | local card_profile="a2dp-sink" 80 | 81 | local bd_address="14:3F:A6:28:DC:51" 82 | local card_id 83 | card_id=$(get_card_id "$card_name_pattern") 84 | if [[ -z $card_id ]]; then 85 | connect_bluetooth "$bd_address" 86 | fi 87 | 88 | set_default_sink "$card_name_pattern" "$sink" "$card_profile" 89 | 90 | localmike 91 | } 92 | 93 | localmike() { 94 | local card_name_pattern="Blue_Microphones" 95 | local source="alsa_input.usb-Generic_Blue_Microphones_LT_221104181411AD020101_111000-00.analog-stereo" 96 | local card_profile="input:analog-stereo" 97 | 98 | set_default_source "$card_name_pattern" "$source" "$card_profile" 99 | } 100 | 101 | budsmike() { 102 | local card_name_pattern="DC_69" 103 | local source="bluez_input.DC:69:E2:9A:6E:30" 104 | local card_profile="headset-head-unit" 105 | 106 | set_default_source "$card_name_pattern" "$source" "$card_profile" 107 | } 108 | 109 | get_card_id() { 110 | local card_name_pattern="$1" 111 | nu -c "pactl list cards short | lines | parse \"{id}\t{name}\t{_}\" | where \$it.name =~ \"$card_name_pattern\" | get id | get 0" || true 112 | } 113 | 114 | set_default_sink() { 115 | local card_name_pattern="$1" 116 | local sink="$2" 117 | local card_profile="$3" 118 | 119 | local card_id 120 | card_id=$(get_card_id "$card_name_pattern") 121 | 122 | pactl set-card-profile "$card_id" "$card_profile" 123 | pactl set-default-sink "$sink" 124 | } 125 | 126 | set_default_source() { 127 | local card_name_pattern="$1" 128 | local source="$2" 129 | local card_profile="$3" 130 | 131 | local card_id 132 | card_id=$(get_card_id "$card_name_pattern") 133 | 134 | pactl set-card-profile "$card_id" "$card_profile" 135 | pactl set-default-source "$source" 136 | } 137 | 138 | connect_bluetooth() { 139 | local bd_address="$1" 140 | 141 | echo -e 'power on\nquit' | bluetoothctl 142 | sleep 2 143 | echo -e "connect $bd_address\nquit" | bluetoothctl 144 | sleep 10 145 | } 146 | 147 | case "$chosen" in 148 | 🎧oh) oh ;; 149 | 🔊creative) creative ;; 150 | 🎧sony) sony ;; 151 | 🍿movie) movie ;; 152 | " buds(listen)") budslisten ;; 153 | " buds(talk)") budstalk ;; 154 | 📢boombox) boombox ;; 155 | *) exit 1 ;; 156 | esac 157 | -------------------------------------------------------------------------------- /home/ssh/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | ... 5 | }: { 6 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 7 | directories = [ 8 | ".ssh" 9 | ]; 10 | }; 11 | 12 | programs.ssh = { 13 | enable = true; 14 | extraConfig = '' 15 | PubkeyAcceptedKeyTypes +ssh-rsa 16 | HostKeyAlgorithms +ssh-rsa 17 | ''; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /home/starship/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | isImpermanent, 3 | lib, 4 | ... 5 | }: { 6 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 7 | directories = [ 8 | ".cache/starship" 9 | ]; 10 | }; 11 | 12 | programs.starship = { 13 | enable = true; 14 | 15 | enableTransience = true; 16 | 17 | settings = { 18 | format = lib.concatStrings [ 19 | "$username" 20 | "$hostname" 21 | "$localip" 22 | "$shlvl" 23 | "$singularity" 24 | "$directory" 25 | "$vcsh" 26 | "$git_branch" 27 | "$git_commit" 28 | "$git_state" 29 | "$git_metrics" 30 | "$git_status" 31 | "$hg_branch" 32 | "$docker_context" 33 | "$package" 34 | "$buf" 35 | "$c" 36 | "$cmake" 37 | "$cobol" 38 | "$container" 39 | "$daml" 40 | "$dart" 41 | "$deno" 42 | "$dotnet" 43 | "$elixir" 44 | "$elm" 45 | "$erlang" 46 | "$golang" 47 | "$haskell" 48 | "$helm" 49 | "$java" 50 | "$julia" 51 | "$kotlin" 52 | "$lua" 53 | "$nim" 54 | "$nodejs" 55 | "$ocaml" 56 | "$perl" 57 | "$php" 58 | "$pulumi" 59 | "$purescript" 60 | "$python" 61 | "$rlang" 62 | "$red" 63 | "$ruby" 64 | "$rust" 65 | "$scala" 66 | "$swift" 67 | "$terraform" 68 | "$vlang" 69 | "$vagrant" 70 | "$zig" 71 | "$nix_shell" 72 | "$conda" 73 | "$spack" 74 | "$memory_usage" 75 | "$aws" 76 | "$gcloud" 77 | "$kubernetes" 78 | "$openstack" 79 | "$azure" 80 | "$env_var" 81 | "$crystal" 82 | "$custom" 83 | "$sudo" 84 | "$cmd_duration" 85 | "$line_break" 86 | "$jobs" 87 | "$battery" 88 | "$time" 89 | "$status" 90 | "$shell" 91 | "$character" 92 | ]; 93 | 94 | aws = { 95 | disabled = true; 96 | }; 97 | 98 | gcloud = { 99 | disabled = true; 100 | format = "on [$symbol$account(@$domain)|($project)](green) "; 101 | }; 102 | 103 | kubernetes = { 104 | disabled = false; 105 | style = "green"; 106 | contexts = [ 107 | { 108 | "context_pattern" = "kind-kind"; 109 | "context_alias" = "kind"; 110 | } 111 | ]; 112 | }; 113 | 114 | shell = { 115 | disabled = false; 116 | fish_indicator = "🐟"; 117 | bash_indicator = "💩"; 118 | nu_indicator = "🦀"; 119 | }; 120 | 121 | status = { 122 | disabled = false; 123 | map_symbol = true; 124 | pipestatus = false; 125 | }; 126 | 127 | nix_shell = { 128 | disabled = true; 129 | format = "via [$symbol$state]($style) "; 130 | impure_msg = ""; 131 | }; 132 | }; 133 | }; 134 | } 135 | -------------------------------------------------------------------------------- /home/stylix/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | home.packages = [ 3 | pkgs.papirus-icon-theme 4 | ]; 5 | stylix = { 6 | iconTheme = { 7 | enable = true; 8 | package = pkgs.papirus-icon-theme; 9 | light = "Papirus-Light"; 10 | dark = "Papirus-Dark"; 11 | }; 12 | targets = { 13 | firefox = { 14 | profileNames = ["main"]; 15 | }; 16 | neovim.enable = false; 17 | }; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /home/syncthing/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | isImpermanent, 3 | lib, 4 | ... 5 | }: { 6 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 7 | directories = [ 8 | ".local/state/syncthing" # device keys and certificates 9 | ".config/syncthing" # pre-v1.27.0 uses this instead of $XDG_STATE_HOME above, keeping for backward-compatibility 10 | ]; 11 | files = [ 12 | ".config/syncthingtray.ini" 13 | ]; 14 | }; 15 | 16 | services.syncthing = { 17 | enable = true; 18 | tray = { 19 | enable = true; 20 | command = "syncthingtray --wait"; 21 | }; 22 | }; 23 | 24 | systemd.user.services.syncthingtray = { 25 | # Remove existing graphical-session.target 26 | Install = lib.mkForce { 27 | WantedBy = ["sway-session.target"]; 28 | }; 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /home/systemd-errors-and-warnings-counter/default.nix: -------------------------------------------------------------------------------- 1 | # Display number of systemd errors and warnings in last 10 minutes 2 | {pkgs, ...}: let 3 | systemd-errors-and-warnings-counter = pkgs.writeShellApplication { 4 | name = "systemd-errors-and-warnings-counter"; 5 | runtimeInputs = [pkgs.ddcutil pkgs.coreutils]; 6 | text = builtins.readFile ./scripts/systemd-errors-and-warnings-counter.sh; 7 | }; 8 | in { 9 | home.packages = [systemd-errors-and-warnings-counter]; 10 | } 11 | -------------------------------------------------------------------------------- /home/systemd-errors-and-warnings-counter/scripts/systemd-errors-and-warnings-counter.sh: -------------------------------------------------------------------------------- 1 | WARNINGS=$(journalctl -p 4..4 --since "10 minutes ago" --boot --output json | wc -l) 2 | ERRORS=$(journalctl -p 3..3 --since "10 minutes ago" --boot --output json | wc -l) 3 | 4 | WARNING_ICON="⚠️" 5 | ERROR_ICON="❗" 6 | 7 | # Determine state based on number of errors 8 | if [ "$ERRORS" -eq 0 ]; then 9 | STATE="Good" 10 | elif [ "$ERRORS" -le 2 ]; then 11 | STATE="Info" 12 | elif [ "$ERRORS" -le 5 ]; then 13 | STATE="Warning" 14 | else 15 | STATE="Critical" 16 | fi 17 | 18 | echo "{\"text\":\"${ERROR_ICON}${ERRORS} ${WARNING_ICON}${WARNINGS}\",\"short_text\":\"${ERRORS}\",\"state\":\"${STATE}\"}" 19 | -------------------------------------------------------------------------------- /home/tealdeer/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | ... 5 | }: { 6 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 7 | directories = [ 8 | ".cache/tealdeer" 9 | ]; 10 | }; 11 | 12 | programs.tealdeer = { 13 | enable = true; 14 | settings = { 15 | updates = { 16 | auto_update = true; 17 | }; 18 | }; 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /home/telegram/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".local/share/TelegramDesktop" 10 | ]; 11 | }; 12 | 13 | home.packages = [ 14 | pkgs.tdesktop 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /home/thefuck/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/thefuck" 10 | ]; 11 | }; 12 | 13 | home.packages = [ 14 | pkgs.thefuck 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /home/todoist/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/Todoist" 10 | ]; 11 | }; 12 | 13 | home.packages = [ 14 | pkgs.todoist-electron 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /home/trash-cli/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | home.packages = [ 3 | pkgs.trash-cli 4 | ]; 5 | } 6 | -------------------------------------------------------------------------------- /home/udiskie/default.nix: -------------------------------------------------------------------------------- 1 | # Indicator icon for automounting USB drives 2 | {...}: { 3 | services.udiskie = { 4 | enable = true; 5 | automount = false; 6 | tray = "never"; # Tray icon is currently broken under swaybar :(, since it doesn't support SNI 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /home/urxvt/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | programs.urxvt = { 3 | enable = true; 4 | 5 | extraConfig = { 6 | # Perl extensions 7 | perl-ext-common = "default,matcher,resize-font,vtwheel,keyboard-select,-searchable-scrollback"; 8 | 9 | # Matcher (clickable URLs) 10 | url-launcher = "${pkgs.xdg-utils}/bin/xdg-open"; 11 | "matcher.button" = 1; 12 | 13 | # Messes with CTRL+SHIFT Keybindings, see https://wiki.archlinux.org/index.php/Rxvt-unicode#Perl_extensions 14 | iso14755_52 = false; 15 | 16 | # https://github.com/muennich/urxvt-perls#keyboard-select 17 | "keyboard-select.clipboard" = true; 18 | }; 19 | 20 | fonts = ["xft:FiraCode Nerd Font:size=8"]; 21 | 22 | # Messes with CTRL+SHIFT Keybindings, see https://wiki.archlinux.org/index.php/Rxvt-unicode#Perl_extensions 23 | iso14755 = false; 24 | 25 | keybindings = { 26 | "Shift-Control-C" = "eval:selection_to_clipboard"; 27 | "Shift-Control-V" = "eval:paste_clipboard"; 28 | 29 | # https://github.com/muennich/urxvt-perls#keyboard-select 30 | "Meta-Escape" = "perl:keyboard-select:activate"; 31 | "Meta-Shift-S" = "perl:keyboard-select:search"; 32 | }; 33 | 34 | package = pkgs.rxvt-unicode; 35 | 36 | scroll.bar.enable = false; 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /home/variety/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | home.packages = [ 3 | pkgs.variety 4 | ]; 5 | 6 | home.file = { 7 | ".config/variety/variety.conf".source = ./variety.conf; 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /home/virtual-cable/default.nix: -------------------------------------------------------------------------------- 1 | # Virtual inputs/outputs via Pipewire (for OBS and beyond) 2 | {pkgs, ...}: let 3 | obs-mic = pkgs.writers.writeBashBin "obs-mic" (builtins.readFile ./scripts/obs-mic.sh); 4 | in { 5 | home.packages = [obs-mic]; 6 | 7 | systemd.user.services.obs-mic = { 8 | Unit = { 9 | After = ["wireplumber.service"]; 10 | Description = "Set up virtualMic and virtualSpeaker for OBS"; 11 | Requires = ["wireplumber.service"]; 12 | }; 13 | Install.WantedBy = ["wireplumber.service"]; 14 | Service = { 15 | Environment = "PATH=$PATH:/run/current-system/sw/bin"; 16 | ExecStartPre = "${pkgs.coreutils}/bin/sleep 5"; # TODO: Find a better way to wait for WirePlumber to fully start 17 | ExecStart = "${obs-mic}/bin/obs-mic"; 18 | Type = "oneshot"; 19 | }; 20 | }; 21 | } 22 | -------------------------------------------------------------------------------- /home/virtual-cable/scripts/obs-mic.sh: -------------------------------------------------------------------------------- 1 | set -euo pipefail 2 | 3 | # Create a virtual sink that can be set as a monitor in OBS 4 | if ! pactl list short sinks | grep -q ObsSpeaker; then 5 | pactl load-module module-null-sink sink_name=ObsSpeaker sink_properties=device.description=VirtualSpeaker 6 | fi 7 | 8 | # Link it with a virtual source that is visible in pulseaudio apps like Zoom 9 | if ! pactl list short sources | grep -q ObsMic; then 10 | pactl load-module module-null-sink media.class=Audio/Source/Virtual sink_name=ObsMic channel_map=front-left,front-right 11 | pw-link ObsSpeaker:monitor_FL ObsMic:input_FL 12 | pw-link ObsSpeaker:monitor_FR ObsMic:input_FR 13 | fi 14 | -------------------------------------------------------------------------------- /home/vlc/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/vlc" 10 | ".local/share/vlc" 11 | ]; 12 | }; 13 | 14 | home.packages = [ 15 | pkgs.vlc 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /home/wlsunset/default.nix: -------------------------------------------------------------------------------- 1 | # Day/night gamma adjustments for Wayland 2 | {...}: { 3 | services.wlsunset = { 4 | enable = true; 5 | latitude = 38.7; 6 | longitude = -9.1; 7 | systemdTarget = "sway-session.target"; 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /home/xdg/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | isImpermanent, 3 | lib, 4 | osConfig, 5 | pkgs, 6 | ... 7 | }: let 8 | isFlexbox = osConfig.networking.hostName == "flexbox"; 9 | in { 10 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 11 | directories = [ 12 | ".xournal" # Other recently used files 13 | ]; 14 | files = [ 15 | ".local/share/recently-used.xbel" # Recently used files 16 | ]; 17 | }; 18 | 19 | home.packages = [ 20 | pkgs.selectdefaultapplication # GUI XDG Default Application Chooser 21 | ]; 22 | 23 | home.sessionVariables = { 24 | XDG_CONFIG_HOME = "/home/farlion/.config"; 25 | }; 26 | 27 | home.preferXdgDirectories = true; 28 | 29 | xdg = { 30 | mimeApps = { 31 | associations = { 32 | added = { 33 | "x-scheme-handler/tg" = "org.telegram.desktop.desktop"; 34 | }; 35 | }; 36 | enable = true; 37 | defaultApplications = { 38 | "application/pdf" = ["okular.desktop"]; 39 | "applications/x-www-browser" = ["brave-browser.desktop"]; 40 | "image/bmp" = ["oculante.desktop"]; 41 | "image/gif" = ["oculante.desktop"]; 42 | "image/jpeg" = ["oculante.desktop"]; 43 | "image/png" = ["oculante.desktop"]; 44 | "image/svg+xml" = ["oculante.desktop"]; 45 | "image/tiff" = ["oculante.desktop"]; 46 | "image/webp" = ["oculante.desktop"]; 47 | "inode/directory" = ["lf.desktop"]; 48 | "text/html" = ["brave-browser.desktop"]; 49 | "text/plain" = ["nvim.desktop"]; 50 | "x-scheme-handler/about" = ["brave-browser.desktop"]; 51 | "x-scheme-handler/http" = ["brave-browser.desktop"]; 52 | "x-scheme-handler/https" = ["brave-browser.desktop"]; 53 | "x-scheme-handler/mailto" = ["brave-browser.desktop"]; 54 | "x-scheme-handler/msteams" = ["teams-for-linux.desktop"]; 55 | "x-scheme-handler/slack" = ["slack.desktop"]; 56 | "x-scheme-handler/tg" = ["org.telegram.desktop.desktop"]; 57 | "x-scheme-handler/tonsite" = ["org.telegram.desktop.desktop"]; 58 | "x-scheme-handler/unknown" = ["brave-browser.desktop"]; 59 | "x-scheme-handler/webcal" = ["brave-browser.desktop"]; 60 | }; 61 | }; 62 | }; 63 | } 64 | -------------------------------------------------------------------------------- /home/ytmdesktop/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | directories = [ 9 | ".config/YouTube Music Desktop App" 10 | ]; 11 | }; 12 | 13 | home.packages = [ 14 | pkgs.unstable.ytmdesktop 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /home/yubico/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | imports = [ 3 | ./modules/yubikey-touch-detector 4 | ]; 5 | 6 | home.packages = with pkgs; [ 7 | pam_u2f # U2F (via yubikey) support for PAM 8 | yubikey-manager # ykman 9 | yubioath-flutter # Yubikey management GUI 10 | ]; 11 | 12 | services = { 13 | yubikey-touch-detector.enable = true; 14 | }; 15 | } 16 | -------------------------------------------------------------------------------- /home/yubico/modules/yubikey-touch-detector/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: 7 | with lib; let 8 | cfg = config.services.yubikey-touch-detector; 9 | in { 10 | options.services.yubikey-touch-detector = { 11 | enable = mkEnableOption "a tool to detect when your YubiKey is waiting for a touch"; 12 | 13 | package = mkOption { 14 | type = types.package; 15 | default = pkgs.yubikey-touch-detector; 16 | defaultText = "pkgs.yubikey-touch-detector"; 17 | description = '' 18 | Package to use. Binary is expected to be called "yubikey-touch-detector". 19 | ''; 20 | }; 21 | 22 | socket.enable = mkEnableOption "starting the process only when the socket is used"; 23 | 24 | extraArgs = mkOption { 25 | type = types.listOf types.str; 26 | default = ["--libnotify"]; 27 | defaultText = literalExpression ''[ "--libnotify" ]''; 28 | description = '' 29 | Extra arguments to pass to the tool. The arguments are not escaped. 30 | ''; 31 | }; 32 | }; 33 | 34 | config = mkIf cfg.enable { 35 | home.packages = [cfg.package]; 36 | 37 | # Service description licensed under ISC 38 | # See https://github.com/maximbaz/yubikey-touch-detector/blob/c9fdff7163361d6323e2de0449026710cacbc08a/LICENSE 39 | # Author: Maxim Baz 40 | systemd.user.sockets.yubikey-touch-detector = mkIf cfg.socket.enable { 41 | Unit.Description = "Unix socket activation for YubiKey touch detector service"; 42 | Socket = { 43 | ListenFIFO = "%t/yubikey-touch-detector.sock"; 44 | RemoveOnStop = true; 45 | SocketMode = "0660"; 46 | }; 47 | Install.WantedBy = ["sockets.target"]; 48 | }; 49 | 50 | # Same license thing for the description here 51 | systemd.user.services.yubikey-touch-detector = { 52 | Unit = { 53 | Description = "Detects when your YubiKey is waiting for a touch"; 54 | Requires = optionals cfg.socket.enable ["yubikey-touch-detector.socket"]; 55 | }; 56 | Service = { 57 | ExecStart = "${cfg.package}/bin/yubikey-touch-detector ${concatStringsSep " " cfg.extraArgs}"; 58 | Environment = ["PATH=${lib.makeBinPath [pkgs.gnupg]}"]; 59 | Restart = "on-failure"; 60 | RestartSec = "1sec"; 61 | }; 62 | Install.Also = optionals cfg.socket.enable ["yubikey-touch-detector.socket"]; 63 | Install.WantedBy = ["default.target"]; 64 | }; 65 | }; 66 | } 67 | -------------------------------------------------------------------------------- /home/zoom/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | ... 6 | }: { 7 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 8 | files = [ 9 | ".config/zoom.conf" 10 | ".config/zoomus.conf" 11 | ]; 12 | directories = [ 13 | ".zoom" 14 | ".cache/zoom" 15 | ]; 16 | }; 17 | 18 | home.packages = [ 19 | pkgs.zoom-us 20 | ]; 21 | } 22 | -------------------------------------------------------------------------------- /home/zoxide/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | ... 5 | }: { 6 | home.persistence."/persist/home/farlion" = lib.mkIf isImpermanent { 7 | directories = [ 8 | ".cache/zoxide" # Some stuff for nushell 9 | ".local/share/zoxide" # Zoxide DB 10 | ]; 11 | }; 12 | 13 | programs.zoxide = { 14 | enable = true; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /machines/boar-server.nix: -------------------------------------------------------------------------------- 1 | # Edit this configuration file to define what should be installed on 2 | # your system. Help is available in the configuration.nix(5) man page 3 | # and in the NixOS manual (accessible by running ‘nixos-help’). 4 | { 5 | config, 6 | pkgs, 7 | ... 8 | }: { 9 | imports = [ 10 | # Include the results of the hardware scan. 11 | ./hardware-configuration.nix 12 | ]; 13 | 14 | # Use the systemd-boot EFI boot loader. 15 | boot.loader.systemd-boot = { 16 | enable = true; 17 | memtest86.enable = true; 18 | }; 19 | boot.loader.efi.canTouchEfiVariables = false; # Disable this after first installation to not wear out EFI storage 20 | 21 | # GPU 22 | services.xserver.videoDrivers = ["nvidia"]; 23 | 24 | # Unfree nixpkgs 25 | nixpkgs.config.allowUnfree = true; 26 | 27 | # The global useDHCP flag is deprecated, therefore explicitly set to false here. 28 | # Per-interface useDHCP will be mandatory in the future, so this generated config 29 | # replicates the default behaviour. 30 | networking.useDHCP = false; 31 | networking.interfaces.eno1 = { 32 | name = "eno1"; 33 | ipv4 = { 34 | addresses = [ 35 | { 36 | address = "192.168.1.42"; 37 | prefixLength = 24; 38 | } 39 | ]; 40 | }; 41 | }; 42 | networking.defaultGateway = "192.168.1.1"; 43 | networking.nameservers = ["1.1.1.1" "1.0.0.1"]; 44 | 45 | networking.networkmanager.enable = true; 46 | 47 | networking.hostName = "boar-server"; 48 | 49 | environment.systemPackages = [ 50 | pkgs.neovim 51 | ]; 52 | 53 | # Syncthing 54 | services.syncthing = { 55 | enable = true; 56 | user = "syncthing"; 57 | openDefaultPorts = true; 58 | }; 59 | 60 | # This value determines the NixOS release from which the default 61 | # settings for stateful data, like file locations and database versions 62 | # on your system were taken. It‘s perfectly fine and recommended to leave 63 | # this value at the release version of the first install of this system. 64 | # Before changing this value read the documentation for this option 65 | # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). 66 | system.stateVersion = "20.03"; # Did you read the comment? 67 | } 68 | -------------------------------------------------------------------------------- /machines/flexbox/hardware-scan.nix: -------------------------------------------------------------------------------- 1 | # Do not modify this file! It was generated by ‘nixos-generate-config’ 2 | # and may be overwritten by future invocations. Please make changes 3 | # to /etc/nixos/configuration.nix instead. 4 | {lib, ...}: { 5 | boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; 6 | boot.initrd.kernelModules = ["dm-snapshot"]; 7 | boot.kernelModules = ["kvm-intel"]; 8 | boot.extraModulePackages = []; 9 | 10 | fileSystems."/" = { 11 | device = "/dev/disk/by-uuid/e5687086-9188-42e8-aa57-423df9cbb863"; 12 | fsType = "ext4"; 13 | options = ["noatime"]; 14 | }; 15 | 16 | fileSystems."/boot" = { 17 | device = "/dev/disk/by-uuid/8483-92D7"; 18 | fsType = "vfat"; 19 | options = ["fmask=0022" "dmask=0022"]; 20 | }; 21 | 22 | hardware.cpu.intel.updateMicrocode = true; 23 | 24 | swapDevices = [{device = "/dev/disk/by-uuid/0fb837c4-ba4e-437d-a54c-ff25312af20c";}]; 25 | 26 | powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; 27 | } 28 | -------------------------------------------------------------------------------- /machines/flexbox/system.nix: -------------------------------------------------------------------------------- 1 | # Edit this configuration file to define what should be installed on 2 | # your system. Help is available in the configuration.nix(5) man page 3 | # and in the NixOS manual (accessible by running ‘nixos-help’). 4 | {...}: { 5 | # https://lore.kernel.org/linux-nvme/YnR%2FFiWbErNGXIx+@kbusch-mbp/T/ 6 | boot.kernelParams = [ 7 | "nvme_core.default_ps_max_latency_us=0" # Stability probs 8 | "acpiphp.disable=1" # NVME disk power management probs 9 | ]; 10 | 11 | # GPU 12 | hardware.nvidia.prime = { 13 | offload = { 14 | enable = true; 15 | enableOffloadCmd = true; 16 | }; 17 | intelBusId = "PCI:0:2:0"; 18 | nvidiaBusId = "PCI:1:0:0"; 19 | }; 20 | 21 | # Disable power saving for fixing Comet Lake Audio Card (SOF) breaking after suspend 22 | services.udev.extraRules = '' 23 | ACTION=="add|change", SUBSYSTEM=="pci", KERNELS=="0000:00:1f.3", ATTR{power/control}="on" 24 | ''; 25 | 26 | # LVM on LUKS 27 | boot.initrd.luks.devices = { 28 | root = { 29 | device = "/dev/disk/by-uuid/ae713884-749b-4edb-adbc-b16fe447e956"; 30 | preLVM = true; 31 | }; 32 | }; 33 | 34 | networking.hostName = "flexbox"; 35 | 36 | # The global useDHCP flag is deprecated, therefore explicitly set to 37 | # false here. Per-interface useDHCP will be mandatory in the future, 38 | # so this generated config replicates the default behaviour. 39 | networking.useDHCP = false; 40 | #networking.interfaces.enp164s0u1.useDHCP = true; 41 | networking.interfaces.wlp0s20f3.useDHCP = true; 42 | 43 | # This value determines the NixOS release from which the default 44 | # settings for stateful data, like file locations and database 45 | # versions on your system were taken. It‘s perfectly fine and 46 | # recommended to leave this value at the release version of the first 47 | # install of this system. Before changing this value read the 48 | # documentation for this option (e.g. man configuration.nix or on 49 | # https://nixos.org/nixos/options.html). 50 | system.stateVersion = "22.05"; # Did you read the comment? 51 | } 52 | -------------------------------------------------------------------------------- /machines/numenor/hardware-scan.nix: -------------------------------------------------------------------------------- 1 | {lib, ...}: { 2 | boot.initrd.availableKernelModules = ["thunderbolt" "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"]; 3 | boot.initrd.kernelModules = ["dm-snapshot"]; 4 | boot.kernelModules = ["kvm-amd"]; 5 | boot.extraModulePackages = []; 6 | 7 | fileSystems."/" = { 8 | device = "/dev/disk/by-uuid/d601a8b7-17a4-46b5-a95e-ab29e94790ef"; 9 | fsType = "btrfs"; 10 | options = ["subvol=root" "compress=zstd" "noatime"]; 11 | }; 12 | 13 | fileSystems."/nix" = { 14 | device = "/dev/disk/by-uuid/d601a8b7-17a4-46b5-a95e-ab29e94790ef"; 15 | fsType = "btrfs"; 16 | options = ["subvol=nix" "compress=zstd" "noatime"]; 17 | }; 18 | 19 | fileSystems."/persist" = { 20 | device = "/dev/disk/by-uuid/d601a8b7-17a4-46b5-a95e-ab29e94790ef"; 21 | fsType = "btrfs"; 22 | options = ["subvol=persist" "compress=zstd" "noatime"]; 23 | }; 24 | 25 | fileSystems."/boot" = { 26 | device = "/dev/disk/by-uuid/12CE-A600"; 27 | fsType = "vfat"; 28 | options = ["fmask=0022" "dmask=0022"]; 29 | }; 30 | 31 | swapDevices = [ 32 | {device = "/dev/disk/by-uuid/daee540c-201b-4ccd-9315-7d8c44c57af6";} 33 | ]; 34 | 35 | nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 36 | hardware.cpu.amd.updateMicrocode = true; 37 | } 38 | -------------------------------------------------------------------------------- /machines/numenor/system.nix: -------------------------------------------------------------------------------- 1 | # Edit this configuration file to define what should be installed on 2 | # your system. Help is available in the configuration.nix(5) man page, on 3 | # https://search.nixos.org/options and in the NixOS manual (`nixos-help`). 4 | {pkgs, ...}: { 5 | # LVM on LUKS 6 | boot.initrd.luks.devices = { 7 | root = { 8 | device = "/dev/nvme0n1p6"; 9 | preLVM = true; 10 | }; 11 | }; 12 | 13 | # Needed for ddcutil 14 | hardware.i2c.enable = true; 15 | 16 | # Plenty of RAM so... 17 | boot.tmp.useTmpfs = true; 18 | 19 | networking.useDHCP = false; 20 | networking.interfaces.enp74s0.useDHCP = true; 21 | 22 | networking.hostName = "numenor"; 23 | 24 | # Disable Wifi at boot 25 | systemd.services.disable-wifi = { 26 | enable = true; 27 | description = "Disable Wi-Fi at boot"; 28 | after = ["network.target" "NetworkManager.service"]; 29 | wantedBy = ["multi-user.target"]; 30 | path = with pkgs; [networkmanager]; 31 | serviceConfig = { 32 | Type = "oneshot"; 33 | ExecStart = "${pkgs.networkmanager}/bin/nmcli radio wifi off"; 34 | }; 35 | }; 36 | 37 | # This option defines the first version of NixOS you have installed on this particular machine, 38 | # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. 39 | # 40 | # Most users should NEVER change this value after the initial install, for any reason, 41 | # even if you've upgraded your system to a new NixOS release. 42 | # 43 | # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, 44 | # so changing it will NOT upgrade your system - see https://nixos.org/manual/nixos/stable/#sec-upgrading for how 45 | # to actually do that. 46 | # 47 | # This value being lower than the current NixOS release does NOT mean your system is 48 | # out of date, out of support, or vulnerable. 49 | # 50 | # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, 51 | # and migrated your data accordingly. 52 | # 53 | # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . 54 | system.stateVersion = "24.11"; # Did you read the comment? 55 | } 56 | -------------------------------------------------------------------------------- /nix/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | nix = { 3 | settings = { 4 | # trusted users for pulling from caches 5 | trusted-users = ["root" "farlion" "@wheel" "@sudo"]; 6 | substituters = [ 7 | "https://cache.nixos.org/" 8 | ]; 9 | trusted-public-keys = [ 10 | ]; 11 | }; 12 | 13 | extraOptions = '' 14 | experimental-features = nix-command flakes 15 | ''; 16 | 17 | nixPath = [ 18 | "nixpkgs=${pkgs.path}" 19 | "nixos-unstable=${pkgs.unstable.path}" 20 | ]; 21 | }; 22 | 23 | nixpkgs = { 24 | config.allowUnfree = true; 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /specialisations/light/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: { 7 | specialisation.light.configuration = { 8 | environment.etc."specialisation".text = "light"; # this is for 'nh' to correctly recognise the specialisation 9 | 10 | # System 11 | stylix = { 12 | base16Scheme = lib.mkForce "${pkgs.base16-schemes}/share/themes/catppuccin-latte.yaml"; 13 | image = lib.mkForce ../../system/stylix/gruvbox-light-rainbow.png; 14 | polarity = lib.mkForce "light"; 15 | }; 16 | 17 | # Home Manager 18 | home-manager.users.farlion = { 19 | # Aichat Light Theme 20 | home.sessionVariables = { 21 | AICHAT_LIGHT_THEME = 1; 22 | }; 23 | 24 | # Dunst 25 | services.dunst.iconTheme.name = lib.mkForce "Papirus-Light"; 26 | 27 | # GTK 28 | gtk.gtk3.extraConfig.gtk-application-prefer-dark-theme = lib.mkForce false; 29 | 30 | # QT 31 | qt.enable = lib.mkForce false; 32 | 33 | # Neovim 34 | programs.neovim = { 35 | extraLuaConfig = '' 36 | -- Override lualine theme for light mode 37 | if require('lualine') then 38 | local lualine_config = require('lualine').get_config() 39 | lualine_config.options.theme = 'gruvbox-light' 40 | require('lualine').setup(lualine_config) 41 | end 42 | ''; 43 | }; 44 | 45 | # Sway 46 | wayland.windowManager.sway.config.bars = lib.mkForce [ 47 | ( 48 | { 49 | fonts = { 50 | names = ["Fira Code" "Font Awesome 6 Free"]; 51 | size = 8.5; # Aligns separators properly, see https://github.com/greshake/i3status-rust/issues/246k 52 | }; 53 | position = "bottom"; 54 | statusCommand = "${pkgs.unstable.i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-default.toml"; 55 | } 56 | // config.specialisation.light.configuration.home-manager.users.farlion.lib.stylix.sway.bar 57 | ) 58 | ]; 59 | programs.i3status-rust.bars.default = { 60 | theme = lib.mkForce "ctp-latte"; 61 | }; 62 | 63 | stylix.targets = { 64 | # Neovim 65 | neovim.enable = lib.mkForce true; 66 | }; 67 | }; 68 | }; 69 | } 70 | -------------------------------------------------------------------------------- /system/amd/default.nix: -------------------------------------------------------------------------------- 1 | # See: https://wiki.nixos.org/wiki/AMD_GPU 2 | # Also see: https://wiki.archlinux.org/title/Hardware_video_acceleration 3 | {pkgs, ...}: { 4 | hardware.amdgpu = { 5 | initrd.enable = true; 6 | opencl.enable = true; 7 | amdvlk = { 8 | enable = true; 9 | support32Bit.enable = true; 10 | }; 11 | }; 12 | 13 | # Disable AMD GPU power management to see if it prevents feezes on S3/s2idle 14 | boot.kernelParams = [ 15 | "amdgpu.runpm=0" 16 | ]; 17 | 18 | environment.systemPackages = with pkgs; [ 19 | lact # GUI for overclocking, undervolting, setting fan curves, etc. 20 | libva-utils 21 | mesa-demos 22 | nvtopPackages.full # nvtop 23 | vulkan-tools 24 | ]; 25 | services.xserver.videoDrivers = ["amdgpu"]; 26 | hardware.graphics = { 27 | enable = true; 28 | enable32Bit = true; 29 | }; 30 | 31 | # # AMDVLK drivers (programs will choose whether to use this over Mesa RADV drivers) 32 | # hardware.graphics.extraPackages = with pkgs; [ 33 | # amdvlk 34 | # ]; 35 | # # For 32 bit applications 36 | # hardware.opengl.extraPackages32 = with pkgs; [ 37 | # driversi686Linux.amdvlk 38 | # ]; 39 | 40 | # GUI for overclocking, undervolting, setting fan curves, etc. 41 | systemd.packages = with pkgs; [lact]; 42 | systemd.services.lactd.wantedBy = ["multi-user.target"]; 43 | } 44 | -------------------------------------------------------------------------------- /system/audio/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: let 7 | in { 8 | home-manager.users.farlion.home.persistence."/persist/home/farlion" = lib.mkIf config.home-manager.extraSpecialArgs.isImpermanent { 9 | directories = [ 10 | ".local/state/wireplumber" # Wireplumber state 11 | ".config/rncbc.org" # qpwgraph config file 12 | ".config/pulse" # pulseaudio cookie 13 | ]; 14 | }; 15 | 16 | environment.systemPackages = with pkgs; [ 17 | alsa-utils 18 | pulseaudioFull 19 | qpwgraph # More extensive patchbay for Pipewire 20 | ]; 21 | 22 | users.users.farlion.extraGroups = ["audio"]; 23 | 24 | # PipeWire! 25 | security.rtkit.enable = true; 26 | services.pipewire = { 27 | enable = true; 28 | alsa.enable = true; 29 | alsa.support32Bit = true; 30 | pulse.enable = true; 31 | 32 | extraConfig.pipewire."92-adjust-clock-quantum" = { 33 | "context.properties" = { 34 | "default.clock.quantum" = 2048; # Larger buffers should prevent xruns 35 | "default.clock.min-quantum" = 512; # Larger buffers should prevent xruns 36 | "default.clock.max-quantum" = 8192; # Matches Windows Settings 37 | }; 38 | }; 39 | extraConfig.pipewire."93-disable-autosuspend" = { 40 | "context.properties" = { 41 | "session.suspend-timeout-seconds" = 0; # Prevent autosuspend of ALSA nodes, causing xruns and crashes 42 | }; 43 | }; 44 | 45 | wireplumber.extraConfig = { 46 | # Enable Fancy Blueooth Codecs 47 | "monitor.bluez.properties" = { 48 | "bluez5.enable-sbc-xq" = true; 49 | "bluez5.enable-msbc" = true; 50 | "bluez5.enable-hw-volume" = true; 51 | "bluez5.roles" = ["hsp_hs" "hsp_ag" "hfp_hf" "hfp_ag"]; 52 | }; 53 | 54 | # Disable unused sinks and sources 55 | "disable-unused-nodes" = { 56 | "monitor.alsa.rules" = [ 57 | { 58 | matches = [ 59 | { 60 | "device.nick" = "HDA NVidia"; 61 | } 62 | ]; 63 | actions = { 64 | update-props = { 65 | "device.disabled" = true; 66 | }; 67 | }; 68 | } 69 | ]; 70 | }; 71 | }; 72 | }; 73 | } 74 | -------------------------------------------------------------------------------- /system/bluetooth/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | ... 5 | }: { 6 | environment.persistence."/persist/system" = lib.mkIf isImpermanent { 7 | directories = [ 8 | "/var/lib/bluetooth" 9 | ]; 10 | }; 11 | services.blueman.enable = true; 12 | hardware.bluetooth.enable = true; 13 | } 14 | -------------------------------------------------------------------------------- /system/boot/default.nix: -------------------------------------------------------------------------------- 1 | {...}: let 2 | in { 3 | boot = { 4 | loader.systemd-boot = { 5 | enable = true; 6 | memtest86.enable = true; 7 | }; 8 | loader.efi.canTouchEfiVariables = true; 9 | consoleLogLevel = 7; 10 | 11 | initrd = { 12 | systemd = { 13 | enable = true; 14 | }; 15 | }; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /system/btrfs/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | ... 5 | }: { 6 | environment.persistence."/persist/system" = lib.mkIf isImpermanent { 7 | directories = [ 8 | "/var/lib/btrfs" # Scrub reports 9 | ]; 10 | }; 11 | 12 | services.btrfs.autoScrub = { 13 | enable = true; 14 | interval = "monthly"; 15 | fileSystems = ["/"]; # Subvols of the same mount point don't need to be scrubbed 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /system/cachix/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | environment.systemPackages = [ 3 | pkgs.cachix 4 | ]; 5 | } 6 | -------------------------------------------------------------------------------- /system/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | isImpermanent, 4 | pkgs, 5 | secrets, 6 | ... 7 | }: let 8 | systemSecrets = 9 | if secrets ? systemSecrets 10 | then secrets.systemSecrets {inherit isImpermanent lib pkgs;} 11 | else {}; 12 | in { 13 | imports = 14 | [ 15 | ./audio 16 | ./bluetooth 17 | ./boot 18 | ./cachix 19 | ./desktop 20 | ./dns 21 | ./firmware 22 | ./fonts 23 | ./io 24 | ./kernel 25 | ./kind-killer 26 | ./networking 27 | ./nix-ld 28 | ./performance 29 | ./power 30 | ./printing 31 | ./security 32 | ./stylix 33 | ./syncthing 34 | ./users 35 | ./various 36 | ./video 37 | ./virtualisation 38 | ] 39 | ++ lib.lists.optionals isImpermanent [./impermanence] 40 | ++ [systemSecrets]; 41 | } 42 | -------------------------------------------------------------------------------- /system/desktop/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | isImpermanent, 3 | lib, 4 | ... 5 | }: let 6 | session = "sway"; 7 | in { 8 | environment.persistence."/persist/system" = lib.mkIf isImpermanent { 9 | files = [ 10 | "/etc/ly/save.ini" # Selected user and session 11 | ]; 12 | }; 13 | 14 | services.displayManager = { 15 | defaultSession = session; 16 | ly = { 17 | enable = true; 18 | settings = { 19 | animation = "doom"; 20 | hide_borders = true; 21 | tty = 7; # Hopefully less logs flowing into the login screen, see https://codeberg.org/AnErrupTion/ly/issues/537 22 | }; 23 | }; 24 | }; 25 | 26 | programs.sway = { 27 | enable = true; 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /system/dns/default.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | networking.nameservers = [ 3 | "127.0.0.1" # dnscrypt-proxy2 4 | ]; 5 | 6 | services.resolved = { 7 | enable = true; 8 | # DNSSEC is provided by dnscrypt-proxy2 and the wrapper doesn't work, but it still works 9 | # dnssec = "true"; 10 | # Not currently sure about dnsovertls 11 | # dnsovertls = "true"; 12 | llmnr = "false"; # https://www.blackhillsinfosec.com/how-to-disable-llmnr-why-you-want-to/ 13 | extraConfig = '' 14 | MulticastDNS=false 15 | DNSStubListenerExtra=172.17.0.1 16 | ''; 17 | fallbackDns = []; # Ensure we always go through dnscrypt-proxy 18 | }; 19 | networking.networkmanager.dns = "systemd-resolved"; 20 | 21 | # DNSSEC / DoH (DNS over HTTPS) 22 | services.dnscrypt-proxy2 = { 23 | enable = true; 24 | settings = { 25 | block_ipv6 = true; # Better performance, see https://github.com/DNSCrypt/dnscrypt-proxy/wiki/Performance 26 | require_dnssec = true; 27 | ipv4_servers = true; 28 | ipv6_servers = false; 29 | dnscrypt_servers = true; 30 | doh_servers = true; 31 | require_nolog = true; # Server must not log user queries (declarative) 32 | 33 | sources.public-resolvers = { 34 | urls = [ 35 | "https://raw.githubusercontent.com/DNSCrypt/dnscrypt-resolvers/master/v3/public-resolvers.md" 36 | "https://download.dnscrypt.info/resolvers-list/v3/public-resolvers.md" 37 | ]; 38 | cache_file = "/var/lib/dnscrypt-proxy/public-resolvers.md"; 39 | minisign_key = "RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3"; 40 | }; 41 | 42 | # You can choose a specific set of servers from https://github.com/DNSCrypt/dnscrypt-resolvers/blob/master/v3/public-resolvers.md 43 | # Leaving this off should find the fastest one automagically 44 | # server_names = [ ... ]; 45 | }; 46 | }; 47 | systemd.services.dnscrypt-proxy2.serviceConfig = { 48 | StateDirectory = "dnscrypt-proxy"; 49 | }; 50 | } 51 | -------------------------------------------------------------------------------- /system/firmware/default.nix: -------------------------------------------------------------------------------- 1 | # Linux Firmware Updates 2 | { 3 | lib, 4 | isImpermanent, 5 | ... 6 | }: { 7 | environment.persistence."/persist/system" = lib.mkIf isImpermanent { 8 | directories = [ 9 | "/var/lib/fwupd" 10 | ]; 11 | }; 12 | 13 | services.fwupd.enable = true; 14 | } 15 | -------------------------------------------------------------------------------- /system/fonts/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: let 7 | # Looted from https://gist.github.com/elijahmanor/c10e5787bf9ac6b8c276e47e6745826c, much obliged 8 | font-smoke-test = pkgs.writers.writeBashBin "font-smoke-test" '' 9 | set -e 10 | 11 | printf "%b\n" "Normal" 12 | printf "%b\n" "\033[1mBold\033[22m" 13 | printf "%b\n" "\033[3mItalic\033[23m" 14 | printf "%b\n" "\033[3;1mBold Italic\033[0m" 15 | printf "%b\n" "\033[4mUnderline\033[24m" 16 | printf "%b\n" "== === !== >= <= =>" 17 | printf "%b\n" "   󰾆   󱑥 󰒲 󰗼" 18 | ''; 19 | in { 20 | home-manager.users.farlion.home.persistence."/persist/home/farlion" = lib.mkIf config.home-manager.extraSpecialArgs.isImpermanent { 21 | directories = [ 22 | ".local/share/fonts" # Locally persisted fonts (not nixos-managed) 23 | ".cache/fontconfig" # Fontconfig cache 24 | ]; 25 | }; 26 | 27 | environment.systemPackages = [font-smoke-test]; 28 | 29 | fonts = { 30 | enableDefaultPackages = false; 31 | packages = [ 32 | pkgs.fira-code 33 | pkgs.fira-code-symbols 34 | pkgs.dejavu_fonts 35 | pkgs.font-awesome_4 36 | pkgs.font-awesome_5 37 | pkgs.font-awesome_6 38 | (pkgs.nerdfonts.override {fonts = ["FiraCode"];}) 39 | pkgs.noto-fonts-color-emoji # emoji font 40 | ]; 41 | fontconfig = { 42 | defaultFonts = { 43 | sansSerif = ["DejaVu Sans"]; 44 | serif = ["DejaVu Serif"]; 45 | monospace = ["Fira Code"]; 46 | }; 47 | }; 48 | }; 49 | } 50 | -------------------------------------------------------------------------------- /system/io/default.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | hardware.logitech.wireless = { 3 | enable = true; 4 | enableGraphical = true; 5 | }; 6 | } 7 | -------------------------------------------------------------------------------- /system/kernel/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | # Writes to /etc/sysctl.d/60-nixos.conf 3 | boot.kernel.sysctl = { 4 | # Enable all magic sysrq commands (NixOS sets this to 16, which enables sync only) 5 | "kernel.sysrq" = 1; 6 | "vm.swappiness" = 20; # balanced setting favoring RAM usage, Default=60 7 | }; 8 | 9 | # boot.kernelPackages = pkgs.linuxPackages_zen; # Optimized for desktop use 10 | # Temporary pin to work around NVidia driver issues, see https://github.com/NixOS/nixpkgs/issues/375730#issuecomment-2625234288 11 | boot.kernelPackages = pkgs.linuxPackages_6_12; # Optimized for desktop use 12 | environment.systemPackages = with pkgs; [ 13 | linuxKernel.packages.linux_zen.perf 14 | linuxKernel.packages.linux_zen.cpupower 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /system/kind-killer/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | systemd.services.kind-killer = { 3 | description = "Kill kind cluster on shutdown"; 4 | after = ["docker.service"]; # Ensures docker is still running when trying to delete the cluster, since systemd reverses the ordering during shutdown 5 | requires = ["docker.service"]; 6 | enableStrictShellChecks = true; 7 | wantedBy = ["multi-user.target"]; 8 | serviceConfig = { 9 | Environment = "PATH=$PATH:/run/current-system/sw/bin"; 10 | ExecStart = "${pkgs.coreutils}/bin/sleep infinity"; 11 | ExecStop = "${pkgs.kind}/bin/kind delete cluster"; 12 | }; 13 | }; 14 | } 15 | -------------------------------------------------------------------------------- /system/networking/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | isImpermanent, 5 | pkgs, 6 | ... 7 | }: let 8 | # Get the current tailscale ip if tailscale is up 9 | tailscale-ip = pkgs.writers.writeBashBin "tailscale-ip" '' 10 | set -euo pipefail 11 | 12 | isOnline=$(tailscale status --json | jq -r '.Self.Online') 13 | if [[ "$isOnline" == "true" ]]; then 14 | tailscaleIp=$(tailscale status --json | jq -r '.Self.TailscaleIPs[0]') 15 | echo "{\"icon\": \"tailscale_up\", \"text\": \"$tailscaleIp\", \"state\": \"Good\"}" 16 | else 17 | echo "{\"icon\": \"tailscale_down\", \"text\": \"\", \"state\": \"Idle\"}" 18 | fi 19 | ''; 20 | in { 21 | environment.persistence."/persist/system" = lib.mkIf isImpermanent { 22 | directories = [ 23 | "/etc/NetworkManager/system-connections" 24 | "/var/lib/tailscale" 25 | "/var/lib/NetworkManager" 26 | ]; 27 | }; 28 | home-manager.users.farlion.home.persistence."/persist/home/farlion" = lib.mkIf config.home-manager.extraSpecialArgs.isImpermanent { 29 | directories = [ 30 | ".config/tailscale" # Tailscale known hosts 31 | ]; 32 | }; 33 | 34 | environment.systemPackages = [ 35 | pkgs.pwru # eBPF-based linux kernel networking debugger 36 | tailscale-ip # Get the current tailscale IP if tailscale is up 37 | ]; 38 | 39 | networking.firewall = { 40 | # if packets are dropped, they will show up in dmesg 41 | logReversePathDrops = true; 42 | logRefusedPackets = true; 43 | # logRefusedUnicastsOnly = false; 44 | }; 45 | 46 | # Tailscale 47 | services.tailscale.enable = true; 48 | services.tailscale.useRoutingFeatures = "client"; 49 | 50 | # Allow for dynamic hosts file override (by root) 51 | environment.etc.hosts.mode = "0644"; 52 | 53 | networking.firewall.allowedTCPPorts = [ 54 | 22000 # Syncthing TCP 55 | 53317 # Localsend 56 | ]; 57 | 58 | networking.firewall.allowedUDPPorts = [ 59 | 22000 # Syncthing QUIC 60 | 21027 # Syncthing discovery broadcasts on IPv4 and multicasts on IPv6 61 | 53317 # Localsend 62 | ]; 63 | 64 | networking.networkmanager = { 65 | enable = true; 66 | }; 67 | users.users.farlion.extraGroups = ["networkmanager"]; 68 | 69 | # Prevent IPv6 leaks when using VPNs 70 | networking.enableIPv6 = false; 71 | 72 | # Disabling DHCPCD in favor of NetworkManager 73 | networking.dhcpcd.enable = false; 74 | # Only wait for a single interface to come up 75 | systemd.network.wait-online.anyInterface = true; 76 | } 77 | -------------------------------------------------------------------------------- /system/nix-ld/default.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | programs.nix-ld.enable = true; 3 | } 4 | -------------------------------------------------------------------------------- /system/nvidia/default.nix: -------------------------------------------------------------------------------- 1 | # See: https://nixos.wiki/wiki/Nvidia 2 | { 3 | config, 4 | pkgs, 5 | ... 6 | }: { 7 | boot.blacklistedKernelModules = ["nouveau"]; 8 | environment.systemPackages = [ 9 | pkgs.nvtopPackages.full # nvtop 10 | pkgs.mesa-demos 11 | pkgs.vulkan-tools 12 | pkgs.libva-utils 13 | ]; 14 | services.xserver.videoDrivers = ["nvidia"]; 15 | hardware.graphics = { 16 | enable = true; 17 | }; 18 | 19 | hardware.nvidia = { 20 | # Modesetting is required. 21 | modesetting.enable = true; 22 | 23 | # Nvidia power management. Experimental, and can cause sleep/suspend to fail. 24 | # Enable this if you have graphical corruption issues or application crashes after waking 25 | # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead 26 | # of just the bare essentials. 27 | powerManagement.enable = false; 28 | 29 | # Fine-grained power management. Turns off GPU when not in use. 30 | # Experimental and only works on modern Nvidia GPUs (Turing or newer). 31 | powerManagement.finegrained = true; 32 | 33 | # Use the NVidia open source kernel module (not to be confused with the 34 | # independent third-party "nouveau" open source driver). 35 | # Support is limited to the Turing and later architectures. Full list of 36 | # supported GPUs is at: 37 | # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus 38 | # Only available from driver 515.43.04+ 39 | # Currently alpha-quality/buggy, so false is currently the recommended setting. 40 | open = true; 41 | 42 | # Temporary fix for http://github.com/NixOS/nixpkgs/issues/375730 43 | package = config.boot.kernelPackages.nvidiaPackages.mkDriver { 44 | version = "570.86.16"; # use new 570 drivers 45 | sha256_64bit = "sha256-RWPqS7ZUJH9JEAWlfHLGdqrNlavhaR1xMyzs8lJhy9U="; 46 | openSha256 = "sha256-DuVNA63+pJ8IB7Tw2gM4HbwlOh1bcDg2AN2mbEU9VPE="; 47 | settingsSha256 = "sha256-9rtqh64TyhDF5fFAYiWl3oDHzKJqyOW3abpcf2iNRT8="; 48 | usePersistenced = false; 49 | }; 50 | 51 | # Enable the Nvidia settings menu, 52 | # accessible via `nvidia-settings`. 53 | nvidiaSettings = true; 54 | }; 55 | } 56 | -------------------------------------------------------------------------------- /system/performance/default.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | documentation.man = { 3 | enable = true; 4 | generateCaches = false; # Used for apropos and the -k option of man, but significantly slows down builds 5 | }; 6 | } 7 | -------------------------------------------------------------------------------- /system/power/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | pkgs, 5 | ... 6 | }: let 7 | isFlexbox = config.networking.hostName == "flexbox"; 8 | in { 9 | # This will save you money and possibly your life! 10 | services.thermald.enable = true; 11 | 12 | services.logind.lidSwitch = "suspend-then-hibernate"; 13 | systemd.sleep.extraConfig = '' 14 | HibernateDelaySec=1h 15 | ''; 16 | 17 | # Dell-specific power management 18 | environment.systemPackages = lib.mkIf isFlexbox [ 19 | pkgs.libsmbios 20 | ]; 21 | 22 | services.auto-cpufreq = { 23 | enable = true; 24 | settings = {}; 25 | }; 26 | security.sudo.extraRules = [ 27 | { 28 | users = ["farlion"]; 29 | commands = [ 30 | { 31 | command = "/run/current-system/sw/bin/auto-cpufreq --force performance"; 32 | options = ["NOPASSWD" "SETENV"]; 33 | } 34 | { 35 | command = "/run/current-system/sw/bin/auto-cpufreq --force powersave"; 36 | options = ["NOPASSWD" "SETENV"]; 37 | } 38 | { 39 | command = "/run/current-system/sw/bin/auto-cpufreq --force reset"; 40 | options = ["NOPASSWD" "SETENV"]; 41 | } 42 | ]; 43 | } 44 | ]; 45 | } 46 | -------------------------------------------------------------------------------- /system/printing/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | services.printing = { 3 | enable = true; 4 | drivers = [ 5 | pkgs.gutenprint 6 | pkgs.hplip 7 | ]; 8 | listenAddresses = ["127.0.0.1:631"]; 9 | }; 10 | 11 | services.avahi = { 12 | enable = true; 13 | nssmdns4 = true; 14 | openFirewall = true; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /system/security/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | lib, 4 | isImpermanent, 5 | pkgs, 6 | ... 7 | }: { 8 | environment.persistence."/persist/system" = lib.mkIf isImpermanent { 9 | directories = [ 10 | "/var/lib/boltd" # Boltd state 11 | "/run/sudo" # Sudo timestamp (to not show the lecture message) 12 | ]; 13 | }; 14 | home-manager.users.farlion.home.persistence."/persist/home/farlion" = lib.mkIf config.home-manager.extraSpecialArgs.isImpermanent { 15 | directories = [ 16 | ".local/share/keyrings" # Gnome Keyrings 17 | ".gnupg" # PGP keys 18 | ]; 19 | }; 20 | 21 | # Thunderbolt security daemon 22 | services.hardware.bolt.enable = true; 23 | 24 | services.gnome.gnome-keyring.enable = true; 25 | environment.systemPackages = with pkgs; [ 26 | # TODO: still needed? 27 | gcr # Gnome crypto services for gnome-keyring 28 | ]; 29 | 30 | programs.gnupg.agent = { 31 | enable = true; 32 | enableSSHSupport = true; 33 | pinentryPackage = pkgs.pinentry-gnome3; 34 | }; 35 | 36 | programs.seahorse.enable = true; 37 | 38 | # Writes to /etc/sudoers 39 | security.sudo.extraConfig = '' 40 | Defaults:root,%wheel timestamp_timeout=30 41 | ''; 42 | users.users.farlion.extraGroups = ["wheel"]; 43 | 44 | # Yubikeys 45 | services.pcscd.enable = true; # Smartcard services for Yubikeys 46 | # Sudo via U2F (Yubikey) 47 | security.pam = { 48 | u2f = { 49 | enable = true; 50 | settings = { 51 | cue = false; # CLI message to show touch is needed, not needed since using system-wide notification 52 | }; 53 | }; 54 | services = { 55 | login.u2fAuth = false; 56 | ly.u2fAuth = false; 57 | sudo.u2fAuth = true; 58 | swaylock.u2fAuth = true; 59 | }; 60 | }; 61 | # Enable system-wide Yubikey Support 62 | services.udev.packages = [pkgs.yubikey-personalization]; 63 | } 64 | -------------------------------------------------------------------------------- /system/stylix/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | stylix = { 3 | enable = true; 4 | base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-dark-medium.yaml"; 5 | cursor = { 6 | name = "Bibata-Modern-Ice"; 7 | package = pkgs.bibata-cursors; 8 | size = 24; 9 | }; 10 | fonts = { 11 | emoji = { 12 | package = pkgs.noto-fonts-color-emoji; 13 | name = "Noto Color Emoji"; 14 | }; 15 | monospace = { 16 | package = pkgs.fira-code; 17 | name = "Fira Code"; 18 | }; 19 | serif = { 20 | package = pkgs.dejavu_fonts; 21 | name = "DejaVu Serif"; 22 | }; 23 | sansSerif = { 24 | package = pkgs.dejavu_fonts; 25 | name = "DejaVu Sans"; 26 | }; 27 | sizes = { 28 | applications = 9; 29 | desktop = 9; 30 | terminal = 8; 31 | popups = 9; 32 | }; 33 | }; 34 | image = ./gruvbox-dark-rainbow.png; 35 | polarity = "dark"; 36 | }; 37 | } 38 | -------------------------------------------------------------------------------- /system/stylix/gruvbox-dark-rainbow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/system/stylix/gruvbox-dark-rainbow.png -------------------------------------------------------------------------------- /system/stylix/gruvbox-light-rainbow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/workflow/dotfiles/f9a13d41ab30d0d07aa68a2114f81563814123a6/system/stylix/gruvbox-light-rainbow.png -------------------------------------------------------------------------------- /system/syncthing/default.nix: -------------------------------------------------------------------------------- 1 | {pkgs, ...}: { 2 | # Prevent syncthing from preventing sleep 3 | powerManagement.powerDownCommands = '' 4 | export XDG_RUNTIME_DIR=/run/user/1000 5 | ${pkgs.systemd}/bin/machinectl shell farlion@ /run/current-system/sw/bin/systemctl --user stop syncthing.service 6 | ''; 7 | powerManagement.resumeCommands = '' 8 | export XDG_RUNTIME_DIR=/run/user/1000 9 | ${pkgs.systemd}/bin/machinectl shell farlion@ /run/current-system/sw/bin/systemctl --user start syncthing.service 10 | ''; 11 | } 12 | -------------------------------------------------------------------------------- /system/users/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | lib, 3 | pkgs, 4 | ... 5 | }: { 6 | users.mutableUsers = false; 7 | 8 | users = { 9 | users.farlion = { 10 | description = "Florian Peter"; 11 | extraGroups = ["disk"]; 12 | group = "users"; 13 | hashedPassword = lib.mkDefault ""; 14 | isNormalUser = true; 15 | shell = pkgs.fish; 16 | }; 17 | }; 18 | 19 | # Default editor for root 20 | programs.vim = { 21 | defaultEditor = true; 22 | enable = true; 23 | }; 24 | # Enable fish for root 25 | programs.fish.enable = true; 26 | } 27 | -------------------------------------------------------------------------------- /system/various/default.nix: -------------------------------------------------------------------------------- 1 | {...}: { 2 | services.atd.enable = true; 3 | 4 | boot.supportedFilesystems = ["ntfs"]; 5 | 6 | services.tzupdate.enable = true; # Oneshot systemd service, run with `sudo systemctl start tzupdate` 7 | 8 | i18n.defaultLocale = "en_US.UTF-8"; 9 | } 10 | -------------------------------------------------------------------------------- /system/video/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | ... 5 | }: { 6 | # Loopback video device :) 7 | # exclusive_caps=1 is needed for Chrome/WebRTC apps to be able to see the virtual cam 8 | boot.extraModprobeConfig = '' 9 | options v4l2loopback devices=1 video_nr=7 card_label="OBS Cam" exclusive_caps=1 10 | ''; 11 | boot.extraModulePackages = with config.boot.kernelPackages; [v4l2loopback]; 12 | boot.kernelModules = ["v4l2loopback"]; 13 | 14 | environment.systemPackages = [ 15 | pkgs.v4l-utils # Video4Linux2 -> configuring webcam 16 | ]; 17 | 18 | users.users.farlion.extraGroups = ["video"]; 19 | } 20 | -------------------------------------------------------------------------------- /system/virtualisation/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | isImpermanent, 4 | lib, 5 | pkgs, 6 | ... 7 | }: let 8 | isFlexbox = config.networking.hostName == "flexbox"; 9 | isNumenor = config.networking.hostName == "numenor"; 10 | in { 11 | environment.persistence."/persist/system" = lib.mkIf isImpermanent { 12 | directories = [ 13 | "/var/lib/containers" # Podman 14 | "/var/lib/docker" 15 | "/var/lib/libvirt" # Virt-Manager 16 | ]; 17 | }; 18 | home-manager.users.farlion.home.persistence."/persist/home/farlion" = lib.mkIf config.home-manager.extraSpecialArgs.isImpermanent { 19 | directories = [ 20 | ".local/share/containers" # Podman (userspace) 21 | ]; 22 | }; 23 | 24 | environment.systemPackages = [ 25 | pkgs.virt-manager # Desktop user interface for managing virtual machines 26 | ]; 27 | virtualisation.docker = { 28 | enable = true; 29 | daemon.settings = { 30 | # Attach to resolved instead of using default Docker DNS servers 31 | dns = ["172.17.0.1"]; 32 | # Have containers listen on localhost instead of 0.0.0.0, 33 | # see https://github.com/NixOS/nixpkgs/issues/111852#issuecomment-1954656069 34 | ip = "127.0.0.1"; 35 | }; 36 | }; 37 | # Allow connecting to resolved DNS from inside Docker containers 38 | networking.firewall.interfaces.docker0.allowedTCPPorts = [53]; 39 | networking.firewall.interfaces.docker0.allowedUDPPorts = [53]; 40 | # Kind 41 | networking.firewall.interfaces.br-19583dda413b = lib.mkIf isFlexbox { 42 | allowedTCPPorts = [53]; 43 | allowedUDPPorts = [53]; 44 | }; 45 | networking.firewall.interfaces.br-3815f82c1c4c = lib.mkIf isNumenor { 46 | allowedTCPPorts = [53]; 47 | allowedUDPPorts = [53]; 48 | }; 49 | # Ad-hoc (Docker Compose) 50 | networking.firewall.interfaces.br-1a132ab74d09 = lib.mkIf isNumenor { 51 | allowedTCPPorts = [53]; 52 | allowedUDPPorts = [53]; 53 | }; 54 | 55 | virtualisation.libvirtd.enable = true; 56 | 57 | virtualisation.podman = { 58 | enable = true; 59 | }; 60 | 61 | users.users.farlion.extraGroups = ["libvirtd" "kvm" "docker"]; 62 | } 63 | --------------------------------------------------------------------------------