Merge remote-tracking branch 'origin/nixos' into nixos

This commit is contained in:
Moritz Böhme 2023-03-02 15:16:33 +01:00
commit 9db80c9673
Signed by: moritz
GPG key ID: 970C6E89EB0547A9
8 changed files with 220 additions and 97 deletions

View file

@ -82,6 +82,22 @@
"type": "github" "type": "github"
} }
}, },
"copilot-lua": {
"flake": false,
"locked": {
"lastModified": 1677479736,
"narHash": "sha256-n/SCrzzzL5WUHJk0sCXbgGusk/dQuy8DI9Pqdh+lVeQ=",
"owner": "zbirenbaum",
"repo": "copilot.lua",
"rev": "b41d4c9c7d4f5e0272bcf94061b88e244904c56f",
"type": "github"
},
"original": {
"owner": "zbirenbaum",
"repo": "copilot.lua",
"type": "github"
}
},
"crane": { "crane": {
"inputs": { "inputs": {
"flake-compat": [ "flake-compat": [
@ -496,6 +512,22 @@
"type": "github" "type": "github"
} }
}, },
"lspsaga-nvim": {
"flake": false,
"locked": {
"lastModified": 1677497543,
"narHash": "sha256-xFba/hXqc0qyJH9Hd9XtXteXIqjJnIgYIy8Y5l9QPQQ=",
"owner": "glepnir",
"repo": "lspsaga.nvim",
"rev": "291629b704ba8fdd0134ef4204fb118050bca363",
"type": "github"
},
"original": {
"owner": "glepnir",
"repo": "lspsaga.nvim",
"type": "github"
}
},
"master": { "master": {
"locked": { "locked": {
"lastModified": 1677259386, "lastModified": 1677259386,
@ -813,6 +845,7 @@
"arkenfox-userjs": "arkenfox-userjs", "arkenfox-userjs": "arkenfox-userjs",
"asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver", "asus-touchpad-numpad-driver": "asus-touchpad-numpad-driver",
"attic": "attic", "attic": "attic",
"copilot-lua": "copilot-lua",
"emacs": "emacs", "emacs": "emacs",
"flake-utils": "flake-utils_3", "flake-utils": "flake-utils_3",
"forgit-git": "forgit-git", "forgit-git": "forgit-git",
@ -821,6 +854,7 @@
"hypr-contrib": "hypr-contrib", "hypr-contrib": "hypr-contrib",
"hyprland": "hyprland", "hyprland": "hyprland",
"hyprpaper": "hyprpaper", "hyprpaper": "hyprpaper",
"lspsaga-nvim": "lspsaga-nvim",
"master": "master", "master": "master",
"neovim": "neovim", "neovim": "neovim",
"nil": "nil", "nil": "nil",

View file

@ -77,6 +77,16 @@
flake = false; flake = false;
}; };
copilot-lua = {
url = "github:zbirenbaum/copilot.lua";
flake = false;
};
lspsaga-nvim = {
url = "github:glepnir/lspsaga.nvim";
flake = false;
};
attic = { attic = {
url = "github:zhaofengli/attic"; url = "github:zhaofengli/attic";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";

View file

@ -48,6 +48,7 @@ in
grep = "rg"; grep = "rg";
rm = "rm -i"; rm = "rm -i";
mv = "mv -i"; mv = "mv -i";
cd = "z";
nixos-switch = nom-system-command "sudo nixos-rebuild switch --flake ~/.dotfiles"; nixos-switch = nom-system-command "sudo nixos-rebuild switch --flake ~/.dotfiles";
nixos-boot = nom-system-command "sudo nixos-rebuild boot --flake ~/.dotfiles"; nixos-boot = nom-system-command "sudo nixos-rebuild boot --flake ~/.dotfiles";
@ -137,6 +138,7 @@ in
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
home-manager.enable = true; home-manager.enable = true;
fzf.enable = true; fzf.enable = true;
zoxide.enable = true;
}; };
home = { home = {
username = "moritz"; username = "moritz";

View file

@ -15,6 +15,24 @@ in
home-manager.users.moritz.programs.direnv = { home-manager.users.moritz.programs.direnv = {
enable = true; enable = true;
nix-direnv.enable = true; nix-direnv.enable = true;
stdlib = ''
layout_poetry() {
if [[ ! -f pyproject.toml ]]; then
log_error 'No pyproject.toml found. Use `poetry new` or `poetry init` to create one first.'
exit 2
fi
local VENV=$(poetry env info --path)
if [[ -z $VENV || ! -d $VENV/bin ]]; then
log_error 'No poetry virtual environment found. Use `poetry install` to create one first.'
exit 2
fi
export VIRTUAL_ENV=$VENV
export POETRY_ACTIVE=1
PATH_add "$VENV/bin"
}
'';
}; };
}; };
} }

View file

@ -137,12 +137,13 @@ in
# Emacs # Emacs
windowrulev2 = opaque, class:^emacs$ windowrulev2 = opaque, class:^emacs$
# Fullscreen Applications # Fullscreen Applications
# ${mkRules ["opaque" "noblur" "noborder" "noshadow" "forceinput"] ["fullscreen:1"]} ${mkRules ["opaque" "noblur" "noborder" "noshadow" "forceinput"] ["fullscreen:1"]}
${mkRules ["opaque" "noblur" "noshadow"] ["class:^jetbrains-pycharm$"]} ${mkRules ["opaque" "noblur" "noshadow"] ["class:^jetbrains-pycharm$"]}
${mkRules ["tile" "opaque"] ["class:^neovide$"]}
# See https://wiki.hyprland.org/Configuring/Keywords/ for more # See https://wiki.hyprland.org/Configuring/Keywords/ for more
$mainMod = SUPER $mainMod = SUPER
$windowMod = ALT $windowMod = ALT

View file

@ -8,26 +8,6 @@
with lib; with lib;
let let
cfg = config.my.programs.vim; cfg = config.my.programs.vim;
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
mkVersionInput = input: mkDate (input.lastModifiedDate or "19700101") + "_" + (input.shortRev or "dirty");
nvim-treesitter-textsubjects = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-treesitter-textsubjects";
version = mkVersionInput inputs.nvim-treesitter-textsubjects;
src = inputs.nvim-treesitter-textsubjects;
};
smartcolumn-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
pname = "smartcolumn-nvim";
version = mkVersionInput inputs.smartcolumn-nvim;
src = inputs.smartcolumn-nvim;
};
in in
{ {
options.my.programs.vim = { options.my.programs.vim = {
@ -39,7 +19,16 @@ in
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
home-manager.users.moritz.programs.neovim = { home-manager.users.moritz = {
home.packages = with pkgs; [
(
if config.my.programs.hyprland.enable
then neovide-hyprland
else neovide
)
];
programs.neovim = {
enable = true; enable = true;
package = pkgs.neovim-nightly; package = pkgs.neovim-nightly;
vimAlias = true; vimAlias = true;
@ -51,6 +40,7 @@ in
alejandra alejandra
black black
isort isort
jq
nil nil
nixpkgs-fmt nixpkgs-fmt
rustfmt rustfmt
@ -68,10 +58,12 @@ in
copilot-cmp copilot-cmp
copilot-lua copilot-lua
dashboard-nvim dashboard-nvim
direnv-vim
formatter-nvim formatter-nvim
gitsigns-nvim gitsigns-nvim
lsp_lines-nvim lsp_lines-nvim
lspkind-nvim lspkind-nvim
lspsaga-nvim-original
lualine-lsp-progress lualine-lsp-progress
lualine-nvim lualine-nvim
luasnip luasnip
@ -90,12 +82,15 @@ in
nvim-web-devicons # for dashboard-nvim nvim-web-devicons # for dashboard-nvim
orgmode orgmode
plenary-nvim # for telescope, neogit plenary-nvim # for telescope, neogit
popup-nvim
smartcolumn-nvim smartcolumn-nvim
telescope-fzf-native-nvim telescope-fzf-native-nvim
telescope-nvim telescope-nvim
telescope-zoxide
vim-lion vim-lion
which-key-nvim which-key-nvim
]; ];
}; };
}; };
};
} }

