Rework common profile into module system

This commit is contained in:
Charlotte Van Petegem 2020-12-05 13:39:22 +01:00
parent 9d2e54547c
commit 9fdec35027
No known key found for this signature in database
GPG key ID: 019E764B7184435A
29 changed files with 288 additions and 214 deletions

View file

@ -1,20 +0,0 @@
{ ... }:
{
chvp.zfs.homeLinks = [
{ path = ".local/share/direnv"; type = "cache"; }
];
nix.extraOptions = ''
keep-outputs = true
keep-derivations = true
'';
home-manager.users.charlotte = { ... }: {
programs.direnv = {
enable = true;
enableZshIntegration = true;
enableNixDirenvIntegration = true;
};
};
}

View file

@ -1,10 +0,0 @@
{ pkgs, ... }:
{
services.pcscd = {
enable = true;
plugins = [ pkgs.ccid ];
};
environment.systemPackages = with pkgs; [ eid-mw ];
}

View file

@ -1,11 +0,0 @@
{ ... }:
{
home-manager.users.charlotte = { pkgs, ... }: {
home.packages = with pkgs; [ element-desktop ];
};
chvp.zfs.homeLinks = [
{ path = ".config/Element"; type = "data"; }
];
}

View file

@ -1,6 +0,0 @@
{ pkgs, ... }:
{
# Use latest kernel
#boot.kernelPackages = pkgs.linuxPackages_latest;
}

View file

@ -1,206 +0,0 @@
{ pkgs, ... }:
let
customPlugins = {
snow-color-theme = pkgs.vimUtils.buildVimPlugin {
name = "snow";
src = pkgs.fetchFromGitHub {
owner = "nightsense";
repo = "snow";
rev = "f9800e987e404efed4748fe8098e04ddbec9770b";
sha256 = "099fky1bpppac5785bhx1jc26gfpm8n837p8487j1rf1lwq83q33";
};
};
};
jdtls = import ../packages/jdtls/default.nix { inherit pkgs; stdenv = pkgs.stdenv; };
kotlinls = import ../packages/kotlin-language-server/default.nix { inherit pkgs; };
in
{
chvp.zfs.homeLinks = [
{ path = ".local/share/nvim"; type = "cache"; }
{ path = ".cache/nvim"; type = "cache"; }
];
home-manager.users.charlotte = { pkgs, ... }: {
home.sessionVariables = { EDITOR = "nvim"; };
programs.neovim = {
enable = true;
extraConfig = ''
set autoread
"" Theming
set termguicolors
set background=light
colorscheme snow
"" General settings
" Undo over sessions
set undofile
set undodir=~/.cache/nvim/undo
" Automatically save sessions on exit and load them on start
function! MakeSession()
let b:sessiondir = $HOME . "/.local/share/nvim/sessions" . getcwd()
if (filewritable(b:sessiondir) != 2)
exe 'silent !mkdir -p ' b:sessiondir
redraw!
endif
let b:filename = b:sessiondir . '/session.vim'
exe "mksession! " . b:filename
endfunction
function! LoadSession()
let b:sessiondir = $HOME . "/.local/share/nvim/sessions" . getcwd()
let b:sessionfile = b:sessiondir . "/session.vim"
if (filereadable(b:sessionfile))
exe 'source ' b:sessionfile
else
echo "No session loaded."
endif
endfunction
if(argc() == 0)
au VimEnter * nested :call LoadSession()
au VimLeave * :call MakeSession()
endif
"" Filetype configuration
" Base settings for all files
syntax enable
set number
set showcmd
set scrolloff=8
set expandtab
set tabstop=4
set shiftwidth=4
set linebreak
set list
set listchars=tab:·\ ,trail:·
set inccommand=split
set clipboard=unnamedplus
filetype plugin indent on
"" Fuzzy search in vim
function! s:completedFiles(winid, filename, ...) abort
bdelete!
call win_gotoid(a:winid)
if filereadable(a:filename)
let lines = readfile(a:filename)
if !empty(lines)
exe ':e ' . lines[0]
endif
call delete(a:filename)
endif
endfunction
function! FzyFiles()
let file = tempname()
let winid = win_getid()
let cmd = split(&shell) + split(&shellcmdflag) + ["${pkgs.ripgrep.out}/bin/rg --files --hidden -g '!/.git' --smart-case | ${pkgs.fzy.out}/bin/fzy > " . file]
let F = function('s:completedFiles', [winid, file])
botright 10 new
call termopen(cmd, {'on_exit': F})
startinsert
endfunction
function! s:completedGrep(winid, filename, ...) abort
bdelete!
call win_gotoid(a:winid)
if filereadable(a:filename)
let lines = readfile(a:filename)
if !empty(lines)
let list = split(lines[0], ':')
let file = list[0]
let line = list[1]
exe ':e ' . file
exe line
endif
call delete(a:filename)
endif
endfunction
function! FzyGrep()
let file = tempname()
let winid = win_getid()
let cmd = split(&shell) + split(&shellcmdflag) + ["${pkgs.ripgrep.out}/bin/rg --vimgrep --hidden -g '!/.git' '^' | ${pkgs.fzy.out}/bin/fzy > " . file]
let F = function('s:completedGrep', [winid, file])
botright 10 new
call termopen(cmd, {'on_exit': F})
startinsert
endfunction
nnoremap <C-f> :call FzyFiles()<CR>
nnoremap <C-g> :call FzyGrep()<CR>
'';
plugins = with pkgs.vimPlugins // customPlugins; [
{
plugin = ale;
config = ''
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'javascript': ['eslint', 'remove_trailing_lines', 'trim_whitespace'],
\ 'ledger': ['trim_whitespace'],
\ 'nix': ['nixpkgs-fmt', 'remove_trailing_lines', 'trim_whitespace'],
\ 'ruby': ['rubocop', 'remove_trailing_lines', 'trim_whitespace'],
\ 'typescript': ['eslint', 'remove_trailing_lines', 'trim_whitespace'],
\ 'vue': ['prettier', 'remove_trailing_lines', 'trim_whitespace'],
\}
let g:ale_fix_on_save = 1
'';
}
auto-pairs
{
plugin = deoplete-nvim;
config = ''
let g:deoplete#enable_at_startup = 1
set completeopt+=noselect
au VimEnter * call deoplete#custom#option('omni_patterns', {
\ 'ledger': ['[a-zA-Z][a-zA-Z: ]*'],
\})
'';
}
editorconfig-vim
kotlin-vim
{
plugin = LanguageClient-neovim;
config = ''
" Required for operations modifying multiple buffers like rename
set hidden
let g:LanguageClient_serverCommands = {
\ 'java': ['${jdtls}/bin/jdtls'],
\ 'javascript': ['${pkgs.nodePackages.javascript-typescript-langserver}/bin/javascript-typescript-stdio'],
\ 'kotlin': ['${kotlinls}/bin/kotlin-language-server'],
\ 'ruby': ['${pkgs.solargraph}/bin/solargraph', 'stdio'],
\ 'typescript': ['${pkgs.nodePackages.typescript-language-server}/bin/typescript-language-server', '--stdio'],
\ 'vue': ['${pkgs.nodePackages.vue-language-server}/bin/vls'],
\ }
function LC_maps()
if has_key(g:LanguageClient_serverCommands, &filetype)
nnoremap <buffer> <silent> K :call LanguageClient#textDocument_hover()<cr>
nnoremap <buffer> <silent> gd :call LanguageClient#textDocument_definition()<CR>
nnoremap <buffer> <silent> <F2> :call LanguageClient#textDocument_rename()<CR>
endif
endfunction
autocmd FileType * call LC_maps()
'';
}
snow-color-theme
vim-ledger
vim-nix
vim-ruby
vim-vue
yats-vim
];
extraPackages = with pkgs; [
nixpkgs-fmt
];
};
};
}

