♻️ refactor nix configs

This commit is contained in:
2022-08-27 10:57:48 -04:00
parent 8e8ce37574
commit b919168c44
8 changed files with 248 additions and 160 deletions

11
modules/default.nix Normal file
View File

@ -0,0 +1,11 @@
{ config, lib, pkgs, ... }:
{
imports = [
./dev.nix
./emacs.nix
./git.nix
./tmux.nix
./zsh.nix
];
}

78
modules/dev.nix Normal file
View File

@ -0,0 +1,78 @@
{ config, lib, pkgs, ... }:
{
home.packages = with pkgs; [
# General
btop
cmake
drone-cli
tea
# Git
git
gh
mr
# Elixir
elixir
# Golang
go
gomodifytags
gotests
gore
# Haskell
haskellPackages.haskell-language-server
# haskellPackages.cabal
haskellPackages.hoogle
stack
# Javascript/Typescript
deno
jq
nodejs
yarn
# Nix
cachix
niv
nixfmt
nixpkgs-fmt
rnix-lsp
# Python
black
isort
pipenv
python39
python39Packages.pyflakes
python39Packages.nose
python39Packages.pytest
# Rust
rustup
rust-analyzer
# Shell
shfmt
shellcheck
# Web
nodePackages.stylelint
nodePackages.js-beautify
];
home.file.".ghci".text = ''
:set prompt "λ> "
'';
home.sessionPath = [
"$HOME/.cargo/bin"
"$HOME/.deno/bin"
"$HOME/.emacs.d/bin"
"$HOME/.go/bin"
"$HOME/.local/bin"
];
}

31
modules/emacs.nix Normal file
View File

@ -0,0 +1,31 @@
{ config, lib, pkgs, ... }:
{
home.packages = with pkgs; [
# Doom requirements
fd
ripgrep
wakatime
];
home.file.".doom.d" = {
onChange = ''
#!/bin/sh
DOOM=$HOME/.emacs.d
if [ ! -d $DOOM ]; then
git clone --depth 1 https://github.com/hlissner/doom-emacs $DOOM
fi
$DOOM/bin/doom sync
'';
source = ../config/.doom.d;
recursive = true;
};
programs = {
emacs = {
enable = true;
package = pkgs.emacs-nox;
extraPackages = epkgs: [ epkgs.vterm ];
};
};
}

30
modules/git.nix Normal file
View File

@ -0,0 +1,30 @@
{ config, lib, pkgs, ... }:
{
programs = {
git = {
enable = true;
userName = "James Walker";
userEmail = "walkah@walkah.net";
aliases = {
lg =
"log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit";
st = "status -s";
undo = "reset HEAD~1 --mixed";
};
extraConfig = {
github.user = "walkah";
init.defaultBranch = "main";
pull.rebase = true;
rebase.autoStash = true;
};
signing = {
key = "8896FEC44D47A81C";
signByDefault = true;
};
};
};
}

29
modules/tmux.nix Normal file
View File

@ -0,0 +1,29 @@
{ config, lib, pkgs, ... }:
{
programs = {
tmux = {
enable = true;
clock24 = true;
plugins = with pkgs.tmuxPlugins; [
sensible
yank
{
plugin = dracula;
extraConfig = ''
set -g @dracula-show-battery true
set -g @dracula-show-fahrenheit false
set -g @dracula-show-left-icon session
set -g @dracula-show-powerline true
set -g @dracula-refresh-rate 10
'';
}
];
extraConfig = ''
set -g set-titles on
set -g set-titles-string "[#S] #W@#h (#I)"
'';
shortcut = "o";
};
};
}

61
modules/zsh.nix Normal file
View File

@ -0,0 +1,61 @@
{ config, lib, pkgs, ... }:
{
programs = {
bat.enable = true;
direnv.enable = true;
exa.enable = true;
fzf = {
enable = true;
fileWidgetOptions = [ "--preview 'bat --color always {}'" ];
};
zsh = {
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
oh-my-zsh = {
enable = true;
plugins = [
"bundler"
"direnv"
"docker"
"docker-compose"
"git"
"golang"
"mix"
"rails"
"ssh-agent"
"tmux"
];
};
sessionVariables = {
EDITOR = "vim";
GOPATH = "$HOME/.go";
};
};
starship = {
enable = true;
enableZshIntegration = true;
settings = {
character = {
success_symbol = "[»](bold green) ";
error_symbol = "[](bold red) ";
};
directory = {
fish_style_pwd_dir_length = 1;
truncation_length = 1;
};
hostname = {
ssh_only = false;
format = "[$hostname]($style):";
};
gcloud = { disabled = true; };
kubernetes = { disabled = false; };
username = { format = "[$user]($style)@"; };
};
};
};
}