lots of changes, damn so much, mostly neovim

This commit is contained in:
CherryKitten 2024-03-24 19:02:22 +01:00
parent ee7d831347
commit 87be395fcc
Signed by: sammy
GPG key ID: 98D8F75FB0658276
15 changed files with 394 additions and 217 deletions

View file

@ -6,17 +6,25 @@
url = "github:nix-community/home-manager/release-23.11"; url = "github:nix-community/home-manager/release-23.11";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
}; };
outputs = inputs@{ self, nixpkgs, nixpkgs-unstable, home-manager, ... }: outputs = inputs @ {
let self,
nixpkgs,
nixpkgs-unstable,
home-manager,
...
}: let
mkHost = hostname: graphical: { mkHost = hostname: graphical: {
imports = [ imports = [
./hosts/${hostname}/configuration.nix ./hosts/${hostname}/configuration.nix
./modules/common ./modules/common
(import "${home-manager}/nixos") (import "${home-manager}/nixos")
(if graphical then ./modules/graphical else null) (
if graphical
then ./modules/graphical
else null
)
]; ];
deployment = { deployment = {
@ -25,9 +33,8 @@
allowLocalDeployment = true; allowLocalDeployment = true;
}; };
}; };
in in {
{ formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
colmena = { colmena = {
meta = { meta = {
nixpkgs = import nixpkgs { nixpkgs = import nixpkgs {
@ -37,7 +44,6 @@
}; };
bengal = mkHost "bengal" true; bengal = mkHost "bengal" true;
}; };
}; };
} }

View file

@ -1,96 +1,25 @@
# Edit this configuration file to define what should be installed on # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on # your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). # https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, ... }:
{ {
imports = config,
[ lib,
pkgs,
...
}: {
imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
]; ];
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
networking.hostName = "bengal"; # Define your hostname. networking.hostName = "bengal";
# Pick only one of the below networking options. networking.networkmanager.enable = true;
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
time.timeZone = "Europe/Berlin";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = lib.mkForce "de";
useXkbConfig = true; # use xkb.options in tty.
};
# Enable the X11 windowing system.
services.xserver.enable = true;
services.xserver.displayManager.sddm.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
services.xserver.libinput.enable = true;
services.xserver.xkb.layout = "de";
services.xserver.xkb.options = "caps:escape";
# Enable CUPS to print documents.
services.printing.enable = true; services.printing.enable = true;
# Enable sound.
# sound.enable = true;
hardware.pulseaudio.enable = true; hardware.pulseaudio.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
curl
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh.enable = true;
# Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ 22 ];
nix.extraOptions =
''
experimental-features = nix-command flakes
'';
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment? system.stateVersion = "23.11"; # Did you read the comment?
} }

View file

@ -1,11 +1,14 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
imports = config,
[ lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
]; ];
@ -14,22 +17,19 @@
boot.kernelModules = ["kvm-amd"]; boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = []; boot.extraModulePackages = [];
fileSystems."/" = fileSystems."/" = {
{
device = "/dev/disk/by-uuid/7a713df7-7027-4ae6-b1a3-839dda62dcbc"; device = "/dev/disk/by-uuid/7a713df7-7027-4ae6-b1a3-839dda62dcbc";
fsType = "btrfs"; fsType = "btrfs";
}; };
boot.initrd.luks.devices."root".device = "/dev/disk/by-uuid/fbd8d597-8cdb-4c6b-9fa0-b05f4cbfce86"; boot.initrd.luks.devices."root".device = "/dev/disk/by-uuid/fbd8d597-8cdb-4c6b-9fa0-b05f4cbfce86";
fileSystems."/boot" = fileSystems."/boot" = {
{
device = "/dev/disk/by-uuid/B4A7-702B"; device = "/dev/disk/by-uuid/B4A7-702B";
fsType = "vfat"; fsType = "vfat";
}; };
swapDevices = swapDevices = [{device = "/dev/disk/by-uuid/8cca600e-735e-4486-92e3-01ff6c0b7599";}];
[{ device = "/dev/disk/by-uuid/8cca600e-735e-4486-92e3-01ff6c0b7599"; }];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View file

