nix-config

My personal nixos and home-manager configuration
Log | Files | Refs | README

commit 78481e89d61349bc57bc5b51b4daa31e480b2701
parent 413ab20e7f2453692e8560ccb8e8cf11e4849c10
Author: benjamin paul <bpaul@bpaul.xyz>
Date:   Thu,  1 Jul 2021 17:05:18 +1000

Ok this repo is getting messy i am going to start using good commit messages after this or at least better commit messages

Diffstat:
Mflake.lock | 210++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------
Mflake.nix | 13++++++++++---
Mhome/home.nix | 1+
Dhome/modules/alacritty.nix | 110-------------------------------------------------------------------------------
Mhome/modules/default.nix | 26+++++++++++++++++++++++++-
Ahome/modules/dev/git.nix | 29+++++++++++++++++++++++++++++
Ahome/modules/dev/haskell.nix | 17+++++++++++++++++
Ahome/modules/dev/idris2/default.nix | 18++++++++++++++++++
Ahome/modules/dev/idris2/lsp.nix | 3+++
Rhome/modules/latex.nix -> home/modules/dev/latex.nix | 0
Rhome/modules/neovim/c.lua -> home/modules/dev/neovim/c.lua | 0
Rhome/modules/neovim/compe.lua -> home/modules/dev/neovim/compe.lua | 0
Rhome/modules/neovim/cpp.lua -> home/modules/dev/neovim/cpp.lua | 0
Ahome/modules/dev/neovim/default.nix | 84+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ahome/modules/dev/neovim/init.lua | 233+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rhome/modules/neovim/lua.lua -> home/modules/dev/neovim/lua.lua | 0
Rhome/modules/neovim/settings.vim -> home/modules/dev/neovim/settings.vim | 0
Rhome/modules/neovim/syntax.vim -> home/modules/dev/neovim/syntax.vim | 0
Rhome/modules/neovim/tex.lua -> home/modules/dev/neovim/tex.lua | 0
Rhome/modules/dunst.nix -> home/modules/graphical/dunst.nix | 0
Rhome/modules/polybar/default.nix -> home/modules/graphical/polybar/default.nix | 0
Rhome/modules/polybar/polybar.conf -> home/modules/graphical/polybar/polybar.conf | 0
Rhome/modules/polybar/settings.nix -> home/modules/graphical/polybar/settings.nix | 0
Rhome/modules/zathura.nix -> home/modules/graphical/zathura.nix | 0
Dhome/modules/neovim/default.nix | 82-------------------------------------------------------------------------------
Dhome/modules/neovim/init.lua | 147-------------------------------------------------------------------------------
Ahome/modules/terminal/alacritty.nix | 109+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rhome/modules/starship.nix -> home/modules/terminal/starship.nix | 0
Ahome/modules/terminal/zsh.nix | 93+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rhome/modules/xbindkeys.nix -> home/modules/xorg/xbindkeys.nix | 0
Rhome/modules/xinit.nix -> home/modules/xorg/xinit.nix | 0
Dhome/modules/zsh.nix | 97-------------------------------------------------------------------------------
Mhome/profiles/arch.nix | 2+-
Mhome/profiles/laptop.nix | 13+++++++------
Mlib/default.nix | 2+-
Mlib/dirs.nix | 45+++++++++++++++++++++++++++++++++++++++++++--
Mnixos/laptop/configuration.nix | 2+-
37 files changed, 807 insertions(+), 529 deletions(-)

