diff --git a/dotfiles/neovim/lua/my/helpers.lua b/dotfiles/neovim/lua/my/helpers.lua index f4fb221..7c0b26f 100644 --- a/dotfiles/neovim/lua/my/helpers.lua +++ b/dotfiles/neovim/lua/my/helpers.lua @@ -13,9 +13,9 @@ function M.mergeTables(t1, t2) end function M.saveCursor(callback) - local cursor = vim.api.nvim_win_get_cursor() + local cursor = vim.api.nvim_win_get_cursor(0) callback() - vim.api.nvim_win_set_cursor(cursor) + vim.api.nvim_win_set_cursor(0, cursor) end return M diff --git a/dotfiles/neovim/lua/my/plugins/lspconfig.lua b/dotfiles/neovim/lua/my/plugins/lspconfig.lua index 444986c..d55c0bd 100644 --- a/dotfiles/neovim/lua/my/plugins/lspconfig.lua +++ b/dotfiles/neovim/lua/my/plugins/lspconfig.lua @@ -55,10 +55,12 @@ local function on_attach_typescript(client, bufnr) M.on_attach(client, bufnr) end -local function on_attach_lua() +local function on_attach_nix(c, b) A.chordSilent("n", "ug", - ":lua require('my.helpers.update-nix-fetchgit').update()", + ":lua require('my.helpers.update-nix-fetchgit').update()", {settings = "b"}) + + M.on_attach(c, b) end -- General server config @@ -97,7 +99,7 @@ local servers = { } } }, - rnix = {on_attach = on_attach_lua}, + rnix = {on_attach = on_attach_nix}, hls = { haskell = { -- set formatter diff --git a/flake.lock b/flake.lock index 016fa3f..82b1d52 100644 --- a/flake.lock +++ b/flake.lock @@ -80,38 +80,6 @@ "type": "github" } }, - "easy-dhall-nix": { - "flake": false, - "locked": { - "lastModified": 1645736928, - "narHash": "sha256-jjEqfh+M73+t2Iq/IKjAGr2d2kGUeo9A7Wu7V0IxdzI=", - "owner": "justinwoo", - "repo": "easy-dhall-nix", - "rev": "dce9acbb99776a7f1344db4751d6080380f76f57", - "type": "github" - }, - "original": { - "owner": "justinwoo", - "repo": "easy-dhall-nix", - "type": "github" - } - }, - "easy-purescript-nix": { - "flake": false, - "locked": { - "lastModified": 1646209831, - "narHash": "sha256-or8Z6aMWdrqcmFA0hhjjb6FIiW14C0ruwXAqy+zYZ8g=", - "owner": "justinwoo", - "repo": "easy-purescript-nix", - "rev": "aa72388ca0fb72ed64467f59a121db1f104897db", - "type": "github" - }, - "original": { - "owner": "justinwoo", - "repo": "easy-purescript-nix", - "type": "github" - } - }, "effect": { "flake": false, "locked": { @@ -144,70 +112,6 @@ "type": "github" } }, - "fish-plugin-z": { - "flake": false, - "locked": { - "lastModified": 1626157139, - "narHash": "sha256-pWkEhjbcxXduyKz1mAFo90IuQdX7R8bLCQgb0R+hXs4=", - "owner": "jethrokuan", - "repo": "z", - "rev": "45a9ff6d0932b0e9835cbeb60b9794ba706eef10", - "type": "github" - }, - "original": { - "owner": "jethrokuan", - "repo": "z", - "type": "github" - } - }, - "fish-theme-agnoster": { - "flake": false, - "locked": { - "lastModified": 1641807476, - "narHash": "sha256-qi4G08yA21iKsTGR8qBlYp36xflW2UqNYlCjn+vRfLc=", - "owner": "oh-my-fish", - "repo": "theme-agnoster", - "rev": "1ffca413bfbc8941c28982eea97c1e1fa3612d57", - "type": "github" - }, - "original": { - "owner": "oh-my-fish", - "repo": "theme-agnoster", - "type": "github" - } - }, - "fish-theme-dangerous": { - "flake": false, - "locked": { - "lastModified": 1547694252, - "narHash": "sha256-OnbS1X/FQaEyVIlgR7YOJlAUu3bgnm2UWk5vm80Cvvc=", - "owner": "oh-my-fish", - "repo": "theme-dangerous", - "rev": "3cdfc82060ba280b44f1f0c6616675f36a275467", - "type": "github" - }, - "original": { - "owner": "oh-my-fish", - "repo": "theme-dangerous", - "type": "github" - } - }, - "fish-theme-harleen": { - "flake": false, - "locked": { - "lastModified": 1631660209, - "narHash": "sha256-DHGjy7UGzy+vuzHrw49KP0nePKvx7sMMMrPj2mbGoJA=", - "owner": "aneveux", - "repo": "theme-harleen", - "rev": "caf53d792038e78faa7b6b6b98669abc171c5e64", - "type": "github" - }, - "original": { - "owner": "aneveux", - "repo": "theme-harleen", - "type": "github" - } - }, "flake-compat": { "flake": false, "locked": { @@ -332,22 +236,6 @@ "type": "github" } }, - "githubNvimTheme": { - "flake": false, - "locked": { - "lastModified": 1645953701, - "narHash": "sha256-FZGmcsc0GWW32gEvcBkJh+oFPjRamsFTRJd8VTAf5QY=", - "owner": "projekt0n", - "repo": "github-nvim-theme", - "rev": "4ad832edd70be94af43fd3f21065e73987b4176e", - "type": "github" - }, - "original": { - "owner": "projekt0n", - "repo": "github-nvim-theme", - "type": "github" - } - }, "hashable": { "flake": false, "locked": { @@ -729,38 +617,6 @@ "type": "github" } }, - "nvim-plugin-agda": { - "flake": false, - "locked": { - "lastModified": 1642289590, - "narHash": "sha256-c7UjrVbfaagIJS7iGdjWiFlpLUDHGc0I3ZGoUPECL00=", - "owner": "isti115", - "repo": "agda.nvim", - "rev": "c7da627547e978b4ac3780af1b8f418c8b12ff98", - "type": "github" - }, - "original": { - "owner": "isti115", - "repo": "agda.nvim", - "type": "github" - } - }, - "nvim-plugin-idris2": { - "flake": false, - "locked": { - "lastModified": 1645883550, - "narHash": "sha256-paIQIUdEOHkJaKWf7TS523VFBmRtmnguM0+gM7Sm9vg=", - "owner": "ShinKage", - "repo": "idris2-nvim", - "rev": "011b932079cd10e674821020b36e717998c1d3d3", - "type": "github" - }, - "original": { - "owner": "ShinKage", - "repo": "idris2-nvim", - "type": "github" - } - }, "odf": { "flake": false, "locked": { @@ -777,22 +633,6 @@ "type": "github" } }, - "oh-my-fish": { - "flake": false, - "locked": { - "lastModified": 1646778488, - "narHash": "sha256-7mBxP5F81U+V0ahrsXL0vGPivTbKMnqYE5vgG/IOBe8=", - "owner": "oh-my-fish", - "repo": "oh-my-fish", - "rev": "ab05441000531d0bc9aaea23b8d4db59b2828a31", - "type": "github" - }, - "original": { - "owner": "oh-my-fish", - "repo": "oh-my-fish", - "type": "github" - } - }, "pretty-show": { "flake": false, "locked": { @@ -859,13 +699,6 @@ }, "root": { "inputs": { - "easy-dhall-nix": "easy-dhall-nix", - "easy-purescript-nix": "easy-purescript-nix", - "fish-plugin-z": "fish-plugin-z", - "fish-theme-agnoster": "fish-theme-agnoster", - "fish-theme-dangerous": "fish-theme-dangerous", - "fish-theme-harleen": "fish-theme-harleen", - "githubNvimTheme": "githubNvimTheme", "home-manager": "home-manager", "idris2-pkgs": "idris2-pkgs", "kmonad": "kmonad", @@ -873,30 +706,7 @@ "nixos-unstable": "nixos-unstable", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable", - "nvim-plugin-agda": "nvim-plugin-agda", - "nvim-plugin-idris2": "nvim-plugin-idris2", - "oh-my-fish": "oh-my-fish", - "sddm-theme-chili": "sddm-theme-chili", - "telescope-file-browser-nvim": "telescope-file-browser-nvim", - "vim-extra-plugins": "vim-extra-plugins", - "vim-plugin-arpeggio": "vim-plugin-arpeggio", - "vim-plugin-kmonad": "vim-plugin-kmonad" - } - }, - "sddm-theme-chili": { - "flake": false, - "locked": { - "lastModified": 1535340922, - "narHash": "sha256-wxWsdRGC59YzDcSopDRzxg8TfjjmA3LHrdWjepTuzgw=", - "owner": "MarianArlt", - "repo": "sddm-chili", - "rev": "6516d50176c3b34df29003726ef9708813d06271", - "type": "github" - }, - "original": { - "owner": "MarianArlt", - "repo": "sddm-chili", - "type": "github" + "vim-extra-plugins": "vim-extra-plugins" } }, "snocvect": { @@ -947,22 +757,6 @@ "type": "github" } }, - "telescope-file-browser-nvim": { - "flake": false, - "locked": { - "lastModified": 1645182018, - "narHash": "sha256-MFKjdmO0KnZWodUeaXrJExM+j6kplDl9HzHwNfJabOc=", - "owner": "nvim-telescope", - "repo": "telescope-file-browser.nvim", - "rev": "d06fe1d4ade68ba17739025e55e941f9e977d37c", - "type": "github" - }, - "original": { - "owner": "nvim-telescope", - "repo": "telescope-file-browser.nvim", - "type": "github" - } - }, "vim-extra-plugins": { "inputs": { "flake-compat": "flake-compat_2", @@ -983,38 +777,6 @@ "type": "github" } }, - "vim-plugin-arpeggio": { - "flake": false, - "locked": { - "lastModified": 1597883245, - "narHash": "sha256-volgKWr1mNwmvOQQEw7feBztmpDVyPJG1n+OI8L1BRA=", - "owner": "kana", - "repo": "vim-arpeggio", - "rev": "01c8fc1a72ef58e490ee0490c65ee313b1b6e843", - "type": "github" - }, - "original": { - "owner": "kana", - "repo": "vim-arpeggio", - "type": "github" - } - }, - "vim-plugin-kmonad": { - "flake": false, - "locked": { - "lastModified": 1647812451, - "narHash": "sha256-7PKVOsb3jvuGEnP/LsrDr96wFSQMou2dgnV+hRaI444=", - "owner": "kmonad", - "repo": "kmonad-vim", - "rev": "37978445197ab00edeb5b731e9ca90c2b141723f", - "type": "github" - }, - "original": { - "owner": "kmonad", - "repo": "kmonad-vim", - "type": "github" - } - }, "xml": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index 16b8a6b..4621fb0 100644 --- a/flake.nix +++ b/flake.nix @@ -29,82 +29,6 @@ }; vim-extra-plugins.url = "github:m15a/nixpkgs-vim-extra-plugins"; - - # Plugin which enables me to create chords (aka keybinds where everything must be set at the same time) - vim-plugin-arpeggio = { - url = "github:kana/vim-arpeggio"; - flake = false; - }; - - vim-plugin-kmonad = { - url = "github:kmonad/kmonad-vim"; - flake = false; - }; - - nvim-plugin-agda = { - url = "github:isti115/agda.nvim"; - flake = false; - }; - - nvim-plugin-idris2 = { - url = "github:ShinKage/idris2-nvim"; - flake = false; - }; - - # Create / delete files within telescope - telescope-file-browser-nvim = { - url = "github:nvim-telescope/telescope-file-browser.nvim"; - flake = false; - }; - - # Github inspired theme for a bunch of stuff - githubNvimTheme = { - url = "github:projekt0n/github-nvim-theme"; - flake = false; - }; - - #### Purescript stuff - easy-dhall-nix = { - url = "github:justinwoo/easy-dhall-nix"; - flake = false; - }; - - easy-purescript-nix = { - url = "github:justinwoo/easy-purescript-nix"; - flake = false; - }; - - #### Fish stuff - fish-plugin-z = { - url = "github:jethrokuan/z"; - flake = false; - }; - - fish-theme-agnoster = { - url = "github:oh-my-fish/theme-agnoster"; - flake = false; - }; - - fish-theme-harleen = { - url = "github:aneveux/theme-harleen"; - flake = false; - }; - - fish-theme-dangerous = { - url = "github:oh-my-fish/theme-dangerous"; - flake = false; - }; - - oh-my-fish = { - url = "github:oh-my-fish/oh-my-fish"; - flake = false; - }; - - #### Other github stuff - sddm-theme-chili = { - url = "github:MarianArlt/sddm-chili"; - flake = false; - }; }; outputs = inputs@{ self, nixpkgs, ... }: diff --git a/modules/applications/neovim.nix b/modules/applications/neovim.nix index 9476390..35072bd 100644 --- a/modules/applications/neovim.nix +++ b/modules/applications/neovim.nix @@ -88,7 +88,7 @@ in nui-nvim # ui lib required by idris plugin idris2-nvim # idris2 support lean-nvim # lean support - kmonad-vim # support for the kmonad config language + kmonad # support for the kmonad config language lh-vim-lib # dependency for lh-brackets lh-brackets # bracket customization diff --git a/modules/foreign.nix b/modules/foreign.nix new file mode 100644 index 0000000..e63dc8c --- /dev/null +++ b/modules/foreign.nix @@ -0,0 +1,104 @@ +{ fetchFromGitHub, ... }: { + vimPlugins = { + kmonad = fetchFromGitHub { + owner = "kmonad"; + repo = "kmonad-vim"; + rev = "37978445197ab00edeb5b731e9ca90c2b141723f"; + sha256 = "13p3i0b8azkmhafyv8hc4hav1pmgqg52xzvk2a3gp3ppqqx9bwpc"; + }; + + arpeggio = fetchFromGitHub { + owner = "kana"; + repo = "vim-arpeggio"; + rev = "37978445197ab00edeb5b731e9ca90c2b141723f"; + sha256 = "13p3i0b8azkmhafyv8hc4hav1pmgqg52xzvk2a3gp3ppqqx9bwpc"; + }; + + agda-nvim = fetchFromGitHub { + owner = "Isti115"; + repo = "agda.nvim"; + rev = "c7da627547e978b4ac3780af1b8f418c8b12ff98"; + sha256 = "0k9g0bqm1a4ivl4cs6f780nnjnc8svc1kqif4l4ahsfzasnj7dbk"; + }; + + idris2-nvim = fetchFromGitHub { + owner = "ShinKage"; + repo = "idris2-nvim"; + rev = "fdc47ba6f0e9d15c2754ee98b6455acad0fa7c95"; + sha256 = "1kzbgmxpywpinrjdrb4crxwlk3jlck3yia2wbl0rq7xwfga663g4"; + }; + + telescope-file-browser-nvim = fetchFromGitHub { + owner = "nvim-telescope"; + repo = "telescope-file-browser.nvim"; + rev = "ee355b83e00475e11dec82e3ea166f846a392018"; + sha256 = "1s39si5fifv6bvjk8kzs2zy18ap5q22pfqg68wn5icnp588498hz"; + }; + }; + fishPlugins = { + z = fetchFromGitHub { + owner = "jethrokuan"; + repo = "z"; + rev = "85f863f20f24faf675827fb00f3a4e15c7838d76"; + sha256 = "1kaa0k9d535jnvy8vnyxd869jgs0ky6yg55ac1mxcxm8n0rh2mgq"; + }; + + themes = { + agnoster = fetchFromGitHub { + owner = "oh-my-fish"; + repo = "theme-agnoster"; + rev = "1ffca413bfbc8941c28982eea97c1e1fa3612d57"; + sha256 = "1dvws7mrz8shca6lmnanz72zm7b2cnhg549in655inw0rk9hcbma"; + }; + + harleen = fetchFromGitHub { + owner = "aneveux"; + repo = "theme-harleen"; + rev = "caf53d792038e78faa7b6b6b98669abc171c5e64"; + sha256 = "1450qrkdmqxk686c7vpimcydwj9z9a7w7sripfpjzkq6np5s6w8c"; + }; + + dangerous = fetchFromGitHub { + owner = "oh-my-fish"; + repo = "theme-dangerous"; + rev = "3cdfc82060ba280b44f1f0c6616675f36a275467"; + sha256 = "1xxy0b6rnvsfbaa6v7p0fsxi8l161sv4fq49ahra2hf5gzax4xis"; + }; + }; + + oh-my-fish = fetchFromGitHub { + owner = "oh-my-fish"; + repo = "oh-my-fish"; + rev = "d428b723c8c18fef3b2a00b8b8b731177f483ad8"; + sha256 = "0n5a8v9kn4xmmi7app6c4wvpjfv6b3vhj7rhljaf9vny8cl2vhls"; + }; + }; + + sddm-theme-chili = fetchFromGitHub { + owner = "MarianArlt"; + repo = "sddm-chili"; + rev = "6516d50176c3b34df29003726ef9708813d06271"; + sha256 = "036fxsa7m8ymmp3p40z671z163y6fcsa9a641lrxdrw225ssq5f3"; + }; + + easy-dhall-nix = fetchFromGitHub { + owner = "justinwoo"; + repo = "easy-dhall-nix"; + rev = "dce9acbb99776a7f1344db4751d6080380f76f57"; + sha256 = "0ckp6515gfvbxm08yyll87d9vg8sq2l21gwav2npzvwc3xz2lccf"; + }; + + easy-purescript-nix = fetchFromGitHub { + owner = "justinwoo"; + repo = "easy-purescript-nix"; + rev = "0ad5775c1e80cdd952527db2da969982e39ff592"; + sha256 = "0x53ads5v8zqsk4r1mfpzf5913byifdpv5shnvxpgw634ifyj1kg"; + }; + + githubNvimTheme = fetchFromGitHub { + owner = "projekt0n"; + repo = "github-nvim-theme"; + rev = "eeac2e7b2832d8de9a21cfa8627835304c96bb44"; + sha256 = "1rfxif39y42amkz772976l14dnsa9ybi2dpkaqbdz7zvwgwm545m"; + }; +} diff --git a/modules/overlays/flakes.nix b/modules/overlays/flakes.nix index a4df394..c9a4342 100644 --- a/modules/overlays/flakes.nix +++ b/modules/overlays/flakes.nix @@ -1,41 +1,19 @@ { system }: { home-manager - # nixos stuff , nixpkgs , nixpkgs-unstable , nixos-unstable - - # easy-* -, easy-purescript-nix -, easy-dhall-nix - - # fish plugins -, fish-plugin-z -, fish-theme-harleen -, fish-theme-agnoster -, fish-theme-dangerous - -, oh-my-fish -, githubNvimTheme - - # vim plugins -, vim-plugin-arpeggio -, vim-plugin-kmonad - - # nvim plugins -, nvim-plugin-agda -, nvim-plugin-idris2 - -, telescope-file-browser-nvim # TODO: rename this one -, sddm-theme-chili , ... }: self: super: -# installs a vim plugin from git with a given tag / branch -let plugin = name: src: self.vimUtils.buildVimPluginFrom2Nix { - inherit name; - inherit src; -}; +let + foreign = self.callPackage (import ../foreign.nix) { }; + + # installs a vim plugin from git with a given tag / branch + plugin = name: src: self.vimUtils.buildVimPluginFrom2Nix { + inherit name; + inherit src; + }; in { unstable = import nixpkgs-unstable { @@ -44,30 +22,30 @@ in config.allowBroken = true; }; - easy-purescript-nix = self.callPackage easy-purescript-nix { }; - easy-dhall-nix = self.callPackage easy-dhall-nix { }; + easy-purescript-nix = self.callPackage foreign.easy-purescript-nix { }; + easy-dhall-nix = self.callPackage foreign.easy-dhall-nix { }; myFishPlugins = { - inherit oh-my-fish; + oh-my-fish = foreign.fishPlugins.oh-my-fish; z = { - src = fish-plugin-z; + src = foreign.fishPlugins.z; name = "z"; }; themes = { agnoster = { - src = fish-theme-agnoster; + src = foreign.fishPlugins.themes.agnoster; name = "agnoster"; }; dangerous = { - src = fish-theme-dangerous; + src = foreign.fishPlugins.themes.dangerous; name = "dangerous"; }; harleen = { - src = fish-theme-harleen; + src = foreign.fishPlugins.themes.harleen; name = "harleen"; }; }; @@ -76,21 +54,19 @@ in # Vim plugins myVimPlugins = { - githubNvimTheme = githubNvimTheme; + githubNvimTheme = foreign.githubNvimTheme; - telescope-file-browser-nvim = plugin "file_browser" telescope-file-browser-nvim; - agda-nvim = plugin "agda" nvim-plugin-agda; - idris2-nvim = plugin "idris" nvim-plugin-idris2; - arpeggio = plugin "arpeggio" vim-plugin-arpeggio; - kmonad-vim = plugin "kmonad-vim" vim-plugin-kmonad; + telescope-file-browser-nvim = plugin "file_browser" + foreign.vimPlugins.telescope-file-browser-nvim; + agda-nvim = plugin "agda" + foreign.vimPlugins.agda-nvim; + idris2-nvim = plugin "idris" + foreign.vimPlugins.idris2-nvim; + arpeggio = plugin "arpeggio" + foreign.vimPlugins.arpeggio; + kmonad = plugin "kmonad-vim" + foreign.vimPlugins.kmonad; }; - # a = fetchFromGitHub { - # repo = "kmonad-vim"; - # owner = "kmonad"; - # rev = ""; - # sha256 = ""; - # }; - - sddm-theme-chili = sddm-theme-chili; + sddm-theme-chili = foreign.sddm-theme-chili; }