Add Rupert’s configuration

This commit is contained in:
fruchti 2023-02-26 16:42:49 +01:00
commit 2b4264d32d
31 changed files with 1742 additions and 0 deletions

10
base/default.nix Normal file
View file

@ -0,0 +1,10 @@
{ ... }:
{
imports = [
./xkb
./neovim.nix
./packages.nix
./users.nix
./locale.nix
];
}

10
base/locale.nix Normal file
View file

@ -0,0 +1,10 @@
{ pkgs, lib, ... }:
{
time.timeZone = "Europe/Berlin";
i18n.defaultLocale = "en_GB.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "de";
};
}

134
base/neovim-init.vim Normal file
View file

@ -0,0 +1,134 @@
set nocompatible
set backspace=indent,eol,start
syntax enable
set mouse=a
set mousemodel=extend
set title
let g:airline_theme='term_light'
filetype plugin on
filetype indent on
" Enable spell check for commit messages
autocmd FileType gitcommit setlocal spell spelllang=en_gb
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
set nobackup
set nowb
set noswapfile
" Set to auto read when a file is changed from the outside
set autoread
" Leader
let mapleader = ","
let g:mapleader = ","
" Fast saving
nmap <leader>w :w!<cr>
" Save and start shell
nmap <leader># :w!<cr>:te<cr>i
"tnoremap <ESC> <C-\><C-n>:buffer #<CR>
tnoremap <C-c> <C-\><C-n>:buffer #<CR>
"autocmd TermClose * bd! " quit when a terminal closes instead of showing exit code and waiting
" Highlight search results
set hlsearch
" Makes search act like search in modern browsers
set incsearch
" Smart case when searching
set ignorecase
set smartcase
" Show results of pattern matching/replacing while typing
set inccommand=split
" When you press <leader>r you can search and replace the selected text
vnoremap <silent> <leader>r :call VisualSelection('replace')<CR>
" Disable highlight when <leader><cr> is pressed
map <silent> <leader><cr> :noh<cr>
" For regular expressions turn magic on
set magic
" Visual mode pressing * or # searches for the current selection
" Super useful! From an idea by Michael Naumann
vnoremap <silent> * :call VisualSelection('f')<CR>
vnoremap <silent> # :call VisualSelection('b')<CR>
" Show matching brackets when text indicator is over them
set showmatch
" How many tenths of a second to blink when matching brackets
set mat=2
" Spell checking
map <leader>ss :setlocal spell! spelllang=de_20<cr>
map <leader>se :setlocal spell! spelllang=en-curly_gb<cr>
map <leader>su :setlocal spell! spelllang=en-curly_us<cr>
" Treat long lines as break lines (useful when moving around in them)
map j gj
map k gk
" Smart way to move between windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" More natural behaviour when splitting
set splitbelow
set splitright
" Useful mappings for managing tabs
map <leader>tn :tabnew<cr>
map <leader>to :tabonly<cr>
map <leader>tc :tabclose<cr>
map <leader>tm :tabmove
" Jump to particular tab directly
noremap <leader>1 1gt
noremap <leader>2 2gt
noremap <leader>3 3gt
noremap <leader>4 4gt
noremap <leader>5 5gt
noremap <leader>6 6gt
noremap <leader>7 7gt
noremap <leader>8 8gt
noremap <leader>9 9gt
noremap <leader>0 :tablast<cr>
" Switch CWD to the directory of the open buffer
map <leader>cd :cd %:p:h<cr>:pwd<cr>
" Remember info about open buffers on close
set viminfo^=%
" Toggle paste mode on and off
map <leader>pp :setlocal paste!<cr>
" Save and make
nnoremap <leader>m :wa <BAR> :Make<CR>
hi ColorColumn ctermbg=47
let g:vimtex_compiler_enabled = 0
let g:local_vimrc = {'names': ['.local.vimrc'], 'hash_fun': 'LVRHashOfFile'}

28
base/neovim.nix Normal file
View file