View file

@ -1,36 +0,0 @@
{ ... }:
{
chvp.zfs.homeLinks = [
{ path = ".cache/nix-index"; type = "cache"; }
];
home-manager.users.charlotte = { pkgs, ... }: {
home.packages = with pkgs; [
nix-index
];
systemd.user = {
services.nix-index = {
Unit = {
Description = "Service to run nix-index";
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.nix-index}/bin/nix-index";
};
};
timers.nix-index = {
Unit = {
Description = "Timer that starts nix-index every two hours";
PartOf = [ "nix-index.service" ];
};
Timer = {
OnCalendar = "00/2:30";
};
Install = {
WantedBy = [ "default.target" ];
};
};
};
};
}

View file

@ -1,31 +0,0 @@
{ pkgs, ... }:
{
nix = {
extraOptions = ''
experimental-features = nix-command flakes
'';
gc = {
automatic = true;
dates = "hourly";
options = "--delete-older-than 7d";
};
optimise = {
automatic = true;
dates = [ "hourly" ];
};
trustedUsers = [ "@wheel" ];
};
nixpkgs.overlays = [
(self: super: {
nix = super.nixUnstable;
})
];
nixpkgs.config = import ./nix-store/config.nix;
home-manager.users.charlotte = { ... }: {
xdg.configFile."nixpkgs/config.nix".source = ./nix-store/config.nix;
};
}

View file

@ -1 +0,0 @@
{ allowUnfree = true; }

View file

@ -1,7 +1,7 @@
{ ... }: {
nixpkgs.overlays = [
(self: super: {
pass = (super.pass-wayland.override { pass = super.pass-wayland; }).withExtensions (ext: [ ext.pass-otp ]);
pass = (super.pass.override { pass = super.pass-wayland; }).withExtensions (ext: [ ext.pass-otp ]);
})
];

View file

@ -1,25 +0,0 @@
{ ... }:
{
home-manager.users.charlotte = { ... }: {
programs.tmux = {
enable = true;
clock24 = true;
extraConfig = ''
bind q kill-session
bind v run-shell "tmux setw main-pane-width $(($(tmux display -p '#{window_width}') * 70 / 100)); tmux select-layout main-vertical"
bind h run-shell "tmux setw main-pane-height $(($(tmux display -p '#{window_height}') * 70 / 100)); tmux select-layout main-horizontal"
set -g default-terminal "screen-256color"
set -sg escape-time 10
'';
keyMode = "vi";
tmuxinator.enable = true;
};
xdg.configFile = {
"tmuxinator/accentor.yml".source = ./tmux/accentor.yml;
"tmuxinator/dodona.yml".source = ./tmux/dodona.yml;
"tmuxinator/mail.yml".source = ./tmux/mail.yml;
};
};
}

View file

@ -1,36 +0,0 @@
name: accentor
project_root: "/home/charlotte/repos/accentor"
windows:
- api:
root: "/home/charlotte/repos/accentor/api"
layout: main-vertical
panes:
- nvim
- git status
- web:
root: "/home/charlotte/repos/accentor/web"
layout: main-vertical
panes:
- nvim
- git status
- android:
root: "/home/charlotte/repos/accentor/android"
layout: main-vertical
panes:
- nvim
- git status
- run:
layout: even-horizontal
panes:
- rails:
- cd api
- bundle exec rails s
- delayed_job:
- cd api
- bundle exec rails jobs:work
- vue:
- cd web
- yarn run serve
- postgres:
- cd api
- start-db

View file

@ -1,55 +0,0 @@
# /home/charlotte/.config/tmuxinator/dodona.yml
name: dodona
root: ~/repos/dodona/dodona
# Optional tmux socket
# socket_name: foo
# Note that the pre and post options have been deprecated and will be replaced by
# project hooks.
# Project hooks
# Runs on project start, always
# on_project_start: command
# Run on project start, the first time
# on_project_first_start: command
# Run on project start, after the first time
# on_project_restart: command
# Run on project exit ( detaching from tmux session )
# on_project_exit: command
# Run on project stop
# on_project_stop: command
# Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions.
# pre_window: rbenv shell 2.0.0-p247
# Pass command line options to tmux. Useful for specifying a different tmux.conf.
# tmux_options: -f ~/.tmux.mac.conf
# Change the command to call tmux. This can be used by derivatives/wrappers like byobu.
# tmux_command: byobu
# Specifies (by name or index) which window will be selected on project startup. If not set, the first window is used.
# startup_window: editor
# Specifies (by index) which pane of the specified window will be selected on project startup. If not set, the first pane is used.
# startup_pane: 1
# Controls whether the tmux session should be attached to automatically. Defaults to true.
# attach: false
windows:
- editor:
layout: main-vertical
panes:
- nvim
- git status
- server:
layout: even-horizontal
panes:
- bundle exec rails s
- bundle exec rails jobs:work
- ./bin/webpack-dev-server
- logs: tail -f log/development.log
- db: start-dockers

View file

@ -1,47 +0,0 @@
# /home/charlotte/.config/tmuxinator/mail.yml
name: mail
root: ~/mail
# Optional tmux socket
# socket_name: foo
# Note that the pre and post options have been deprecated and will be replaced by
# project hooks.
# Project hooks
# Runs on project start, always
# on_project_start: command
# Run on project start, the first time
# on_project_first_start: command
# Run on project start, after the first time
# on_project_restart: command
# Run on project exit ( detaching from tmux session )
# on_project_exit: command
# Run on project stop
# on_project_stop: command
# Runs in each window and pane before window/pane specific commands. Useful for setting up interpreter versions.
# pre_window: rbenv shell 2.0.0-p247
# Pass command line options to tmux. Useful for specifying a different tmux.conf.
# tmux_options: -f ~/.tmux.mac.conf
# Change the command to call tmux. This can be used by derivatives/wrappers like byobu.
# tmux_command: byobu
# Specifies (by name or index) which window will be selected on project startup. If not set, the first window is used.
# startup_window: editor
# Specifies (by index) which pane of the specified window will be selected on project startup. If not set, the first pane is used.
# startup_pane: 1
# Controls whether the tmux session should be attached to automatically. Defaults to true.
# attach: false
windows:
- main:
layout: main-vertical
panes:
- neomutt
- khal interactive

View file

@ -1,5 +0,0 @@
{ pkgs, ... }:
{
users.users.charlotte.extraGroups = [ "input" "video" ];
}