@ -1,4 +1,9 @@
{ lib, config, pkgs, ... }: { {
lib,
config,
pkgs,
...
}: {
imports = [ imports = [
../../users ../../users
./home.nix ./home.nix
@ -6,9 +11,35 @@
]; ];
nix.settings.experimental-features = ["nix-command" "flakes"]; nix.settings.experimental-features = ["nix-command" "flakes"];
services.openssh.enable = true;
networking.firewall.allowedTCPPorts = [22];
time.timeZone = "Europe/Berlin"; time.timeZone = "Europe/Berlin";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = lib.mkForce "de";
useXkbConfig = true; # use xkb.options in tty.
};
fonts = {
enableDefaultFonts = true;
packages = with pkgs; [
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
monaspace
nerdfonts
];
fontconfig = {
defaultFonts.emoji = ["Noto Emoji"];
defaultFonts.serif = ["Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSans Nerd Font"];
defaultFonts.sansSerif = ["Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font" "NotoSerif Nerd Font"];
defaultFonts.monospace = ["Monaspace Xenon" "FiraCode Nerd Font" "Hack Nerd Font"];
};
};
# Packages used on all systems # Packages used on all systems
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
git git
@ -17,7 +48,4 @@
pinentry pinentry
wget wget
]; ];
} }

View file