@ -0,0 +1,28 @@
{ pkgs, ... }:
{
programs.neovim = {
enable = true;
vimAlias = true;
viAlias = true;
defaultEditor = true;
configure = {
customRC = (builtins.readFile ./neovim-init.vim);
packages.myVimPackage = with pkgs.vimPlugins; {
start = [
vim-lastplace
direnv-vim
vim-addon-local-vimrc
vim-nix
vim-airline
vim-airline-themes
vim-colorschemes
changeColorScheme-vim
vim-dispatch
vimtex
suda-vim
];
opt = [];
};
};
};
}

46
base/packages.nix Normal file
View file

@ -0,0 +1,46 @@
{ config, pkgs, lib, ... }:
{
environment.systemPackages = with pkgs; [
direnv nix-direnv
tmux zellij
wget
rsync
git
gnupg
file
ripgrep
fd
htop
ncdu
ranger nnn joshuto
hexyl
rink
kitty
kitty-themes
] ++ lib.optionals config.services.xserver.enable [
wine
pavucontrol
xsensors
kitty
kitty-themes
firefox
ungoogled-chromium
zathura
gthumb
vlc
feh
xsel
];
fonts.fonts = with pkgs; [
vollkorn
alegreya alegreya-sans
b612
raleway
];
}

19
base/users.nix Normal file
View file

@ -0,0 +1,19 @@
{ pkgs, lib, ... }:
let
definedInPersonalDotNix = lib.mkDefault (throw "Configuration option missing from personal.nix");
in
{
users.users = {
fruchti = {
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" "audio" "video" ];
openssh.authorizedKeys.keys = definedInPersonalDotNix;
shell = pkgs.fish;
};
};
users.extraGroups = {
system = {
members = [ "fruchti" ];
};
};
}

16
base/xkb/default.nix Normal file
View file

@ -0,0 +1,16 @@
{ ... }:
{
services.xserver.layout = "us-fruchti";
services.xserver.extraLayouts = {
de-fruchti = {
description = "DE layout with some small changes";
languages = [ "deu" ];
symbolsFile = ./symbols/de-fruchti;
};
us-fruchti = {
description = "US-altgr-intl layout with some small changes";
languages = [ "eng" ];
symbolsFile = ./symbols/us-fruchti;
};
};
}

View file

@ -0,0 +1,8 @@
xkb_symbols "de-fruchti"
{
include "de(basic)"
// Swap insert/print screen
key <PRSC> { [ Insert ] };
key <INS> { [ Print ] };
};

View file

@ -0,0 +1,44 @@
partial alphanumeric_keys
xkb_symbols "us-fruchti" {
include "us(altgr-intl)"
name[Group1]="English (intl., with AltGr dead keys, customised)";
key <AC02> {
// Change: Replace section with U1E9E (capital sharp s)
[ s, S, ssharp, U1E9E ]
};
key <AC04> {
// Change: Replace f with U017F (long s)
// Change: Replace F with section
[ f, F, U017F, section ]
};
key <AC05> {
// Change: replace g with doublelowquotemark
// Change: replace G with singlelowquotemark
[ g, G, doublelowquotemark, singlelowquotemark ]
};
key <AC06> {
// Change: replace h with leftdoublequotemark
// Change: replace H with leftsinglequotemark
[ h, H, leftdoublequotemark, leftsinglequotemark ]
};
key <AC08> {
// oe/OE are already available with AltGr+(Shift+)X
// Change: Replace oe with endash
// Change: Replace OE with emdash
[ k, K, endash, emdash ]
};
key <AB05> {
// Change: Replace b with U2026 (ellipsis)
// Change: Replace B with Greek_OMEGA
[ b, B, U2026, Greek_OMEGA ]
};
key <AB07> {
// Change: Replace mu with endash
[ m, M, mu, endash ]
};
key <SPCE> {
// Change: Add thinspace for AltGr+Space
[ space, space, U2009, nobreakspace ]
};
};