1 { config, pkgs, lib, wallpaper, ... }:
4 theme = pkgs.qogir-theme.override { tweaks = [ "square" ]; };
5 markdownStyleHeader = pkgs.writeText "style.html" ''
6 <style type="text/css">
13 background-color:#EEE;
16 @media (prefers-color-scheme: dark) {
19 background-color:#333;
22 h1,h2,h3{line-height:1.2}
25 markdownCaddyfile = pkgs.writeText "Caddyfile" ''
36 {file}.endsWith(".md")
37 || {file}.endsWith(".MD")
40 header @md Content-Type "text/html; charset=UTF-8"
45 <title>{{ "{file.base}" }}</title>
46 <link rel="stylesheet" href="https://sindresorhus.com/github-markdown-css/github-markdown.css">
49 box-sizing: border-box;
57 <body class="markdown-body">
59 markdown (include "{path}")
67 # Home Manager needs a bit of information about you and the paths it should
70 home.homeDirectory = "/home/ps";
81 "backdrop/screen0/monitor0/image-path" = "${wallpaper}";
82 "backdrop/screen0/monitor0/image-show" = true;
83 "backdrop/screen0/monitor0/image-style" = 5;
87 systemd.user.services.markdownCaddy = {
89 Description = "Run a web server serving Markdown files.";
90 Wants = [ "network-online.target" ];
91 After = [ "network-online.target" ];
94 WantedBy = [ "default.target" ];
97 WorkingDirectory = "/";
98 ExecStart = "${pkgs.writeShellScript "markdown-caddy" ''
99 ${pkgs.caddy}/bin/caddy run --config ${markdownCaddyfile} --adapter caddyfile
104 xsession.windowManager.i3 = {
109 terminal = "${pkgs.kitty}/bin/kitty";
110 gaps = { inner = 0; outer = 0; };
113 mod = config.xsession.windowManager.i3.config.modifier;
114 i3-next = pkgs.writers.writePython3 "i3-next" {} ''
116 from subprocess import check_output
118 workspaces = json.loads(check_output(
119 ["${pkgs.i3}/bin/i3-msg",
120 "-t", "get_workspaces"]))
128 workspace = int(w["num"])
129 if output not in outputs:
130 outputs[output] = set()
131 outputs[output].add(workspace)
133 activeOutput = output
134 activeWorkspace = workspace
136 workspacesSorted = sorted(outputs[activeOutput])
137 activeWorkspaceIndex = workspacesSorted.index(activeWorkspace)
139 if activeWorkspaceIndex < len(workspacesSorted) - 1:
140 print(workspacesSorted[activeWorkspaceIndex + 1])
142 allWorkspaces = set()
143 for o in outputs.values():
144 allWorkspaces = allWorkspaces.union(o)
145 allWorkspacesSorted = sorted(allWorkspaces)
146 print(allWorkspacesSorted[-1]+1)
149 i3-empty = pkgs.writers.writePython3 "i3-empty" {} ''
151 from subprocess import check_output
153 workspaces = json.loads(check_output(
154 ["${pkgs.i3}/bin/i3-msg",
155 "-t", "get_workspaces"]))
161 if wNum >= nextWorkspace:
162 nextWorkspace = wNum + 1
167 i3-max = pkgs.writers.writePython3 "i3-max" {} ''
169 from subprocess import check_output
171 workspaces = json.loads(check_output(
172 ["${pkgs.i3}/bin/i3-msg",
173 "-t", "get_workspaces"]))
179 wFocused = w["focused"]
180 if wName == "MAX" and wFocused:
181 result = "back_and_forth"
184 print(f"move window to workspace {result}; workspace {result}")
186 i3-move-max = pkgs.writers.writePython3 "i3-move-max" {} ''
188 from subprocess import check_output
190 workspaces = json.loads(check_output(
191 ["${pkgs.i3}/bin/i3-msg",
192 "-t", "get_workspaces"]))
198 wFocused = w["focused"]
199 if wName == "MAX" and wFocused:
200 result = "back_and_forth"
203 print(f"workspace {result}")
205 in lib.mkOptionDefault
207 # "${mod}+d" = "exec --no-startup-id krunner";
208 # "${mod}+Shift+p" = "exec --no-startup-id set-wallpaper";
209 "${mod}+Shift+Return" = "exec --no-startup-id ${pkgs.kitty}/bin/kitty -d $(${pkgs.xcwd}/bin/xcwd)";
210 "${mod}+BackSpace" = "kill";
211 "${mod}+Prior" = "workspace prev_on_output";
212 "${mod}+Next" = "exec --no-startup-id i3-msg workspace number $(${i3-next})";
213 "${mod}+End" = "exec --no-startup-id i3-msg workspace $(${i3-empty})";
214 "${mod}+Shift+Prior" = "move container to workspace prev_on_output";
215 "${mod}+Shift+Next" = "exec --no-startup-id i3-msg move container to workspace number $(${i3-next})";
216 "${mod}+Shift+End" = "exec --no-startup-id i3-msg move container to workspace $(${i3-empty})";
217 "${mod}+Ctrl+Left" = "move workspace to output left";
218 "${mod}+Ctrl+Right" = "move workspace to output right";
219 "${mod}+y" = "exec --no-startup-id mirror-phone";
220 "${mod}+n" = "exec ${pkgs.kitty}/bin/kitty -d ~/sync/txt $EDITOR .";
221 "${mod}+m" = "exec --no-startup-id i3-msg $(${i3-max})";
222 "${mod}+b" = "split toggle; layout tabbed";
223 "${mod}+Shift+m" = "exec --no-startup-id i3-msg $(${i3-move-max})";
224 "${mod}+Shift+p" = "exec --no-startup-id ${pkgs.autorandr}/bin/autorandr --match-edid -c -f";
228 exec ${pkgs.xfce.xfce4-panel}/bin/xfce4-panel
229 for_window [window_role="pop-up"] floating enable
230 for_window [window_role="task_dialog"] floating enable
231 # for_window [workspace="0"] floating enable
233 for_window [class="kitty-popup"] floating enable
234 for_window [class="Xfce4-appfinder"] floating enable
235 for_window [class="yakuake"] floating enable
236 for_window [class="systemsettings"] floating enable
237 for_window [title="win7"] floating enable; border none
238 for_window [title="Arbeitsfläche.*"] kill, floating enable, border none
240 # class border backgr. text indicator child_border
241 client.focused #000000bf #000000bf #e6ebef #000000bf #000000bf
242 client.focused_inactive #00000080 #00000080 #e6ebef #00000080 #00000080
243 client.unfocused #00000040 #00000040 #e6ebef #00000040 #00000040
244 client.urgent #2f343a #900000 #e6ebef #900000 #2f343a
245 client.placeholder #000000 #0c0c0c #e6ebef #000000 #0c0c0c
247 focus_follows_mouse no
249 popup_during_fullscreen all
257 "0:_NET_WM_STATE@[*]:a = '_NET_WM_STATE_HIDDEN'"
262 userName = "patrick-scho";
263 userEmail = "patrick.schoenberger@posteo.de";
264 includes = [{ contents = {
266 email = "patrick.schoenberger@posteo.de";
275 historyFileSize = -1;
277 snrs = "sudo nixos-rebuild switch --flake /etc/nixos#default";
278 snrt = "sudo nixos-rebuild test --flake /etc/nixos#default";
279 snrb = "sudo nixos-rebuild boot --flake /etc/nixos#default";
280 senc = "sudo $EDITOR /etc/nixos/configuration.nix";
281 senh = "sudo $EDITOR /etc/nixos/home.nix";
282 senf = "sudo $EDITOR /etc/nixos/flake.nix";
283 flakerun = "nix run --override-input nixpkgs nixpkgs";
290 enableBashIntegration = true;
293 programs.readline = {
296 "\\e[A" = "history-search-backward";
297 "\\e[B" = "history-search-forward";
303 themeFile = "Adapta_Nokto_Maia";
305 # hide_window_decorations = "yes";
306 background_opacity = "0.98";
307 background_blur = "1";
308 confirm_os_window_close = "0";
309 enable_audio_bell = "no";
310 scrollback_pager_history_size = "1024";
317 theme = "base16_terminal";
318 editor.cursor-shape = {
321 select = "underline";
326 editor.file-picker = {
329 keys.normal."space" = {
330 "space" = "goto_word";
337 formatter = { command = "clang-format"; args = ["--style=microsoft"]; };
342 home.file.".config/zls.json".text = ''
344 "enable_build_on_save": true,
345 "build_on_save_step": "check"
351 defaultEditor = true;
352 plugins = with pkgs.vimPlugins; [
371 set foldmethod=marker
374 filetype plugin indent on
383 inoremap <Down> <C-o>gj
384 inoremap <Up> <C-o>gk
385 tnoremap <Esc> <C-\><C-n>
387 nnoremap <Esc> :noh<CR>
388 nnoremap gr :Telescope lsp_references<CR>
389 nnoremap gd :Telescope lsp_definitions<CR>
390 nnoremap <leader>u :UndotreeToggle<CR> :UndotreeFocus<CR>
391 nnoremap <leader>f :Telescope find_files<CR>
392 nnoremap <leader>b :Telescope buffers<CR>
393 nnoremap <leader>e :Telescope diagnostics<CR>
394 nnoremap <leader>g :Telescope live_grep<CR>
395 nnoremap <leader>s :Telescope lsp_document_symbols<CR>
396 nnoremap <leader>r :lua vim.lsp.buf.rename()<CR>
397 nnoremap <leader>n :bnext<CR>
398 nnoremap <leader>m :bprevious<CR>
399 noremap <leader>y "+y<CR>
400 noremap <leader>p "+p<CR>
401 noremap <leader><S-y> "+<S-y><CR>
402 noremap <leader><S-p> "+<S-p><CR>
405 " augroup FormatAutogroup
407 " autocmd BufWritePost * FormatWrite
410 " enter insert mode when opening terminal
411 autocmd TermOpen * startinsert
414 autocmd BufReadPost *
415 \ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
416 \ | exe "normal! g`\""
419 " Use persistent history.
420 if !isdirectory("/tmp/.vim-undo-dir")
421 call mkdir("/tmp/.vim-undo-dir", "", 0700)
423 set undodir=/tmp/.vim-undo-dir
427 vim.lsp.enable('zls')
428 vim.lsp.enable('clangd')
429 vim.lsp.config('zuban', {})
430 vim.lsp.enable('zuban')
431 require('guess-indent').setup {}
432 local util = require('formatter.util')
433 local telescope = require('telescope')
434 require('formatter').setup {
436 log_level = vim.log.levels.WARN,
438 c = { require("formatter.filetypes.c").clangformat },
439 cpp = { require("formatter.filetypes.cpp").clangformat },
440 zig = { require("formatter.filetypes.zig").zigfmt },
443 require('blink.cmp').setup {
447 ['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
448 ['<C-e>'] = { 'hide', 'fallback' },
449 ['<CR>'] = { 'accept', 'fallback' },
451 ['<Tab>'] = { 'select_next', 'fallback_to_mappings' },
452 ['<S-Tab>'] = { 'select_prev', 'fallback_to_mappings' },
454 ['<C-p>'] = { 'scroll_documentation_up', 'fallback' },
455 ['<C-n'] = { 'scroll_documentation_down', 'fallback' },
457 ['<C-k>'] = { 'show_signature', 'hide_signature', 'fallback' },
460 list = { selection = { preselect = false, } },
463 -- treesitter_highlighting = false,
466 signature = { enabled = true },
472 home.file.".config/vis/plugins/vis-lspc" = {
473 source = builtins.fetchGit {
474 url = "https://gitlab.com/muhq/vis-lspc.git";
475 rev = "e184eb6c971abfcd0dc7f836f402aae6c33a8d13";
479 home.file.".config/vis/plugins/vis-commentary" = {
480 source = builtins.fetchGit {
481 url = "https://github.com/lutobler/vis-commentary.git";
482 rev = "0e06ed8212c12c6651cb078b822390094b396f08";
486 home.file.".config/vis/visrc.lua".text = ''
488 require('plugins/vis-commentary')
489 lspc = require('plugins/vis-lspc')
491 lspc.menu_cmd = 'vis-menu'
492 lspc.fallback_dirname_as_root = true
493 lspc.ls_map.zig = {name='zls',cmd='zls',roots={'build.zig'}}
495 vis.events.subscribe(vis.events.INIT, function()
496 -- Your global configuration options
499 vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused args
500 -- Your per window configuration options e.g.
501 vis:command('set number on')
502 vis:command('set autoindent')
503 vis:command('set tabwidth 4')
504 vis:command('set expandtab on')
514 (global-display-line-numbers-mode)
516 display-line-numbers-type 'relative
517 make-backup-files nil
518 inhibit-startup-screen t)
519 (load-theme 'tango-dark t)
521 extraPackages = epkgs: [
531 set-option -g default-terminal screen-256color
532 set -g history-limit 10000
534 set-option -g renumber-windows on
535 bind-key -n M-n new-window -c "#{pane_current_path}"
536 bind-key -n M-1 select-window -t :1
537 bind-key -n M-2 select-window -t :2
538 bind-key -n M-3 select-window -t :3
539 bind-key -n M-4 select-window -t :4
540 bind-key -n M-5 select-window -t :5
541 bind-key -n M-6 select-window -t :6
542 bind-key -n M-7 select-window -t :7
543 bind-key -n M-8 select-window -t :8
544 bind-key -n M-9 select-window -t :9
545 bind-key -n M-0 select-window -t :0
546 bind-key -n M-. select-window -n
547 bind-key -n M-, select-window -p
548 bind-key -n M-S-. swap-window -t +1
549 bind-key -n M-S-, swap-window -t -1
550 bind-key -n M-X confirm-before "kill-window"
551 bind-key -n M-v split-window -h -c "#{pane_current_path}"
552 bind-key -n M-b split-window -v -c "#{pane_current_path}"
553 bind-key -n M-R command-prompt -I "" "rename-window '%%'"
554 bind-key -n M-f resize-pane -Z
555 bind-key -n M-h select-pane -L
556 bind-key -n M-l select-pane -R
557 bind-key -n M-k select-pane -U
558 bind-key -n M-j select-pane -D
559 bind-key -n M-Left select-pane -L
560 bind-key -n M-Right select-pane -R
561 bind-key -n M-Up select-pane -U
562 bind-key -n M-Down select-pane -D
563 bind-key -n "M-H" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -L; tmux swap-pane -t $old'
564 bind-key -n "M-J" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -D; tmux swap-pane -t $old'
565 bind-key -n "M-K" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -U; tmux swap-pane -t $old'
566 bind-key -n "M-L" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -R; tmux swap-pane -t $old'
567 bind-key -n "M-S-Left" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -L; tmux swap-pane -t $old'
568 bind-key -n "M-S-Down" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -D; tmux swap-pane -t $old'
569 bind-key -n "M-S-Up" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -U; tmux swap-pane -t $old'
570 bind-key -n "M-S-Right" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -R; tmux swap-pane -t $old'
571 bind-key -n M-x confirm-before "kill-pane"
572 bind-key -n M-/ copy-mode
574 # Linux system clipboard
575 bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
576 bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "xclip -in -selection clipboard"
579 # set-option -g status-keys vi
580 # set-option -g set-titles on
581 # set-option -g set-titles-string 'tmux - #W'
582 # set -g bell-action any
583 # set-option -g visual-bell off
584 # set-option -g set-clipboard off
585 # setw -g mode-keys vi
586 # setw -g monitor-activity on
587 # set -g visual-activity on
588 # set -g status-style fg=colour15
589 # set -g status-justify centre
590 # set -g status-left ""
591 # set -g status-right ""
592 # set -g status-interval 1
593 # set -g message-style fg=colour0,bg=colour3
594 # setw -g window-status-bell-style fg=colour1
595 # setw -g window-status-current-style fg=yellow,bold
596 # setw -g window-status-style fg=colour250
597 # setw -g window-status-current-format ' #{?#{==:#W,#{b:SHELL}},#{b:pane_current_path},#W} '
598 # setw -g window-status-format ' #{?#{==:#W,#{b:SHELL}},#{b:pane_current_path},#W} '
600 # #setw -g window-status-format ' #W '
601 # #setw -g window-status-current-format ' #W '
607 # for editing directly to config.nu
612 case_sensitive: false # case-sensitive completions
613 quick: true # set to false to prevent auto-selecting completions
614 partial: true # set to false to prevent partial filling of the prompt
615 algorithm: "fuzzy" # prefix or fuzzy
618 command_not_found: { |cmd| (command-not-found $cmd | str trim) }
628 # programs.carapace = {
630 # enableNushellIntegration = true;
633 # programs.starship = {
636 # add_newline = false;
638 # success_symbol = "[➜](bold green)";
639 # error_symbol = "[➜](bold red)";
649 "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
650 "browser.fullscreen.autohide" = false;
651 "browser.toolbars.bookmarks.visibility" = "never";
652 "browser.tabs.inTitlebar" = 0;
653 "browser.compactmode.show" = true;
654 "browser.uidensity" = 1;
658 visibility: collapse !important;
665 "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
666 "browser.fullscreen.autohide" = false;
667 "browser.toolbars.bookmarks.visibility" = "never";
668 "browser.tabs.inTitlebar" = 0;
669 "browser.compactmode.show" = true;
670 "browser.uidensity" = 1;
674 visibility: collapse !important;
677 visibility: collapse !important;
680 border-bottom: none !important;
687 xdg.desktopEntries = {
690 genericName = "Messenger";
691 exec = "app web.whatsapp.com";
693 categories = [ "Application" ];
694 icon = pkgs.fetchurl {
695 url = "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/2062095_application_chat_communication_logo_whatsapp_icon.svg/1024px-2062095_application_chat_communication_logo_whatsapp_icon.svg.png";
696 sha256 = "sha256-0eE3EEGnWFlpObfraTXMIqJz0Uya/h0hDsUA528qKCY=";
701 genericName = "Documents";
704 categories = [ "Application" ];
705 icon = pkgs.fetchurl {
706 url = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Markdown-mark.svg/1024px-Markdown-mark.svg.png";
707 sha256 = "0v161jvmcfxp9lwd86y789430w1vpvxnnm5n2hzgr1kfh03psvb2";
717 # programs.gnome-shell.theme = {
719 # name = "Qogir-Dark";
722 # package = pkgs.vimix-icon-theme;
723 # name = "vimix-doder-dark";
725 home.pointerCursor = {
729 name = "volantes_light_cursors";
731 package = pkgs.volantes-cursors;
734 # This value determines the Home Manager release that your configuration is
735 # compatible with. This helps avoid breakage when a new Home Manager release
736 # introduces backwards incompatible changes.
738 # You should not change this value, even if you update Home Manager. If you do
739 # want to update the value, then make sure to first check the Home Manager
741 home.stateVersion = "24.05"; # Please read the comment before changing.
743 # The home.packages option allows you to install Nix packages into your
745 home.packages = with pkgs; [
752 fzf bat delta silver-searcher ripgrep perl universal-ctags
759 linuxPackages_latest.perf
761 asciidoctor-with-extensions
790 wineWowPackages.unstableFull winetricks
793 # # It is sometimes useful to fine-tune packages, for example, by applying
794 # # overrides. You can do that directly here, just don't forget the
795 # # parentheses. Maybe you want to install Nerd Fonts with a limited number of
797 # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
799 # # You can also create simple shell scripts directly inside your
800 # # configuration. For example, this adds a command 'my-hello' to your
802 # (pkgs.writeShellScriptBin "my-hello" ''
803 # echo "Hello, ${config.home.username}!"
805 # $@ - Liste aller Parameter
806 # $* - String aller Parameter
807 # $# - Anzahl aller Parameter
808 # &> - stdout und stderr pipen
812 (pkgs.writeShellScriptBin "app" ''
813 ${pkgs.firefox}/bin/firefox -p appmode --new-window "$@"
815 (pkgs.writeShellScriptBin "md" ''
816 file=$(mktemp --suffix=.html) && \
818 ${pkgs.pandoc}/bin/pandoc -o $file $1 -s -H ${markdownStyleHeader} && \
822 (pkgs.writeShellScriptBin "run" ''
823 (nohup "$@" &>/dev/null &); sleep 0
825 (pkgs.writeShellScriptBin "popup" ''
826 ${pkgs.kitty}/bin/kitty -o hide_window_decorations=yes -o background_opacity=0.5 \
827 --class kitty-popup -o remember_window_size=no \
828 -o initial_window_width=120c -o initial_window_height=40c \
831 (pkgs.writeShellScriptBin "fzfdir" ''
832 find "$1" -name "$2" | ${pkgs.fzf}/bin/fzf --layout=reverse
834 (pkgs.writeShellScriptBin "file-app" ''
837 (pkgs.writeShellScriptBin "run-popup" ''
838 popup bash -c 'file=$(compgen -c | grep -v fzf | sort -u | fzf --layout=reverse --print-query | tail -n 1) && run $file'
840 (pkgs.writeShellScriptBin "set-wallpaper" ''
841 ${pkgs.feh}/bin/feh --bg-fill --no-fehbg ${wallpaper}
843 (pkgs.writeShellScriptBin "mirror-phone" "IP=$(select-ip) && sudo scrcpy --tcpip=$IP --no-audio -K --kill-adb-on-close")
844 (pkgs.writeShellScriptBin "select-ip" ''
845 FILE=$HOME/.cache/select-ip.txt
846 IP=$( ${pkgs.rofi}/bin/rofi -dmenu -input $FILE -p IP ) || exit 1
848 gawk -i inplace 'FNR==1{delete a} !a[$0]++' $FILE
851 (pkgs.writeShellScriptBin "create-repo" ''
852 ssh psch.dev sudo -u git git init --bare /srv/git/$1
856 # Home Manager is pretty good at managing dotfiles. The primary way to manage
857 # plain files is through 'home.file'.
859 # # Building this configuration will create a copy of 'dotfiles/screenrc' in
860 # # the Nix store. Activating the configuration will then make '~/.screenrc' a
861 # # symlink to the Nix store copy.
862 # ".screenrc".source = dotfiles/screenrc;
864 # # You can also set the file content immediately.
865 # ".gradle/gradle.properties".text = ''
866 # org.gradle.console=verbose
867 # org.gradle.daemon.idletimeout=3600000
871 # Home Manager can also manage your environment variables through
872 # 'home.sessionVariables'. These will be explicitly sourced when using a
873 # shell provided by Home Manager. If you don't want to manage your shell
874 # through Home Manager then you have to manually source 'hm-session-vars.sh'
877 # ~/.nix-profile/etc/profile.d/hm-session-vars.sh
881 # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
885 # /etc/profiles/per-user/ps/etc/profile.d/hm-session-vars.sh
887 home.sessionVariables = {
891 # Let Home Manager install and manage itself.
892 programs.home-manager.enable = true;