@ -1,9 +1,12 @@
{ lib, config, pkgs, ... }: { {
lib,
config,
pkgs,
...
}: {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.users.sammy = { home-manager.users.sammy = {
imports = [ ./neovim.nix ]; imports = [./nvim];
home.username = "sammy"; home.username = "sammy";
home.homeDirectory = "/home/sammy"; home.homeDirectory = "/home/sammy";
home.stateVersion = "23.11"; # Please read the comment before changing. home.stateVersion = "23.11"; # Please read the comment before changing.
@ -12,6 +15,7 @@
lsd lsd
gnupg gnupg
kitty kitty
tmux
]; ];
programs = { programs = {
@ -28,7 +32,6 @@
core = {editor = "nvim";}; core = {editor = "nvim";};
pull.rebase = true; pull.rebase = true;
}; };
}; };
nushell = { nushell = {

View file

@ -1,62 +0,0 @@
{ config, pkgs, inputs, ... }:
{
programs.neovim =
let
toLua = str: "lua << EOF\n${str}\nEOF\n";
toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n";
in
{
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
extraPackages = with pkgs; [
lua-language-server
rnix-lsp
xclip
wl-clipboard
];
plugins = with pkgs.vimPlugins; [
{
plugin = comment-nvim;
config = toLua "require(\"Comment\").setup()";
}
{
plugin = catppuccin-nvim;
config = "colorscheme catppuccin";
}
{ plugin = which-key-nvim;
config = toLua "require(\"which-key\").setup()";
}
nvim-cmp
neodev-nvim
cmp_luasnip
cmp-nvim-lsp
luasnip
friendly-snippets
lualine-nvim
nvim-web-devicons
vim-nix
];
extraLuaConfig = ''
${builtins.readFile ./nvim/options.lua}
${builtins.readFile ./nvim/keymap.lua}
'';
};
}

View file

@ -0,0 +1,101 @@
{
config,
pkgs,
inputs,
...
}: {
programs.neovim = let
toLua = str: "lua << EOF\n${str}\nEOF\n";
toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n";
in {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
extraPackages = with pkgs; [
lua-language-server
rnix-lsp
xclip
wl-clipboard
rustfmt
black
isort
alejandra
prettierd
codespell
stylua
];
plugins = with pkgs.vimPlugins; [
plenary-nvim
persistence-nvim
nvim-web-devicons
nui-nvim
{
plugin = comment-nvim;
config = toLua "require(\"Comment\").setup()";
}
{
plugin = catppuccin-nvim;
config = "colorscheme catppuccin";
}
{
plugin = which-key-nvim;
config = toLua "require(\"which-key\").setup()";
}
{
plugin = neo-tree-nvim;
config = toLuaFile ./plugins/neo-tree.lua;
}
{
plugin = conform-nvim;
config = toLuaFile ./plugins/conform.lua;
}
{
plugin = dressing-nvim;
config = toLua "require(\"dressing\").setup()";
}
{
plugin = bufferline-nvim;
config = toLua "require(\"bufferline\").setup()";
}
{
plugin = lualine-nvim;
config = toLua "require(\"lualine\").setup()";
}
{
plugin = indent-blankline-nvim;
config = toLua "require(\"ibl\").setup()";
}
{
plugin = noice-nvim;
config = toLuaFile ./plugins/noice.lua;
}
{
plugin = dashboard-nvim;
config = toLuaFile ./plugins/dashboard.lua;
}
nvim-notify
vim-nix
];
extraLuaConfig = ''
${builtins.readFile ./options.lua}
${builtins.readFile ./keymap.lua}
'';
};
}

View file

@ -67,3 +67,28 @@ map("n", "<leader><tab>]", "<cmd>tabnext<cr>", { desc = "Next Tab" })
map("n", "<leader><tab>d", "<cmd>tabclose<cr>", { desc = "Close Tab" }) map("n", "<leader><tab>d", "<cmd>tabclose<cr>", { desc = "Close Tab" })
map("n", "<leader><tab>[", "<cmd>tabprevious<cr>", { desc = "Previous Tab" }) map("n", "<leader><tab>[", "<cmd>tabprevious<cr>", { desc = "Previous Tab" })
-- NeoTree
map("n", "<leader>fe",
function()
require("neo-tree.command").execute({ toggle = true, dir = vim.loop.cwd() })
end, { desc = "NeoTree" }
)
map("n", "<leader>e", "<leader>fe", { desc = "NeoTree", remap = true })
map("n", "<leader>ge",
function()
require("neo-tree.command").execute({ source = "git_status", toggle = true })
end, { desc = "Git explorer" }
)
map("n", "<leader>be",
function()
require("neo-tree.command").execute({ source = "buffers", toggle = true })
end, { desc = "Buffer explorer" }
)
map({"n", "v"}, "<leader>cf",
function()
require("conform").format()
end, { desc = "Format Code" }
)

View file

@ -0,0 +1,12 @@
require("conform").setup({
formatters_by_ft = {
lua = { "stylua" },
python = { "isort", "black" },
javascript = { "prettier" },
rust = { "rustfmt" },
nix = { "alejandra" },
["*"] = { "codespell" },
},
log_level = vim.log.levels.ERROR,
notify_on_error = true,
})

View file

@ -0,0 +1,32 @@
local logo = [[
Nyanyanyanyanyanyanyanyanyanyanyanyanyanyanyanyanyanya
]]
logo = string.rep("\n", 8) .. logo .. "\n\n"
require("dashboard").setup({
theme = "doom",
hide = {
statusline = false,
tabline = true, -- hide the tabline
},
config = {
header = vim.split(logo, "\n"),
-- stylua: ignore
center = {
{ action = "Telescope find_files", desc = " Find file", icon = "", key = "f" },
{ action = "ene | startinsert", desc = " New file", icon = "", key = "n" },
{ action = "Telescope oldfiles", desc = " Recent files", icon = "", key = "r" },
{ action = "Telescope live_grep", desc = " Find text", icon = "", key = "g" },
{ action = 'lua require("persistence").load()', desc = " Restore Session", icon = "", key = "s" },
{ action = "qa", desc = " Quit", icon = "", key = "q" },
},
footer = { "Meow!!!" }, --your footer
},
})

View file

@ -0,0 +1,41 @@
local opts = {
sources = { "filesystem", "buffers", "git_status", "document_symbols" },
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" },
filesystem = {
bind_to_cwd = false,
follow_current_file = { enabled = true },
use_libuv_file_watcher = true,
},
window = {
mappings = {
["<space>"] = "none",
},
},
default_component_configs = {
indent = {
indent_size = 2,
padding = 1, -- extra padding on left hand side
-- indent guides
with_markers = true,
indent_marker = "",
last_indent_marker = "",
highlight = "NeoTreeIndentMarker",
-- expander config, needed for nesting files
with_expanders = nil, -- if nil and file nesting is enabled, will enable expanders
expander_collapsed = "",
expander_expanded = "",
expander_highlight = "NeoTreeExpander",
},
icon = {
folder_closed = "",
folder_open = "",
folder_empty = "󰜌",
-- The next two settings are only a fallback, if you use nvim-web-devicons and configure default icons there
-- then these will never be used.
default = "*",
highlight = "NeoTreeFileIcon",
},
},
}
require("neo-tree").setup(opts)

View file

@ -0,0 +1,18 @@
require("noice").setup({
lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true,
["cmp.entry.get_documentation"] = true,
},
},
-- you can enable a preset for easier configuration
presets = {
bottom_search = true, -- use a classic bottom cmdline for search
command_palette = true, -- position the cmdline and popupmenu together
long_message_to_split = true, -- long messages will be sent to a split
inc_rename = false, -- enables an input dialog for inc-rename.nvim
lsp_doc_border = false, -- add a border to hover docs and signature help
},
})

