add hm
This commit is contained in:
parent
3d63c94742
commit
e913bd96d5
12 changed files with 409 additions and 1 deletions
|
@ -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
|
||||
];
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
71
common/users/default.nix
Normal file
71
common/users/default.nix
Normal file
|
@ -0,0 +1,71 @@
|
|||
{ config, pkgs, lib, ... }: {
|
||||
imports = [ ./laura.nix ./vivian.nix ./jonathan.nix ];
|
||||
programs = {
|
||||
|
||||
# Setup ZSH to use grml config
|
||||
zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
autosuggestions.enable = true;
|
||||
interactiveShellInit = ''
|
||||
source "${pkgs.grml-zsh-config}/etc/zsh/zshrc"
|
||||
export FZF_DEFAULT_COMMAND="${pkgs.ripgrep}/bin/rg --files --follow"
|
||||
source "${pkgs.fzf}/share/fzf/key-bindings.zsh"
|
||||
source "${pkgs.fzf}/share/fzf/completion.zsh"
|
||||
eval "$(${pkgs.zoxide}/bin/zoxide init zsh)"
|
||||
'';
|
||||
# otherwise it'll override the grml prompt
|
||||
promptInit = "";
|
||||
};
|
||||
|
||||
# Install Neovim and set it as alias for vi(m)
|
||||
neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
defaultEditor = true;
|
||||
};
|
||||
};
|
||||
|
||||
environment.pathsToLink = [ "/share/zsh" ];
|
||||
|
||||
# Disable sudo prompt for `wheel` users.
|
||||
security.sudo.wheelNeedsPassword = lib.mkDefault false;
|
||||
|
||||
# Configure the root account
|
||||
users.extraUsers.root = {
|
||||
# Allow my SSH keys for logging in as root.
|
||||
openssh.authorizedKeys.keys =
|
||||
config.users.extraUsers.vivian.openssh.authorizedKeys.keys;
|
||||
# Also use zsh for root
|
||||
shell = pkgs.zsh;
|
||||
};
|
||||
|
||||
# Setup packages available everywhere
|
||||
environment.systemPackages = with pkgs; [
|
||||
file
|
||||
fzf
|
||||
git
|
||||
htop
|
||||
ncdu
|
||||
psmisc
|
||||
helix
|
||||
ripgrep
|
||||
rsync
|
||||
zoxide
|
||||
];
|
||||
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
withUtempter = true;
|
||||
terminal = "tmux-256color";
|
||||
secureSocket = false;
|
||||
extraConfig = ''
|
||||
set -g mouse on
|
||||
setw -g mouse on
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
}
|
13
common/users/jonathan.nix
Normal file
13
common/users/jonathan.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{ pkgs, ... }: {
|
||||
users.extraUsers.jonathan = {
|
||||
isNormalUser = true;
|
||||
shell = pkgs.zsh;
|
||||
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOAXOTU6E06zjK/zkzlSPhTG35PoNRYgTCStEPUYyjeE jonathan@kili"
|
||||
];
|
||||
|
||||
extraGroups = [ ];
|
||||
};
|
||||
}
|
||||
|
14
common/users/laura.nix
Normal file
14
common/users/laura.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ pkgs, ... }: {
|
||||
users.extraUsers.laura = {
|
||||
isNormalUser = true;
|
||||
shell = pkgs.zsh;
|
||||
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBIlFUUXbwOkhNUjoA6zueTdRuaylgpgFqSe/xWGK9zb laura@zmeura"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBVkk9/80askWhInQk03JMntF6SThAYkFZNm+lIGt4E7 laura@mura"
|
||||
];
|
||||
|
||||
extraGroups = [ ];
|
||||
};
|
||||
}
|
||||
|
45
common/users/vivian.nix
Normal file
45
common/users/vivian.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
{ pkgs, ... }: {
|
||||
# The block that specifies my user account.
|
||||
users.extraUsers.vivian = {
|
||||
# This account is intended for a non-system user.
|
||||
isNormalUser = true;
|
||||
|
||||
# My default shell
|
||||
shell = pkgs.zsh;
|
||||
|
||||
# My SSH keys.
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICBhJAp7NWlHgwDYd2z6VNROy5RkeZHRINFLsFvwT4b3 vivian@bastion"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMMbdjysLnmwJD5Fs/SjBPstdIQNUxy8zFHP0GlhHMJB vivian@bastion"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIfooZjMWXvXZu1ReOEACDZ0TMb2WJRBSOLlWE8y6fUh vivian@aoife"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBMTCUjDbDjAiEKbKmLPavuYM0wJIBdjgytLsg1uWuGc vivian@nord"
|
||||
"sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIM3TqXaApX2JZsgfZd7PKVFMecDgqTHKibpSzgdXNpYAAAAABHNzaDo= solov2-le"
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID+HbsgJTQS6pvnMEI5NPKjIf78z+9A7CTIt3abi+PS6 vivian@eevee"
|
||||
];
|
||||
|
||||
# Make me admin
|
||||
extraGroups =
|
||||
[ "systemd-journal" "wheel" "networkmanager" "libvirtd" "dialout" ];
|
||||
};
|
||||
|
||||
home-manager.users.vivian = {
|
||||
programs = {
|
||||
home-manager.enable = true;
|
||||
|
||||
v.git.enable = true;
|
||||
|
||||
tmux = {
|
||||
enable = true;
|
||||
shortcut = "b";
|
||||
clock24 = true;
|
||||
};
|
||||
|
||||
bat.enable = true;
|
||||
};
|
||||
home = {
|
||||
username = "vivian";
|
||||
homeDirectory = "/home/vivian";
|
||||
stateVersion = "23.05";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue