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-08-03 08:51:15 +00:00
# extract package from `extraPackages`
pkglist = pkgspec : builtins . map ( e : e . pkg or e ) pkgspec ;
# extract `dir` from `extraPackages`
dirlist = pkgspec : builtins . concatLists ( builtins . map ( e : if e ? " d i r " then [ e . dir ] else [ ] ) pkgspec ) ;
2022-09-27 00:48:55 +00:00
# extract `persist-files` from `extraPackages`
persistfileslist = pkgspec : builtins . concatLists ( builtins . map ( e : if e ? " p e r s i s t - f i l e s " then e . persist-files else [ ] ) pkgspec ) ;
# TODO: dirlist and persistfileslist should be folded
2022-10-14 16:37:40 +00:00
feeds = import ./feeds.nix { inherit lib ; } ;
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-03 09:03:17 +00:00
# packages to deploy to the user's home
2022-08-01 07:23:49 +00:00
sane . home-manager . extraPackages = mkOption {
2022-06-09 21:50:24 +00:00
default = [ ] ;
2022-08-03 08:51:15 +00:00
# each entry can be either a package, or attrs:
2022-08-03 09:03:17 +00:00
# { pkg = package; dir = optional string;
2022-08-03 08:51:15 +00:00
type = types . listOf ( types . either types . package types . attrs ) ;
2022-06-09 21:50:24 +00:00
} ;
2022-08-03 09:03:17 +00:00
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 09:03:17 +00:00
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-08-10 06:10:21 +00:00
sops . secrets . " s u b l i m e _ m u s i c _ c o n f i g " = {
owner = config . users . users . colin . name ;
sopsFile = ../../../secrets/universal/sublime_music_config.json.bin ;
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-08-03 08:51:15 +00:00
] ++ ( dirlist cfg . extraPackages ) ;
2022-09-27 00:48:55 +00:00
sane . impermanence . home-files = persistfileslist cfg . extraPackages ;
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-08-03 08:51:15 +00:00
2022-10-06 22:56:37 +00:00
# run `home-manager-help` to access manpages
# or `man home-configuration.nix`
manual . html . enable = true ;
2022-08-03 08:51:15 +00:00
home . packages = pkglist cfg . extraPackages ;
wayland . windowManager = cfg . windowManager ;
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 " ;
2022-10-07 00:29:10 +00:00
home . activation = {
initKeyring = {
after = [ " w r i t e B o u n d a r y " ] ;
before = [ ] ;
data = " ${ ../../../scripts/init-keyring } " ;
} ;
} ;
2022-06-09 21:50:24 +00:00
# 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-09-26 09:21:09 +00:00
# the xdg mime type for a file can be found with:
# - `xdg-mime query filetype path/to/thing.ext`
2022-07-01 11:36:32 +00:00
xdg . mimeApps . enable = true ;
2022-10-10 00:42:48 +00:00
xdg . mimeApps . defaultApplications = let
www = " l i b r e w o l f . d e s k t o p " ;
pdf = " o r g . g n o m e . E v i n c e . d e s k t o p " ;
md = " o b s i d i a n . d e s k t o p " ;
thumb = " o r g . g n o m e . g T h u m b . d e s k t o p " ;
video = " v l c . d e s k t o p " ;
2022-10-10 11:58:42 +00:00
# audio = "mpv.desktop";
audio = " v l c . d e s k t o p " ;
2022-10-10 00:42:48 +00:00
in {
2022-09-26 09:21:09 +00:00
# HTML
2022-10-10 00:42:48 +00:00
" t e x t / h t m l " = [ www ] ;
" x - s c h e m e - h a n d l e r / h t t p " = [ www ] ;
" x - s c h e m e - h a n d l e r / h t t p s " = [ www ] ;
" x - s c h e m e - h a n d l e r / a b o u t " = [ www ] ;
" x - s c h e m e - h a n d l e r / u n k n o w n " = [ www ] ;
2022-09-27 00:02:14 +00:00
# RICH-TEXT DOCUMENTS
2022-10-10 00:42:48 +00:00
" a p p l i c a t i o n / p d f " = [ pdf ] ;
" t e x t / m a r k d o w n " = [ md ] ;
2022-09-26 09:21:09 +00:00
# IMAGES
2022-10-10 00:42:48 +00:00
" i m a g e / h e i f " = [ thumb ] ; # apple codec
" i m a g e / p n g " = [ thumb ] ;
" i m a g e / j p e g " = [ thumb ] ;
2022-09-26 09:21:09 +00:00
# VIDEO
2022-10-10 00:42:48 +00:00
" v i d e o / m p 4 " = [ video ] ;
" v i d e o / q u i c k t i m e " = [ video ] ;
" v i d e o / x - m a t r o s k a " = [ video ] ;
2022-09-26 09:21:09 +00:00
# AUDIO
2022-10-10 00:42:48 +00:00
" a u d i o / f l a c " = [ audio ] ;
" a u d i o / m p e g " = [ audio ] ;
" a u d i o / x - v o r b i s + o g g " = [ audio ] ;
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-10-01 10:00:15 +00:00
home . file . " V i d e o s / s e r v o " . source = config . lib . file . mkOutOfStoreSymlink " / m n t / s e r v o - m e d i a / V i d e o s " ;
home . file . " V i d e o s / s e r v o - i n c o m p l e t e " . source = config . lib . file . mkOutOfStoreSymlink " / m n t / s e r v o - m e d i a / i n c o m p l e t e " ;
home . file . " M u s i c / s e r v o " . source = config . lib . file . mkOutOfStoreSymlink " / m n t / s e r v o - m e d i a / M u s i c " ;
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
'' ;
2022-09-16 01:49:16 +00:00
# uBlock filter list configuration.
# specifically, enable the GDPR cookie prompt blocker.
# data.toOverwrite.filterLists is additive (i.e. it supplements the default filters)
# this configuration method is documented here:
# - <https://github.com/gorhill/uBlock/issues/2986#issuecomment-364035002>
# the specific attribute path is found via scraping ublock code here:
# - <https://github.com/gorhill/uBlock/blob/master/src/js/storage.js>
# - <https://github.com/gorhill/uBlock/blob/master/assets/assets.json>
home . file . " . l i b r e w o l f / m a n a g e d - s t o r a g e / u B l o c k 0 @ r a y m o n d h i l l . n e t . j s o n " . text = ''
{
" n a m e " : " u B l o c k 0 @ r a y m o n d h i l l . n e t " ,
" d e s c r i p t i o n " : " i g n o r e d " ,
" t y p e " : " s t o r a g e " ,
" d a t a " : {
" t o O v e r w r i t e " : " { \" f i l t e r L i s t s \" : [ \" f a n b o y - c o o k i e m o n s t e r \" ] } "
}
}
'' ;
2022-10-09 04:54:00 +00:00
home . file . " . l i b r e w o l f / l i b r e w o l f . o v e r r i d e s . c f g " . text = ''
// if we can't query the revocation status of a SSL cert because the issuer is offline ,
// treat it as unrevoked .
// see : < https://librewolf.net/docs/faq/ #im-getting-sec_error_ocsp_server_error-what-can-i-do>
defaultPref ( " s e c u r i t y . O C S P . r e q u i r e " , false ) ;
'' ;
2022-09-16 01:49:16 +00:00
2022-08-01 01:09:01 +00:00
# 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-09-20 11:39:28 +00:00
# make Discord usable even when client is "outdated"
xdg . configFile . " d i s c o r d / s e t t i n g s . j s o n " . text = ''
{
" S K I P _ H O S T _ U P D A T E " : true
}
'' ;
2022-08-10 06:10:21 +00:00
# sublime music player
xdg . configFile . " s u b l i m e - m u s i c / c o n f i g . j s o n " . source =
config . lib . file . mkOutOfStoreSymlink sysconfig . sops . secrets . sublime_music_config . path ;
2022-08-05 07:46:17 +00:00
xdg . configFile . " v l c / v l c r c " . text =
let
2022-10-15 05:37:02 +00:00
podcastUrls = lib . strings . concatStringsSep " | " (
builtins . map ( feed : feed . url ) feeds . podcasts
) ;
2022-08-05 07:46:17 +00:00
in ''
2022-10-15 05:37:02 +00:00
[ podcast ]
podcast-urls = $ { podcastUrls }
[ core ]
metadata-network-access = 0
[ qt ]
qt-privacy-ask = 0
2022-08-05 07:46:17 +00:00
'' ;
2022-10-11 08:30:17 +00:00
2022-10-14 16:37:40 +00:00
xdg . configFile . " g p o d d e r F e e d s . o p m l " . text = with feeds ;
2022-10-15 05:37:02 +00:00
feedsToOpml feeds . podcasts ;
2022-08-05 07:46:17 +00:00
2022-10-11 08:30:17 +00:00
# news-flash RSS viewer
2022-10-14 16:37:40 +00:00
xdg . configFile . " n e w s f l a s h F e e d s . o p m l " . text = with feeds ;
2022-10-15 05:37:02 +00:00
feedsToOpml ( feeds . texts ++ feeds . images ) ;
2022-10-10 01:37:19 +00:00
2022-08-04 21:16:37 +00:00
# gnome feeds RSS viewer
2022-10-15 05:37:02 +00:00
xdg . configFile . " o r g . g a b m u s . g f e e d s . j s o n " . text =
let
myFeeds = feeds . texts ++ feeds . images ;
in builtins . toJSON {
# feed format is a map from URL to a dict,
# with dict["tags"] a list of string tags.
feeds = builtins . foldl' ( acc : feed : acc // {
" ${ feed . url } " . tags = [ feed . cat feed . freq ] ;
} ) { } myFeeds ;
2022-08-04 21:16:37 +00:00
dark_reader = false ;
new_first = true ;
2022-08-04 21:20:21 +00:00
# windowsize = {
# width = 350;
# height = 650;
# };
2022-08-04 23:43:36 +00:00
max_article_age_days = 90 ;
2022-08-04 21:16:37 +00:00
enable_js = false ;
2022-08-20 19:49:35 +00:00
max_refresh_threads = 3 ;
2022-08-04 21:20:21 +00:00
# saved_items = {};
# read_items = [];
2022-08-04 21:16:37 +00:00
show_read_items = true ;
full_article_title = true ;
2022-08-04 23:35:04 +00:00
# views: "webview", "reader", "rsscont"
default_view = " r s s c o n t " ;
2022-08-04 21:16:37 +00:00
open_links_externally = true ;
full_feed_name = false ;
2022-08-04 21:20:21 +00:00
refresh_on_startup = true ;
2022-10-15 05:37:02 +00:00
tags = lib . lists . unique (
( builtins . catAttrs " c a t " myFeeds ) ++ ( builtins . catAttrs " f r e q " myFeeds )
) ;
2022-08-04 21:16:37 +00:00
open_youtube_externally = false ;
2022-08-05 02:16:15 +00:00
media_player = " v l c " ; # default: mpv
2022-08-04 21:16:37 +00:00
} ;
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 ;
2022-10-18 01:22:28 +00:00
history . ignorePatterns = [ " r m * " ] ;
# history.path = TODO
2022-06-09 22:05:58 +00:00
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
'' ;
2022-10-09 03:12:50 +00:00
initExtra = ''
# zmv is a way to do rich moves/renames, with pattern matching/substitution.
# see for an example: <https://filipe.kiss.ink/zmv-zsh-rename/>
autoload - Uz zmv
'' ;
2022-06-09 22:05:58 +00:00
# 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-10-09 11:43:26 +00:00
2022-08-04 10:33:42 +00:00
kitty = {
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-10-09 11:43:26 +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-10-09 11:43:26 +00:00
aliases = { co = " c h e c k o u t " ; } ;
2022-10-14 08:10:23 +00:00
# TODO: figure out how to get the old `diff` for generating patches
# difftastic.enable = true; # better diff rendering
2022-06-09 22:05:58 +00:00
} ;
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 ; [
2022-08-25 07:17:33 +00:00
# docs: surround-nvim: https://github.com/ur4ltz/surround.nvim/
2022-08-01 01:09:01 +00:00
# docs: vim-surround: https://github.com/tpope/vim-surround
vim-surround
# docs: fzf-vim (fuzzy finder): https://github.com/junegunn/fzf.vim
fzf-vim
2022-08-25 07:59:13 +00:00
# docs: https://github.com/KeitaNakamura/tex-conceal.vim/
( {
plugin = tex-conceal-vim ;
type = " v i m l " ;
config = ''
" p r e s e n t p r e t t i e r f r a c t i o n s
let g:tex_conceal_frac=1
'' ;
} )
2022-08-25 07:17:33 +00:00
( {
plugin = vim-SyntaxRange ;
type = " v i m l " ;
config = ''
" e n a b l e m a r k d o w n - s t y l e c o d e b l o c k h i g h l i g h t i n g f o r t e x c o d e
autocmd BufEnter * call SyntaxRange #Include('```tex', '```', 'tex', 'NonText')
2022-08-25 07:59:13 +00:00
" a u t o c m d S y n t a x t e x s e t c o n c e a l l e v e l = 2
2022-08-25 07:17:33 +00:00
'' ;
} )
2022-08-25 02:44:32 +00:00
# nabla renders inline math in any document, but it's buggy.
# https://github.com/jbyuki/nabla.nvim
# ({
# plugin = pkgs.nabla;
# type = "lua";
# config = ''
# require'nabla'.enable_virt()
# '';
# })
# treesitter syntax highlighting: https://nixos.wiki/wiki/Tree_sitters
2022-08-25 07:17:33 +00:00
# docs: https://github.com/nvim-treesitter/nvim-treesitter
# 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 = ''
2022-08-01 01:09:01 +00:00
require'nvim-treesitter . configs' . setup {
highlight = {
enable = true ,
2022-08-25 07:17:33 +00:00
- - disable treesitter on Rust so that we can use SyntaxRange
- - and leverage TeX rendering in rust projects
disable = { " r u s t " , " t e x " , " l a t e x " } ,
- - disable = { " t e x " , " l a t e x " } ,
- - true to also use builtin vim syntax highlighting when treesitter fails
additional_vim_regex_highlighting = false
2022-08-01 01:09:01 +00:00
} ,
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 = { }
}
}
2022-08-25 22:57:48 +00:00
2022-08-01 01:09:01 +00:00
vim . o . foldmethod = ' expr'
vim . o . foldexpr = ' nvim_treesitter #foldexpr()'
'' ;
2022-08-25 07:17:33 +00:00
} )
2022-08-01 01:09:01 +00:00
] ;
2022-08-25 07:17:33 +00:00
extraConfig = ''
2022-10-09 05:57:51 +00:00
" l e t t h e t e r m i n a l h a n d l e m o u s e e v e n t s , t h a t w a y i g e t O S - l e v e l c t r l + s h i f t + c / e t c
" t h i s u s e d t o b e d e f a u l t , u n t i l < h t t p s : / / g i t h u b . c o m / n e o v i m / n e o v i m / p u l l / 1 9 2 9 0 >
set mouse =
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-08-25 22:57:48 +00:00
" s c r e w t a b s ; a l w a y s e x p a n d t h e m i n t o s p a c e s
set expandtab
2022-08-25 07:17:33 +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-08-25 07:59:13 +00:00
" a l l o w t e x t s u b s t i t u t i o n s f o r c e r t a i n g l y p h s .
" h i g h e r n u m b e r = m o r e a g g r e s s i v e s u b s t i t u t i o n ( 0 , 1 , 2 , 3 )
" i o n l y m a k e u s e o f t h i s f o r t e x , b u t i t ' s u n c l e a r h o w t o
" a p p l y t h a t * j u s t * t o t e x a n d r e t a i n t h e S y n t a x R a n g e s t u f f .
set conceallevel = 2
2022-08-25 22:57:48 +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
2022-08-25 07:17:33 +00:00
" s e t c u r s o r l i n e
2022-08-25 22:57:48 +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-08-25 22:57:48 +00:00
" e n a b l e h i g h l i g h t i n g o f l e a d i n g / t r a i l i n g s p a c e s ,
" a n d e s p e c i a l l y t a b s
" s o u r c e : h t t p s : / / w w w . r e d d i t . c o m / r / n e o v i m / c o m m e n t s / c h l m f k / h i g h l i g h t _ t r a i l i n g _ w h i t e s p a c e s _ i n _ n e o v i m /
set list
set listchars = tab : ▷ \ · , trail : · , extends : ◣ , precedes : ◢ , nbsp : ○
2022-08-25 07:17:33 +00:00
'' ;
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-10-10 01:37:19 +00:00
mpv = {
enable = true ;
config = {
save-position-on-quit = true ;
keep-open = " y e s " ;
} ;
} ;
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-05-22 08:27:02 +00:00
}