dotfiles.nix/home.nix

316 lines
8.8 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{ pkgs, lib, ... }:
let
name = "Matthew Ess";
email = "daringseal@gmail.com";
workEmail = "mess@yelp.com";
lockCmd = "i3lock -i ~/.lockscreen-image";
statusCmd = "i3status-rs ~/.config/i3status.toml";
nixpkgs-lldb = import <nixpkgs-vscode-lldb> {};
nixpkgs-ra = import <nixpkgs-ra> {};
in {
nixpkgs = { config = { allowUnfree = true; }; };
home = {
sessionVariables = {
EDITOR = "vim";
BROWSER = "firefox";
TERMINAL = "kitty";
};
packages = with pkgs; [
# nix utilities
cachix
niv
nixfmt
nix-prefetch-git
# command line utilities
ag
python37Packages.cookiecutter
du-dust
exercism
fzy
imagemagick
jq
haskell.packages.ghc865.pointfree
rlwrap
tldr
unzip
# graphical applications
discord
(dunst.override { dunstify = true; })
enpass
fractal
firefox
httpie
kitty
signal-desktop
slack
steam
xfce.thunar
xfce.thunar-archive-plugin
# graphical utilities
clipmenu
clipnotify
dmenu
i3lock
i3status-rust
libnotify
lxappearance
rofi
xclip
];
file = {
".background-image".source = ./assets/background-image;
".lockscreen-image".source = ./assets/lockscreen-image;
".config/fish/fishfile".text = ''
laughedelic/pisces
joehillen/to-fish
jethrokuan/z
decors/fish-colored-man
franciscolourenco/done
haslersn/fish-nix-completions
gyakovlev/fish-fzy
joseluisq/gitnow
edc/bass
fishpkg/fish-get
fishpkg/fish-spin
oh-my-fish/plugin-bang-bang
fishpkg/fish-humanize-duration
jorgebucaran/fish-getopts
matthewess/fish-autovenv
'';
".config/fish/completions/systemctl.fish".source =
./assets/systemctl.fish;
".config/fish/functions/colortest.fish".source = ./assets/colortest.fish;
".config/fish/functions/kbl.fish".text = ''
function kbl -a level
set -l initial (cat /sys/class/leds/tpacpi\:\:kbd_backlight/brightness)
test -z "$level"; and set -l level $initial
echo $level > /sys/class/leds/tpacpi\:\:kbd_backlight/brightness
end
'';
".config/fish/functions/mkdcd.fish".text = ''
function mkdcd -a target
mkdir $target
cd $target
end
'';
".config/fish/functions/unz.fish".text = ''
function unz -a target
# strip extensions
string match \*.zip $target; and set target (string split -r -m1 . $target)[1]
unzip -d $target $target
end
'';
".config/i3status.toml".source = ./assets/i3status.toml;
".config/kitty/kitty.conf".text = ''
font_family Fira Code Regular
bold_font Fira Code Bold
font_size 15.0
include ./theme.conf
'';
".config/kitty/theme.conf".source = ./assets/kitty-theme.conf;
".config/nvim/init.vim".source = ./assets/init.vim;
".config/rofi/theme.rasi".source = ./assets/sidetab.rasi;
};
};
programs = {
alacritty = {
enable = false;
settings = {
font = {
normal.family = "Fira Code";
size = 10.5;
};
};
};
bat.enable = true;
broot.enable = true;
command-not-found.enable = true;
direnv.enable = true;
feh.enable = true;
firefox.enable = true;
fish = {
enable = true;
package = pkgs.fish;
interactiveShellInit = ''
echo '(´) welcome (´)'
if not functions -q fisher
set -q XDG_CONFIG_HOME; or set XDG_CONFIG_HOME ~/.config
curl https://git.io/fisher --create-dirs -sLo $XDG_CONFIG_HOME/fish/functions/fisher.fish
fish -c fisher
end
fish_vi_key_bindings
set VIRTUAL_ENV_DISABLE_PROMPT true
alias cat=bat
alias br=broot
alias tree=br
alias ack=ag
alias grep=ag
alias sys="sudo systemctl"
alias rebuild="sudo nixos-rebuild switch"
alias rebuildd="sudo nixos-rebuild switch; and systemctl restart display-manager"
alias upgrade="sudo rm -rf /root/.cache/nix/tarballs; and sudo nixos-rebuild switch --upgrade"
alias clip="xclip -selection c"
alias cxuse="sudo cachix use -d ~/dotfiles.nix"
alias cxpsh="nix-shell --command exit; nix-store -qR --include-outputs (nix-instantiate shell.nix) | cachix push"
alias cxpush=cxpsh
alias home="vim ~/dotfiles.nix/home.nix +'cd %:p:h'"
alias i3="vim ~/dotfiles.nix/i3.nix +'cd %:p:h'"
alias config="vim ~/dotfiles.nix/configuration.nix +'cd %:p:h'"
alias vims="vim -S Session.vim"
alias bigscreen="xrandr --output eDP1 --off --output HDMI2 --auto"
alias smallscreen="xrandr --output eDP1 --auto --output HDMI2 --off"
bind \cr 'fzy_select_history (commandline -b)'
bind -M insert \cr 'fzy_select_history (commandline -b)'
bind \cf 'fzy_select_directory'
bind -M insert \cf 'fzy_select_directory'
bind -M insert ! __history_previous_command
bind -M insert '$' __history_previous_command_arguments
'';
};
git = {
enable = true;
userName = "${name}";
userEmail = "${email}";
ignores = [ ".*.sw[a-z]" "tags" ];
extraConfig = {
color.ui = true;
core.editor = "vim";
push.default = "simple";
init.defaultBranch = "main";
};
};
htop = {
enable = true;
highlightBaseName = true;
};
jq.enable = true;
man.enable = true;
neovim = {
enable = true;
viAlias = true;
vimAlias = true;
withNodeJs = true;
extraPython3Packages = ps: with ps; [ pynvim ];
plugins = with pkgs.vimPlugins; [
neovim-sensible
vim-fugitive
vim-surround
nerdtree
nerdtree-git-plugin
vim-colorschemes
vim-nix
lightline-vim
haskell-vim
auto-pairs
vim-fish
LanguageClient-neovim
ncm2
ncm2-path
nvim-yarp
ctrlp
dhall-vim
];
extraConfig = builtins.readFile ./assets/init.vim;
};
rofi = {
enable = true;
font = "Fira Code 14";
lines = 10;
location = "center";
theme = "~/.config/rofi/theme.rasi";
};
ssh = {
enable = true;
extraOptionOverrides = { "AddKeysToAgent" = "true"; };
};
starship.enable = true;
vscode = {
enable = true;
package = pkgs.vscodium.overrideAttrs (_: {
preFixupPhases = [ "preFixup" ];
preFixup = ''
sed -i "s#open-vsx.org/vscode/gallery#marketplace.visualstudio.com/_apis/public/gallery#" $out/lib/vscode/resources/app/product.json
sed -i "s#open-vsx.org/vscode/item#marketplace.visualstudio.com/items#" $out/lib/vscode/resources/app/product.json
sed -i "s#open-vsx.org#marketplace.visualstudio.com#" $out/lib/vscode/resources/app/product.json
'';
});
extensions = with pkgs.vscode-extensions; [
# matklad.rust-analyzer
nixpkgs-ra.vscode-extensions.matklad.rust-analyzer
ms-python.python
skyapps.fish-vscode
# vadimcn.vscode-lldb
nixpkgs-lldb.vscode-extensions.vadimcn.vscode-lldb
];
};
};
services = {
dunst = {
enable = true;
settings = {
global = {
geometry = "0x5-30+20";
notification_height = 25;
indicate_hidden = "yes";
corner_radius = 5;
padding = 10;
horizontal_padding = 10;
idle_threshold = 60;
font = "Fira Code 16";
markup = "full";
format = ''
<b>%s<b> %a
%b'';
alignment = "center";
horizontal_alignment = "center";
icon_position = "left";
separator_color = "#383838";
frame_color = "#383838";
frame_width = 2;
};
shortcuts = {
close = "ctrl+space";
history = "ctrl+shift+grave";
};
urgency_low = {
background = "#282828";
foreground = "#5882FA";
};
urgency_normal = {
background = "#282828";
foreground = "#5882FA";
};
urgency_critical = {
background = "#282828";
foreground = "#FF0040";
timeout = 0;
};
};
};
gnome-keyring.enable = true;
lorri.enable = true;
redshift = {
enable = true;
provider = "geoclue2";
};
screen-locker = {
enable = false;
lockCmd = "${lockCmd}";
};
};
xsession = {
enable = true;
scriptPath = ".hm-xsession";
windowManager = {
i3 = import ./i3.nix { inherit lib lockCmd statusCmd; };
};
};
}