revamp of nix organization
This commit is contained in:
parent
01a48ac956
commit
4a4014bf59
20 changed files with 369 additions and 129 deletions
14
nix/home/commandline.nix
Normal file
14
nix/home/commandline.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
defaultPkgs = with pkgs; [
|
||||
lorri
|
||||
p7zip
|
||||
];
|
||||
in
|
||||
{
|
||||
imports = [(import ./universal.nix)];
|
||||
|
||||
services.lorri.enable = true;
|
||||
xdg.enable = true;
|
||||
}
|
||||
22
nix/home/desktop.nix
Normal file
22
nix/home/desktop.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
defaultPkgs = with pkgs; [
|
||||
calibre
|
||||
dmenu
|
||||
firefox
|
||||
gnomecast
|
||||
multilockscreen
|
||||
signal-desktop
|
||||
slack
|
||||
vlc
|
||||
zathura
|
||||
];
|
||||
in
|
||||
{
|
||||
imports = [(import ./commandline.nix)] ++ [(import ./programs/rofi)];
|
||||
|
||||
home = {
|
||||
packages = defaultPkgs;
|
||||
};
|
||||
}
|
||||
9
nix/home/programs/direnv/default.nix
Normal file
9
nix/home/programs/direnv/default.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{pkgs, ...}:
|
||||
let
|
||||
in with builtins;
|
||||
{
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
stdlib = readFile ./direnvrc;
|
||||
};
|
||||
}
|
||||
40
nix/home/programs/direnv/direnvrc
Normal file
40
nix/home/programs/direnv/direnvrc
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
layout_postgres() {
|
||||
export PGDATA="$(direnv_layout_dir)/tmp/pgdata"
|
||||
export PGHOST="$PGDATA"
|
||||
if [[ ! -d "$PGDATA" ]]; then
|
||||
initdb --locale=$LANG
|
||||
cat <<EOF >>"$PGDATA/postgresql.conf"
|
||||
listen_addresses = 'localhost'
|
||||
unix_socket_directories = '$PGHOST'
|
||||
EOF
|
||||
echo "CREATE DATABASE $USER;" | postgres --single -E postgres
|
||||
fi
|
||||
}
|
||||
|
||||
layout_go() {
|
||||
export GOPATH="$(direnv_layout_dir)/tmp/golibs"
|
||||
if [[ ! -d "$GOPATH" ]]; then
|
||||
mkdir -p $GOPATH
|
||||
fi
|
||||
|
||||
export PATH="$GOPATH/bin:$PATH"
|
||||
}
|
||||
|
||||
layout_mysql() {
|
||||
export MYSQL_HOME="$(direnv_layout_dir)/mysql"
|
||||
export MYSQLDATA="$MYSQL_HOME/data"
|
||||
if [[ ! -d "$MYSQLDATA" ]]; then
|
||||
mkdir -p $MYSQL_HOME
|
||||
cat <<EOF >>"$MYSQL_HOME/my.cnf"
|
||||
[mysqld]
|
||||
table_open_cache=400
|
||||
socket=/tmp/mysql.sock
|
||||
max_allowed_packet=256M
|
||||
datadir=$MYSQLDATA
|
||||
|
||||
[client]
|
||||
socket=/tmp/mysql.sock
|
||||
EOF
|
||||
mysqld --initialize-insecure
|
||||
fi
|
||||
}
|
||||
22
nix/home/programs/git/default.nix
Normal file
22
nix/home/programs/git/default.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
in
|
||||
{
|
||||
programs.git = {
|
||||
enable = true;
|
||||
userName = "Haak Saxberg";
|
||||
userEmail = "haak.erling@gmail.com";
|
||||
ignores = [
|
||||
".idea/"
|
||||
".direnv/"
|
||||
".git-plans/"
|
||||
".envrc"
|
||||
".tools-info"
|
||||
"*~"
|
||||
"*.swp"
|
||||
".yardoc/"
|
||||
"doc/"
|
||||
];
|
||||
};
|
||||
}
|
||||
146
nix/home/programs/nvim/default.nix
Normal file
146
nix/home/programs/nvim/default.nix
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
vim-goyo = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "vim-goyo";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "junegunn";
|
||||
repo = "goyo.vim";
|
||||
rev = "6b6ed2734084fdbb6315357ddcaecf9c8e6f143d";
|
||||
sha256 = "1ywlz1hn54kxyp5q0angriaarimq7ys7m6sk6l4x8jr1g2yh0afz";
|
||||
};
|
||||
};
|
||||
|
||||
vim-nix = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "vim-nix";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "LnL7";
|
||||
repo = "vim-nix";
|
||||
rev = "d733cb96707a2a6bdc6102b6d89f947688e0e959";
|
||||
sha256 = "12k2gwm8b1n02361gpjhsldql99yd7qsh80a3lbwc5c5gz5j8jsb";
|
||||
};
|
||||
};
|
||||
|
||||
vim-catppuccino = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "vim-catppuccino";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Pocco81";
|
||||
repo = "Catppuccino.nvim";
|
||||
rev = "014d8575acdd19ecef4ecb12fc82a2e21794b548";
|
||||
sha256 = "0i0p21jkrx99n3dnm5xvnw8n963c67l4lgl4iwngz0psdzwxphkw";
|
||||
};
|
||||
};
|
||||
in with builtins;
|
||||
{
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
vimAlias = true;
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
vim-sensible
|
||||
vim-startify
|
||||
vim-catppuccino
|
||||
|
||||
vim-elixir
|
||||
alchemist-vim
|
||||
vim-nix
|
||||
vim-javascript
|
||||
vim-json
|
||||
vim-jsx-pretty
|
||||
|
||||
vim-commentary
|
||||
vim-airline
|
||||
{
|
||||
plugin = rainbow;
|
||||
config = ''
|
||||
let g:rainbow_conf = {
|
||||
\ 'guifgs': ['RoyalBlue3', 'SeaGreen3', 'DarkOrchid3', 'firebrick3', 'RoyalBlue3', 'SeaGreen3', 'DarkOrchid3', 'firebrick3', 'RoyalBlue3', 'DarkOrchid3', 'firebrick3', 'RoyalBlue3', 'SeaGreen3', 'DarkOrchid3', 'firebrick3'],
|
||||
\ 'ctermfgs': ['red', 'brown', 'blue', 'gray', 'green', 'magenta', 'cyan', 'darkred', 'brown', 'darkblue', 'gray', 'darkgreen', 'darkmagenta', 'darkcyan', 'red'],
|
||||
\ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold']
|
||||
\}
|
||||
let g:rainbow_active = 1
|
||||
'';
|
||||
}
|
||||
vim-signify
|
||||
{
|
||||
plugin = vim-indent-guides;
|
||||
config = ''
|
||||
let g:indent_guides_enable_on_vim_startup = 1
|
||||
let g:indent_guides_start_level = 2
|
||||
'';
|
||||
}
|
||||
vim-surround
|
||||
fugitive
|
||||
{
|
||||
plugin = easymotion;
|
||||
config = ''
|
||||
map / <Plug>(easymotion-sn)
|
||||
omap / <Plug>(easymotion-tn)
|
||||
map n <Plug>(easymotion-next)
|
||||
map N <Plug>(easymotion-prev)
|
||||
let g:EasyMotion_landing_highlight = 0
|
||||
'';
|
||||
}
|
||||
vinegar
|
||||
undotree
|
||||
{
|
||||
plugin = nvim-compe;
|
||||
config = ''
|
||||
set completeopt=menuone,noselect
|
||||
let g:compe = {}
|
||||
let g:compe.enabled = v:true
|
||||
let g:compe.autocomplete = v:true
|
||||
let g:compe.debug = v:false
|
||||
let g:compe.min_length = 1
|
||||
let g:compe.preselect = 'enable'
|
||||
let g:compe.throttle_time = 80
|
||||
let g:compe.source_timeout = 200
|
||||
let g:compe.resolve_timeout = 800
|
||||
let g:compe.incomplete_delay = 400
|
||||
let g:compe.max_abbr_width = 100
|
||||
let g:compe.max_kind_width = 100
|
||||
let g:compe.max_menu_width = 100
|
||||
let g:compe.documentation = v:true
|
||||
|
||||
let g:compe.source = {}
|
||||
let g:compe.source.path = v:true
|
||||
let g:compe.source.buffer = v:true
|
||||
let g:compe.source.calc = v:true
|
||||
let g:compe.source.nvim_lsp = v:true
|
||||
let g:compe.source.nvim_lua = v:true
|
||||
let g:compe.source.vsnip = v:true
|
||||
let g:compe.source.ultisnips = v:true
|
||||
let g:compe.source.luasnip = v:true
|
||||
let g:compe.source.emoji = v:true
|
||||
'';
|
||||
}
|
||||
vim-goyo
|
||||
{
|
||||
plugin = nvim-lspconfig;
|
||||
config = ''
|
||||
lua << EOF
|
||||
${readFile (
|
||||
pkgs.substituteAll {
|
||||
src = ./nvim-lspconfig.lua;
|
||||
# since both of these are used for actually configuring the system,
|
||||
# we'll probably always want them around.
|
||||
lua_ls = pkgs.sumneko-lua-language-server;
|
||||
rnix_lsp = pkgs.rnix-lsp;
|
||||
}
|
||||
) }
|
||||
EOF
|
||||
'';
|
||||
}
|
||||
{
|
||||
plugin = telescope-nvim;
|
||||
config = ''
|
||||
nnoremap <leader>ff <cmd>lua require('telescope.builtin').find_files()<cr>
|
||||
nnoremap <leader>fg <cmd>lua require('telescope.builtin').live_grep()<cr>
|
||||
nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr>
|
||||
nnoremap <leader>fh <cmd>lua require('telescope.builtin').help_tags()<cr>
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
extraConfig = readFile ./init.vim;
|
||||
};
|
||||
|
||||
}
|
||||
86
nix/home/programs/nvim/init.vim
Normal file
86
nix/home/programs/nvim/init.vim
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
filetype plugin indent on
|
||||
|
||||
" Indent guides
|
||||
|
||||
" let netrw look like NERDTree
|
||||
let g:netrw_liststyle = 3
|
||||
set nobackup
|
||||
set noswapfile
|
||||
set pastetoggle=<F2>
|
||||
set nowrap
|
||||
|
||||
set background=dark
|
||||
colorscheme catppuccino
|
||||
|
||||
set nocompatible
|
||||
set number relativenumber
|
||||
set numberwidth=1
|
||||
set cursorline
|
||||
set cursorcolumn
|
||||
set ruler
|
||||
set list
|
||||
set listchars=tab:>-,trail:-,extends:>,precedes:<,nbsp:+,eol:$
|
||||
set matchpairs+=<:>
|
||||
set ts=2
|
||||
set shiftwidth=2
|
||||
set expandtab
|
||||
|
||||
" Open new split panes to right and bottom, which feels more natural
|
||||
set splitbelow
|
||||
set splitright
|
||||
|
||||
""" Searching and Patterns
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set smarttab
|
||||
set hlsearch
|
||||
" Add the g flag to search/replace by default
|
||||
set gdefault
|
||||
|
||||
"recalculate the trailing whitespace warning when idle, and after saving
|
||||
autocmd cursorhold,bufwritepost * unlet! b:statusline_trailing_space_warning
|
||||
|
||||
" strip trailing whitespace
|
||||
autocmd BufWritePre * :%s/\s\+$//e
|
||||
|
||||
""" Handy remaps
|
||||
noremap ; :
|
||||
inoremap jj <Esc>
|
||||
map <silent> <leader>V :source ~/.config/nvim/init.vim<CR>:filetype detect<CR>:exe ":echo 'vimrc reloaded'"<CR>
|
||||
map \q :q<CR>
|
||||
map \w :w<CR>
|
||||
noremap Q <nop>
|
||||
|
||||
""" Esperanto digraphs (for use with ctrl-k)
|
||||
:digraph Cx 264
|
||||
:digraph cx 265
|
||||
:digraph Gx 284
|
||||
:digraph gx 285
|
||||
:digraph Hx 292
|
||||
:digraph hx 293
|
||||
:digraph Jx 308
|
||||
:digraph jx 309
|
||||
:digraph Sx 348
|
||||
:digraph sx 349
|
||||
:digraph Ux 364
|
||||
:digraph ux 365
|
||||
|
||||
""" Terminal mode remaps
|
||||
tnoremap <Esc> <C-\><C-n>
|
||||
nnoremap <leader>o :below 10sp term://$SHELL<cr>i
|
||||
|
||||
" Quicker window movement
|
||||
nnoremap <C-j> <C-w>j
|
||||
nnoremap <C-k> <C-w>k
|
||||
nnoremap <C-h> <C-w>h
|
||||
nnoremap <C-l> <C-w>l
|
||||
|
||||
" Don’t reset cursor to start of line when moving around.
|
||||
set nostartofline
|
||||
" minimal number of lines to keep above/below cursorline
|
||||
set scrolloff=10
|
||||
|
||||
" Local overrides?
|
||||
if filereadable($HOME . "/.vimrc.local")
|
||||
source ~/.vimrc.local
|
||||
endif
|
||||
161
nix/home/programs/nvim/nvim-lspconfig.lua
Normal file
161
nix/home/programs/nvim/nvim-lspconfig.lua
Normal file
|
|
@ -0,0 +1,161 @@
|
|||
local nvim_lsp = require("lspconfig")
|
||||
|
||||
local format_async = function(err, _, result, _, bufnr)
|
||||
if err ~= nil or result == nil then return end
|
||||
if not vim.api.nvim_buf_get_option(bufnr, "modified") then
|
||||
local view = vim.fn.winsaveview()
|
||||
vim.lsp.util.apply_text_edits(result, bufnr)
|
||||
vim.fn.winrestview(view)
|
||||
if bufnr == vim.api.nvim_get_current_buf() then
|
||||
vim.api.nvim_command("noautocmd :update")
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.lsp.handlers["textDocument/formatting"] = format_async
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
local buf_map = vim.api.nvim_buf_set_keymap
|
||||
|
||||
vim.cmd("command! LspDef lua vim.lsp.buf.definition()")
|
||||
vim.cmd("command! LspFormatting lua vim.lsp.buf.formatting()")
|
||||
vim.cmd("command! LspCodeAction lua vim.lsp.buf.code_action()")
|
||||
vim.cmd("command! LspHover lua vim.lsp.buf.hover()")
|
||||
vim.cmd("command! LspRename lua vim.lsp.buf.rename()")
|
||||
vim.cmd("command! LspOrganize lua lsp_organize_imports()")
|
||||
vim.cmd("command! LspRefs lua vim.lsp.buf.references()")
|
||||
vim.cmd("command! LspTypeDef lua vim.lsp.buf.type_definition()")
|
||||
vim.cmd("command! LspImplementation lua vim.lsp.buf.implementation()")
|
||||
vim.cmd("command! LspDiagPrev lua vim.lsp.diagnostic.goto_prev()")
|
||||
vim.cmd("command! LspDiagNext lua vim.lsp.diagnostic.goto_next()")
|
||||
vim.cmd("command! LspDiagLine lua vim.lsp.diagnostic.show_line_diagnostics()")
|
||||
vim.cmd("command! LspSignatureHelp lua vim.lsp.buf.signature_help()")
|
||||
|
||||
buf_map(bufnr, "n", "gd", ":LspDef<CR>", {silent = true})
|
||||
buf_map(bufnr, "n", "gr", ":LspRename<CR>", {silent = true})
|
||||
buf_map(bufnr, "n", "gR", ":LspRefs<CR>", {silent = true})
|
||||
buf_map(bufnr, "n", "gy", ":LspTypeDef<CR>", {silent = true})
|
||||
buf_map(bufnr, "n", "K", ":LspHover<CR>", {silent = true})
|
||||
buf_map(bufnr, "n", "gs", ":LspOrganize<CR>", {silent = true})
|
||||
buf_map(bufnr, "n", "[a", ":LspDiagPrev<CR>", {silent = true})
|
||||
buf_map(bufnr, "n", "]a", ":LspDiagNext<CR>", {silent = true})
|
||||
buf_map(bufnr, "n", "ga", ":LspCodeAction<CR>", {silent = true})
|
||||
buf_map(bufnr, "n", "<Leader>a", ":LspDiagLine<CR>", {silent = true})
|
||||
buf_map(bufnr, "i", "<C-x><C-x>", "<cmd> LspSignatureHelp<CR>", {silent = true})
|
||||
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
vim.api.nvim_exec([[
|
||||
augroup LspAutocommands
|
||||
autocmd! * <buffer>
|
||||
autocmd BufWritePost <buffer> LspFormatting
|
||||
augroup END
|
||||
]], true)
|
||||
end
|
||||
end
|
||||
|
||||
nvim_lsp.diagnosticls.setup {
|
||||
on_attach = on_attach;
|
||||
filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact', 'css', 'scss', 'markdown', 'pandoc' },
|
||||
init_options = {
|
||||
linters = {
|
||||
eslint = {
|
||||
command = 'eslint',
|
||||
rootPatterns = { '.git' },
|
||||
debounce = 100,
|
||||
args = { '--stdin', '--stdin-filename', '%filepath', '--format', 'json' },
|
||||
sourceName = 'eslint',
|
||||
parseJson = {
|
||||
errorsRoot = '[0].messages',
|
||||
line = 'line',
|
||||
column = 'column',
|
||||
endLine = 'endLine',
|
||||
endColumn = 'endColumn',
|
||||
message = '[eslint] ${message} [${ruleId}]',
|
||||
security = 'severity'
|
||||
},
|
||||
securities = {
|
||||
[2] = 'error',
|
||||
[1] = 'warning'
|
||||
}
|
||||
},
|
||||
markdownlint = {
|
||||
command = 'markdownlint',
|
||||
rootPatterns = { '.git' },
|
||||
isStderr = true,
|
||||
debounce = 100,
|
||||
args = { '--stdin' },
|
||||
offsetLine = 0,
|
||||
offsetColumn = 0,
|
||||
sourceName = 'markdownlint',
|
||||
securities = {
|
||||
undefined = 'hint'
|
||||
},
|
||||
formatLines = 1,
|
||||
formatPattern = {
|
||||
'^.*:(\\d+)\\s+(.*)$',
|
||||
{
|
||||
line = 1,
|
||||
column = -1,
|
||||
message = 2,
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
filetypes = {
|
||||
javascript = 'eslint',
|
||||
javascriptreact = 'eslint',
|
||||
typescript = 'eslint',
|
||||
typescriptreact = 'eslint',
|
||||
markdown = 'markdownlint',
|
||||
pandoc = 'markdownlint'
|
||||
},
|
||||
formatters = {
|
||||
prettier = {
|
||||
command = 'prettier',
|
||||
args = { '--stdin-filepath', '%filename' }
|
||||
}
|
||||
},
|
||||
formatFiletypes = {
|
||||
css = 'prettier',
|
||||
javascript = 'prettier',
|
||||
javascriptreact = 'prettier',
|
||||
json = 'prettier',
|
||||
scss = 'prettier',
|
||||
typescript = 'prettier',
|
||||
typescriptreact = 'prettier'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nvim_lsp.elmls.setup{
|
||||
on_attach = on_attach;
|
||||
}
|
||||
nvim_lsp.tsserver.setup {
|
||||
on_attach = function(client)
|
||||
-- Avoid conflict with prettier and eslint
|
||||
client.resolved_capabilities.document_formatting = false
|
||||
on_attach(client)
|
||||
end
|
||||
}
|
||||
nvim_lsp.elixirls.setup{
|
||||
cmd = { "elixir-ls" };
|
||||
on_attach = on_attach;
|
||||
}
|
||||
nvim_lsp.rnix.setup{
|
||||
cmd = { "@rnix_lsp@/bin/rnix-lsp" };
|
||||
on_attach = on_attach;
|
||||
}
|
||||
nvim_lsp.rust_analyzer.setup{
|
||||
on_attach = on_attach;
|
||||
}
|
||||
|
||||
nvim_lsp.sumneko_lua.setup{
|
||||
cmd = { "@lua_ls@/bin/lua-language-server" };
|
||||
on_attach = on_attach;
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'vim' }
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
50
nix/home/programs/obsidianmd/default.nix
Normal file
50
nix/home/programs/obsidianmd/default.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{ stdenv, writeScript, gtk3, appimageTools }:
|
||||
|
||||
# run this function like so:
|
||||
# nix-shell --run obsidian -p "callPackage ./path/to/this/file.nix {}"
|
||||
|
||||
let
|
||||
inherit (appimageTools) extractType2 wrapType2;
|
||||
|
||||
name = "obsidian";
|
||||
src = ~/Downloads/Obsidian-0.6.7.AppImage;
|
||||
|
||||
# you can add more paths as required
|
||||
xdg_dirs = builtins.concatStringsSep ":" [
|
||||
"${gtk3}/share/gsettings-schemas/${gtk3.name}"
|
||||
];
|
||||
|
||||
# not necessary, here for debugging purposes
|
||||
# adapted from the original runScript of appimageTools
|
||||
extracted_source = extractType2 { inherit name src; };
|
||||
debugScript = writeScript "run" ''
|
||||
#!${stdenv.shell}
|
||||
|
||||
export APPDIR=${extracted_source}
|
||||
export APPIMAGE_SILENT_INSTALL=1
|
||||
|
||||
# >>> inspect the script running environment here <<<
|
||||
echo "INSPECT: ''${GIO_EXTRA_MODULES:-no extra modules!}"
|
||||
echo "INSPECT: ''${GSETTINGS_SCHEMA_DIR:-no schemas!}"
|
||||
echo "INSPECT: ''${XDG_DATA_DIRS:-no data dirs!}"
|
||||
|
||||
cd $APPDIR
|
||||
exec ./AppRun "$@"
|
||||
'';
|
||||
in wrapType2 {
|
||||
inherit name src;
|
||||
|
||||
# for debugging purposes only
|
||||
#runScript = debugScript;
|
||||
|
||||
extraPkgs = pkgs: with pkgs; [
|
||||
# put runtime dependencies if any here
|
||||
];
|
||||
|
||||
# the magic happens here
|
||||
# other potential variables of interest:
|
||||
# GIO_EXTRA_MODULES, GSETTINGS_SCHEMA_DIR
|
||||
profile = ''
|
||||
export XDG_DATA_DIRS="${xdg_dirs}''${XDG_DATA_DIRS:+:"''$XDG_DATA_DIRS"}"
|
||||
'';
|
||||
}
|
||||
7
nix/home/programs/rofi/default.nix
Normal file
7
nix/home/programs/rofi/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
programs.rofi = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
||||
14
nix/home/programs/tmux/default.nix
Normal file
14
nix/home/programs/tmux/default.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
tmuxinator = {
|
||||
enable = true;
|
||||
};
|
||||
secureSocket = false;
|
||||
};
|
||||
|
||||
home.file.".tmux.conf" = {
|
||||
source = ./tmux.conf;
|
||||
};
|
||||
}
|
||||
45
nix/home/programs/tmux/tmux.conf
Normal file
45
nix/home/programs/tmux/tmux.conf
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# reload tmux conf
|
||||
unbind r
|
||||
bind r source-file ~/.tmux.conf
|
||||
|
||||
bind-key C-a last-window
|
||||
|
||||
setw -g aggressive-resize on
|
||||
|
||||
# faster escape recognition
|
||||
set-option -sg escape-time 50
|
||||
|
||||
# number tabs starting at 1
|
||||
set-option -g base-index 1
|
||||
|
||||
set-option -g default-terminal screen-256color
|
||||
|
||||
# STATUS BAR
|
||||
set-option -g status-bg colour234 # light gray bg
|
||||
set-option -g status-fg colour255 # black text
|
||||
set-option -g status-left-bg default # match
|
||||
set-option -g status-left-fg colour74 # light blue
|
||||
|
||||
setw -g window-status-current-format "#[fg=white,bold]#[bg=cyan][#I:#W]"
|
||||
set -g pane-active-border-fg green
|
||||
|
||||
# xterm title
|
||||
set-option -g set-titles on
|
||||
set-option -g set-titles-string '[#S:#I #H] #W'
|
||||
|
||||
# mouse mode
|
||||
set -g mouse-utf8 on
|
||||
set -g mouse on
|
||||
|
||||
# clipboard
|
||||
set -g set-clipboard off
|
||||
|
||||
# big scrollback
|
||||
set -g history-limit 10240
|
||||
|
||||
# smart pane switching with awareness of vim splits
|
||||
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
|
||||
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
|
||||
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
|
||||
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
|
||||
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
|
||||
27
nix/home/programs/zsh/default.nix
Normal file
27
nix/home/programs/zsh/default.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
with builtins; {
|
||||
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
defaultKeymap = "viins";
|
||||
|
||||
initExtra = readFile ./zshrc;
|
||||
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
theme = "typewritten";
|
||||
custom = "$HOME/.oh-my-zsh/custom";
|
||||
plugins = [
|
||||
"vi-mode"
|
||||
"git"
|
||||
"z"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
home.file.".oh-my-zsh/custom/themes/typewritten.zsh-theme" = {
|
||||
source = ./typewritten.zsh-theme;
|
||||
};
|
||||
}
|
||||
58
nix/home/programs/zsh/typewritten.zsh-theme
Normal file
58
nix/home/programs/zsh/typewritten.zsh-theme
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# ____ ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
|
||||
# ||t |||y |||p |||e |||w |||r |||i |||t |||t |||e |||n ||
|
||||
# ||__|||__|||__|||__|||__|||__|||__|||__|||__|||__|||__||
|
||||
# |/__\|/__\|/__\|/__\|/__\|/__\|/__\|/__\|/__\|/__\|/__\|
|
||||
#
|
||||
# A minimal, informative zsh prompt theme
|
||||
#
|
||||
# Adapted from https://github.com/reobin/typewritten/commit/0eebac711e98ee759942ed82f8c20e92912e2cc7
|
||||
|
||||
# git status variables
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$reset_color%}%{$fg[magenta]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=""
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg_bold[cyan]%} +"
|
||||
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg_bold[yellow]%} !"
|
||||
ZSH_THEME_GIT_PROMPT_DELETED="%{$fg_bold[red]%} —"
|
||||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg_bold[green]%} »"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg_bold[white]%} #"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg_bold[blue]%} ?"
|
||||
ZSH_THEME_GIT_PROMPT_STASHED="%{$fg_bold[yellow]%} $"
|
||||
ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg_bold[blue]%} •|"
|
||||
ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_bold[blue]%} |•"
|
||||
|
||||
# git status display
|
||||
local git_info='$(git_prompt_info)$(git_prompt_status)%{$reset_color%}'
|
||||
|
||||
# current user and hostname
|
||||
local user_host='%{$fg[yellow]%}%n%{$reset_color%}@%{$fg[yellow]%}%m %{$reset_color%}'
|
||||
|
||||
# default: blue, if return code other than 0: red
|
||||
local prompt='%(?,%{$fg[blue]%}> ,%{$fg[red]%}> )'
|
||||
|
||||
# current directory display
|
||||
local directory_path='%{$fg[magenta]%}%~'
|
||||
|
||||
# last command return code
|
||||
local return_code='%(?,,%{$fg[red]%} RC=%?%{$reset_color%})'
|
||||
|
||||
# left prompt definition (multiline)
|
||||
PROMPT="${directory_path}
|
||||
${prompt}"
|
||||
|
||||
# right prompt definition
|
||||
RPROMPT="${git_info}"
|
||||
RPROMPT+="${return_code}"
|
||||
|
||||
# prompt cursor fix when exiting vim
|
||||
local cursor="\e[3 q"
|
||||
if [ "$TYPEWRITTEN_CURSOR" = "block" ]; then
|
||||
cursor="\e[1 q"
|
||||
elif [ "$TYPEWRITTEN_CURSOR" = "beam" ]; then
|
||||
cursor="\e[5 q"
|
||||
fi
|
||||
_fix_cursor() {
|
||||
echo -ne "${cursor}"
|
||||
}
|
||||
precmd_functions+=(_fix_cursor)
|
||||
32
nix/home/programs/zsh/zshrc
Normal file
32
nix/home/programs/zsh/zshrc
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
export LOCALE_ARCHIVE="/usr/lib/locale/locale-archive"
|
||||
export NIX_PATH=darwin-config=$HOME/.nixpkgs/darwin-configuration.nix:$HOME/.nix-defexpr/channels:$NIX_PATH
|
||||
export EDITOR=vim
|
||||
|
||||
source $HOME/.nix-profile/etc/profile.d/nix.sh
|
||||
source $HOME/.nix-profile/share/fzf/key-bindings.zsh
|
||||
source $HOME/.nix-profile/share/fzf/completion.zsh
|
||||
source $HOME/.nix-profile/share/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
source $HOME/.nix-profile/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
source $HOME/.config/zsh/local.zsh
|
||||
|
||||
bindkey '^[[A' history-substring-search-up
|
||||
bindkey '^[[B' history-substring-search-down
|
||||
bindkey -M viins 'jj' vi-cmd-mode
|
||||
|
||||
# utility for storing functions under a new name
|
||||
save_function() {
|
||||
local ORIG_FUNC=$(declare -f $1)
|
||||
local NEWNAME_FUNC="$2''${ORIG_FUNC#$1}"
|
||||
eval "$NEWNAME_FUNC"
|
||||
}
|
||||
|
||||
# Override an oh-my-zsh/lib/git.sh function so that old repositories
|
||||
# don't slow the shell down
|
||||
save_function git_prompt_status old_git_prompt_status
|
||||
function git_prompt_status() {
|
||||
if [[ "$(command git config --get oh-my-zsh.hide-prompt-status 2>/dev/null)" != "1" ]]; then
|
||||
old_git_prompt_status
|
||||
fi
|
||||
}
|
||||
|
||||
eval "$(direnv hook zsh)"
|
||||
58
nix/home/universal.nix
Normal file
58
nix/home/universal.nix
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
let
|
||||
git-plan = pkgs.rustPlatform.buildRustPackage rec {
|
||||
name = "git-plan";
|
||||
version = "1";
|
||||
src = pkgs.fetchFromGitLab {
|
||||
owner = "haaksmash";
|
||||
repo = "git-plan";
|
||||
rev = "518dcf15f3a46605f18569dd69b3b63d763e9439";
|
||||
sha256 = "06gh3v35bdr0qsp459183br4hpmwm36d2r9fjyx9j5jfpzggqg51";
|
||||
};
|
||||
|
||||
cargoSha256 = "17lr4pc2fjcgvx0p4vpkwx3mg9jadb4lygbwri0blmnkqql8xlh3";
|
||||
nativeBuildInputs = [ pkgs.pkgconfig ];
|
||||
buildInputs = [ pkgs.openssl ] ++ (if pkgs.stdenv.isDarwin then [ pkgs.libiconv pkgs.darwin.apple_sdk.frameworks.Security ] else []);
|
||||
};
|
||||
|
||||
defaultPkgs = with pkgs; [
|
||||
git-plan
|
||||
jq
|
||||
nnn
|
||||
tree
|
||||
ripgrep
|
||||
zsh-autosuggestions
|
||||
zsh-history-substring-search
|
||||
zsh-syntax-highlighting
|
||||
];
|
||||
in with builtins;
|
||||
{
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
# no need for home-manager news, thanks
|
||||
news.display = "silent";
|
||||
|
||||
nixpkgs.config = {
|
||||
allowUnfree = true;
|
||||
};
|
||||
|
||||
imports = [
|
||||
(import ./programs/direnv)
|
||||
(import ./programs/git)
|
||||
(import ./programs/zsh)
|
||||
(import ./programs/tmux)
|
||||
(import ./programs/nvim)
|
||||
];
|
||||
|
||||
programs.htop = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
programs.fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
defaultCommand = "rg --no-ignore --follow --files --hidden --smart-case --glob \\\"!.git/*\\\"";
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue