mirror of
https://mzte.de/git/LordMZTE/dotfiles.git
synced 2024-06-14 09:18:50 +02:00
Compare commits
4 commits
869b7fe7f6
...
101dbc7181
Author | SHA1 | Date | |
---|---|---|---|
LordMZTE | 101dbc7181 | ||
LordMZTE | acf4abc8ba | ||
LordMZTE | 73b009dd51 | ||
LordMZTE | bbabdab552 |
|
@ -24,7 +24,10 @@ cg.onDone(function(errors)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local nix = (loadfile "cgnix/nix.lua" or function() return {} end)()
|
local nix = (loadfile "nix/cgnix/nix.lua" or function()
|
||||||
|
print "no cgnix file!"
|
||||||
|
return {}
|
||||||
|
end)()
|
||||||
|
|
||||||
cg.opt.nix = nix
|
cg.opt.nix = nix
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1711703276,
|
"lastModified": 1712791164,
|
||||||
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=",
|
"narHash": "sha256-3sbWO1mbpWsLepZGbWaMovSO7ndZeFqDSdX0hZ9nVyw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089",
|
"rev": "1042fd8b148a9105f3c0aca3a6177fd1d9360ba5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
68
flake.nix
68
flake.nix
|
@ -8,7 +8,8 @@
|
||||||
{ self
|
{ self
|
||||||
, nixpkgs
|
, nixpkgs
|
||||||
, utils
|
, utils
|
||||||
}: utils.lib.eachDefaultSystem
|
, ...
|
||||||
|
}@inputs: utils.lib.eachDefaultSystem
|
||||||
(system:
|
(system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { inherit system; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
@ -17,8 +18,10 @@
|
||||||
|
|
||||||
root-mod = {
|
root-mod = {
|
||||||
options.packages = nixpkgs.lib.mkOption { };
|
options.packages = nixpkgs.lib.mkOption { };
|
||||||
|
options.dev-shells = nixpkgs.lib.mkOption { };
|
||||||
|
|
||||||
config._module.args = {
|
config._module.args = {
|
||||||
|
inherit inputs;
|
||||||
inherit pkgs system;
|
inherit pkgs system;
|
||||||
inherit (pkgs) lib stdenv;
|
inherit (pkgs) lib stdenv;
|
||||||
};
|
};
|
||||||
|
@ -32,44 +35,47 @@
|
||||||
(flakePkg "github:nix-community/zon2nix")
|
(flakePkg "github:nix-community/zon2nix")
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# devshell for the dotfiles
|
||||||
|
config.dev-shells.default = nixpkgs.legacyPackages.${system}.mkShell {
|
||||||
|
buildInputs = with pkgs;
|
||||||
|
[
|
||||||
|
# packages required to build scripts
|
||||||
|
libGL
|
||||||
|
libgit2
|
||||||
|
luajit
|
||||||
|
pkg-config
|
||||||
|
racket
|
||||||
|
roswell
|
||||||
|
wayland
|
||||||
|
wayland-protocols
|
||||||
|
haxe
|
||||||
|
mpv-unwrapped
|
||||||
|
] ++
|
||||||
|
# shorthands for setup.rkt
|
||||||
|
builtins.map
|
||||||
|
(cmd: pkgs.writeShellScriptBin cmd ''
|
||||||
|
./setup.rkt ${cmd}
|
||||||
|
'') [
|
||||||
|
"install-scripts"
|
||||||
|
"install-plugins"
|
||||||
|
"install-lsps-paru"
|
||||||
|
"setup-nvim-config"
|
||||||
|
"setup-nix"
|
||||||
|
"run-confgen"
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
modopt = nixpkgs.lib.evalModules {
|
modopt = nixpkgs.lib.evalModules {
|
||||||
modules = [ root-mod ./cgnix ] ++ common.localconf;
|
modules = [ root-mod ./nix ] ++ common.localconf;
|
||||||
specialArgs = { inherit common; };
|
specialArgs = { inherit common; };
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
config = modopt;
|
||||||
mzteinit = pkgs.callPackage ./scripts/mzteinit/package.nix { };
|
mzteinit = pkgs.callPackage ./scripts/mzteinit/package.nix { };
|
||||||
packages = modopt.config.packages;
|
packages = modopt.config.packages;
|
||||||
|
devShells = modopt.config.dev-shells;
|
||||||
devShells.default = nixpkgs.legacyPackages.${system}.mkShell {
|
|
||||||
buildInputs = with pkgs;
|
|
||||||
[
|
|
||||||
# packages required to build scripts
|
|
||||||
libGL
|
|
||||||
libgit2
|
|
||||||
luajit
|
|
||||||
pkg-config
|
|
||||||
racket
|
|
||||||
roswell
|
|
||||||
wayland
|
|
||||||
wayland-protocols
|
|
||||||
haxe
|
|
||||||
mpv-unwrapped
|
|
||||||
] ++
|
|
||||||
# shorthands for setup.rkt
|
|
||||||
builtins.map
|
|
||||||
(cmd: pkgs.writeShellScriptBin cmd ''
|
|
||||||
./setup.rkt ${cmd}
|
|
||||||
'') [
|
|
||||||
"install-scripts"
|
|
||||||
"install-plugins"
|
|
||||||
"install-lsps-paru"
|
|
||||||
"setup-nvim-config"
|
|
||||||
"setup-nix"
|
|
||||||
"run-confgen"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
const cg_opt = try common.confgenGet(struct {
|
const cg_opt = try common.confgenGet(struct {
|
||||||
term_font: []u8, // TODO: this being non-const is a workaround for an std bug
|
term_font: []u8, // TODO: this being non-const is a workaround for an std bug
|
||||||
nix: struct {
|
nix: struct {
|
||||||
|
nvim_plugins: ?[:0]u8 = null,
|
||||||
tree_sitter_parsers: ?[:0]u8 = null,
|
tree_sitter_parsers: ?[:0]u8 = null,
|
||||||
nvim_tools: ?[:0]u8 = null,
|
nvim_tools: ?[:0]u8 = null,
|
||||||
jvm: ?[:0]u8 = null,
|
jvm: ?[:0]u8 = null,
|
||||||
|
@ -31,6 +32,7 @@ pub fn build(b: *std.Build) !void {
|
||||||
|
|
||||||
const opts = b.addOptions();
|
const opts = b.addOptions();
|
||||||
opts.addOption([]const u8, "font", cg_opt.term_font);
|
opts.addOption([]const u8, "font", cg_opt.term_font);
|
||||||
|
opts.addOption(?[:0]const u8, "nvim_plugins", cg_opt.nix.nvim_plugins);
|
||||||
opts.addOption(?[:0]const u8, "tree_sitter_parsers", cg_opt.nix.tree_sitter_parsers);
|
opts.addOption(?[:0]const u8, "tree_sitter_parsers", cg_opt.nix.tree_sitter_parsers);
|
||||||
opts.addOption(?[:0]const u8, "nvim_tools", cg_opt.nix.nvim_tools);
|
opts.addOption(?[:0]const u8, "nvim_tools", cg_opt.nix.nvim_tools);
|
||||||
opts.addOption(?[:0]const u8, "jvm", cg_opt.nix.jvm);
|
opts.addOption(?[:0]const u8, "jvm", cg_opt.nix.jvm);
|
||||||
|
|
|
@ -30,10 +30,7 @@
|
||||||
(nmap :<C-k> vim.lsp.buf.signature_help)
|
(nmap :<C-k> vim.lsp.buf.signature_help)
|
||||||
(nmap :<space>e vim.diagnostic.open_float)
|
(nmap :<space>e vim.diagnostic.open_float)
|
||||||
|
|
||||||
(nmap :K (fn []
|
(nmap :K vim.lsp.buf.hover)
|
||||||
(if ((. (require :conjure.client) :get))
|
|
||||||
((. (require :conjure.eval) :doc-word))
|
|
||||||
(vim.lsp.buf.hover))))
|
|
||||||
|
|
||||||
;; command to stop LSPs
|
;; command to stop LSPs
|
||||||
(vim.api.nvim_create_user_command :StopLsps
|
(vim.api.nvim_create_user_command :StopLsps
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
(values (require :cmp) (require :luasnip) (require :mzte_nv)))
|
(values (require :cmp) (require :luasnip) (require :mzte_nv)))
|
||||||
|
|
||||||
(local sources {:buffer " "
|
(local sources {:buffer " "
|
||||||
:conjure " "
|
|
||||||
:crates " "
|
:crates " "
|
||||||
:luasnip " "
|
:luasnip " "
|
||||||
:nvim_lsp " "
|
:nvim_lsp " "
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
;; Blame conjure for this BS config
|
|
||||||
;; NOTE: this is ran before conjure initialization
|
|
||||||
|
|
||||||
;; Disable auto-attach
|
|
||||||
(tset vim :g "conjure#client_on_load" false)
|
|
||||||
|
|
||||||
(tset vim :g "conjure#mapping#prefix" :<F1>)
|
|
||||||
|
|
||||||
;; Only enable used clients
|
|
||||||
(tset vim :g "conjure#filetypes" [:clojure
|
|
||||||
:commonlisp
|
|
||||||
:fennel
|
|
||||||
:scheme
|
|
||||||
:lua
|
|
||||||
:lisp
|
|
||||||
:python])
|
|
||||||
|
|
||||||
(tset vim :g "conjure#filetype#rust" false)
|
|
||||||
(tset vim :g "conjure#filetype#racket" false)
|
|
||||||
(tset vim :g "conjure#filetype#commonlisp" "conjure.client.common-lisp.swank")
|
|
||||||
|
|
||||||
;; This has custom handling for compat with LSP
|
|
||||||
(tset vim :g "conjure#mapping#doc_word" false)
|
|
4
mzte-nv/conf/lua/pluginconf/p-dressing.fnl
Normal file
4
mzte-nv/conf/lua/pluginconf/p-dressing.fnl
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
(local dressing (require :dressing))
|
||||||
|
|
||||||
|
(dressing.setup {;; Provided by noice
|
||||||
|
:input {:enabled false}})
|
|
@ -10,8 +10,8 @@ local t = ls.text_node
|
||||||
local fmt = require("luasnip.extras.fmt").fmt
|
local fmt = require("luasnip.extras.fmt").fmt
|
||||||
local rep = require("luasnip.extras").rep
|
local rep = require("luasnip.extras").rep
|
||||||
|
|
||||||
require("luasnip.loaders.from_vscode").load()
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
require("luasnip.loaders.from_snipmate").load()
|
require("luasnip.loaders.from_snipmate").lazy_load()
|
||||||
|
|
||||||
ls.add_snippets("markdown", {
|
ls.add_snippets("markdown", {
|
||||||
s("shrug", {
|
s("shrug", {
|
||||||
|
|
|
@ -7,16 +7,5 @@
|
||||||
:ignore false}
|
:ignore false}
|
||||||
:renderer {:indent_markers {:enable true} :group_empty true}})
|
:renderer {:indent_markers {:enable true} :group_empty true}})
|
||||||
|
|
||||||
;; open on startup
|
|
||||||
(fn on-enter [data]
|
|
||||||
(local is-no-name (and (= data.file "") (= (. vim :bo data.buf :buftype) "")))
|
|
||||||
(local is-dir (= (vim.fn.isdirectory data.file) 1))
|
|
||||||
(when is-dir
|
|
||||||
(vim.cmd.cd data.file))
|
|
||||||
(when (or is-no-name is-dir)
|
|
||||||
((. (require :nvim-tree.api) :tree :open))))
|
|
||||||
|
|
||||||
(vim.api.nvim_create_autocmd [:VimEnter] {:callback on-enter})
|
|
||||||
|
|
||||||
(vim.keymap.set :n :TT #((. (require :nvim-tree.api) :tree :toggle))
|
(vim.keymap.set :n :TT #((. (require :nvim-tree.api) :tree :toggle))
|
||||||
(. (require :mzte_nv) :utils :map_opt))
|
(. (require :mzte_nv) :utils :map_opt))
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
(tset opt k v))
|
(tset opt k v))
|
||||||
`(do
|
`(do
|
||||||
(nmap ,(.. :g suffix) ,action ,opt)
|
(nmap ,(.. :g suffix) ,action ,opt)
|
||||||
(nmap ,(.. :gt suffix) ,action
|
(nmap ,(.. :gn suffix) ,action
|
||||||
,(doto (collect [k v (pairs opt)] k v)
|
,(doto (collect [k v (pairs opt)] k v)
|
||||||
(tset :jump_type :tab)))
|
(tset :jump_type :tab)))
|
||||||
(nmap ,(.. :gs suffix) ,action
|
(nmap ,(.. :gs suffix) ,action
|
||||||
|
|
|
@ -1,98 +1,62 @@
|
||||||
(vim.cmd "packadd packer.nvim")
|
(local mztenv (require :mzte_nv))
|
||||||
|
|
||||||
(local packer (require :packer))
|
(tset mztenv.reg :plugin_load_callbacks [])
|
||||||
|
|
||||||
(macro pconf [plugin]
|
(let [path mztenv.reg.nvim_plugins]
|
||||||
`#(require ,(.. :pluginconf.p- plugin)))
|
(when path
|
||||||
|
(vim.opt.runtimepath:prepend (.. path "/*"))
|
||||||
|
(vim.opt.runtimepath:append (.. path "/*/after"))))
|
||||||
|
|
||||||
(fn use/mztegit [plugin opts]
|
;; Plugins to load before nvim finishes startup
|
||||||
(let [url (.. "https://git.mzte.de/nvim-plugins/" plugin)
|
(local startup-plugins [])
|
||||||
opt (or opts {})]
|
|
||||||
(tset opt 1 url)
|
|
||||||
(packer.use opt)))
|
|
||||||
|
|
||||||
(macro use/pconf [plugin conf]
|
;; Plugins to load in the background
|
||||||
`(use/mztegit ,plugin {:config (pconf ,conf)}))
|
(local deferred-plugins [:lspconf
|
||||||
|
:cmp
|
||||||
|
:luasnip
|
||||||
|
:nullls
|
||||||
|
:catppuccin
|
||||||
|
:line
|
||||||
|
:treesitter
|
||||||
|
:nvimtree
|
||||||
|
:devicons
|
||||||
|
:neogit
|
||||||
|
:telescope
|
||||||
|
:autopairs
|
||||||
|
:tterm
|
||||||
|
:ts-context
|
||||||
|
:ufo
|
||||||
|
:aerial
|
||||||
|
:dap
|
||||||
|
:harpoon
|
||||||
|
:recorder
|
||||||
|
:noice
|
||||||
|
:tsn-actions
|
||||||
|
:lightbulb
|
||||||
|
:dressing])
|
||||||
|
|
||||||
(macro use/pconf [plugin conf extra]
|
(local errors {})
|
||||||
(var c {:config `(pconf ,conf)})
|
|
||||||
(each [k v (pairs (or extra {}))]
|
|
||||||
(tset c k v))
|
|
||||||
`(use/mztegit ,plugin ,c))
|
|
||||||
|
|
||||||
(fn cmp-plugins []
|
(fn load-plugin [plugin]
|
||||||
(use/pconf :nvim-lspconfig :lspconf)
|
(let [(success ret) (pcall require (.. :pluginconf/p- plugin))]
|
||||||
(use/pconf :nvim-cmp :cmp)
|
(when (not success)
|
||||||
(use/mztegit :cmp-nvim-lsp)
|
(tset errors p ret))))
|
||||||
(use/mztegit :cmp-buffer)
|
|
||||||
(use/mztegit :cmp-path)
|
|
||||||
(use/mztegit :cmp-cmdline)
|
|
||||||
(use/mztegit :cmp_luasnip)
|
|
||||||
(use/mztegit :friendly-snippets)
|
|
||||||
(use/pconf :LuaSnip :luasnip)
|
|
||||||
(use/mztegit :crates.nvim {:config #((. (require :crates) :setup) {})})
|
|
||||||
(use/mztegit :cmp-treesitter)
|
|
||||||
(use/pconf :null-ls.nvim :nullls)
|
|
||||||
(use/mztegit :nvim-nu
|
|
||||||
{:config #((. (require :nu) :setup) {:complete_cmd_names true})})
|
|
||||||
(use/mztegit :cmp-conjure))
|
|
||||||
|
|
||||||
(fn init []
|
(each [_ p (ipairs startup-plugins)]
|
||||||
(use/mztegit :packer.nvim)
|
(load-plugin p))
|
||||||
(use/mztegit :plenary.nvim)
|
|
||||||
(use/pconf :catppuccin :catppuccin)
|
|
||||||
(use/mztegit :gitsigns.nvim {:config #((. (require :gitsigns) :setup) {})})
|
|
||||||
(use/mztegit :vim-fish)
|
|
||||||
(use/pconf :lualine.nvim :line {:after :catppuccin})
|
|
||||||
(use/pconf :nvim-treesitter :treesitter)
|
|
||||||
(use/pconf :nvim-web-devicons :devicons)
|
|
||||||
(use/pconf :nvim-tree.lua :nvimtree)
|
|
||||||
(use/pconf :neogit :neogit)
|
|
||||||
(use/pconf :telescope.nvim :telescope)
|
|
||||||
(use/pconf :nvim-autopairs :autopairs)
|
|
||||||
(use/mztegit :nvim-ts-autotag)
|
|
||||||
(use/mztegit :rainbow-delimiters.nvim)
|
|
||||||
(use/pconf :toggleterm.nvim :tterm)
|
|
||||||
(use/mztegit :wgsl.vim)
|
|
||||||
(use/mztegit :nvim-notify)
|
|
||||||
;; TODO: remove once noice gets support for ui.select
|
|
||||||
(use/mztegit :dressing.nvim
|
|
||||||
{:config #((. (require :dressing) :setup) {:input ;; Provided by noice
|
|
||||||
{:enabled false}})})
|
|
||||||
(use/pconf :nvim-treesitter-context :ts-context)
|
|
||||||
(use/mztegit :crafttweaker-vim-highlighting)
|
|
||||||
(use/mztegit :nvim-jdtls)
|
|
||||||
(use/mztegit :promise-async)
|
|
||||||
(use/pconf :nvim-ufo :ufo {:after :nvim-lspconfig})
|
|
||||||
(use/pconf :aerial.nvim :aerial)
|
|
||||||
(use/mztegit :nvim-nio) ;; dep of dap-ui
|
|
||||||
(use/mztegit :nvim-dap-ui)
|
|
||||||
(use/pconf :nvim-dap :dap)
|
|
||||||
(use/pconf :harpoon :harpoon)
|
|
||||||
(use/pconf :nvim-recorder :recorder)
|
|
||||||
(use/mztegit :nui.nvim)
|
|
||||||
(use/pconf :noice.nvim :noice)
|
|
||||||
(use/mztegit :vaxe)
|
|
||||||
(use/pconf :ts-node-action :tsn-actions)
|
|
||||||
(use/mztegit :playground)
|
|
||||||
(use/mztegit :conjure {:setup (pconf :conjure)})
|
|
||||||
(use/pconf :nvim-lightbulb :lightbulb)
|
|
||||||
(cmp-plugins))
|
|
||||||
|
|
||||||
(packer.startup init)
|
(fn load-one-deferred [idx]
|
||||||
|
(let [plugin (. deferred-plugins idx)]
|
||||||
|
(if plugin
|
||||||
|
(do
|
||||||
|
(load-plugin plugin)
|
||||||
|
(vim.schedule #(load-one-deferred (+ idx 1))))
|
||||||
|
(do
|
||||||
|
(when (next errors)
|
||||||
|
(vim.notify (accumulate [text "Errors loading plugin configs:\n" plugin err (pairs errors)]
|
||||||
|
(.. text " - " plugin ": " err))
|
||||||
|
vim.log.levels.error))
|
||||||
|
(each [_ cb (ipairs mztenv.reg.plugin_load_callbacks)]
|
||||||
|
(pcall cb))))))
|
||||||
|
|
||||||
;; PackerCompile automagically
|
(vim.schedule #(load-one-deferred 1))
|
||||||
(when (= 0 (length (vim.api.nvim_get_runtime_file :plugin/packer_compiled.lua
|
|
||||||
false)))
|
|
||||||
(packer.compile))
|
|
||||||
|
|
||||||
;; actually compile packer-generated config after packer's "compile" step
|
|
||||||
(fn compile-packer-generated []
|
|
||||||
(let [mztenv (require :mzte_nv)
|
|
||||||
packer (require :packer)]
|
|
||||||
(mztenv.compile.compilePath packer.config.compile_path)))
|
|
||||||
|
|
||||||
(vim.api.nvim_create_autocmd :User
|
|
||||||
{:pattern :PackerCompileDone
|
|
||||||
:once true
|
|
||||||
:callback compile-packer-generated})
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ fn lOnInit(l: *c.lua_State) !c_int {
|
||||||
|
|
||||||
c.lua_getfield(l, c.LUA_REGISTRYINDEX, reg_key);
|
c.lua_getfield(l, c.LUA_REGISTRYINDEX, reg_key);
|
||||||
defer c.lua_pop(l, 1);
|
defer c.lua_pop(l, 1);
|
||||||
inline for (.{ "tree_sitter_parsers", "nvim_tools" }) |fname| {
|
inline for (.{ "nvim_plugins", "tree_sitter_parsers", "nvim_tools" }) |fname| {
|
||||||
if (@field(opts, fname)) |x| {
|
if (@field(opts, fname)) |x| {
|
||||||
ffi.luaPushString(l, x);
|
ffi.luaPushString(l, x);
|
||||||
c.lua_setfield(l, -2, fname);
|
c.lua_setfield(l, -2, fname);
|
||||||
|
|
|
@ -48,7 +48,11 @@ fn lPathTransformerClosure(l: *c.lua_State) !c_int {
|
||||||
fn transformJdtlsURI(uri_str: []const u8, writer: anytype) !void {
|
fn transformJdtlsURI(uri_str: []const u8, writer: anytype) !void {
|
||||||
// We do a full-on URI parse here because JDTLS often appends parameters and other garbage data.
|
// We do a full-on URI parse here because JDTLS often appends parameters and other garbage data.
|
||||||
const uri = try std.Uri.parse(uri_str);
|
const uri = try std.Uri.parse(uri_str);
|
||||||
var fname_iter = std.fs.path.ComponentIterator(.posix, u8).init(uri.path) catch
|
var fname_iter = std.fs.path.ComponentIterator(.posix, u8).init(
|
||||||
|
switch (uri.path) {
|
||||||
|
inline else => |s| s,
|
||||||
|
},
|
||||||
|
) catch
|
||||||
unreachable; // this can only error on windows lol
|
unreachable; // this can only error on windows lol
|
||||||
|
|
||||||
_ = fname_iter.next() orelse return error.InvalidPath; // name of the JAR
|
_ = fname_iter.next() orelse return error.InvalidPath; // name of the JAR
|
||||||
|
|
0
cgnix/.gitignore → nix/cgnix/.gitignore
vendored
0
cgnix/.gitignore → nix/cgnix/.gitignore
vendored
|
@ -6,6 +6,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./jvm.nix
|
./jvm.nix
|
||||||
|
./nvim-plugins.nix
|
||||||
./nvim-tools.nix
|
./nvim-tools.nix
|
||||||
./tree-sitter-parsers.nix
|
./tree-sitter-parsers.nix
|
||||||
];
|
];
|
108
nix/cgnix/nvim-plugins.nix
Normal file
108
nix/cgnix/nvim-plugins.nix
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
{ config, pkgs, lib, stdenv, ... }:
|
||||||
|
let
|
||||||
|
plugin = name: fetchGit { url = "https://git.mzte.de/nvim-plugins/${name}.git"; };
|
||||||
|
|
||||||
|
plugins = {
|
||||||
|
# LSP
|
||||||
|
"20-lspconfig" = plugin "nvim-lspconfig";
|
||||||
|
"20-nullls" = plugin "null-ls.nvim";
|
||||||
|
"20-jdtls" = plugin "nvim-jdtls";
|
||||||
|
|
||||||
|
# CMP
|
||||||
|
"45-cmp" = plugin "nvim-cmp";
|
||||||
|
"50-cmp-nvim-lsp" = plugin "cmp-nvim-lsp";
|
||||||
|
"50-cmp-buffer" = plugin "cmp-buffer";
|
||||||
|
"50-cmp-path" = plugin "cmp-path";
|
||||||
|
"50-cmp-cmdline" = plugin "cmp-cmdline";
|
||||||
|
"50-cmp-luasnip" = plugin "cmp_luasnip";
|
||||||
|
"50-friendly-snippets" = plugin "friendly-snippets";
|
||||||
|
"50-luasnip" = plugin "LuaSnip";
|
||||||
|
"50-cmp-treesitter" = plugin "cmp-treesitter";
|
||||||
|
|
||||||
|
# Treesitter
|
||||||
|
"30-treesitter" = plugin "nvim-treesitter";
|
||||||
|
"30-autopairs" = plugin "nvim-autopairs";
|
||||||
|
"30-ts-autotag" = plugin "nvim-ts-autotag";
|
||||||
|
"30-ts-context" = plugin "nvim-treesitter-context";
|
||||||
|
"30-tsn-actions" = plugin "ts-node-action";
|
||||||
|
"30-ts-playground" = plugin "playground";
|
||||||
|
|
||||||
|
# Language Support
|
||||||
|
"30-fish" = plugin "vim-fish";
|
||||||
|
"30-wgsl" = plugin "wgsl.vim";
|
||||||
|
"30-nu" = plugin "nvim-nu";
|
||||||
|
"30-crafttweaker" = plugin "crafttweaker-vim-highlighting";
|
||||||
|
"30-vaxe" = plugin "vaxe";
|
||||||
|
|
||||||
|
# Misc
|
||||||
|
"50-catppuccin" = plugin "catppuccin";
|
||||||
|
"50-gitsigns" = plugin "gitsigns.nvim";
|
||||||
|
"50-lualine" = plugin "lualine.nvim";
|
||||||
|
"50-tree" = plugin "nvim-tree.lua";
|
||||||
|
"50-neogit" = fetchGit { url = "https://git.mzte.de/nvim-plugins/neogit.git?rev=nightly"; };
|
||||||
|
"50-telescope" = plugin "telescope.nvim";
|
||||||
|
"50-toggleterm" = plugin "toggleterm.nvim";
|
||||||
|
"50-notify" = plugin "nvim-notify";
|
||||||
|
"50-dressing" = plugin "dressing.nvim"; # TODO: remove once noice gets support for ui.select
|
||||||
|
"50-ufo" = plugin "nvim-ufo";
|
||||||
|
"50-aerial" = plugin "aerial.nvim";
|
||||||
|
"50-dap" = plugin "nvim-dap";
|
||||||
|
"50-dapui" = plugin "nvim-dap-ui";
|
||||||
|
"50-harpoon" = plugin "harpoon";
|
||||||
|
"50-recorder" = plugin "nvim-recorder";
|
||||||
|
"50-noice" = plugin "noice.nvim";
|
||||||
|
"50-lightbulb" = plugin "nvim-lightbulb";
|
||||||
|
|
||||||
|
# Libraries
|
||||||
|
"10-plenary" = plugin "plenary.nvim";
|
||||||
|
"10-devicons" = plugin "nvim-web-devicons";
|
||||||
|
"10-promise-async" = plugin "promise-async";
|
||||||
|
"10-nio" = plugin "nvim-nio";
|
||||||
|
"10-nui" = plugin "nui.nvim";
|
||||||
|
};
|
||||||
|
|
||||||
|
mzte-nv-compiler =
|
||||||
|
let
|
||||||
|
path = "${builtins.getEnv "HOME"}/.local/bin/mzte-nv-compile";
|
||||||
|
in
|
||||||
|
if (builtins.pathExists path) then
|
||||||
|
# This derivation exists to patch a potentially mismatched dynamic linker.
|
||||||
|
stdenv.mkDerivation
|
||||||
|
{
|
||||||
|
name = "mzte-nv-compiler-patched";
|
||||||
|
nativeBuildInputs = [ pkgs.autoPatchelfHook ];
|
||||||
|
buildInputs = with pkgs; [ luajit ];
|
||||||
|
dontUnpack = true;
|
||||||
|
buildPhase = ''
|
||||||
|
cp ${/. + path} $out
|
||||||
|
'';
|
||||||
|
} else "";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.cgnix.nvim-plugins = lib.mkOption { };
|
||||||
|
config.cgnix.nvim-plugins = plugins;
|
||||||
|
|
||||||
|
config.cgnix.entries.nvim_plugins = pkgs.linkFarm "nvim-plugins"
|
||||||
|
(lib.mapAttrsToList
|
||||||
|
(name: src: {
|
||||||
|
name = name;
|
||||||
|
path = stdenv.mkDerivation {
|
||||||
|
name = "${name}-compiled";
|
||||||
|
inherit src;
|
||||||
|
|
||||||
|
nativeBuildInputs = with pkgs; [ luajit luajitPackages.fennel ];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
# Compile source with mzte-nv-compile
|
||||||
|
${if mzte-nv-compiler != "" then "${mzte-nv-compiler} ." else ""}
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p "$out"
|
||||||
|
mv * .* "$out"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
})
|
||||||
|
config.cgnix.nvim-plugins
|
||||||
|
);
|
||||||
|
}
|
7
nix/default.nix
Normal file
7
nix/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./cgnix
|
||||||
|
./mcdev.nix
|
||||||
|
];
|
||||||
|
}
|
37
nix/mcdev.nix
Normal file
37
nix/mcdev.nix
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# A dev shell for Minecraft development, including necessary dependencies for the game to run.
|
||||||
|
|
||||||
|
{ pkgs, ... }:
|
||||||
|
let
|
||||||
|
libs = with pkgs; [
|
||||||
|
libpulseaudio
|
||||||
|
libGL
|
||||||
|
glfw
|
||||||
|
openal
|
||||||
|
stdenv.cc.cc.lib
|
||||||
|
udev # OSHI
|
||||||
|
];
|
||||||
|
xorg-libs = with pkgs.xorg; [
|
||||||
|
libX11
|
||||||
|
libXext
|
||||||
|
libXcursor
|
||||||
|
libXrandr
|
||||||
|
libXxf86vm
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
dev-shells = builtins.mapAttrs
|
||||||
|
(_: extra-pkgs:
|
||||||
|
let
|
||||||
|
shpgks = libs ++ xorg-libs ++ extra-pkgs;
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
shellHook = ''
|
||||||
|
export LD_LIBRARY_PATH="${pkgs.addOpenGLRunpath.driverLink}/lib:${pkgs.lib.makeLibraryPath shpgks}:$LD_LIBRARY_PATH"
|
||||||
|
'';
|
||||||
|
buildInputs = shpgks;
|
||||||
|
})
|
||||||
|
{
|
||||||
|
mcdev = [ pkgs.jdk8 ];
|
||||||
|
mcdev-new = [ pkgs.jdk17 ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -19,22 +19,24 @@ pub fn main() !u8 {
|
||||||
var env = try std.process.getEnvMap(alloc);
|
var env = try std.process.getEnvMap(alloc);
|
||||||
defer env.deinit();
|
defer env.deinit();
|
||||||
|
|
||||||
|
const jvm_basepath = opts.jvm orelse "/usr/lib/jvm";
|
||||||
|
|
||||||
if (env.getPtr("PATH")) |path_p| {
|
if (env.getPtr("PATH")) |path_p| {
|
||||||
const newpath = try std.fmt.allocPrint(
|
const newpath = try std.fmt.allocPrint(
|
||||||
alloc,
|
alloc,
|
||||||
(opts.jvm orelse "/usr/lib/jvm") ++ "/{s}/bin:{s}",
|
jvm_basepath ++ "/{s}/bin:{s}",
|
||||||
.{ std.os.argv[1], path_p.* },
|
.{ std.os.argv[1], path_p.* },
|
||||||
);
|
);
|
||||||
alloc.free(path_p.*);
|
alloc.free(path_p.*);
|
||||||
path_p.* = newpath;
|
path_p.* = newpath;
|
||||||
} else {
|
} else {
|
||||||
const newpath = try std.fmt.allocPrint(alloc, "/usr/lib/jvm/{s}/bin", .{std.os.argv[1]});
|
const newpath = try std.fmt.allocPrint(alloc, jvm_basepath ++ "/{s}/bin", .{std.os.argv[1]});
|
||||||
errdefer alloc.free(newpath);
|
errdefer alloc.free(newpath);
|
||||||
try env.putMove(try alloc.dupe(u8, "PATH"), newpath);
|
try env.putMove(try alloc.dupe(u8, "PATH"), newpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
const java_home = try std.fmt.allocPrint(alloc, "/usr/lib/jvm/{s}", .{std.os.argv[1]});
|
const java_home = try std.fmt.allocPrint(alloc, jvm_basepath ++ "/{s}", .{std.os.argv[1]});
|
||||||
errdefer alloc.free(java_home);
|
errdefer alloc.free(java_home);
|
||||||
try env.putMove(try alloc.dupe(u8, "JAVA_HOME"), java_home);
|
try env.putMove(try alloc.dupe(u8, "JAVA_HOME"), java_home);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
(define (run)
|
(define (run)
|
||||||
(define out (build-path (find-system-path 'home-dir) ".local" "mzte-nix"))
|
(define out (build-path (find-system-path 'home-dir) ".local" "mzte-nix"))
|
||||||
(cmd "nix" "build" ".#mzte-nix" "--impure" "--out-link" out)
|
(cmd "nix" "build" ".#mzte-nix" "--impure" "--out-link" out)
|
||||||
(cmd "nix" "build" ".#cgnix" "--impure" "--out-link" "cgnix/nix.lua"))
|
(cmd "nix" "build" ".#cgnix" "--impure" "--out-link" "nix/cgnix/nix.lua"))
|
||||||
|
|
Loading…
Reference in a new issue