2022-06-09 21:50:24 +00:00
# docs:
# https://rycee.gitlab.io/home-manager/
# https://rycee.gitlab.io/home-manager/options.html
# man home-configuration.nix
#
2022-07-06 21:36:14 +00:00
{ lib , config , pkgs , . . . }:
2022-06-09 21:50:24 +00:00
with lib ;
let
2022-08-01 07:23:49 +00:00
cfg = config . sane . home-manager ;
2022-07-31 19:00:06 +00:00
vim-swap-dir = " . c a c h e / v i m - s w a p " ;
2022-06-09 21:50:24 +00:00
in
2022-05-22 08:27:02 +00:00
{
2022-06-09 21:50:24 +00:00
options = {
2022-08-01 07:23:49 +00:00
sane . home-manager . enable = mkOption {
2022-06-23 07:24:39 +00:00
default = false ;
type = types . bool ;
} ;
2022-08-01 07:23:49 +00:00
sane . home-manager . extraPackages = mkOption {
2022-06-09 21:50:24 +00:00
default = [ ] ;
type = types . listOf types . package ;
} ;
2022-08-03 08:23:23 +00:00
# attributes to copy directly to home-manager's `wayland.windowManager` option
2022-08-01 07:23:49 +00:00
sane . home-manager . windowManager = mkOption {
2022-06-09 22:01:38 +00:00
default = { } ;
type = types . attrs ;
} ;
2022-08-03 08:23:23 +00:00
# extra attributes to include in home-manager's `programs` option
2022-08-01 07:23:49 +00:00
sane . home-manager . programs = mkOption {
2022-06-09 22:05:58 +00:00
default = { } ;
type = types . attrs ;
} ;
2022-06-09 21:50:24 +00:00
} ;
2022-06-23 07:24:39 +00:00
config = lib . mkIf cfg . enable {
2022-06-21 06:55:43 +00:00
sops . secrets . " a e r c _ a c c o u n t s " = {
owner = config . users . users . colin . name ;
2022-07-06 21:23:49 +00:00
sopsFile = ../../../secrets/universal/aerc_accounts.conf ;
2022-06-21 06:55:43 +00:00
format = " b i n a r y " ;
} ;
2022-06-10 01:53:19 +00:00
2022-08-01 07:23:49 +00:00
sane . impermanence . home-dirs = [
2022-07-10 22:25:04 +00:00
" a r c h i v e "
" d e v "
" r e c o r d s "
" r e f "
" t m p "
" u s e "
" M u s i c "
" P i c t u r e s "
" V i d e o s "
2022-07-31 19:00:06 +00:00
vim-swap-dir
2022-07-10 22:25:04 +00:00
] ;
2022-06-09 21:50:24 +00:00
home-manager . useGlobalPkgs = true ;
home-manager . useUserPackages = true ;
2022-06-21 06:55:43 +00:00
# XXX this weird rename + closure is to get home-manager's `config.lib.file` to exist.
# see: https://github.com/nix-community/home-manager/issues/589#issuecomment-950474105
home-manager . users . colin = let sysconfig = config ; in { config , . . . }: {
2022-06-09 21:50:24 +00:00
home . stateVersion = " 2 1 . 1 1 " ;
home . username = " c o l i n " ;
home . homeDirectory = " / h o m e / c o l i n " ;
# XDG defines things like ~/Desktop, ~/Downloads, etc.
# these clutter the home, so i mostly don't use them.
xdg . userDirs = {
enable = true ;
createDirectories = false ; # on headless systems, most xdg dirs are noise
desktop = " $ H O M E / . x d g / D e s k t o p " ;
2022-06-18 00:52:31 +00:00
documents = " $ H O M E / d e v " ;
2022-06-09 21:50:24 +00:00
download = " $ H O M E / t m p " ;
music = " $ H O M E / M u s i c " ;
pictures = " $ H O M E / P i c t u r e s " ;
publicShare = " $ H O M E / . x d g / P u b l i c " ;
templates = " $ H O M E / . x d g / T e m p l a t e s " ;
videos = " $ H O M E / V i d e o s " ;
} ;
2022-07-01 11:36:32 +00:00
xdg . mimeApps . enable = true ;
xdg . mimeApps . defaultApplications = {
" t e x t / h t m l " = [ " l i b r e w o l f . d e s k t o p " ] ;
" x - s c h e m e - h a n d l e r / h t t p " = [ " l i b r e w o l f . d e s k t o p " ] ;
" x - s c h e m e - h a n d l e r / h t t p s " = [ " l i b r e w o l f . d e s k t o p " ] ;
" x - s c h e m e - h a n d l e r / a b o u t " = [ " l i b r e w o l f . d e s k t o p " ] ;
" x - s c h e m e - h a n d l e r / u n k n o w n " = [ " l i b r e w o l f . d e s k t o p " ] ;
2022-08-01 01:09:01 +00:00
" i m a g e / p n g " = [ " o r g . g n o m e . g T h u m b . d e s k t o p " ] ;
2022-07-01 11:36:32 +00:00
} ;
2022-06-09 21:50:24 +00:00
2022-06-21 08:59:31 +00:00
# convenience
home . file . " k n o w l e d g e " . source = config . lib . file . mkOutOfStoreSymlink " / h o m e / c o l i n / d e v / k n o w l e d g e " ;
2022-06-21 09:23:19 +00:00
home . file . " n i x o s " . source = config . lib . file . mkOutOfStoreSymlink " / h o m e / c o l i n / d e v / n i x o s " ;
2022-06-21 08:59:31 +00:00
2022-08-01 01:09:01 +00:00
# nb markdown/personal knowledge manager
home . file . " . n b / k n o w l e d g e " . source = config . lib . file . mkOutOfStoreSymlink " / h o m e / c o l i n / d e v / k n o w l e d g e " ;
home . file . " . n b / . c u r r e n t " . text = " k n o w l e d g e " ;
home . file . " . n b r c " . text = ''
# manage with `nb settings`
export NB_AUTO_SYNC = 0
'' ;
# aerc TUI mail client
2022-06-21 06:55:43 +00:00
xdg . configFile . " a e r c / a c c o u n t s . c o n f " . source =
config . lib . file . mkOutOfStoreSymlink sysconfig . sops . secrets . aerc_accounts . path ;
2022-06-09 22:05:58 +00:00
programs = {
home-manager . enable = true ; # this lets home-manager manage dot-files in user dirs, i think
zsh = {
2022-06-09 21:50:24 +00:00
enable = true ;
2022-06-09 22:05:58 +00:00
enableSyntaxHighlighting = true ;
enableVteIntegration = true ;
dotDir = " . c o n f i g / z s h " ;
initExtraBeforeCompInit = ''
# p10k instant prompt
# run p10k configure to configure, but it can't write out its file :-(
POWERLEVEL9K_DISABLE_CONFIGURATION_WIZARD = true
'' ;
# prezto = oh-my-zsh fork; controls prompt, auto-completion, etc.
# see: https://github.com/sorin-ionescu/prezto
prezto = {
enable = true ;
pmodules = [
" e n v i r o n m e n t "
" t e r m i n a l "
" e d i t o r "
" h i s t o r y "
" d i r e c t o r y "
" s p e c t r u m "
" u t i l i t y "
" c o m p l e t i o n "
" p r o m p t "
" g i t "
] ;
prompt = {
theme = " p o w e r l e v e l 1 0 k " ;
} ;
2022-06-09 21:50:24 +00:00
} ;
} ;
2022-08-03 08:23:23 +00:00
kitty = lib . mkIf ( sysconfig . sane . gui . enable ) {
2022-06-30 07:43:08 +00:00
enable = true ;
2022-08-01 06:42:13 +00:00
# docs: https://sw.kovidgoyal.net/kitty/conf/
settings = {
# disable terminal bell (when e.g. you backspace too many times)
enable_audio_bell = false ;
} ;
keybindings = {
" c t r l + n " = " n e w _ o s _ w i n d o w _ w i t h _ c w d " ;
} ;
2022-08-02 00:12:36 +00:00
# docs: https://github.com/kovidgoyal/kitty-themes
# theme = "1984 Light"; # dislike: awful, harsh blues/teals
# theme = "Adventure Time"; # dislike: harsh (dark)
# theme = "Atom One Light"; # GOOD: light theme. all color combos readable. not a huge fan of the blue.
# theme = "Belafonte Day"; # dislike: too low contrast for text colors
# theme = "Belafonte Night"; # better: dark theme that's easy on the eyes. all combos readable. low contrast.
# theme = "Catppuccin"; # dislike: a bit pale/low-contrast (dark)
# theme = "Desert"; # mediocre: colors are harsh
# theme = "Earthsong"; # BEST: dark theme. readable, good contrast. unique, but decent colors.
# theme = "Espresso Libre"; # better: dark theme. readable, but meh colors
# theme = "Forest Night"; # decent: very pastel. it's workable, but unconventional and muted/flat.
# theme = "Gruvbox Material Light Hard"; # mediocre light theme.
# theme = "kanagawabones"; # better: dark theme. colors are too background-y
# theme = "Kaolin Dark"; # dislike: too dark
# theme = "Kaolin Breeze"; # mediocre: not-too-harsh light theme, but some parts are poor contrast
# theme = "Later This Evening"; # mediocre: not-too-harsh dark theme, but cursor is poor contrast
# theme = "Material"; # decent: light theme, few colors.
# theme = "Mayukai"; # decent: not-too-harsh dark theme. the teal is a bit straining
# theme = "Nord"; # mediocre: pale background, low contrast
# theme = "One Half Light"; # better: not-too-harsh light theme. contrast could be better
theme = " P a p e r C o l o r D a r k " ; # BEST: dark theme, very readable still the colors are background-y
# theme = "Parasio Dark"; # dislike: too low contrast
# theme = "Pencil Light"; # better: not-too-harsh light theme. decent contrast.
# theme = "Pnevma"; # dislike: too low contrast
# theme = "Piatto Light"; # better: readable light theme. pleasing colors. powerline prompt is hard to read.
# theme = "Rosé Pine Dawn"; # GOOD: light theme. all color combinations are readable. it is very mild -- may need to manually tweak contrast. tasteful colors
# theme = "Rosé Pine Moon"; # GOOD: dark theme. tasteful colors. but background is a bit intense
# theme = "Sea Shells"; # mediocre. not all color combos are readable
# theme = "Solarized Light"; # mediocre: not-too-harsh light theme; GREAT background; but some colors are low contrast
# theme = "Solarized Dark Higher Contrast"; # better: dark theme, decent colors
# theme = "Sourcerer"; # mediocre: ugly colors
# theme = "Space Gray"; # mediocre: too muted
# theme = "Space Gray Eighties"; # better: all readable, decent colors
# theme = "Spacemacs"; # mediocre: too muted
# theme = "Spring"; # mediocre: readable light theme, but the teal is ugly.
# theme = "Srcery"; # better: highly readable. colors are ehhh
# theme = "Substrata"; # decent: nice colors, but a bit flat.
# theme = "Sundried"; # mediocre: the solar text makes me squint
# theme = "Symfonic"; # mediocre: the dark purple has low contrast to the black bg.
# theme = "Tango Light"; # dislike: teal is too grating
# theme = "Tokyo Night Day"; # medicore: too muted
# theme = "Tokyo Night"; # better: tasteful. a bit flat
# theme = "Tomorrow"; # GOOD: all color combinations are readable. contrast is slightly better than Rose. on the blander side
# theme = "Treehouse"; # dislike: the orange is harsh on my eyes.
# theme = "Urple"; # dislike: weird palette
# theme = "Warm Neon"; # decent: not-too-harsh dark theme. the green is a bit unattractive
# theme = "Wild Cherry"; # GOOD: dark theme: nice colors. a bit flat
# theme = "Xcodedark"; # dislike: bad palette
# theme = "citylights"; # decent: dark theme. some parts have just a bit low contrast
# theme = "neobones_light"; # better light theme. the background is maybe too muted
# theme = "vimbones";
# theme = "zenbones_dark"; # mediocre: readable, but meh colors
# theme = "zenbones_light"; # decent: light theme. all colors are readable. contrast is passable but not excellent. highlight color is BAD
# theme = "zenwritten_dark"; # mediocre: looks same as zenbones_dark
2022-08-01 06:42:13 +00:00
# extraConfig = "";
2022-06-30 07:43:08 +00:00
} ;
2022-06-09 22:05:58 +00:00
git = {
enable = true ;
userName = " c o l i n " ;
userEmail = " c o l i n @ u n i n s a n e . o r g " ;
} ;
2022-06-09 21:50:24 +00:00
2022-08-01 01:09:01 +00:00
neovim = {
# neovim: https://github.com/neovim/neovim
2022-06-09 22:05:58 +00:00
enable = true ;
2022-08-01 01:09:01 +00:00
viAlias = true ;
vimAlias = true ;
plugins = with pkgs . vimPlugins ; [
# docs: surround-nvim: https://github.com/ur4ltz/surround.nvim/
# docs: vim-surround: https://github.com/tpope/vim-surround
vim-surround
# docs: fzf-vim (fuzzy finder): https://github.com/junegunn/fzf.vim
fzf-vim
# treesitter syntax highlighting: https://nixos.wiki/wiki/Tree_sitters
# config taken from: https://github.com/i077/system/blob/master/modules/home/neovim/default.nix
# this is required for tree-sitter to even highlight
( {
plugin = ( nvim-treesitter . withPlugins ( _ : pkgs . tree-sitter . allGrammars ) ) ;
type = " l u a " ;
config = ''
require'nvim-treesitter . configs' . setup {
highlight = {
enable = true ,
disable = { }
} ,
incremental_selection = {
enable = true ,
keymaps = {
init_selection = " g n n " ,
node_incremental = " g r n " ,
mcope_incremental = " g r c " ,
node_decremental = " g r m "
}
} ,
indent = {
enable = true ,
disable = { }
}
}
vim . o . foldmethod = ' expr'
vim . o . foldexpr = ' nvim_treesitter #foldexpr()'
'' ;
} )
] ;
extraConfig = ''
2022-06-09 22:05:58 +00:00
" c o p y / p a s t e t o s y s t e m c l i p b o a r d
set clipboard = unnamedplus
2022-07-31 19:00:06 +00:00
2022-08-01 01:09:01 +00:00
" a t l e a s t d o n ' t o p e n f i l e s w i t h s e c t i o n s f o l d e d b y d e f a u l t
set nofoldenable
2022-07-31 19:00:06 +00:00
2022-08-01 01:09:01 +00:00
" h o r i z o n t a l r u l e u n d e r t h e a c t i v e l i n e
" s e t c u r s o r l i n e
2022-07-31 19:00:06 +00:00
2022-08-01 01:09:01 +00:00
" h i g h l i g h t t r a i l i n g s p a c e & r e l a t e d s y n t a x e r r o r s ( d o e s n ' t s e e m t o w o r k ? ? )
" l e t c _ s p a c e _ e r r o r s = 1
" l e t p y t h o n _ s p a c e _ e r r o r s = 1
'' ;
2022-06-09 22:05:58 +00:00
} ;
2022-06-09 21:50:24 +00:00
2022-08-03 08:23:23 +00:00
# XXX: although home-manager calls this option `firefox`, we can use other browsers and it still mostly works.
2022-08-01 07:23:49 +00:00
firefox = lib . mkIf ( sysconfig . sane . gui . enable ) {
2022-06-09 22:05:58 +00:00
enable = true ;
2022-07-06 21:41:19 +00:00
package = import ./web-browser.nix pkgs ;
2022-06-09 21:50:24 +00:00
} ;
2022-06-09 22:05:58 +00:00
# "command not found" will cause the command to be searched in nixpkgs
nix-index . enable = true ;
} // cfg . programs ;
2022-06-09 21:50:24 +00:00
home . shellAliases = {
" : q " = " e x i t " ;
# common typos
" c d . . " = " c d . . " ;
" c d . . / " = " c d . . / " ;
} ;
2022-06-09 22:01:38 +00:00
wayland . windowManager = cfg . windowManager ;
2022-06-09 21:50:24 +00:00
2022-07-11 00:14:20 +00:00
home . packages = cfg . extraPackages ;
2022-06-09 21:50:24 +00:00
} ;
} ;
2022-05-22 08:27:02 +00:00
}