View file

@ -5,9 +5,7 @@
enable = true; enable = true;
enableSSHSupport = true; enableSSHSupport = true;
enableExtraSocket = true; enableExtraSocket = true;
}; };
services.pcscd.enable = true; services.pcscd.enable = true;
} }

View file

@ -1,12 +1,55 @@
{ pkgs, config, lib, ... }: { {
pkgs,
config,
lib,
...
}: {
services.xserver = {
enable = true;
displayManager.sddm.enable = true;
desktopManager.plasma5.enable = true;
desktopManager.plasma5.bigscreen.enable = true;
libinput.enable = true;
xkb.layout = "de";
xkb.options = "caps:escape";
};
home-manager.users.sammy = { home-manager.users.sammy = {
programs = { programs = {
librewolf.enable = true; librewolf.enable = true;
kitty = { kitty = {
enable = true; enable = true;
theme = "Catppuccin-Mocha"; theme = "Catppuccin-Mocha";
font = {
name = "Monaspace Xenon";
size = 12;
};
settings = {
# Seti-UI + Custom
"symbol_map U+E5FA-U+E62B" = "Symbols Nerd Font";
# Devicons
"symbol_map U+E700-U+E7C5" = "Symbols Nerd Font";
# Font Awesome
"symbol_map U+F000-U+F2E0" = "Symbols Nerd Font";
# Font Awesome Extension
"symbol_map U+E200-U+E2A9" = "Symbols Nerd Font";
# Material Design Icons
"symbol_map U+F500-U+FD46" = "Symbols Nerd Font";
# Weather
"symbol_map U+E300-U+E3EB" = "Symbols Nerd Font";
# Octicons
"symbol_map U+F400-U+F4A8,U+2665,U+26A1,U+F27C" = "Symbols Nerd Font";
# Powerline Extra Symbols
"symbol_map U+E0A3,U+E0B4-U+E0C8,U+E0CC-U+E0D2,U+E0D4" = "Symbols Nerd Font";
# IEC Power Symbols
"symbol_map U+23FB-U+23FE,U+2b58" = "Symbols Nerd Font";
# Font Logos
"symbol_map U+F300-U+F313" = "Symbols Nerd Font";
# Pomicons
"symbol_map U+E000-U+E00D" = "Symbols Nerd Font";
};
}; };
}; };
}; };

View file

@ -1,11 +1,14 @@
{ lib, config, pkgs, ... }: { {
lib,
config,
pkgs,
...
}: {
users.users = { users.users = {
sammy = { sammy = {
isNormalUser = true; isNormalUser = true;
extraGroups = ["networkmanager" "wheel" "docker"]; extraGroups = ["networkmanager" "wheel" "docker"];
shell = pkgs.nushell; shell = pkgs.nushell;
}; };
}; };
} }