diff --git a/hosts/thinkpad/configuration.nix b/hosts/thinkpad/configuration.nix index 5b28893..3d594ce 100755 --- a/hosts/thinkpad/configuration.nix +++ b/hosts/thinkpad/configuration.nix @@ -5,6 +5,8 @@ [ # Include the results of the hardware scan. ./hardware-configuration.nix + ../../shared/vim.nix + ../../shared/input.nix ]; nix.settings.experimental-features = [ "nix-command" "flakes" ]; @@ -16,7 +18,7 @@ networking.hostName = "thinkpad"; # Define your hostname. networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. networking.firewall = { - allowedUDPPorts = [ 51820 ]; + allowedUDPPorts = [ 51820 ]; # used for wireguard checkReversePath = false; }; @@ -48,91 +50,16 @@ libinput.enable = true; }; - # Configure keymap in X11 - services.xserver.layout = "us"; - services.xserver.xkbVariant = "dvorak-alt-intl"; - services.xserver.displayManager.sessionCommands = - "${pkgs.xorg.xmodmap}/bin/xmodmap ${pkgs.writeText "xkb-layout" '' - keycode 108 = Mode_switch - keycode 94 = Shift_L NoSymbol Shift_L - keysym a = a A adiaeresis Adiaeresis - keysym o = o O odiaeresis Odiaeresis - keysym u = u U udiaeresis Udiaeresis - keysym s = s S ssharp - ''}"; - # Enable sound. sound.enable = true; hardware.pulseaudio.enable = true; hardware.bluetooth.enable = true; - environment.variables = { EDITOR = "vim"; }; - # enable polkit security.polkit.enable = true; - - # List packages installed in system profile. To search, run: - # $ nix search wget + # Baseline of installed packages environment.systemPackages = with pkgs; [ - ((vim_configurable.override { }).customize { - name = "vim"; - vimrcConfig.packages.myplugins = with pkgs.vimPlugins; { - start = [ vim-nix vim-lastplace ]; - opt = [ ]; - }; - vimrcConfig.customRC = '' - - " basic commands bound to uppercase key - command Q q - command W w - command Wq wq - command WQ wq - - set number relativenumber - set tabstop=4 - set shiftwidth=4 - set smartcase - set colorcolumn=120 - set nowrap - syntax on - highlight ColorColumn ctermbg=darkgray - - nnoremap ; : - nnoremap : ; - vnoremap ; : - vnoremap : ; - - " set space as leader - nnoremap - let mapleader = " " - - - " beautify indents - :set list lcs=tab:\|\ - - "remove ex-mode shortcut - nmap Q - - " quickfixlist binds - nnoremap :cnext - nnoremap :cprev - - " locallist binds - nnoremap :lnext - nnoremap :lprev - - " split keybinds - nnoremap s :sp - nnoremap v :vs - - nnoremap h h - nnoremap j j - nnoremap k k - nnoremap l l - ''; - } - ) # essentials wget git @@ -148,6 +75,8 @@ maven ]; + programs.light.enable = true; + programs.gnupg.agent = { enable = true; enableSSHSupport = true; @@ -155,11 +84,14 @@ # List services that you want to enable: - services.blueman.enable = true; - services.devmon.enable = true; - services.pcscd.enable = true; # yubikey and smartcard stuff - services.printing.enable = true; - services.fprintd.enable = true; + services = { + blueman.enable = true; + devmon.enable = true; + pcscd.enable = true; # yubikey and smartcard stuff + printing.enable = true; + fprintd.enable = true; # log in using fingerprint + picom.enable = true; + }; # Automatically configure displays services.autorandr.enable = true; diff --git a/shared/input.nix b/shared/input.nix new file mode 100644 index 0000000..a984160 --- /dev/null +++ b/shared/input.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: +{ + # Configure keymap in X11 + services.xserver.layout = "us"; + services.xserver.xkbVariant = "dvorak-alt-intl"; + services.xserver.displayManager.sessionCommands = + "${pkgs.xorg.xmodmap}/bin/xmodmap ${pkgs.writeText "xkb-layout" '' + keycode 108 = Mode_switch + keycode 94 = Shift_L NoSymbol Shift_L + keysym a = a A adiaeresis Adiaeresis + keysym o = o O odiaeresis Odiaeresis + keysym u = u U udiaeresis Udiaeresis + keysym s = s S ssharp + ''}"; +} diff --git a/shared/vim.nix b/shared/vim.nix new file mode 100644 index 0000000..fda7b0d --- /dev/null +++ b/shared/vim.nix @@ -0,0 +1,64 @@ +{ config, pkgs, ... }: +{ + environment.variables = { EDITOR = "vim"; }; + environment.systemPackages = with pkgs; [ + ((vim_configurable.override { }).customize { + name = "vim"; + vimrcConfig.packages.myplugins = with pkgs.vimPlugins; { + start = [ vim-nix vim-lastplace ]; + opt = [ ]; + }; + vimrcConfig.customRC = '' + + " basic commands bound to uppercase key + command Q q + command W w + command Wq wq + command WQ wq + + set number relativenumber + set tabstop=4 + set shiftwidth=4 + set smartcase + set colorcolumn=120 + set nowrap + syntax on + highlight ColorColumn ctermbg=darkgray + + nnoremap ; : + nnoremap : ; + vnoremap ; : + vnoremap : ; + + " set space as leader + nnoremap + let mapleader = " " + + + " beautify indents + :set list lcs=tab:\|\ + + "remove ex-mode shortcut + nmap Q + + " quickfixlist binds + nnoremap :cnext + nnoremap :cprev + + " locallist binds + nnoremap :lnext + nnoremap :lprev + + " split keybinds + nnoremap s :sp + nnoremap v :vs + + nnoremap h h + nnoremap j j + nnoremap k k + nnoremap l l + ''; + } + ) + ]; +} diff --git a/users/rouven/default.nix b/users/rouven/default.nix index dedd15f..290b391 100644 --- a/users/rouven/default.nix +++ b/users/rouven/default.nix @@ -1,7 +1,6 @@ { config, pkgs, ... }: { nixpkgs.config.allowUnfree = true; - # Define a user account. users.users.rouven = { isNormalUser = true; extraGroups = [ "wheel" "video" "libvirtd" ]; @@ -13,6 +12,8 @@ imports = [ ./modules ]; config = { + home.username = "rouven"; + home.homeDirectory = "/home/rouven"; home.stateVersion = config.system.stateVersion; }; }; diff --git a/users/rouven/modules/default.nix b/users/rouven/modules/default.nix index 57a20db..36e24cc 100644 --- a/users/rouven/modules/default.nix +++ b/users/rouven/modules/default.nix @@ -5,279 +5,13 @@ [ ./vifm ./alacritty - ]; - home.username = "rouven"; - home.homeDirectory = "/home/rouven"; - - home.packages = with pkgs; [ - # essentials - alacritty - networkmanagerapplet - pcmanfm - # vifm - xsel - lightlocker - vlc - - # graphics - lxappearance - feh - flameshot - picom - okular - gimp - - # editing - fzf - powerline-fonts - - # sound - pavucontrol - - # bluetooth - blueman - - # internet - thunderbird - discord - google-chrome - nextcloud-client - zoom-us - - # messaging - tdesktop - element-desktop - whatsapp-for-linux - - # games - minecraft - superTuxKart - extremetuxracer - wine - - # yubikey and password stuff - yubikey-manager - yubikey-manager-qt - yubioath-desktop - pass - - # misc - fzf - neofetch - trash-cli - spotify - plover.dev - nixpkgs-fmt - virt-manager - - # libs - libyubikey - libfido2 - ]; - - # programs.light.enable = true; # display brightness manager - # programs.kdeconnect.enable = true; - programs.git = { - enable = true; - userName = "Rouven Seifert"; - userEmail = "rouven@rfive.de"; - extraConfig = { - user.signingkey = "B95E8FE6B11C4D09"; - pull.rebase = false; - init.defaultBranch = "main"; - commit.gpgsign = true; - }; - - }; - - programs.zsh = { - enable = true; - shellAliases = { - rm = "trash"; - vifm = "vifm ."; - }; - history = { - size = 10000; - path = "${config.xdg.dataHome}/zsh/history"; - }; - - oh-my-zsh = { - enable = true; - # plugins = [ "zsh-autosuggestions" "fzf-tab" ]; - theme = "agnoster"; - }; - - plugins = [ - { - name = "zsh-autosuggestions"; - src = pkgs.fetchFromGitHub { - owner = "zsh-users"; - repo = "zsh-autosuggestions"; - rev = "v0.7.0"; - sha256 = "KLUYpUu4DHRumQZ3w59m9aTW6TBKMCXl2UcKi4uMd7w="; - }; - } - { - name = "fzf-tab"; - src = pkgs.fetchFromGitHub { - owner = "Aloxaf"; - repo = "fzf-tab"; - rev = "14f66e4d3d0b366552c0412eb08ca9e0f7c797bd"; - sha256 = "YkfHPSuSKParz7JidR924CJSuXO6Rk0RZTlxPOBwLJk="; - }; - } + ./zsh + ./tmux + ./git + ./neovim + ./packages.nix ]; - localVariables = { - COMPLETION_WAITING_DOTS = "true"; - ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=#00bbbb,bold"; - # ZSH_AUTOSUGGEST_STRATEGY="(history completion)"; - }; - initExtra = - '' - function c() { - cd - if [ $# -eq 0 ]; then - cd $(find -maxdepth 4 -not -path '*[cC]ache*' -not -path '*[tT]rash*' -type d | fzf --preview 'tree -C {}') - else - $1 $(find -maxdepth 5 -not -path '*[cC]ache*' -not -path '*[tT]rash*' | fzf --preview 'tree -C {}') - fi - } - - function sn() { - nmcli connection up $(nmcli connection show | tail -n +2 | cut -d " " -f1 | fzf --preview 'nmcli connection show {}') - } - - prompt_dir() { - prompt_segment blue $CURRENT_FG '%c' - } - ''; - }; - - programs.tmux = { - enable = true; - keyMode = "vi"; - terminal = "tmux-256color"; - clock24 = true; - extraConfig = - '' - set -g default-shell /etc/profiles/per-user/rouven/bin/zsh - bind P display-popup - ''; - plugins = with pkgs.tmuxPlugins; [ - { - plugin = dracula; - extraConfig = '' - set -g @dracula-show-fahrenheit false - set -g @dracula-plugins "weather time" - set -g @dracula-show-left-icon session - set -g @dracula-show-powerline true - ''; - } - ]; - }; - - programs.neovim = { - enable = true; - # defaultEditor = true; why the hell doesn't this work :( - # vimAlias = true; - plugins = with pkgs.vimPlugins; [ - nerdtree - nerdcommenter - fugitive-gitlab-vim - vim-repeat - vim-airline - fzf-vim - dracula-vim - vim-nix # this destroys my tab settings, ffs - ]; - extraConfig = - '' - " basic commands bound to uppercase key - command Q q - command W w - command Wq wq - command WQ wq - - set shiftwidth=4 - set noexpandtab - set preserveindent - set number relativenumber - set tabstop=4 - set smartcase - set colorcolumn=120 - set nowrap - highlight ColorColumn ctermbg=darkgray - - - " beautify indents - :set list lcs=tab:\|\ - - nnoremap ; : - nnoremap : ; - vnoremap ; : - vnoremap : ; - - " set space as leader - nnoremap - let mapleader = " " - - " air-line - let g:airline_powerline_fonts = 1 - - " NERDTree - nnoremap n :NERDTreeFocus :NERDTreeRefreshRoot - " NERDTree autostart" - autocmd VimEnter * NERDTree | wincmd p - - " Close the tab if NERDTree is the only window remaining in it. - autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif - - "remove ex-mode shortcut - nmap Q - - " trigger the fuzzy finder (fzf) - nnoremap f :Files - nnoremap g :GFiles - nnoremap b :Buffers - nnoremap r :Rg - - " keybinds for coc - nnoremap d :CocDiagnostics - - " quickfixlist binds - nnoremap :cnext - nnoremap :cprev - - " locallist binds - nnoremap :lnext - nnoremap :lprev - - " split keybinds - nnoremap s :sp - nnoremap v :vs - - nnoremap h h - nnoremap j j - nnoremap k k - nnoremap l l - - " coloring stuff - let g:dracula_colorterm = 0 - colorscheme dracula - - " better autocompletion menu colors - highlight Pmenu ctermbg=darkgray ctermfg=black - highlight PmenuSel ctermbg=gray ctermfg=black - - ''; - }; - - services.picom = { - enable = true; - }; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; + # programs.kdeconnect.enable = true; # doesn't work yet } diff --git a/users/rouven/modules/git/default.nix b/users/rouven/modules/git/default.nix new file mode 100644 index 0000000..119ea83 --- /dev/null +++ b/users/rouven/modules/git/default.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: +{ + programs.git = { + enable = true; + userName = "Rouven Seifert"; + userEmail = "rouven@rfive.de"; + extraConfig = { + user.signingkey = "B95E8FE6B11C4D09"; + pull.rebase = false; + init.defaultBranch = "main"; + commit.gpgsign = true; + }; + + }; +} diff --git a/users/rouven/modules/neovim/default.nix b/users/rouven/modules/neovim/default.nix new file mode 100644 index 0000000..cbd45e9 --- /dev/null +++ b/users/rouven/modules/neovim/default.nix @@ -0,0 +1,99 @@ +{ config, pkgs, ... }: +{ + programs.neovim = { + enable = true; + # defaultEditor = true; why the hell doesn't this work :( + # vimAlias = true; + plugins = with pkgs.vimPlugins; [ + nerdtree + nerdcommenter + fugitive-gitlab-vim + vim-repeat + vim-airline + fzf-vim + dracula-vim + vim-nix # this destroys my tab settings, ffs + ]; + extraConfig = + '' + " basic commands bound to uppercase key + command Q q + command W w + command Wq wq + command WQ wq + + set shiftwidth=4 + set noexpandtab + set preserveindent + set number relativenumber + set tabstop=4 + set smartcase + set colorcolumn=120 + set nowrap + highlight ColorColumn ctermbg=darkgray + + + " beautify indents + :set list lcs=tab:\|\ + + nnoremap ; : + nnoremap : ; + vnoremap ; : + vnoremap : ; + + " set space as leader + nnoremap + let mapleader = " " + + " air-line + let g:airline_powerline_fonts = 1 + + " NERDTree + nnoremap n :NERDTreeFocus :NERDTreeRefreshRoot + " NERDTree autostart" + autocmd VimEnter * NERDTree | wincmd p + + " Close the tab if NERDTree is the only window remaining in it. + autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif + + "remove ex-mode shortcut + nmap Q + + " trigger the fuzzy finder (fzf) + nnoremap f :Files + nnoremap g :GFiles + nnoremap b :Buffers + nnoremap r :Rg + + " keybinds for coc + nnoremap d :CocDiagnostics + + " quickfixlist binds + nnoremap :cnext + nnoremap :cprev + + " locallist binds + nnoremap :lnext + nnoremap :lprev + + " split keybinds + nnoremap s :sp + nnoremap v :vs + + nnoremap h h + nnoremap j j + nnoremap k k + nnoremap l l + + " coloring stuff + let g:dracula_colorterm = 0 + colorscheme dracula + + " better autocompletion menu colors + highlight Pmenu ctermbg=darkgray ctermfg=black + highlight PmenuSel ctermbg=gray ctermfg=black + + ''; + }; + +} diff --git a/users/rouven/modules/packages.nix b/users/rouven/modules/packages.nix new file mode 100644 index 0000000..a2e0434 --- /dev/null +++ b/users/rouven/modules/packages.nix @@ -0,0 +1,67 @@ +{ config, pkgs, ... }: +{ + home.packages = with pkgs; [ + # essentials + alacritty + networkmanagerapplet + pcmanfm + xsel + lightlocker + vlc + + # graphics + lxappearance + feh + flameshot + picom + okular + gimp + + # editing + fzf + powerline-fonts + + # sound + pavucontrol + + # bluetooth + blueman + + # internet + thunderbird + discord + google-chrome + nextcloud-client + zoom-us + + # messaging + tdesktop + element-desktop + whatsapp-for-linux + + # games + minecraft + superTuxKart + extremetuxracer + wine + + # yubikey and password stuff + yubikey-manager + yubikey-manager-qt + yubioath-desktop + pass + + # misc + fzf + neofetch + trash-cli + spotify + nixpkgs-fmt + virt-manager + + # libs + libyubikey + libfido2 + ]; +} + diff --git a/users/rouven/modules/tmux/default.nix b/users/rouven/modules/tmux/default.nix new file mode 100644 index 0000000..b8768e6 --- /dev/null +++ b/users/rouven/modules/tmux/default.nix @@ -0,0 +1,26 @@ +{ config, pkgs, ... }: +{ + programs.tmux = { + enable = true; + keyMode = "vi"; + terminal = "tmux-256color"; + clock24 = true; + extraConfig = + '' + set -g default-shell /etc/profiles/per-user/rouven/bin/zsh + bind P display-popup + ''; + plugins = with pkgs.tmuxPlugins; [ + { + plugin = dracula; + extraConfig = '' + set -g @dracula-show-fahrenheit false + set -g @dracula-plugins "weather time" + set -g @dracula-show-left-icon session + set -g @dracula-show-powerline true + ''; + } + ]; + }; + +} diff --git a/users/rouven/modules/zsh/default.nix b/users/rouven/modules/zsh/default.nix new file mode 100644 index 0000000..2042497 --- /dev/null +++ b/users/rouven/modules/zsh/default.nix @@ -0,0 +1,67 @@ +{ config, pkgs, ... }: +{ + programs.zsh = { + enable = true; + shellAliases = { + rm = "trash"; + vifm = "vifm ."; + }; + history = { + size = 10000; + path = "${config.xdg.dataHome}/zsh/history"; + }; + + oh-my-zsh = { + enable = true; + # plugins = [ "zsh-autosuggestions" "fzf-tab" ]; + theme = "agnoster"; + }; + + plugins = [ + { + name = "zsh-autosuggestions"; + src = pkgs.fetchFromGitHub { + owner = "zsh-users"; + repo = "zsh-autosuggestions"; + rev = "v0.7.0"; + sha256 = "KLUYpUu4DHRumQZ3w59m9aTW6TBKMCXl2UcKi4uMd7w="; + }; + } + { + name = "fzf-tab"; + src = pkgs.fetchFromGitHub { + owner = "Aloxaf"; + repo = "fzf-tab"; + rev = "14f66e4d3d0b366552c0412eb08ca9e0f7c797bd"; + sha256 = "YkfHPSuSKParz7JidR924CJSuXO6Rk0RZTlxPOBwLJk="; + }; + } + ]; + + localVariables = { + COMPLETION_WAITING_DOTS = "true"; + ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE = "fg=#00bbbb,bold"; + # ZSH_AUTOSUGGEST_STRATEGY="(history completion)"; + }; + + initExtra = + '' + function c() { + cd + if [ $# -eq 0 ]; then + cd $(find -maxdepth 4 -not -path '*[cC]ache*' -not -path '*[tT]rash*' -type d | fzf --preview 'tree -C {}') + else + $1 $(find -maxdepth 5 -not -path '*[cC]ache*' -not -path '*[tT]rash*' | fzf --preview 'tree -C {}') + fi + } + + function sn() { + nmcli connection up $(nmcli connection show | tail -n +2 | cut -d " " -f1 | fzf --preview 'nmcli connection show {}') + } + + prompt_dir() { + prompt_segment blue $CURRENT_FG '%c' + } + ''; + }; +}