Skip to content

Commit

Permalink
added homeManagerModules to instances itself
Browse files Browse the repository at this point in the history
  • Loading branch information
orzklv committed Jul 1, 2024
1 parent a91c39d commit db0d317
Show file tree
Hide file tree
Showing 18 changed files with 1,486 additions and 0 deletions.
4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@
# These are usually stuff you would upstream services to global
serverModules = import ./modules/server;

# Reusable home-manager modules you might want to export
# These are usually stuff you would upstream into home-manager
homeManagerModules = import ./modules/home;

# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
Expand Down
13 changes: 13 additions & 0 deletions modules/home/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module).
# These should be stuff you would like to share with others, not your personal configurations.
{
# List your module files here
git = import ./git;
zsh = import ./zsh;
helix = import ./helix;
neovim = import ./neovim;
nixpkgs = import ./nixpkgs;
terminal = import ./terminal;
topgrade = import ./topgrade;
packages = import ./packages;
}
69 changes: 69 additions & 0 deletions modules/home/git/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
config,
pkgs,
lib,
...
}: let
isMacOS = pkgs.stdenv.hostPlatform.system == "aarch64-darwin" || pkgs.stdenv.hostPlatform.system == "x86_64-darwin";
in {
options = {
git = {
isMacOS = lib.mkOption {
type = lib.types.bool;
default = isMacOS;
description = "Install MacOS specific agent.";
};
};
};

config = {
# Git Configurations
programs.git = {
enable = true;
lfs.enable = true;

# User credentials
userName = "Sokhibjon Orzikulov";
userEmail = "[email protected]";

extraConfig = {
http.sslVerify = false;
};

# GPG Signing
signing = {
signByDefault = true;
key = "00D27BC687070683FBB9137C3C35D3AF0DA1D6A8";
};

# Aliases
aliases = {
ch = "checkout";
};

# Git ignores
ignores = [
".idea"
".DS_Store"
];
};

home.file.".gnupg/gpg-agent.conf".text =
if config.git.isMacOS
then ''
pinentry-program ${pkgs.pinentry_mac}/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac
''
else ''
pinentry-program ${pkgs.kwalletcli}/bin/pinentry-kwallet
'';

home.file.".gnupg/gpg.conf".text =
if config.git.isMacOS
then ''
no-tty
use-agent
''
else ''
'';
};
}
60 changes: 60 additions & 0 deletions modules/home/helix/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{pkgs, ...}: {
config = {
programs.helix = {
enable = true;

settings = {
theme = "autumn_night";

editor = {
line-number = "relative";

cursor-shape = {
insert = "bar";
normal = "block";
select = "underline";
};

file-picker = {
hidden = false;
git-ignore = true;
git-global = true;
};

statusline = {
left = ["mode" "spinner"];

center = ["file-name"];

right = [
"diagnostics"
"selections"
"position"
"file-encoding"
"file-line-ending"
"file-type"
];

separator = "│";

mode = {
normal = "SLAVE";
insert = "MASTER";
select = "DUNGEON";
};
};
};

keys.normal = {
# Easy window movement
"C-left" = "jump_view_left";
"C-right" = "jump_view_right";
"C-up" = "jump_view_up";
"C-down" = "jump_view_down";

"C-r" = ":reload";
};
};
};
};
}
149 changes: 149 additions & 0 deletions modules/home/neovim/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
{
inputs,
pkgs,
...
}: {
imports = [];

xdg.configFile = {
# astronvim's config
"nvim".source = inputs.astronvim;

# my custom astronvim config, astronvim will load it after base config
# https://github.com/AstroNvim/AstroNvim/blob/v3.32.0/lua/astronvim/bootstrap.lua#L15-L16
"astronvim/lua/user".source = ./user;
};

nixpkgs.config = {
programs.npm.npmrc = ''
prefix = ''${HOME}/.npm-global
'';
};

programs = {
neovim = {
enable = true;

defaultEditor = true;
viAlias = true;
vimAlias = true;

# currently we use lazy.nvim as neovim's package manager, so comment this one.
# plugins = with pkgs.vimPlugins; [
# # search all the plugins using https://search.nixos.org/packages
# ];

# Extra packages only available to nvim(won't pollute the global home environment)
extraPackages = with pkgs;
[
#-- c/c++
cmake
cmake-language-server
gnumake
checkmake
gcc # c/c++ compiler, required by nvim-treesitter!
llvmPackages.clang-unwrapped # c/c++ tools with clang-tools such as clangd
lldb

#-- python
python3Packages.black # python formatter
python3Packages.ruff-lsp
(python3.withPackages (
ps:
with ps; [
pynvim # Python client and plugin host for Nvim

ipython
pandas
requests
pyquery
pyyaml
]
))

#-- rust
rust-analyzer
cargo # rust package manager
rustfmt

#-- zig
zls

#-- nix
nil
# nixd
statix # Lints and suggestions for the nix programming language
deadnix # Find and remove unused code in .nix source files
alejandra # Nix Code Formatter

#-- golang
go
gomodifytags
iferr # generate error handling code for go
impl # generate function implementation for go
gotools # contains tools like: godoc, goimports, etc.
gopls # go language server
delve # go debugger

# -- java
jdk17
gradle
maven
spring-boot-cli

#-- lua
stylua
lua-language-server

#-- bash
nodePackages.bash-language-server
shellcheck
shfmt

#-- javascript/typescript --#
nodePackages.nodejs
nodePackages.typescript
nodePackages.typescript-language-server
# HTML/CSS/JSON/ESLint language servers extracted from vscode
nodePackages.vscode-langservers-extracted
nodePackages."@tailwindcss/language-server"

#-- CloudNative
nodePackages.dockerfile-language-server-nodejs
emmet-ls
jsonnet
jsonnet-language-server
hadolint # Dockerfile linter

#-- Others
taplo # TOML language server / formatter / validator
nodePackages.yaml-language-server
sqlfluff # SQL linter
actionlint # GitHub Actions linter
buf # protoc plugin for linting and formatting
proselint # English prose linter
guile # scheme language

#-- Misc
tree-sitter # common language parser/highlighter
nodePackages.prettier # common code formatter
marksman # language server for markdown
glow # markdown previewer
fzf

#-- Optional Requirements:
gdu # disk usage analyzer, required by AstroNvim
ripgrep # fast search tool, required by AstroNvim's '<leader>fw'(<leader> is space key)
]
++ (
if pkgs.stdenv.isDarwin
then []
else [
#-- verilog / systemverilog
verible
gdb
]
);
};
};
}
Loading

0 comments on commit db0d317

Please sign in to comment.