View file

@ -12,7 +12,6 @@ vim.opt.backupdir = { vim.fn.stdpath("state") .. "/nvim/backup//" } -- don't sto
vim.opt.clipboard = "unnamedplus" -- sync with system clipboard vim.opt.clipboard = "unnamedplus" -- sync with system clipboard
vim.opt.conceallevel = 2 vim.opt.conceallevel = 2
vim.opt.expandtab = true -- spaces instead of tabs vim.opt.expandtab = true -- spaces instead of tabs
vim.opt.guifont = "Fira Code Nerd Font:h1"
vim.opt.ignorecase = true vim.opt.ignorecase = true
vim.opt.mouse = "a" -- mouse for all modes vim.opt.mouse = "a" -- mouse for all modes
vim.opt.number = true vim.opt.number = true
@ -33,6 +32,11 @@ vim.opt.updatetime = 300
vim.opt_local.spell = true vim.opt_local.spell = true
vim.opt_local.spelllang = { "en", "de_20" } -- all English regions and new German spelling vim.opt_local.spelllang = { "en", "de_20" } -- all English regions and new German spelling
if vim.g.neovide then
vim.opt.guifont = "Fira Code Nerd Font:h10"
vim.g.neovide_scale_factor = 0.7
end
require("catppuccin").setup({ require("catppuccin").setup({
compile_path = vim.fn.stdpath("cache") .. "/catppuccin", -- fix issue of writing to nix store compile_path = vim.fn.stdpath("cache") .. "/catppuccin", -- fix issue of writing to nix store
integrations = { integrations = {
@ -67,10 +71,13 @@ require("noice").setup({
}, },
}) })
require("telescope").load_extension("zoxide")
wk.register({ wk.register({
f = { f = {
name = "find", name = "find",
f = { "<cmd>Telescope find_files<cr>", "find file" }, f = { "<cmd>Telescope find_files<cr>", "find file" },
z = { "<cmd>Telescope zoxide list<cr>", "find location" },
l = { "<cmd>Telescope current_buffer_fuzzy_find<cr>", "find line" },
g = { "<cmd>Telescope live_grep<cr>", "live grep" }, g = { "<cmd>Telescope live_grep<cr>", "live grep" },
b = { "<cmd>Telescope buffers<cr>", "find buffer" }, b = { "<cmd>Telescope buffers<cr>", "find buffer" },
}, },
@ -186,11 +193,10 @@ require("formatter").setup({
log_level = vim.log.levels.WARN, log_level = vim.log.levels.WARN,
-- All formatter configurations are opt-in -- All formatter configurations are opt-in
filetype = { filetype = {
-- Formatter configurations for filetype "lua" go here json = {
-- and will be executed in order require("formatter.filetypes.json").jq,
},
lua = { lua = {
-- "formatter.filetypes.lua" defines default configurations for the
-- "lua" filetype
require("formatter.filetypes.lua").stylua, require("formatter.filetypes.lua").stylua,
}, },
nix = { nix = {
@ -259,18 +265,25 @@ vim.diagnostic.config({
-- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers.. -- The nvim-cmp almost supports LSP's capabilities so You should advertise it to LSP servers..
local capabilities = require("cmp_nvim_lsp").default_capabilities() local capabilities = require("cmp_nvim_lsp").default_capabilities()
require("lspsaga").setup({
symbol_in_winbar = {
enable = false,
},
})
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
local on_attach_def = function(_, bufnr) local on_attach_def = function(_, bufnr)
wk.register({ wk.register({
K = { vim.lsp.buf.hover, "show info" }, K = { "<cmd>Lspsaga hover_doc ++quiet<cr>", "show info" },
["<leader>"] = { ["<leader>"] = {
l = { l = {
name = "lsp", name = "lsp",
d = { vim.diagnostic.open_float, "open diagnostic window" }, d = { "<cmd>Lspsaga show_cursor_diagnostics<cr>", "open diagnostic window" },
n = { vim.diagnostic.goto_next, "next error" }, n = { "<cmd>Lspsaga diagnostic_jump_next<CR>", "next error" },
p = { vim.diagnostic.goto_prev, "prev error" }, p = { "<cmd>Lspsaga diagnostic_jump_prev<CR>", "prev error" },
c = { vim.lsp.buf.code_action, "code action" }, c = { "<cmd>Lspsaga code_action<cr>", "code action" },
r = { vim.lsp.buf.rename, "rename" }, r = { "<cmd>Lspsaga rename<cr>", "rename" },
i = { "<cmd>Lspsaga hover_doc ++keep<cr>", "show info (sticky)" },
f = { f = {
function() function()
vim.lsp.buf.format({ async = true }) vim.lsp.buf.format({ async = true })
@ -297,11 +310,9 @@ local on_attach_def = function(_, bufnr)
}, },
g = { g = {
name = "goto", name = "goto",
r = { vim.lsp.buf.references, "references" }, d = { "<cmd>Lspsaga peek_definition<cr>", "definition" },
d = { vim.lsp.buf.definition, "definition" }, t = { "<cmd>Lspsaga peek_type_definition<cr>", "type defininition" },
D = { vim.lsp.buf.declaration, "declaration" }, h = { "<cmd>Lspsaga lsp_finder<CR>", "lsp finder" },
i = { vim.lsp.buf.implementation, "implementation" },
t = { vim.lsp.buf.type_definition, "type defininition" },
}, },
}, { buffer = bufnr, silent = true }) }, { buffer = bufnr, silent = true })
end end
@ -323,7 +334,7 @@ local function lspconfig_setup(lsp, options)
lspconfig[lsp].setup(final_options) lspconfig[lsp].setup(final_options)
end end
local servers = { "nil_ls", "pylsp", "rust_analyzer" } local servers = { "nil_ls", "pylsp", "rust_analyzer", "ruff_lsp" }
for _, lsp in ipairs(servers) do for _, lsp in ipairs(servers) do
lspconfig_setup(lsp, {}) lspconfig_setup(lsp, {})
end end
@ -360,7 +371,7 @@ lspconfig_setup("lua_ls", {
require("dashboard").setup({ require("dashboard").setup({
theme = "hyper", theme = "hyper",
config = { config = {
packages = { enable = true }, packages = { enable = false },
week_header = { week_header = {
enable = true, enable = true,
}, },
@ -434,6 +445,10 @@ require("copilot").setup({
suggestion = { enabled = false }, suggestion = { enabled = false },
panel = { enabled = false }, panel = { enabled = false },
}) })
vim.api.nvim_create_autocmd("VimEnter", {
desc = "Disable Copilot by default on startup",
command = "Copilot disable",
})
require("copilot_cmp").setup() require("copilot_cmp").setup()
local orgmode = require("orgmode") local orgmode = require("orgmode")
@ -478,4 +493,5 @@ wk.register({
require("smartcolumn").setup({ require("smartcolumn").setup({
colorcolumn = 120, colorcolumn = 120,
disabled_filetypes = { "help", "text", "markdown", "dashboard" },
}) })

View file

@ -1,4 +1,14 @@
{ inputs }: final: prev: { { inputs }: final: prev:
let
mkDate = longDate: (prev.lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
mkVersionSrc = src: "unstable-" + builtins.substring 0 7 src.rev;
mkVersionInput = input: "unstable-" + mkDate (input.lastModifiedDate or "19700101") + "_" + (input.shortRev or "dirty");
in
{
agenix = inputs.agenix.packages.${prev.system}.default; agenix = inputs.agenix.packages.${prev.system}.default;
attic = inputs.attic.packages.${prev.system}.default; attic = inputs.attic.packages.${prev.system}.default;
hyprpaper = inputs.hyprpaper.packages.${prev.system}.default; hyprpaper = inputs.hyprpaper.packages.${prev.system}.default;
@ -23,6 +33,43 @@
mesonFlags = old.mesonFlags or [ ] ++ [ "-Dexperimental=true" ]; mesonFlags = old.mesonFlags or [ ] ++ [ "-Dexperimental=true" ];
}); });
vimPlugins = prev.vimPlugins // {
nvim-treesitter-textsubjects = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "nvim-treesitter-textsubjects";
version = mkVersionInput inputs.nvim-treesitter-textsubjects;
src = inputs.nvim-treesitter-textsubjects;
};
smartcolumn-nvim = prev.vimUtils.buildVimPluginFrom2Nix {
pname = "smartcolumn-nvim";
version = mkVersionInput inputs.smartcolumn-nvim;
src = inputs.smartcolumn-nvim;
};
copilot-lua = prev.vimPlugins.copilot-lua.overrideAttrs (old: {
version = mkVersionInput inputs.copilot-lua;
src = inputs.copilot-lua;
});
lspsaga-nvim-original = prev.vimPlugins.lspsaga-nvim-original.overrideAttrs (old: {
version = mkVersionInput inputs.lspsaga-nvim;
src = inputs.lspsaga-nvim;
});
};
neovide-hyprland = final.symlinkJoin {
name = "neovide-hyprland-${final.neovide.version}";
paths = [ final.neovide ];
nativeBuildInputs = [ final.makeWrapper ];
postBuild = ''
rm $out/bin/neovide
makeWrapper ${final.neovide}/bin/neovide $out/bin/neovide --set WINIT_UNIX_BACKEND x11
'';
meta = final.neovide.meta // {
mainProgram = "neovide";
};
};
master = import inputs.master { master = import inputs.master {
inherit (prev) system; inherit (prev) system;
config.allowUnfree = true; config.allowUnfree = true;