add hm
This commit is contained in:
parent
e9f9a8e84d
commit
b11cd37ad2
|
@ -1,4 +1,16 @@
|
|||
{ lib, inputs, pkgs, ... }: {
|
||||
imports = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
./users
|
||||
];
|
||||
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = { inherit inputs; };
|
||||
sharedModules = [ ./hm-modules inputs.nixvim.homeManagerModules.nixvim ];
|
||||
};
|
||||
|
||||
virtualisation.oci-containers.backend = lib.mkDefault "podman";
|
||||
|
||||
# Set your time zone.
|
||||
|
|
40
common/hm-modules/catppuccin.nix
Normal file
40
common/hm-modules/catppuccin.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let cfg = config.themes.v.catppuccin;
|
||||
in {
|
||||
options.themes.v.catppuccin = { enable = mkEnableOption "catppuccin"; };
|
||||
config =
|
||||
let
|
||||
theme = "Catppuccin-Pink-Dark";
|
||||
cursorTheme = config.home.pointerCursor.name;
|
||||
in
|
||||
mkIf cfg.enable {
|
||||
home.pointerCursor = {
|
||||
name = "Bibata_Ghost";
|
||||
size = 24;
|
||||
package = pkgs.bibata-cursors-translucent;
|
||||
};
|
||||
|
||||
gtk = {
|
||||
enable = true;
|
||||
theme = {
|
||||
name = theme;
|
||||
package = pkgs.catppuccin-gtk;
|
||||
};
|
||||
iconTheme = {
|
||||
name = "Papirus-Dark";
|
||||
package = pkgs.papirus-icon-theme.override { color = "violet"; };
|
||||
};
|
||||
cursorTheme = {
|
||||
name = cursorTheme;
|
||||
inherit (config.home.pointerCursor) package size;
|
||||
};
|
||||
};
|
||||
|
||||
programs.vscode = {
|
||||
userSettings."workbench.colorTheme" = "Catppuccin Frappé";
|
||||
extensions = [ pkgs.vscode-extensions.catppuccin.catppuccin-vsc ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
3
common/hm-modules/default.nix
Normal file
3
common/hm-modules/default.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{ ... }: {
|
||||
imports = [ ./catppuccin.nix ./nvim.nix ./riff.nix ./vscode.nix ./git.nix ./rust.nix ];
|
||||
}
|
31
common/hm-modules/git.nix
Normal file
31
common/hm-modules/git.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let cfg = config.programs.v.git;
|
||||
in {
|
||||
options.programs.v.git = { enable = mkEnableOption "git"; };
|
||||
config = mkIf cfg.enable {
|
||||
programs.git = {
|
||||
enable = true;
|
||||
package = pkgs.gitAndTools.gitFull;
|
||||
userName = "Vivian";
|
||||
userEmail = "vivian@0x76.dev";
|
||||
lfs.enable = true;
|
||||
extraConfig = {
|
||||
push.autoSetupRemote = true;
|
||||
init.defaultBranch = "main";
|
||||
# Git merge driver that always grabs upstream changes
|
||||
# Useful for e.g. lock files
|
||||
merge.ours = {
|
||||
name = "Overwrite Upstream Changes";
|
||||
driver = "cp -f '%A' '%B'";
|
||||
};
|
||||
};
|
||||
|
||||
difftastic.enable = true;
|
||||
};
|
||||
|
||||
home.file.".config/git/attributes".text = ''
|
||||
flake.lock merge=ours
|
||||
'';
|
||||
};
|
||||
}
|
190
common/hm-modules/nvim.nix
Normal file
190
common/hm-modules/nvim.nix
Normal file
|
@ -0,0 +1,190 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
let cfg = config.programs.v.nvim;
|
||||
in with lib; {
|
||||
options.programs.v.nvim = { enable = mkEnableOption "nvim"; };
|
||||
config = mkIf cfg.enable {
|
||||
programs.nixvim = {
|
||||
enable = true;
|
||||
package = pkgs.neovim-unwrapped;
|
||||
vimAlias = true;
|
||||
luaLoader.enable = true;
|
||||
|
||||
globals.mapleader = " ";
|
||||
|
||||
options.number = true;
|
||||
|
||||
clipboard = { providers.wl-copy.enable = true; };
|
||||
|
||||
keymaps = [
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>ff";
|
||||
action = "require('telescope.builtin').find_files";
|
||||
lua = true;
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<leader>fg";
|
||||
action = "require('telescope.builtin').live_grep";
|
||||
lua = true;
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "<C-_>";
|
||||
action = "require('Comment.api').toggle.linewise.current";
|
||||
lua = true;
|
||||
}
|
||||
{
|
||||
mode = "x";
|
||||
key = "<C-_>";
|
||||
action = ''
|
||||
function()
|
||||
local esc = vim.api.nvim_replace_termcodes(
|
||||
'<ESC>', true, false, true
|
||||
)
|
||||
vim.api.nvim_feedkeys(esc, 'nx', false)
|
||||
require('Comment.api').toggle.linewise(vim.fn.visualmode())
|
||||
end
|
||||
'';
|
||||
lua = true;
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "g=";
|
||||
action = "vim.lsp.buf.format";
|
||||
lua = true;
|
||||
}
|
||||
{
|
||||
mode = "n";
|
||||
key = "t";
|
||||
action = ":FloatermToggle myfloat<CR>";
|
||||
}
|
||||
{
|
||||
mode = "t";
|
||||
key = "<ESC>";
|
||||
action = "function() vim.cmd(':FloatermToggle myfloat') end";
|
||||
lua = true;
|
||||
}
|
||||
];
|
||||
|
||||
extraPlugins = with pkgs.vimPlugins; [
|
||||
FixCursorHold-nvim
|
||||
luasnip
|
||||
plenary-nvim
|
||||
neotest
|
||||
neotest-plenary
|
||||
neotest-rust
|
||||
];
|
||||
|
||||
colorschemes.catppuccin = {
|
||||
enable = true;
|
||||
flavour = "frappe";
|
||||
};
|
||||
|
||||
extraConfigLua = ''
|
||||
require("neotest").setup({
|
||||
adapters = {
|
||||
require("neotest-plenary"),
|
||||
require("neotest-rust") {
|
||||
args = { "--no-capture" },
|
||||
}
|
||||
},
|
||||
})
|
||||
'';
|
||||
|
||||
plugins = {
|
||||
bufferline.enable = true;
|
||||
none-ls = {
|
||||
enable = true;
|
||||
sources = {
|
||||
formatting.nixpkgs_fmt.enable = true;
|
||||
code_actions.shellcheck.enable = true;
|
||||
code_actions.statix.enable = true;
|
||||
diagnostics = {
|
||||
statix.enable = true;
|
||||
deadnix.enable = true;
|
||||
shellcheck.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
nix.enable = true;
|
||||
treesitter = {
|
||||
enable = true;
|
||||
nixGrammars = true;
|
||||
disabledLanguages = [ "latex" ];
|
||||
};
|
||||
surround.enable = true;
|
||||
fugitive.enable = true;
|
||||
gitgutter.enable = true;
|
||||
lualine = {
|
||||
enable = true;
|
||||
theme = "catppuccin";
|
||||
};
|
||||
telescope = {
|
||||
enable = true;
|
||||
extensions.fzf-native.enable = true;
|
||||
extensions.fzf-native.fuzzy = true;
|
||||
};
|
||||
comment-nvim = { enable = true; };
|
||||
lsp = {
|
||||
enable = true;
|
||||
servers = {
|
||||
nil_ls.enable = true;
|
||||
rust-analyzer = {
|
||||
installCargo = false;
|
||||
installRustc = false;
|
||||
};
|
||||
pyright.enable = true;
|
||||
elixirls.enable = true;
|
||||
clangd.enable = true;
|
||||
yamlls.enable = true;
|
||||
};
|
||||
};
|
||||
trouble.enable = true;
|
||||
lspkind.enable = true;
|
||||
|
||||
vimtex.enable = true;
|
||||
|
||||
floaterm.enable = true;
|
||||
|
||||
nvim-cmp = {
|
||||
enable = true;
|
||||
autoEnableSources = true;
|
||||
sources = [
|
||||
{ name = "nvim_lsp"; }
|
||||
{
|
||||
name = "luasnip";
|
||||
option = { show_autosnippets = true; };
|
||||
}
|
||||
{ name = "cmp-spell"; }
|
||||
{ name = "cmp-rg"; }
|
||||
{ name = "path"; }
|
||||
{ name = "buffer"; }
|
||||
];
|
||||
snippet.expand = "luasnip";
|
||||
mappingPresets = [ "insert" "cmdline" ];
|
||||
mapping = {
|
||||
"<CR>" = "cmp.mapping.confirm({ select = true })";
|
||||
"<Tab>" = {
|
||||
modes = [ "i" "s" ];
|
||||
action = ''
|
||||
function(fallback)
|
||||
local luasnip = require('luasnip')
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
28
common/hm-modules/riff.nix
Normal file
28
common/hm-modules/riff.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
{ config, pkgs, lib, inputs, ... }:
|
||||
with lib;
|
||||
let cfg = config.programs.riff;
|
||||
in {
|
||||
options.programs.riff = {
|
||||
enable = mkEnableOption "riff";
|
||||
direnv = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable direnv support
|
||||
'';
|
||||
};
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = [ inputs.riff.packages.${pkgs.system}.riff ];
|
||||
|
||||
xdg.configFile."direnv/lib/riff.sh" = mkIf cfg.direnv {
|
||||
executable = true;
|
||||
text = ''
|
||||
use_riff() {
|
||||
watch_file Cargo.toml watch_file Cargo.lock
|
||||
eval "$(riff --offline print-dev-env)"
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
26
common/hm-modules/rust.nix
Normal file
26
common/hm-modules/rust.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
with lib;
|
||||
let cfg = config.programs.v.rust;
|
||||
in {
|
||||
options.programs.v.rust = { enable = mkEnableOption "rust"; };
|
||||
config = mkIf cfg.enable {
|
||||
home = {
|
||||
packages = with pkgs; [ rustup cargo-nextest cargo-msrv cargo-dist cargo-cross];
|
||||
|
||||
file = {
|
||||
".cargo/config.toml".text = ''
|
||||
[registries.crates-io]
|
||||
protocol = "sparse"
|
||||
|
||||
[build]
|
||||
rustc-wrapper = "${pkgs.sccache}/bin/sccache"
|
||||
|
||||
[profile.rust-analyzer]
|
||||
inherits = "dev"
|
||||
'';
|
||||
};
|
||||
|
||||
sessionPath = [ "$HOME/.cargo/bin" ];
|
||||
};
|
||||
};
|
||||
}
|
79
common/hm-modules/vscode.nix
Normal file
79
common/hm-modules/vscode.nix
Normal file
|
@ -0,0 +1,79 @@
|
|||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let cfg = config.programs.v.vscode;
|
||||
in {
|
||||
options.programs.v.vscode = { enable = mkEnableOption "vscode"; };
|
||||
config = mkIf cfg.enable {
|
||||
programs.vscode = {
|
||||
enable = true;
|
||||
package = pkgs.vscode;
|
||||
userSettings = {
|
||||
"ltex.language" = "en-GB";
|
||||
"latex-workshop.linting.chktex.enabled" = true;
|
||||
"latex-workshop.latex.clean.subfolder.enabled" = true;
|
||||
"latex-workshop.latex.outDir" = "%TMPDIR%/%RELATIVE_DOC%";
|
||||
"editor.fontFamily" =
|
||||
"'DejaVuSansMono Nerd Font', 'monospace', monospace";
|
||||
"keyboard.dispatch" = "keyCode";
|
||||
"rust-analyzer.server.path" = "${pkgs.rust-analyzer}/bin/rust-analyzer";
|
||||
"rust-analyzer.check.extraArgs" = ["--profile" "rust-analyzer"];
|
||||
"rust-analyzer.check.command" = "clippy";
|
||||
"terminal.integrated.defaultProfile.linux" = "zsh";
|
||||
"nix.enableLanguageServer" = true; # Enable LSP.
|
||||
"nix.serverPath" = "${pkgs.nil}/bin/nil";
|
||||
"[nix]" = { "editor.defaultFormatter" = "brettm12345.nixfmt-vscode"; };
|
||||
"[python]" = { "editor.formatOnType" = true; };
|
||||
"debug.allowBreakpointsEverywhere" = true;
|
||||
"C_Cpp.clang_format_fallbackStyle" =
|
||||
"{ BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 0}";
|
||||
"crates.compatibleDecorator" = "✓";
|
||||
"crates.errorDecorator" = "✗";
|
||||
"crates.incompatibleDecorator" = "🛇";
|
||||
# Don't index unecessary things
|
||||
"files.exclude" = {
|
||||
"**/.vscode" = true;
|
||||
"**/.git" = true;
|
||||
"**/.svn" = true;
|
||||
"**/.hg" = true;
|
||||
"**/.deps" = true;
|
||||
"**/CVS" = true;
|
||||
"**/.DS_Store" = true;
|
||||
"/bin" = true;
|
||||
"/boot" = true;
|
||||
"/cdrom" = true;
|
||||
"/dev" = true;
|
||||
"/proc" = true;
|
||||
"/etc" = true;
|
||||
"/nix" = true;
|
||||
};
|
||||
};
|
||||
extensions = with pkgs.vscode-extensions;
|
||||
with pkgs.v.vscode-extensions; [
|
||||
brettm12345.nixfmt-vscode
|
||||
codezombiech.gitignore
|
||||
editorconfig.editorconfig
|
||||
foxundermoon.shell-format
|
||||
james-yu.latex-workshop
|
||||
jnoortheen.nix-ide
|
||||
matklad.rust-analyzer
|
||||
mkhl.direnv
|
||||
ms-vscode-remote.remote-ssh
|
||||
ms-vscode.cpptools
|
||||
platformio.platformio-ide
|
||||
redhat.vscode-yaml
|
||||
redhat.vscode-xml
|
||||
tamasfe.even-better-toml
|
||||
valentjn.vscode-ltex
|
||||
vscodevim.vim
|
||||
vadimcn.vscode-lldb
|
||||
xaver.clang-format
|
||||
sumneko.lua
|
||||
davidlday.languagetool-linter
|
||||
serayuzgur.crates
|
||||
skellock.just
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
|
@ -41,6 +41,5 @@
|
|||
homeDirectory = "/home/vivian";
|
||||
stateVersion = "23.05";
|
||||
};
|
||||
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue