dotfiles.nix/home.nix

306 lines
8.1 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";
niv = (import (builtins.fetchTarball {
url =
"https://github.com/nmattia/niv/tarball/abd0de3269fd712955d27b70e32921841c7b8bb7";
sha256 = "0b38n1ad00s1qqyw3ml3pypf8i1pw4aqw0bpa02qq9iv7sp3x0gz";
}) { }).niv;
in {
home = {
sessionVariables = {
EDITOR = "vim";
BROWSER = "firefox";
TERMINAL = "alacritty";
};
packages = with pkgs; [
# nix utilities
cachix
niv
nixfmt
nix-prefetch-git
# command line utilities
ag
fzy
imagemagick
jq
tldr
unzip
# graphical applications
alacritty
atom
enpass
firefox
nheko
slack
steam
# graphical utilities
clipmenu
clipnotify
dmenu
i3lock
rofi
xclip
];
file = {
".background-image".source = ./assets/background-image;
".lockscreen-image".source = ./assets/lockscreen-image;
".config/fish/fishfile".text = ''
laughedelic/pisces
sijad/gitignore
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/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
string match \*.zip $target; and set target (basename target)
unzip -d $target $target
end
'';
".config/i3status/config".text = ''
# i3status configuration file.
# see "man i3status" for documentation.
# It is important that this file is edited as UTF-8.
# The following line should contain a sharp s:
# ß
# If the above line is not correctly displayed, fix your editor first!
general {
colors = true
interval = 5
}
order += "disk /"
order += "volume master"
order += "wireless _first_"
order += "battery 1"
order += "load"
order += "tztime local"
wireless _first_ {
format_up = " (%essid - %quality) %ip"
format_down = "down"
}
volume master {
format = " %volume"
format_muted = " (%volume)"
device = "pulse:0"
mixer = "Master"
mixer_idx = 0
}
battery 1 {
format = "%status %percentage %remaining"
status_bat = ""
status_chr = ""
status_full = ""
low_threshold = 30
threshold_type = percentage
integer_battery_capacity = true
color_good = "#0000FF"
path = "/sys/class/power_supply/BAT0/uevent"
}
run_watch DHCP {
pidfile = "/var/run/dhclient*.pid"
}
run_watch VPN {
pidfile = "/var/run/vpnc/pid"
}
tztime local {
format = " %h %d, %Y %I:%M:%S"
}
load {
format = " %1min"
}
disk "/" {
format = " %avail free"
}
'';
".config/rofi/theme.rasi".source = ./assets/arc-dark-red.rasi;
};
};
nixpkgs = { config.allowUnfree = true; };
programs = {
alacritty = {
enable = true;
settings = { font.normal.family = "Fira Code"; };
};
bat.enable = true;
broot.enable = true;
command-not-found.enable = true;
direnv.enable = true;
feh.enable = true;
firefox.enable = true;
fish = {
enable = true;
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 upgrade="sudo nixos-rebuild switch --upgrade"
alias clip="xclip -selection c"
alias cxuse="sudo cachix use -d ~/dotfiles.nix"
alias cxpsh="nix build -f shell.nix; nix-store -qR --include-outputs (nix-instantiate shell.nix) | cachix push"
'';
};
git = {
enable = true;
userName = "${name}";
userEmail = "${workEmail}";
ignores = [ ".*.sw[a-z]" "tags" ];
extraConfig = {
color.ui = true;
core.editor = "vim";
push.default = "simple";
};
};
htop = {
enable = true;
highlightBaseName = true;
};
jq.enable = true;
man.enable = true;
neovim = {
enable = true;
viAlias = true;
vimAlias = true;
plugins = with pkgs.vimPlugins; [
neovim-sensible
vim-fugitive
vim-surround
nerdtree
nerdtree-git-plugin
vim-colorschemes
vim-nix
lightline-vim
haskell-vim
LanguageClient-neovim
];
extraConfig = ''
set cursorline "highlight current line
set showmatch "highlight matching [{()}]
set tabstop=2 "number of visual spaces per TAB when reading
set softtabstop=2 "number of spaces per TAB when editing
set expandtab "tabs are spaces
set shiftwidth=2 "indents
cmap w!! w !sudo tee >/dev/null %
set ww=<,>,[,] "wrap
"terminal exit
tnoremap <Esc> <C-\><C-n>:q!<CR>
colorscheme Tomorrow-Night-Eighties
"lightline options
let g:lightline = {'colorscheme': 'jellybeans'}
"cursor saving
autocmd BufReadPost * if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
"nerdtree
"show hidden files
let NERDTreeShowHidden=1
"open on vim open
autocmd vimenter * NERDTree
"switch to editing window
autocmd vimenter * wincmd p
"close if only nerdtree is left
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
"language server stuff
let g:LanguageClient_rootMarkers = ['*.cabal', 'stack.yaml']
let g:LanguageClient_serverCommands = {
\ 'haskell': ['ghcide', '--lsp'],
\ }
'';
};
rofi = {
enable = true;
font = "Fira Code 14";
lines = 15;
location = "center";
theme = ".config/rofi/theme";
};
ssh = {
enable = true;
extraOptionOverrides = {
"AddKeysToAgent" = "true";
};
};
starship.enable = true;
};
services = {
gnome-keyring.enable = true;
lorri.enable = true;
redshift = {
enable = true;
provider = "geoclue2";
};
screen-locker = {
enable = true;
lockCmd = "${lockCmd}";
};
};
xsession = {
enable = true;
scriptPath = ".hm-xsession";
windowManager = {
i3 = import ./i3.nix {
inherit lib;
inherit lockCmd;
};
};
};
}