diff --git a/flake.lock b/flake.lock @@ -3,11 +3,11 @@ "LuaSnip": { "flake": false, "locked": { - "lastModified": 1624036110, - "narHash": "sha256-LeM5FguQHglggAm7BNcxD8mRYBR+H8p7+/muF9VGFBc=", + "lastModified": 1624809029, + "narHash": "sha256-nb0cHSqDpdMlbZ+sYNfgY+hql/vxE/j8Fvn55KV802w=", "owner": "L3MON4D3", "repo": "LuaSnip", - "rev": "6aed450e36b4f7d818097d048706ecd35cfa8ed3", + "rev": "1e79310e57404e86e00ceca2c4657bb9a9072673", "type": "github" }, "original": { @@ -47,6 +47,21 @@ "type": "github" } }, + "flake-utils_2": { + "locked": { + "lastModified": 1623875721, + "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "focus-vim": { "flake": false, "locked": { @@ -82,11 +97,11 @@ "fzf-lsp-nvim": { "flake": false, "locked": { - "lastModified": 1621935170, - "narHash": "sha256-awBSkN1jSLUWDlamVdVnYkMiaqz+3C01Zufv3BuBz2c=", + "lastModified": 1624184329, + "narHash": "sha256-R/oLNFSpikimIEQ3i+d+k/LnuHVnw87cC9qI4/xpjIk=", "owner": "gfanto", "repo": "fzf-lsp.nvim", - "rev": "fdbe8e8f447870c8693d81045031fc1d5812e38e", + "rev": "6683718524adec3ce58c848706bcc7f3aa6a09a1", "type": "github" }, "original": { @@ -115,11 +130,11 @@ "gitsigns-nvim": { "flake": false, "locked": { - "lastModified": 1624004414, - "narHash": "sha256-zpt41euLuHovuIUPPCaapZjg/O+hcVR33dJAedILbXE=", + "lastModified": 1624713733, + "narHash": "sha256-5bmCqi74g9Eo8wak5nS+hjBkhXiHF2veLjoLvvYLobE=", "owner": "lewis6991", "repo": "gitsigns.nvim", - "rev": "0ae26de8e74e3f783595d4a04b9ea140909ebdef", + "rev": "521e9357bdbd2cadf4863d5c67f2e816182bdecf", "type": "github" }, "original": { @@ -167,11 +182,11 @@ ] }, "locked": { - "lastModified": 1623967045, - "narHash": "sha256-D8tZULncqU2Drn4vmG1vgMdhnZ5ONV5aEuHIxaA/kyE=", + "lastModified": 1625016439, + "narHash": "sha256-zHf7iCU9nYd6/7xwYx5gwDzXdXcJ9RUagdy0IgX39sQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "2f6d5c90f4497dc3cfc043c0fd1b77272ebaeeaa", + "rev": "9ad0024d4d292c628d4c9a50c2347f23418d7000", "type": "github" }, "original": { @@ -180,14 +195,52 @@ "type": "github" } }, + "idris2-pkgs": { + "inputs": { + "flake-utils": "flake-utils_2", + "idris2-src": "idris2-src", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1625101581, + "narHash": "sha256-1jcw75prqb/9DSG9qUWQycTm1N/KtqO/zAb583iPxbI=", + "owner": "claymager", + "repo": "idris2-pkgs", + "rev": "39609a1fa56334b7461694033c27912a29c0237a", + "type": "github" + }, + "original": { + "owner": "claymager", + "repo": "idris2-pkgs", + "type": "github" + } + }, + "idris2-src": { + "flake": false, + "locked": { + "lastModified": 1625087514, + "narHash": "sha256-ujkB9GVSYoNVKmZaYw6BkEhSNNrg9/g2jiLJeui9ark=", + "owner": "idris-lang", + "repo": "idris2", + "rev": "08fb38b7914de6721ca3d9633fbe0f942effd633", + "type": "github" + }, + "original": { + "owner": "idris-lang", + "repo": "idris2", + "type": "github" + } + }, "indent-blankline-nvim": { "flake": false, "locked": { - "lastModified": 1623902117, - "narHash": "sha256-wN4reeKfzbD82gFFlEDIshP58FWxC+vpnZ84xbSb0Dw=", + "lastModified": 1624410510, + "narHash": "sha256-IM2NrKKmmEM9rAP4BFBx5wfFKbzRcye72q0v1pia81c=", "owner": "lukas-reineke", "repo": "indent-blankline.nvim", - "rev": "1b7a974ddf95fb88c3c450888369d492bdb99a53", + "rev": "f314659a68f936bf65502fe318222facbeb439a5", "type": "github" }, "original": { @@ -200,11 +253,11 @@ "lsp_signature-nvim": { "flake": false, "locked": { - "lastModified": 1623972953, - "narHash": "sha256-Zc/SdfznE26a+h8cYkm/cEt2bA7ogx/eKtaDD2TdeM0=", + "lastModified": 1624936331, + "narHash": "sha256-4OinfGM1pccA4ToA+dCOs6PX9AoE8VWlzvCIaf7EFXI=", "owner": "ray-x", "repo": "lsp_signature.nvim", - "rev": "9945aeec348b756c6f9bd1c97a8870ece8a72b7a", + "rev": "ef20fad69270f4d3df356be3c01bd079739e72c4", "type": "github" }, "original": { @@ -240,11 +293,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1624085315, - "narHash": "sha256-bjsZh9R/edLA8Cbuoda/1IrjvI/dVlbugAxJciftAfo=", + "lastModified": 1625102991, + "narHash": "sha256-59KXUz7WHMfXfwHEl3PO5CUONCanPkDIy77muF6RxaY=", "owner": "neovim", "repo": "neovim", - "rev": "7da86f55a7ab08fee8479b219b2fbaf2eb424724", + "rev": "f35a5f2efc32b508ff5fc7d55b31a5bb7facfa17", "type": "github" }, "original": { @@ -256,11 +309,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1623862044, - "narHash": "sha256-mY7nldu9Wl/Yb0qMPihZrWw0bRWXNsk6iyYztw/6F6Y=", + "lastModified": 1624977608, + "narHash": "sha256-i/QZI5qM4eYw2wWGd/OjruBx53FqUPq+sdAWmyIQ0ws=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0747387223edf1aa5beaedf48983471315d95e16", + "rev": "db6e089456cdddcd7e2c1d8dac37a505c797e8fa", "type": "github" }, "original": { @@ -272,11 +325,11 @@ "nvcode-color-schemes-vim": { "flake": false, "locked": { - "lastModified": 1623864081, - "narHash": "sha256-eJEOpmf/A42WSl1ZHkcKLNG02iVFYC6Rmo1AzRnn8Kk=", + "lastModified": 1624730236, + "narHash": "sha256-LKT9A1f33OKsMFKV/vaeY59Ah9EjocYP+BpU4vqsCFg=", "owner": "ChristianChiarulli", "repo": "nvcode-color-schemes.vim", - "rev": "2afb852177a28e579c1348033dbc043a99ca6dc7", + "rev": "cb3682a8eaf25485efe0b377f0b9e8291f68ab59", "type": "github" }, "original": { @@ -304,11 +357,11 @@ "nvim-bufferline-lua": { "flake": false, "locked": { - "lastModified": 1623779249, - "narHash": "sha256-BD1svb0e9xvGaQL97AwjN1J0FB1VmkJLyVkyA4mF4is=", + "lastModified": 1624951664, + "narHash": "sha256-FiP1oaPO41gK+5UiJbDhWXLh36+9er/w/8CwCmwzdR4=", "owner": "akinsho", "repo": "nvim-bufferline.lua", - "rev": "2db4a3c2c42816a31db391f30a708d976a8c679c", + "rev": "165114f65c267ee912018ef3565d70cba7183fc3", "type": "github" }, "original": { @@ -336,11 +389,11 @@ "nvim-compe": { "flake": false, "locked": { - "lastModified": 1623923075, - "narHash": "sha256-FPb74JB98kD+3r/oUZxulaEhQ3Pul1zqbsCZeD3tuCE=", + "lastModified": 1624970070, + "narHash": "sha256-Sucf9yBfhn8E20MfOEW7LzmH1CwlZlUe/E7j0vvacBI=", "owner": "hrsh7th", "repo": "nvim-compe", - "rev": "d0934e7b335283879fd3e4ca68adaee6a92688b0", + "rev": "9a1ab398bfdb4bda1134b7a0e7a379017d3bdefa", "type": "github" }, "original": { @@ -352,11 +405,11 @@ "nvim-dap": { "flake": false, "locked": { - "lastModified": 1623780040, - "narHash": "sha256-FseSsjaZrbQNj2Qfx8eZPWgLLiZzwxz3W50K9ha98gk=", + "lastModified": 1624622085, + "narHash": "sha256-V+GCXtPlVqhi1xnESHGz8SgPv/K6mrsfBfv5erWaR3g=", "owner": "mfussenegger", "repo": "nvim-dap", - "rev": "d5e57dc263ab14ec5d99049f66f5a069b63837dc", + "rev": "e92ef2acc81b668c90b2dbf2e2a4412ea5975242", "type": "github" }, "original": { @@ -384,11 +437,11 @@ "nvim-jdtls": { "flake": false, "locked": { - "lastModified": 1623784260, - "narHash": "sha256-y0o2O6MzdZ+buEm7cPAlKACGnijgRb7dTLF/h2+ThgM=", + "lastModified": 1624989895, + "narHash": "sha256-rrpntvvsZMMyi3lwh2i8HhUYibylwzSZiAVVqlzrPFI=", "owner": "mfussenegger", "repo": "nvim-jdtls", - "rev": "a26e1818fa62cfbcbd9728ad11bc3fc312d6e50e", + "rev": "018b013d5ee873dfaa9fa2d487d166c5f6dd3aee", "type": "github" }, "original": { @@ -400,11 +453,11 @@ "nvim-lspconfig": { "flake": false, "locked": { - "lastModified": 1623824159, - "narHash": "sha256-D3gMx5bwD1Kx1GJB2IXw88z76sYCNXIjf2C/wHMoUpg=", + "lastModified": 1625001195, + "narHash": "sha256-iIuT2QH2KpFbcCj7JfkWlVwxz3ITSqNUoFGna0yvIHA=", "owner": "neovim", "repo": "nvim-lspconfig", - "rev": "f81570d1288fd974098e0f311f728469ca919155", + "rev": "234a8cdad1104dd562796e6ca2c6c41e22e5f77a", "type": "github" }, "original": { @@ -416,11 +469,11 @@ "nvim-tree-lua": { "flake": false, "locked": { - "lastModified": 1623786580, - "narHash": "sha256-ZyozHY3Zos85XwxqSIYUFGiWc/Jn6rNC4h9nybZsHms=", + "lastModified": 1625001208, + "narHash": "sha256-UZDM0mGUMfuQ7UyAZITrf/FeJdwdrUfgLDvjsbUSpoY=", "owner": "kyazdani42", "repo": "nvim-tree.lua", - "rev": "bfeaf4c8ef5ff24e93005da2561407a13ba69d4d", + "rev": "a80ea23b4c765efe3b6eaa9440d19d298e4c709b", "type": "github" }, "original": { @@ -432,11 +485,11 @@ "nvim-treesitter": { "flake": false, "locked": { - "lastModified": 1623938000, - "narHash": "sha256-TEjRies4cwMYqT0VVHI2LzxJ/2TgwbbNWHHs4zeauI8=", + "lastModified": 1624989976, + "narHash": "sha256-rTSUlqxXe8ChQXs/qTricwDUS9841EYuA3NA5wBKsAI=", "owner": "nvim-treesitter", "repo": "nvim-treesitter", - "rev": "d1f6a2a3d8372725e777e96740bfdf0cde7eb2c8", + "rev": "917ae3da7c0d827c819405cc747aafc8bb041dbd", "type": "github" }, "original": { @@ -480,11 +533,11 @@ "nvim-ts-rainbow": { "flake": false, "locked": { - "lastModified": 1623945160, - "narHash": "sha256-tDM/nPS8hSkaqQVSOx33Pk2dWwQ2cTHrmQi6mF77Gh8=", + "lastModified": 1624603127, + "narHash": "sha256-ctjcDZoZmMpP3cn6Z+IJx/6QF4bS9eAlvs/oinhiB/w=", "owner": "p00f", "repo": "nvim-ts-rainbow", - "rev": "faecf6c5b848fc2b3ee51d29b4db609abe90f239", + "rev": "c2a5af6b6f08b883ac6925273142eb178178a2f6", "type": "github" }, "original": { @@ -512,11 +565,11 @@ "packer-nvim": { "flake": false, "locked": { - "lastModified": 1623613031, - "narHash": "sha256-kETm6r5K6eu2U3bzdTPog0/kJqMK19EBnO5Ufsqlb3A=", + "lastModified": 1624902921, + "narHash": "sha256-pWNcIGI679Xv1G5NXELIxq29X4miTIBCQPUINSTjlSs=", "owner": "wbthomason", "repo": "packer.nvim", - "rev": "4012bd40af350a38696a6ba92a5df9bd99b48527", + "rev": "78a42c3bc7b153a621b5f9d35623db88d6d0d0ee", "type": "github" }, "original": { @@ -528,11 +581,11 @@ "plenary-nvim": { "flake": false, "locked": { - "lastModified": 1623955260, - "narHash": "sha256-vX6TiFZWmSccGEaT5v31/Qw1Hm/hMFkVsiyl08OCq5s=", + "lastModified": 1624125414, + "narHash": "sha256-/2AgeZV4BF67rM0/haqFuf2pxQqDSCxtVIzostKf+h8=", "owner": "nvim-lua", "repo": "plenary.nvim", - "rev": "baf7f0f3bf32a3c7c16fb7ff27d3c4cb54b8f59b", + "rev": "268002fdba2f8f5a4e86574e3b9924ad6d42da20", "type": "github" }, "original": { @@ -561,6 +614,7 @@ "inputs": { "flake-utils": "flake-utils", "home-manager": "home-manager", + "idris2-pkgs": "idris2-pkgs", "neovim": "neovim", "nixpkgs": "nixpkgs", "vim-plugins-overlay": "vim-plugins-overlay" @@ -601,11 +655,11 @@ "telescope-bibtex-nvim": { "flake": false, "locked": { - "lastModified": 1614071010, - "narHash": "sha256-tu2OdlRVtpLMs4z3CfsNDt6F/gA1sOadV6zLqoK0w3c=", + "lastModified": 1624961220, + "narHash": "sha256-Rvn4UwVcbfd5+mQWt7H7/6i3DwlNSY0O7NxWp75Gwww=", "owner": "nvim-telescope", "repo": "telescope-bibtex.nvim", - "rev": "f1ec374c2bd6e595327dc1b9b837c571e5182ed2", + "rev": "5811b5bdbf2e663189ddb4cb252d414bf2f587af", "type": "github" }, "original": { @@ -713,11 +767,11 @@ "telescope-github-nvim": { "flake": false, "locked": { - "lastModified": 1622809307, - "narHash": "sha256-3lp84Q6QOwFurYmNiNcDKger78HR36UwP+yylcW96Xg=", + "lastModified": 1624780154, + "narHash": "sha256-KgP6Nkk30Ho09PgGCWlitvvjlTZ1igXo+tQV5zHreIc=", "owner": "nvim-telescope", "repo": "telescope-github.nvim", - "rev": "479ca5fdc5e2bceb2549808518995a68d9e5cc94", + "rev": "497b86cdcea3fe3d8325661e2fa3cee7353a7a0b", "type": "github" }, "original": { @@ -777,11 +831,11 @@ "telescope-nvim": { "flake": false, "locked": { - "lastModified": 1623700246, - "narHash": "sha256-N9S+zn/Wk+rg93zmLWbAbGPmkouu9O3+BAA0hpSnT8w=", + "lastModified": 1624792850, + "narHash": "sha256-61NxNvr3LHKKbXMrElkVfv/gbF5TOo/ADzOriEPKU7c=", "owner": "nvim-telescope", "repo": "telescope.nvim", - "rev": "6ac5ee0854fe02d651cadf2fc97a2463ff92f322", + "rev": "e5bd4963da81b5d044749ee4507061801aeb0f78", "type": "github" }, "original": { @@ -809,11 +863,11 @@ "telescope-project-nvim": { "flake": false, "locked": { - "lastModified": 1623780342, - "narHash": "sha256-wNoV0A0V2GSfezbLf8tJ4FIW1xxg2TbmGq+eC8Z4G54=", + "lastModified": 1624348083, + "narHash": "sha256-coFfYRV+UstWsuAvWe+6RsKHqFy9S4FSGoZjDcaRBeo=", "owner": "nvim-telescope", "repo": "telescope-project.nvim", - "rev": "d5bd0f016ce081e786164dce973fe6ca7aba7c60", + "rev": "6a1c607b9fc53890213cbb0bd72f45cb1ad1b249", "type": "github" }, "original": { @@ -1017,11 +1071,11 @@ "which-key-nvim": "which-key-nvim" }, "locked": { - "lastModified": 1624063925, - "narHash": "sha256-+wlSpnl4vaqgfmTKS1P5Vcqt01Ggti2h20EkdCV6Q4Y=", + "lastModified": 1625059092, + "narHash": "sha256-NkpVW/Y4jp26dBEJ5l5kENmLlXsZwR9EzEhJpoaJyE0=", "owner": "vi-tality", "repo": "vim-plugins-overlay", - "rev": "ac2a4225a4f3959f1f30c0b397b7a87b807ba6b4", + "rev": "9284a653f912ba3268b9f326fc3139a187e1c76b", "type": "github" }, "original": { @@ -1049,11 +1103,11 @@ "vim-repl": { "flake": false, "locked": { - "lastModified": 1622625970, - "narHash": "sha256-8Rt0zYcr7cmgyAR+KVpWcqtw1zt9yq3JJvFeZje3dm0=", + "lastModified": 1624963724, + "narHash": "sha256-4ne/POA9xzWh6vrMJt6nsxNNtH3VxslsyTT7b7NVh4k=", "owner": "sillybun", "repo": "vim-repl", - "rev": "46a295d440ea2d705f168afd194d570e76161557", + "rev": "f164c5b9899a767f7a1d456624b1954fe7563b44", "type": "github" }, "original": { @@ -1113,11 +1167,11 @@ "which-key-nvim": { "flake": false, "locked": { - "lastModified": 1623929737, - "narHash": "sha256-JO+rGR/B8ajSYvaVROng6ub0RVkY4wSwpCYB8BE0j7U=", + "lastModified": 1624712444, + "narHash": "sha256-vSMMM3SmUDGz5d2+IvEkBCmQfcT+hJ/FLayFFnS7vJs=", "owner": "folke", "repo": "which-key.nvim", - "rev": "78821de0b633275d6934660e67989639bc7a784c", + "rev": "e0dce1552ea37964ae6ac7144709867544eae7f3", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix @@ -17,16 +17,23 @@ }; vim-plugins-overlay = { - url = github:vi-tality/vim-plugins-overlay; + url = "github:vi-tality/vim-plugins-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + idris2-pkgs = { + url = "github:claymager/idris2-pkgs"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { self, nixpkgs, home-manager, neovim, vim-plugins-overlay, ... }@inputs: + outputs = { self, nixpkgs, home-manager, neovim, + vim-plugins-overlay, idris2-pkgs, ... }@inputs: let overlays = [ neovim.overlay vim-plugins-overlay.overlay + #idris2-pkgs.overlay ]; lib = nixpkgs.lib; libExtra = import ./lib { inherit lib; }; @@ -52,7 +59,7 @@ nixpkgs.overlays = overlays; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.benjamin = import ./home/home.nix; + home-manager.users.benjamin = import ./home/profiles/laptop.nix; } ]; }; diff --git a/home/home.nix b/home/home.nix @@ -50,6 +50,7 @@ in { pkgs.haskell-language-server pkgs.i3lock-color pkgs.manpages + pkgs.sxiv pkgs.texlab pkgs.tree-sitter ]; diff --git a/home/modules/alacritty.nix b/home/modules/alacritty.nix @@ -1,110 +0,0 @@ -{ config, pkgs, lib, ... }: - -with lib; - -let - mkColourOption = name: default: mkOption { - type = types.str; - default = default; - example = "#123456"; - description = "Colour value for ${name}."; - }; - -in -{ - options.alacritty = { - enable = mkEnableOption "Alacritty"; - - font = mkOption { - type = types.str; - default = "Hack"; - example = "Hack"; - description = "Font used"; - }; - - colours = { - bg = mkColourOption "bg" "#1d1f21"; - fg = mkColourOption "fg" "#c5c8c6"; - - black = mkColourOption "black" "#1d1f21"; - black-bright = mkColourOption "black-bright" "#666666"; - - red = mkColourOption "red" "#cc6666"; - red-bright = mkColourOption "red-bright" "#d54e53"; - - green = mkColourOption "green" "#b5bd68"; - green-bright = mkColourOption "green-bright" "#b9ca4a"; - - yellow = mkColourOption "yellow" "#f0c674"; - yellow-bright = mkColourOption "yellow-bright" "#e7c547"; - - blue = mkColourOption "blue" "#81a2be"; - blue-bright = mkColourOption "blue-bright" "#7aa6da"; - - magenta = mkColourOption "magenta" "#b294bb"; - magenta-bright = mkColourOption "magenta-bright" "#c397d8"; - - cyan = mkColourOption "cyan" "#8abeb7"; - cyan-bright = mkColourOption "cyan-bright" "#70c0b1"; - - white = mkColourOption "white" "#c5c8c6"; - white-bright = mkColourOption "white-bright" "#eaeaea"; - }; - }; - - config = mkIf config.alacritty.enable { - programs.alacritty = { - enable = true; - package = pkgs.hello; - - settings = { - font = { - size = 10; - normal = { - family = config.alacritty.font; - style = "Regular"; - }; - bold = { - family = config.alacritty.font; - style = "Bold"; - }; - italic = { - family = config.alacritty.font; - style = "Italic"; - }; - bold_italic = { - family = config.alacritty.font; - style = "Bold Italic"; - }; - }; - - colors = { - primary = { - background = config.alacritty.colours.bg; - foreground = config.alacritty.colours.fg; - }; - normal = { - black = config.alacritty.colours.black; - red = config.alacritty.colours.red; - green = config.alacritty.colours.green; - yellow = config.alacritty.colours.yellow; - blue = config.alacritty.colours.blue; - magenta = config.alacritty.colours.magenta; - cyan = config.alacritty.colours.cyan; - white = config.alacritty.colours.white; - }; - bright = { - black-bright = config.alacritty.colours.black-bright; - red-bright = config.alacritty.colours.red-bright; - green-bright = config.alacritty.colours.green-bright; - yellow-bright = config.alacritty.colours.yellow-bright; - blue-bright = config.alacritty.colours.blue-bright; - magenta-bright = config.alacritty.colours.magenta-bright; - cyan-bright = config.alacritty.colours.cyan-bright; - white-bright = config.alacritty.colours.white-bright; - }; - }; - }; - }; - }; -} diff --git a/home/modules/default.nix b/home/modules/default.nix @@ -1,6 +1,30 @@ { lib, ... }: + +with lib; + let libExtra = import ../../lib { inherit lib; }; + + importModulesRecursively = dir: + let d = builtins.readDir dir; in + if hasAttrByPath ["default.nix"] d then [""] else + concatLists (mapAttrsToList (n: v: + if v == "directory" then + map (f: "${n}/${f}") (importModulesRecursively "${toString dir}/${n}") + else ["${n}"]) + d); + + callImportModules = dir: + let d = builtins.readDir dir; in + concatLists (mapAttrsToList (n: v: + if v == "directory" then + map (f: "${toString dir}/${n}/${f}") (importModulesRecursively "${toString dir}/${n}") + else "${toString dir}/${n}") + (filterAttrs (n: v: n != "default.nix") d)); in { - imports = libExtra.importDir ./.; + # Basically just imports everything + # If importing a directory which contains a default.nix treat it like + # it is its own module + # An example of one of these is ./dev/neovim + imports = callImportModules ./.; } diff --git a/home/modules/dev/git.nix b/home/modules/dev/git.nix @@ -0,0 +1,29 @@ +{ config, pkgs, lib, ... }: + +with lib; + +{ + options.git = { + enable = mkEnableOption "Git"; + }; + + config = mkIf config.git.enable { + programs.git = { + enable = true; + aliases = { + ga = "add"; + gc = "commit"; + gd = "diff"; + gp = "push"; + gs = "status"; + }; + userEmail = "bpaul@bpaul.xyz"; + userName = "Benjamin Paul"; + + extraConfig = { + askPass = ""; + github.user = "GuyClicking"; + }; + }; + }; +} diff --git a/home/modules/dev/haskell.nix b/home/modules/dev/haskell.nix @@ -0,0 +1,17 @@ +{ config, pkgs, lib, ... }: + +with lib; + +{ + options.haskell = { + enable = mkEnableOption "Haskell"; + }; + + # im 99% sure this wont be helpful but eh + config = mkIf config.haskell.enable { + home.packages = with pkgs; [ + ghc + haskell-language-server + ]; + }; +} diff --git a/home/modules/dev/idris2/default.nix b/home/modules/dev/idris2/default.nix @@ -0,0 +1,18 @@ +{ config, pkgs, lib, ... }: + +with lib; + +{ + options.idris2 = { + enable = mkEnableOption "idris2"; + }; + + config = mkIf config.idris2.enable { + home.packages = [ + pkgs.idris2 + #(pkgs.idris2.withPackages (ps: with ps; [ idris2api ])) + #(pkgs.idris2.packages.lsp.withPackages (ps: with ps; [ idris2api ])) + #(import ./lsp.nix) + ]; + }; +} diff --git a/home/modules/dev/idris2/lsp.nix b/home/modules/dev/idris2/lsp.nix @@ -0,0 +1,3 @@ +stdenv.mkDerivation { + +} diff --git a/home/modules/latex.nix b/home/modules/dev/latex.nix diff --git a/home/modules/neovim/c.lua b/home/modules/dev/neovim/c.lua diff --git a/home/modules/neovim/compe.lua b/home/modules/dev/neovim/compe.lua diff --git a/home/modules/neovim/cpp.lua b/home/modules/dev/neovim/cpp.lua diff --git a/home/modules/dev/neovim/default.nix b/home/modules/dev/neovim/default.nix @@ -0,0 +1,84 @@ +{ config, pkgs, lib, ... }: + +with builtins; +with lib; + +let + luaConfig = file: '' + lua << EOF + ${readFile file} + EOF + ''; +in +{ + options.neovim = { + enable = mkEnableOption "Neovim"; + + colourSchemePackage = mkOption { + type = types.package; + default = pkgs.vimPlugins.gruvbox; + example = pkgs.vimPlugins.dracula-vim; + description = "Package of the vim colour scheme used."; + }; + + colourScheme = mkOption { + type = types.str; + default = "gruvbox"; + example = "blue"; + description = "What you would type in the colorscheme vim command (e.g. `colorscheme gruvbox`)."; + }; + }; + + config = mkIf config.neovim.enable { + programs.neovim = { + enable = true; + package = pkgs.neovim; + extraConfig = '' + ${readFile ./syntax.vim} + + lua << EOF + ${readFile ./init.lua} + + function c() + ${readFile ./c.lua} + end + function cpp() + ${readFile ./cpp.lua} + end + function lua() + ${readFile ./lua.lua} + end + function tex() + ${readFile ./tex.lua} + end + EOF + au BufEnter *.c lua c() + au BufEnter *.cpp lua cpp() + au BufEnter *.lua lua lua() + au BufEnter *.tex lua tex() + ''; + plugins = [ + { plugin = pkgs.vimPlugins.vim-nix; } + { plugin = pkgs.vimPlugins.fzfWrapper; } + { plugin = pkgs.vimPlugins.plenary-nvim; } + { plugin = pkgs.vitalityVimPlugins.LuaSnip; } + { plugin = config.neovim.colourSchemePackage; config = "colorscheme ${config.neovim.colourScheme}"; } + { plugin = pkgs.vimPlugins.nvim-compe; config = luaConfig ./compe.lua; } + { plugin = pkgs.vimPlugins.nvim-lspconfig; } + { plugin = pkgs.vimPlugins.nvim-treesitter; config = "lua require'nvim-treesitter.configs'.setup{highlight={enable=true}}"; } + { plugin = pkgs.vimPlugins.vimwiki; } + { plugin = pkgs.vimPlugins.fugitive; } + { plugin = pkgs.vimPlugins.vim-startify; } + { plugin = pkgs.vimPlugins.vim-dispatch; } + { plugin = pkgs.vimPlugins.vim-surround; } + { plugin = pkgs.vimPlugins.vim-polyglot; } + { plugin = pkgs.vimPlugins.mattn-calendar-vim; } + + # Language specific plugins + (mkIf config.haskell.enable { plugin = pkgs.vimPlugins.haskell-vim; }) + (mkIf config.idris2.enable { plugin = pkgs.vimPlugins.idris2-vim; }) + (mkIf config.latex.enable { plugin = pkgs.vimPlugins.vimtex; }) + ]; + }; + }; +} diff --git a/home/modules/dev/neovim/init.lua b/home/modules/dev/neovim/init.lua @@ -0,0 +1,233 @@ +-- vimrc but lua + +-- Set leader to space +vim.g.mapleader = ' ' + +-- Line numbers +-- See :h number_relativenumber +vim.wo.number = true +vim.wo.relativenumber = true + +-- Tab configuration +-- See :h tabstop for tab configuration stuff +vim.bo.tabstop = 4 +vim.bo.softtabstop = 4 +vim.bo.shiftwidth = 4 +vim.bo.expandtab = true +vim.bo.autoindent = true +vim.o.tabstop = 4 +vim.o.softtabstop = 4 +vim.o.shiftwidth = 4 +vim.o.expandtab = true +vim.o.autoindent = true +vim.o.smarttab = true +vim.o.hlsearch = false +vim.o.hidden = true + +-- Use Australian spelling +vim.bo.spelllang = 'en_au' + +-- Ruler shows the line and column number at the bottom right +vim.o.ruler = true + +-- Always show the tab bar for consistency +vim.o.showtabline = 2 + +-- Make underscore separated words separate words +--vim.bo.iskeyword = vim.bo.iskeyword:gsub(",_","") +--vim.o.iskeyword = vim.o.iskeyword:gsub(",_","") + +-- Dont wrap long lines +vim.wo.wrap = false + +-- Dont highlight searches +vim.o.hlsearch = false + +-- Make CTRL-L clear echo and search +vim.api.nvim_set_keymap('n', '<C-L>', ':noh<CR>:mode<CR>', + { noremap = true, silent = true }) + +-- Make leader+a insert one from the end of the line because semicolon +vim.api.nvim_set_keymap('n', '<leader>a', '$i', + { noremap = true, silent = true }) +-- Make leader+x delete char at the end of the line +vim.api.nvim_set_keymap('n', '<leader>x', '$x', + { noremap = true, silent = true }) +-- Make leader+f fix the spelling of the current word +vim.api.nvim_set_keymap('n', '<leader>f', '1z=', + { noremap = true, silent = true }) +-- Make leader+C open the colour scheme menu +vim.api.nvim_set_keymap('n', '<leader>C', ':lua colourscheme()<CR>', + { noremap = true, silent = true }) + +-- Make Shift-Delete do nothing (my keyboard is weird so I press it a lot) +vim.api.nvim_set_keymap('i', '<S-Del>', '', { noremap = true, silent = true }) + +-- Colour column shows the text width of a file +vim.wo.colorcolumn = vim.wo.colorcolumn .. '+' .. 1 +for i = 2,255 do vim.wo.colorcolumn = vim.wo.colorcolumn .. ',+' .. i end + +-- Funky commands +vim.api.nvim_command('command! W w') + +-- Command that opens fzf for colour schemes +function colourscheme() + vim.api.nvim_eval('fzf#run(fzf#wrap({"source":luaeval("{'..string.gsub(vim.api.nvim_eval("globpath(&rtp, 'colors/*.vim')") .. '\n','.-/colors/(.-).vim\n',"'%1',")..'}"),"sink":"colorscheme"}))') +end + +-- LSP + +require'lspconfig'.ccls.setup{} +require'lspconfig'.hls.setup{} +require'lspconfig'.texlab.setup{} + +-- Always have the sign column so that code doesnt move around on error +vim.wo.signcolumn = "yes" + +-- nvim-compe + +vim.g.vimtex_view_method = "zathura" + +function t(str) + return vim.api.nvim_replace_termcodes(str, true, true, true) +end + +function check_back_space() + local col = vim.fn.col('.') - 1 + if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then + return true + else + return false + end +end + +_G.tab_complete = function() + if vim.fn.pumvisible() == 1 then + return t "<C-n>" + elseif require'luasnip'.expand_or_jumpable() then + return t "<Plug>luasnip-expand-or-jump" + elseif check_back_space() then + return t "<Tab>" + else + return vim.fn['compe#complete']() + end +end +_G.s_tab_complete = function() + if vim.fn.pumvisible() == 1 then + return t "<C-p>" + elseif require'luasnip'.expand_or_jumpable() then + return t "<Plug>luasnip-expand-or-jump" + else + return t "<S-Tab>" + end +end + +vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true}) +vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true}) + +-- Vimwiki +vim.g.vimwiki_list = {{ + path = "~/.local/share/vimwiki/", + path_html = "~/.local/share/vimwiki-html/", + auto_toc = 1, + index = "main" +}} + +vim.g.calendar_open = 0 + +_G.open_calendar = function() + if vim.g.calendar_open == 1 then + vim.g.calendar_open = 0 + return t "<Plug>CalendarVq" + end + vim.g.calendar_open = 1 + return t "<Plug>CalendarV" +end + +vim.api.nvim_set_keymap("n", "<leader>wc", "v:lua.open_calendar()", {expr = true}) + + + +-- The very big idris2-lsp config that they give you + +local lspconfig = require('lspconfig') +local configs = require('lspconfig/configs') +if not lspconfig.idris2_lsp then + configs.idris2_lsp = { + default_config = { + cmd = {'idris2-lsp'}; -- if not available in PATH, provide the absolute path + filetypes = {'idris2'}; + on_new_config = function(new_config, new_root_dir) + new_config.cmd = {'idris2-lsp'} + new_config.capabilities['workspace']['semanticTokens'] = {refreshSupport = true} + end; + root_dir = function(fname) + local scandir = require('plenary.scandir') + local find_ipkg_ancestor = function(fname) + return lspconfig.util.search_ancestors(fname, function(path) + local res = scandir.scan_dir(path, {depth=1; search_pattern='.+%.ipkg'}) + if not vim.tbl_isempty(res) then + return path + end + end) + end + return find_ipkg_ancestor(fname) or lspconfig.util.find_git_ancestor(fname) or vim.loop.os_homedir() + end; + settings = {}; + }; + } +end +-- Flag to enable semantic highlightning on start, if false you have to issue a first command manually +local autostart_semantic_highlightning = true +lspconfig.idris2_lsp.setup { + on_init = custom_init, + on_attach = function(client) + if autostart_semantic_highlightning then + vim.lsp.buf_request(0, 'textDocument/semanticTokens/full', + { textDocument = vim.lsp.util.make_text_document_params() }, nil) + end + --custom_attach(client) -- remove this line if you don't have a customized attach function + end, + autostart = true, + handlers = { + ['workspace/semanticTokens/refresh'] = function(err, method, params, client_id, bufnr, config) + if autostart_semantic_highlightning then + vim.lsp.buf_request(0, 'textDocument/semanticTokens/full', + { textDocument = vim.lsp.util.make_text_document_params() }, nil) + end + return vim.NIL + end, + ['textDocument/semanticTokens/full'] = function(err, method, result, client_id, bufnr, config) + -- temporary handler until native support lands + local client = vim.lsp.get_client_by_id(client_id) + local legend = client.server_capabilities.semanticTokensProvider.legend + local token_types = legend.tokenTypes + local data = result.data + + local ns = vim.api.nvim_create_namespace('nvim-lsp-semantic') + vim.api.nvim_buf_clear_namespace(bufnr, ns, 0, -1) + local tokens = {} + local prev_line, prev_start = nil, 0 + for i = 1, #data, 5 do + local delta_line = data[i] + prev_line = prev_line and prev_line + delta_line or delta_line + local delta_start = data[i + 1] + prev_start = delta_line == 0 and prev_start + delta_start or delta_start + local token_type = token_types[data[i + 3] + 1] + vim.api.nvim_buf_add_highlight(bufnr, ns, 'LspSemantic_' .. token_type, prev_line, prev_start, prev_start + data[i + 2]) + end + end + }, +} + +-- Set here your preferred colors for semantic values +vim.cmd [[highlight link LspSemantic_type Include]] -- Type constructors +vim.cmd [[highlight link LspSemantic_function Identifier]] -- Functions names +vim.cmd [[highlight link LspSemantic_enumMember Number]] -- Data constructors +vim.cmd [[highlight LspSemantic_variable guifg=gray]] -- Bound variables +vim.cmd [[highlight link LspSemantic_keyword Structure]] -- Keywords + +-- Add the following command to a mapping if you want to send a manual request for semantic highlight +-- :lua vim.lsp.buf_request(0, 'textDocument/semanticTokens/full', {textDocument = vim.lsp.util.make_text_document_params()}, nil) diff --git a/home/modules/neovim/lua.lua b/home/modules/dev/neovim/lua.lua diff --git a/home/modules/neovim/settings.vim b/home/modules/dev/neovim/settings.vim diff --git a/home/modules/neovim/syntax.vim b/home/modules/dev/neovim/syntax.vim diff --git a/home/modules/neovim/tex.lua b/home/modules/dev/neovim/tex.lua diff --git a/home/modules/dunst.nix b/home/modules/graphical/dunst.nix diff --git a/home/modules/polybar/default.nix b/home/modules/graphical/polybar/default.nix diff --git a/home/modules/polybar/polybar.conf b/home/modules/graphical/polybar/polybar.conf diff --git a/home/modules/polybar/settings.nix b/home/modules/graphical/polybar/settings.nix diff --git a/home/modules/zathura.nix b/home/modules/graphical/zathura.nix diff --git a/home/modules/neovim/default.nix b/home/modules/neovim/default.nix @@ -1,82 +0,0 @@ -{ config, pkgs, lib, ... }: - -with builtins; -with lib; - -let - luaConfig = file: '' - lua << EOF - ${readFile file} - EOF - ''; -in -{ - options.neovim = { - enable = mkEnableOption "Neovim"; - - colourSchemePackage = mkOption { - type = types.package; - default = pkgs.vimPlugins.gruvbox; - example = pkgs.vimPlugins.dracula-vim; - description = "Package of the vim colour scheme used."; - }; - - colourScheme = mkOption { - type = types.str; - default = "gruvbox"; - example = "blue"; - description = "What you would type in the colorscheme vim command (e.g. `colorscheme gruvbox`)."; - }; - }; - - config = mkIf config.neovim.enable { - programs.neovim = { - enable = true; - package = pkgs.neovim; - extraConfig = '' - ${readFile ./syntax.vim} - - lua << EOF - ${readFile ./init.lua} - - function c() - ${readFile ./c.lua} - end - function cpp() - ${readFile ./cpp.lua} - end - function lua() - ${readFile ./lua.lua} - end - function tex() - ${readFile ./tex.lua} - end - EOF - au BufEnter *.c lua c() - au BufEnter *.cpp lua cpp() - au BufEnter *.lua lua lua() - au BufEnter *.tex lua tex() - ''; - plugins = [ - { plugin = pkgs.vimPlugins.vim-nix; } - { plugin = pkgs.vimPlugins.fzfWrapper; } - { plugin = pkgs.vimPlugins.idris2-vim; } - { plugin = pkgs.vimPlugins.haskell-vim; } - { plugin = pkgs.vitalityVimPlugins.LuaSnip; } - { plugin = config.neovim.colourSchemePackage; config = "colorscheme ${config.neovim.colourScheme}"; } - #{ plugin = pkgs.vimPlugins.nvim-compe; config = "lua require'compe'.setup{ enabled=true; autocomplete=true; source={ path=true; nvim_lsp=true; }; }"; } - { plugin = pkgs.vimPlugins.nvim-compe; config = luaConfig ./compe.lua; } - { plugin = pkgs.vimPlugins.nvim-lspconfig; } - { plugin = pkgs.vimPlugins.nvim-treesitter; config = "lua require'nvim-treesitter.configs'.setup{highlight={enable=true}}"; } - { plugin = pkgs.vimPlugins.vimwiki; } - { plugin = pkgs.vimPlugins.vimtex; } - { plugin = pkgs.vimPlugins.fugitive; } - { plugin = pkgs.vimPlugins.vim-startify; } - { plugin = pkgs.vimPlugins.vim-dispatch; } - { plugin = pkgs.vimPlugins.vim-surround; } - { plugin = pkgs.vimPlugins.vim-polyglot; } - { plugin = pkgs.vimPlugins.mattn-calendar-vim; } - ]; - }; - }; -} diff --git a/home/modules/neovim/init.lua b/home/modules/neovim/init.lua @@ -1,147 +0,0 @@ --- vimrc but lua - --- Set leader to space -vim.g.mapleader = ' ' - --- Line numbers --- See :h number_relativenumber -vim.wo.number = true -vim.wo.relativenumber = true - --- Tab configuration --- See :h tabstop for tab configuration stuff -vim.bo.tabstop = 4 -vim.bo.softtabstop = 4 -vim.bo.shiftwidth = 4 -vim.bo.expandtab = true -vim.bo.autoindent = true -vim.o.tabstop = 4 -vim.o.softtabstop = 4 -vim.o.shiftwidth = 4 -vim.o.expandtab = true -vim.o.autoindent = true -vim.o.smarttab = true - --- Use Australian spelling -vim.bo.spelllang = 'en_au' - --- Ruler shows the line and column number at the bottom right -vim.o.ruler = true - --- Always show the tab bar for consistency -vim.o.showtabline = 2 - --- Make underscore separated words separate words ---vim.bo.iskeyword = vim.bo.iskeyword:gsub(",_","") ---vim.o.iskeyword = vim.o.iskeyword:gsub(",_","") - --- Dont wrap long lines -vim.wo.wrap = false - --- Dont highlight searches -vim.o.hlsearch = false - --- Make CTRL-L clear echo and search -vim.api.nvim_set_keymap('n', '<C-L>', ':noh<CR>:mode<CR>', - { noremap = true, silent = true }) - --- Make leader+a insert one from the end of the line because semicolon -vim.api.nvim_set_keymap('n', '<leader>a', '$i', - { noremap = true, silent = true }) --- Make leader+x delete char at the end of the line -vim.api.nvim_set_keymap('n', '<leader>x', '$x', - { noremap = true, silent = true }) --- Make leader+f fix the spelling of the current word -vim.api.nvim_set_keymap('n', '<leader>f', '1z=', - { noremap = true, silent = true }) --- Make leader+C open the colour scheme menu -vim.api.nvim_set_keymap('n', '<leader>C', ':lua colourscheme()<CR>', - { noremap = true, silent = true }) - --- Make Shift-Delete do nothing (my keyboard is weird so I press it a lot) -vim.api.nvim_set_keymap('i', '<S-Del>', '', { noremap = true, silent = true }) - --- Colour column shows the text width of a file -vim.wo.colorcolumn = vim.wo.colorcolumn .. '+' .. 1 -for i = 2,255 do vim.wo.colorcolumn = vim.wo.colorcolumn .. ',+' .. i end - --- Funky commands -vim.api.nvim_command('command! W w') - --- Command that opens fzf for colour schemes -function colourscheme() - vim.api.nvim_eval('fzf#run(fzf#wrap({"source":luaeval("{'..string.gsub(vim.api.nvim_eval("globpath(&rtp, 'colors/*.vim')") .. '\n','.-/colors/(.-).vim\n',"'%1',")..'}"),"sink":"colorscheme"}))') -end - --- LSP - -require'lspconfig'.ccls.setup{} -require'lspconfig'.hls.setup{} -require'lspconfig'.texlab.setup{} - --- Always have the sign column so that code doesnt move around on error -vim.wo.signcolumn = "yes" - --- nvim-compe - -vim.g.vimtex_view_method = "zathura" - -function t(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) -end - -function check_back_space() - local col = vim.fn.col('.') - 1 - if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then - return true - else - return false - end -end - -_G.tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t "<C-n>" - elseif require'luasnip'.expand_or_jumpable() then - return t "<Plug>luasnip-expand-or-jump" - elseif check_back_space() then - return t "<Tab>" - else - return vim.fn['compe#complete']() - end -end -_G.s_tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t "<C-p>" - elseif require'luasnip'.expand_or_jumpable() then - return t "<Plug>luasnip-expand-or-jump" - else - return t "<S-Tab>" - end -end - -vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true}) -vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true}) -vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true}) -vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true}) - --- Vimwiki -vim.g.vimwiki_list = {{ - path = "~/.local/share/vimwiki/", - path_html = "~/.local/share/vimwiki-html/", - auto_toc = 1, - index = "main" -}} - -vim.g.calendar_open = 0 - -_G.open_calendar = function() - if vim.g.calendar_open == 1 then - vim.g.calendar_open = 0 - return t "<Plug>CalendarVq" - end - vim.g.calendar_open = 1 - return t "<Plug>CalendarV" -end - -vim.api.nvim_set_keymap("n", "<leader>wc", "v:lua.open_calendar()", {expr = true}) diff --git a/home/modules/terminal/alacritty.nix b/home/modules/terminal/alacritty.nix @@ -0,0 +1,109 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + mkColourOption = name: default: mkOption { + type = types.str; + default = default; + example = "#123456"; + description = "Colour value for ${name}."; + }; + +in +{ + options.alacritty = { + enable = mkEnableOption "Alacritty"; + + font = mkOption { + type = types.str; + default = "Hack"; + example = "Hack"; + description = "Font used"; + }; + + colours = { + bg = mkColourOption "bg" "#1d1f21"; + fg = mkColourOption "fg" "#c5c8c6"; + + black = mkColourOption "black" "#1d1f21"; + black-bright = mkColourOption "black-bright" "#666666"; + + red = mkColourOption "red" "#cc6666"; + red-bright = mkColourOption "red-bright" "#d54e53"; + + green = mkColourOption "green" "#b5bd68"; + green-bright = mkColourOption "green-bright" "#b9ca4a"; + + yellow = mkColourOption "yellow" "#f0c674"; + yellow-bright = mkColourOption "yellow-bright" "#e7c547"; + + blue = mkColourOption "blue" "#81a2be"; + blue-bright = mkColourOption "blue-bright" "#7aa6da"; + + magenta = mkColourOption "magenta" "#b294bb"; + magenta-bright = mkColourOption "magenta-bright" "#c397d8"; + + cyan = mkColourOption "cyan" "#8abeb7"; + cyan-bright = mkColourOption "cyan-bright" "#70c0b1"; + + white = mkColourOption "white" "#c5c8c6"; + white-bright = mkColourOption "white-bright" "#eaeaea"; + }; + }; + + config = mkIf config.alacritty.enable { + programs.alacritty = { + enable = true; + + settings = { + font = { + size = 9; + normal = { + family = config.alacritty.font; + style = "Regular"; + }; + bold = { + family = config.alacritty.font; + style = "Bold"; + }; + italic = { + family = config.alacritty.font; + style = "Italic"; + }; + bold_italic = { + family = config.alacritty.font; + style = "Bold Italic"; + }; + }; + + colors = { + primary = { + background = config.alacritty.colours.bg; + foreground = config.alacritty.colours.fg; + }; + normal = { + black = config.alacritty.colours.black; + red = config.alacritty.colours.red; + green = config.alacritty.colours.green; + yellow = config.alacritty.colours.yellow; + blue = config.alacritty.colours.blue; + magenta = config.alacritty.colours.magenta; + cyan = config.alacritty.colours.cyan; + white = config.alacritty.colours.white; + }; + bright = { + black-bright = config.alacritty.colours.black-bright; + red-bright = config.alacritty.colours.red-bright; + green-bright = config.alacritty.colours.green-bright; + yellow-bright = config.alacritty.colours.yellow-bright; + blue-bright = config.alacritty.colours.blue-bright; + magenta-bright = config.alacritty.colours.magenta-bright; + cyan-bright = config.alacritty.colours.cyan-bright; + white-bright = config.alacritty.colours.white-bright; + }; + }; + }; + }; + }; +} diff --git a/home/modules/starship.nix b/home/modules/terminal/starship.nix diff --git a/home/modules/terminal/zsh.nix b/home/modules/terminal/zsh.nix @@ -0,0 +1,93 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let editor = "nvim"; +in +{ + options.zsh = { + enable = mkEnableOption "Zsh"; + + editor = mkOption { + type = types.str; + default = "nvim"; + example = "nano"; + description = "The default editor, which is what \$EDITOR will be set to"; + }; + }; + + config = mkIf config.zsh.enable { + home.packages = [ pkgs.any-nix-shell ]; + programs.zsh = { + enable = true; + + history = { + path = "/home/benjamin/.cache/zsh/history"; + }; + + # bind keys properly for backword or switch to vi mode?? + + shellAliases = { + ls = "ls --color=auto"; + l = "ls"; + la = "ls -la"; + grep = "grep --color=auto"; + v = config.zsh.editor; + tmux = "tmux -2"; + die = "shutdown now"; + idris2 = "rlwrap idris2"; + }; + + sessionVariables = { + EDITOR = config.zsh.editor; + NIX_PATH = "\$HOME/.nix-defexpr/channels\${NIX_PATH:+:}\$NIX_PATH"; + TERMINAL = "alacritty"; + }; + + initExtra = '' + #. ~/.nix-profile/etc/profile.d/nix.sh + + any-nix-shell zsh --info-right | source /dev/stdin + + # From the fzf wiki + fd() { + local dir + dir=$(find ''${1:-.} -path '*/\.*' -prune \ + -o -type d -print 2> /dev/null | fzf-tmux -r +m) && + cd "$dir" + } + + fh() { + eval $(history -n | fzf-tmux -r +m) + } + + fmv() { + local dir + dir=$(find ''${2:-.} -path '*/\.*' -prune \ + -o -type d -print 2> /dev/null | fzf-tmux -r +m) && + mv $1 "$dir" + } + + fcp() { + local dir + dir=$(find ''${2:-.} -path '*/\.*' -prune \ + -o -type d -print 2> /dev/null | fzf-tmux -r +m) && + cp $1 "$dir" + } + ''; + + # plugins = [ + # { + # name = "zsh-nix-shell"; + # file = "nix-shell.plugin.zsh"; + # src = pkgs.fetchFromGitHub { + # owner = "chisui"; + # repo = "zsh-nix-shell"; + # rev = "v0.1.0"; + # sha256 = "0snhch9hfy83d4amkyxx33izvkhbwmindy0zjjk28hih1a9l2jmx"; + # }; + # } + # ]; + }; + }; +} diff --git a/home/modules/xbindkeys.nix b/home/modules/xorg/xbindkeys.nix diff --git a/home/modules/xinit.nix b/home/modules/xorg/xinit.nix diff --git a/home/modules/zsh.nix b/home/modules/zsh.nix @@ -1,97 +0,0 @@ -{ config, pkgs, lib, ... }: - -with lib; - -let editor = "nvim"; -in -{ - options.zsh = { - enable = mkEnableOption "Zsh"; - - editor = mkOption { - type = types.str; - default = "nvim"; - example = "nano"; - description = "The default editor, which is what \$EDITOR will be set to"; - }; - }; - - config = mkIf config.zsh.enable { - home.packages = [ pkgs.any-nix-shell ]; - programs.zsh = { - enable = true; - - history = { - path = "/home/benjamin/.cache/zsh/history"; - }; - - # bind keys properly for backword or switch to vi mode?? - - shellAliases = { - ls = "ls --color=auto"; - l = "ls"; - la = "ls -la"; - grep = "grep --color=auto"; - v = config.zsh.editor; - ga = "git add"; - gc = "git commit"; - gd = "git diff"; - gp = "git push"; - gs = "git status"; - tmux = "tmux -2"; - die = "shutdown now"; - }; - - sessionVariables = { - EDITOR = config.zsh.editor; - NIX_PATH = "\$HOME/.nix-defexpr/channels\${NIX_PATH:+:}\$NIX_PATH"; - TERMINAL = "alacritty"; - }; - - initExtra = '' - . ~/.nix-profile/etc/profile.d/nix.sh - - any-nix-shell zsh --info-right | source /dev/stdin - - # From the fzf wiki - fd() { - local dir - dir=$(find ''${1:-.} -path '*/\.*' -prune \ - -o -type d -print 2> /dev/null | fzf-tmux -r +m) && - cd "$dir" - } - - fh() { - eval $(history -n | fzf-tmux -r +m) - } - - fmv() { - local dir - dir=$(find ''${2:-.} -path '*/\.*' -prune \ - -o -type d -print 2> /dev/null | fzf-tmux -r +m) && - mv $1 "$dir" - } - - fcp() { - local dir - dir=$(find ''${2:-.} -path '*/\.*' -prune \ - -o -type d -print 2> /dev/null | fzf-tmux -r +m) && - cp $1 "$dir" - } - ''; - - # plugins = [ - # { - # name = "zsh-nix-shell"; - # file = "nix-shell.plugin.zsh"; - # src = pkgs.fetchFromGitHub { - # owner = "chisui"; - # repo = "zsh-nix-shell"; - # rev = "v0.1.0"; - # sha256 = "0snhch9hfy83d4amkyxx33izvkhbwmindy0zjjk28hih1a9l2jmx"; - # }; - # } - # ]; - }; - }; -} diff --git a/home/profiles/arch.nix b/home/profiles/arch.nix @@ -3,7 +3,7 @@ with lib; let libExtra = import ../../lib { inherit lib; }; - scripts = libExtra.mapOnDir ../scripts (name: a: + scripts = libExtra.mapOnDirRec ../scripts (name: a: libExtra.createScriptFile name "${toString ../scripts}/${name}" ); in { diff --git a/home/profiles/laptop.nix b/home/profiles/laptop.nix @@ -2,22 +2,23 @@ with lib; let - libExtra = import ../lib { inherit lib; }; - scripts = libExtra.mapOnDir ./scripts (name: a: - libExtra.createScriptFile name "${toString ./scripts}/${name}" + libExtra = import ../../lib { inherit lib; }; + scripts = libExtra.mapOnDirRec ../scripts (name: a: + libExtra.createScriptFile name "${toString ../scripts}/${name}" ); in { home.stateVersion = "20.09"; imports = [ - ./modules - ./themes/gruvbox + ../modules + ../themes/gruvbox ]; home.file = scripts; alacritty.enable = true; dunst.enable = true; + idris2.enable = true; neovim.enable = true; polybar.enable = true; starship.enable = true; @@ -42,9 +43,9 @@ in { pkgs.ccls pkgs.fzf pkgs.gcc - pkgs.haskell-language-server pkgs.i3lock-color pkgs.manpages + pkgs.rlwrap pkgs.texlab pkgs.tree-sitter ]; diff --git a/lib/default.nix b/lib/default.nix @@ -6,7 +6,7 @@ with lib; let dirs = import ./dirs.nix { inherit lib; }; - files = filterAttrs (name: value: name != "default.nix") (dirs.mapOnDir ./. + files = filterAttrs (name: value: name != "default.nix") (dirs.mapOnDirRec ./. # a will be "regular" on a file and "directory" on a directory (name: a: let path = "${toString ./.}/${name}"; in diff --git a/lib/dirs.nix b/lib/dirs.nix @@ -3,9 +3,30 @@ with lib; rec { + + /* + * Recursively read a directory + * Ugly code warning! + */ + readDirRec = dir: + let d = builtins.readDir dir; in + foldAttrs (n: a: n) [] (attrValues (mapAttrs (n: v: + if v == "directory" then + # Add the directory name to the start of the file + # e.g. file.nix in directory called dir -> dir/file.nix + mapAttrs' (fName: fVal: + nameValuePair "${n}/${fName}" "${n}/${fName}") + (readDirRec "${toString dir}/${n}") + + # Else it is a normal file + # Yeah dont mind this weird stuff it's so that the + # directory stuff works lol + else {${n} = n;}) + d)); + /* - * Map the function fn to every file in dir - */ + * Map the function fn to every file in dir + */ mapOnDir = dir: fn: let d = builtins.readDir dir; in mapAttrs (fn) d; @@ -14,7 +35,27 @@ rec { let d = builtins.readDir dir; in mapAttrs' (fn) d; + mapOnDirRec = dir: fn: + let d = readDirRec dir; in + mapAttrs (fn) d; + + mapOnDirRec' = dir: fn: + let d = readDirRec dir; in + mapAttrs' (fn) d; + importDir = dir: map (file: "${toString dir}/${file}") (filter (f: f != "default.nix") (attrValues (mapOnDir dir (name: a: name)))); + + importDir' = dir: + map (file: "${toString dir}/${file}") (filter (f: f != "default.nix") (attrValues (mapOnDir' dir (name: a: + name)))); + + importDirRec = dir: + map (file: "${toString dir}/${file}") (filter (f: f != "default.nix" && hasSuffix ".nix" f) (attrValues (mapOnDirRec dir (name: a: + name)))); + + importDirRec' = dir: + map (file: "${toString dir}/${file}") (filter (f: f != "default.nix" && hasSuffix ".nix" f) (attrValues (mapOnDirRec' dir (name: a: + name)))); } diff --git a/nixos/laptop/configuration.nix b/nixos/laptop/configuration.nix @@ -21,7 +21,7 @@ # Use the GRUB 2 boot loader. boot.loader.grub.enable = true; boot.loader.grub.version = 2; - boot.loader.grub.configurationLimit = 100; + boot.loader.grub.configurationLimit = 50; # boot.loader.grub.efiSupport = true; # boot.loader.grub.efiInstallAsRemovable = true; # boot.loader.efi.efiSysMountPoint = "/boot/efi";