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";
115 mod = config.xsession.windowManager.i3.config.modifier;
116 i3-next = pkgs.writers.writePython3 "i3-next" {} ''
118 from subprocess import check_output
120 workspaces = json.loads(check_output(
121 ["${pkgs.i3}/bin/i3-msg",
122 "-t", "get_workspaces"]))
130 workspace = int(w["num"])
131 if output not in outputs:
132 outputs[output] = set()
133 outputs[output].add(workspace)
135 activeOutput = output
136 activeWorkspace = workspace
138 workspacesSorted = sorted(outputs[activeOutput])
139 activeWorkspaceIndex = workspacesSorted.index(activeWorkspace)
141 if activeWorkspaceIndex < len(workspacesSorted) - 1:
142 print(workspacesSorted[activeWorkspaceIndex + 1])
144 allWorkspaces = set()
145 for o in outputs.values():
146 allWorkspaces = allWorkspaces.union(o)
147 allWorkspacesSorted = sorted(allWorkspaces)
148 print(allWorkspacesSorted[-1]+1)
151 i3-empty = pkgs.writers.writePython3 "i3-empty" {} ''
153 from subprocess import check_output
155 workspaces = json.loads(check_output(
156 ["${pkgs.i3}/bin/i3-msg",
157 "-t", "get_workspaces"]))
163 if wNum >= nextWorkspace:
164 nextWorkspace = wNum + 1
169 i3-max = pkgs.writers.writePython3 "i3-max" {} ''
171 from subprocess import check_output
173 workspaces = json.loads(check_output(
174 ["${pkgs.i3}/bin/i3-msg",
175 "-t", "get_workspaces"]))
181 wFocused = w["focused"]
182 if wName == "MAX" and wFocused:
183 result = "back_and_forth"
186 print(f"move window to workspace {result}; workspace {result}")
188 i3-move-max = pkgs.writers.writePython3 "i3-move-max" {} ''
190 from subprocess import check_output
192 workspaces = json.loads(check_output(
193 ["${pkgs.i3}/bin/i3-msg",
194 "-t", "get_workspaces"]))
200 wFocused = w["focused"]
201 if wName == "MAX" and wFocused:
202 result = "back_and_forth"
205 print(f"workspace {result}")
207 in lib.mkOptionDefault
209 # "${mod}+d" = "exec --no-startup-id krunner";
210 # "${mod}+Shift+p" = "exec --no-startup-id set-wallpaper";
211 "${mod}+Shift+Return" = "exec --no-startup-id ${pkgs.kitty}/bin/kitty -d $(${pkgs.xcwd}/bin/xcwd)";
212 "${mod}+BackSpace" = "kill";
213 "${mod}+Prior" = "workspace prev_on_output";
214 "${mod}+Next" = "exec --no-startup-id i3-msg workspace number $(${i3-next})";
215 "${mod}+End" = "exec --no-startup-id i3-msg workspace $(${i3-empty})";
216 "${mod}+Shift+Prior" = "move container to workspace prev_on_output";
217 "${mod}+Shift+Next" = "exec --no-startup-id i3-msg move container to workspace number $(${i3-next})";
218 "${mod}+Shift+End" = "exec --no-startup-id i3-msg move container to workspace $(${i3-empty})";
219 "${mod}+Ctrl+Left" = "move workspace to output left";
220 "${mod}+Ctrl+Right" = "move workspace to output right";
221 "${mod}+y" = "exec --no-startup-id mirror-phone";
222 "${mod}+n" = "exec ${pkgs.kitty}/bin/kitty -d ~/sync/txt $EDITOR .";
223 "${mod}+m" = "exec --no-startup-id i3-msg $(${i3-max})";
224 "${mod}+Shift+m" = "exec --no-startup-id i3-msg $(${i3-move-max})";
225 "${mod}+Shift+p" = "exec --no-startup-id ${pkgs.autorandr}/bin/autorandr --match-edid -c -f";
229 exec ${pkgs.xfce.xfce4-panel}/bin/xfce4-panel
230 for_window [window_role="pop-up"] floating enable
231 for_window [window_role="task_dialog"] floating enable
232 # for_window [workspace="0"] floating enable
234 for_window [class="kitty-popup"] floating enable
235 for_window [class="Xfce4-appfinder"] floating enable
236 for_window [class=".blueman-manager-wrapped"] floating enable
237 for_window [class="yakuake"] floating enable
238 for_window [class="systemsettings"] floating enable
239 for_window [title="win7"] floating enable; border none
241 # class border backgr. text indicator child_border
242 client.focused #000000bf #000000bf #e6ebef #000000bf #000000bf
243 client.focused_inactive #00000080 #00000080 #e6ebef #00000080 #00000080
244 client.unfocused #00000040 #00000040 #e6ebef #00000040 #00000040
245 client.urgent #2f343a #900000 #e6ebef #900000 #2f343a
246 client.placeholder #000000 #0c0c0c #e6ebef #000000 #0c0c0c
248 focus_follows_mouse no
250 popup_during_fullscreen all
258 "0:_NET_WM_STATE@[*]:a = '_NET_WM_STATE_HIDDEN'"
263 userName = "patrick-scho";
264 userEmail = "patrick.schoenberger@posteo.de";
265 includes = [{ contents = {
267 email = "patrick.schoenberger@posteo.de";
276 historyFileSize = -1;
278 snrs = "sudo nixos-rebuild switch --flake /etc/nixos#default";
279 snrt = "sudo nixos-rebuild test --flake /etc/nixos#default";
280 snrb = "sudo nixos-rebuild boot --flake /etc/nixos#default";
281 senc = "sudo $EDITOR /etc/nixos/configuration.nix";
282 senh = "sudo $EDITOR /etc/nixos/home.nix";
283 senf = "sudo $EDITOR /etc/nixos/flake.nix";
284 flakerun = "nix run --override-input nixpkgs nixpkgs";
291 enableBashIntegration = true;
294 programs.readline = {
297 "\\e[A" = "history-search-backward";
298 "\\e[B" = "history-search-forward";
304 themeFile = "Adapta_Nokto_Maia";
306 # hide_window_decorations = "yes";
307 background_opacity = "0.98";
308 background_blur = "1";
309 confirm_os_window_close = "0";
310 enable_audio_bell = "no";
311 scrollback_pager_history_size = "1024";
318 theme = "base16_terminal";
319 editor.cursor-shape = {
322 select = "underline";
327 editor.file-picker = {
330 keys.normal."space" = {
331 "space" = "goto_word";
338 formatter = { command = "clang-format"; args = ["--style=microsoft"]; };
343 home.file.".config/zls.json".text = ''
345 "enable_build_on_save": true,
346 "build_on_save_step": "check"
352 defaultEditor = true;
353 plugins = with pkgs.vimPlugins; [
372 set foldmethod=marker
375 filetype plugin indent on
384 inoremap <Down> <C-o>gj
385 inoremap <Up> <C-o>gk
386 tnoremap <Esc> <C-\><C-n>
388 nnoremap <Esc> :noh<CR>
389 nnoremap <leader>u :UndotreeToggle<CR> :UndotreeFocus<CR>
390 nnoremap <leader>f :Telescope find_files<CR>
391 nnoremap <leader>b :Telescope buffers<CR>
392 nnoremap <leader>e :Telescope diagnostics<CR>
393 nnoremap <leader>g :Telescope live_grep<CR>
394 nnoremap <leader>s :Telescope lsp_document_symbols<CR>
395 nnoremap <leader>r :Telescope lsp_references<CR>
396 nnoremap <leader><S-r> :Telescope lsp_references<CR><C-q>
397 nnoremap <leader>d :Telescope lsp_definitions<CR>
398 noremap <leader>y "+y"<CR>
399 noremap <leader>p "+p"<CR>
401 " augroup FormatAutogroup
403 " autocmd BufWritePost * FormatWrite
406 autocmd BufReadPost *
407 \ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
408 \ | exe "normal! g`\""
412 require('lspconfig').zls.setup{}
413 require('lspconfig').clangd.setup{}
414 local util = require('formatter.util')
415 require('formatter').setup {
417 log_level = vim.log.levels.WARN,
419 c = { require("formatter.filetypes.c").clangformat },
420 cpp = { require("formatter.filetypes.cpp").clangformat },
421 zig = { require("formatter.filetypes.zig").zigfmt },
424 require('blink.cmp').setup {
428 ['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
429 ['<C-e>'] = { 'hide', 'fallback' },
430 ['<CR>'] = { 'accept', 'fallback' },
432 ['<Tab>'] = { 'select_next', 'fallback_to_mappings' },
433 ['<S-Tab>'] = { 'select_prev', 'fallback_to_mappings' },
435 ['<C-p>'] = { 'scroll_documentation_up', 'fallback' },
436 ['<C-n'] = { 'scroll_documentation_down', 'fallback' },
438 ['<C-k>'] = { 'show_signature', 'hide_signature', 'fallback' },
441 list = { selection = { preselect = false, } },
448 home.file.".config/vis/plugins/vis-lspc" = {
449 source = builtins.fetchGit {
450 url = "https://gitlab.com/muhq/vis-lspc.git";
451 rev = "e184eb6c971abfcd0dc7f836f402aae6c33a8d13";
455 home.file.".config/vis/plugins/vis-commentary" = {
456 source = builtins.fetchGit {
457 url = "https://github.com/lutobler/vis-commentary.git";
458 rev = "0e06ed8212c12c6651cb078b822390094b396f08";
462 home.file.".config/vis/visrc.lua".text = ''
464 require('plugins/vis-commentary')
465 lspc = require('plugins/vis-lspc')
467 lspc.menu_cmd = 'vis-menu'
468 lspc.fallback_dirname_as_root = true
469 lspc.ls_map.zig = {name='zls',cmd='zls',roots={'build.zig'}}
471 vis.events.subscribe(vis.events.INIT, function()
472 -- Your global configuration options
475 vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused args
476 -- Your per window configuration options e.g.
477 vis:command('set number on')
478 vis:command('set autoindent')
479 vis:command('set tabwidth 4')
480 vis:command('set expandtab on')
490 (global-display-line-numbers-mode)
492 display-line-numbers-type 'relative
493 make-backup-files nil
494 inhibit-startup-screen t)
495 (load-theme 'tango-dark t)
497 extraPackages = epkgs: [
507 set-option -g default-terminal screen-256color
508 set -g history-limit 10000
510 set-option -g renumber-windows on
511 bind-key -n M-n new-window -c "#{pane_current_path}"
512 bind-key -n M-1 select-window -t :1
513 bind-key -n M-2 select-window -t :2
514 bind-key -n M-3 select-window -t :3
515 bind-key -n M-4 select-window -t :4
516 bind-key -n M-5 select-window -t :5
517 bind-key -n M-6 select-window -t :6
518 bind-key -n M-7 select-window -t :7
519 bind-key -n M-8 select-window -t :8
520 bind-key -n M-9 select-window -t :9
521 bind-key -n M-0 select-window -t :0
522 bind-key -n M-. select-window -n
523 bind-key -n M-, select-window -p
524 bind-key -n M-S-. swap-window -t +1
525 bind-key -n M-S-, swap-window -t -1
526 bind-key -n M-X confirm-before "kill-window"
527 bind-key -n M-v split-window -h -c "#{pane_current_path}"
528 bind-key -n M-b split-window -v -c "#{pane_current_path}"
529 bind-key -n M-R command-prompt -I "" "rename-window '%%'"
530 bind-key -n M-f resize-pane -Z
531 bind-key -n M-h select-pane -L
532 bind-key -n M-l select-pane -R
533 bind-key -n M-k select-pane -U
534 bind-key -n M-j select-pane -D
535 bind-key -n M-Left select-pane -L
536 bind-key -n M-Right select-pane -R
537 bind-key -n M-Up select-pane -U
538 bind-key -n M-Down select-pane -D
539 bind-key -n "M-H" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -L; tmux swap-pane -t $old'
540 bind-key -n "M-J" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -D; tmux swap-pane -t $old'
541 bind-key -n "M-K" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -U; tmux swap-pane -t $old'
542 bind-key -n "M-L" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -R; tmux swap-pane -t $old'
543 bind-key -n "M-S-Left" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -L; tmux swap-pane -t $old'
544 bind-key -n "M-S-Down" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -D; tmux swap-pane -t $old'
545 bind-key -n "M-S-Up" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -U; tmux swap-pane -t $old'
546 bind-key -n "M-S-Right" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -R; tmux swap-pane -t $old'
547 bind-key -n M-x confirm-before "kill-pane"
548 bind-key -n M-/ copy-mode
550 # Linux system clipboard
551 bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
552 bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "xclip -in -selection clipboard"
555 # set-option -g status-keys vi
556 # set-option -g set-titles on
557 # set-option -g set-titles-string 'tmux - #W'
558 # set -g bell-action any
559 # set-option -g visual-bell off
560 # set-option -g set-clipboard off
561 # setw -g mode-keys vi
562 # setw -g monitor-activity on
563 # set -g visual-activity on
564 # set -g status-style fg=colour15
565 # set -g status-justify centre
566 # set -g status-left ""
567 # set -g status-right ""
568 # set -g status-interval 1
569 # set -g message-style fg=colour0,bg=colour3
570 # setw -g window-status-bell-style fg=colour1
571 # setw -g window-status-current-style fg=yellow,bold
572 # setw -g window-status-style fg=colour250
573 # setw -g window-status-current-format ' #{?#{==:#W,#{b:SHELL}},#{b:pane_current_path},#W} '
574 # setw -g window-status-format ' #{?#{==:#W,#{b:SHELL}},#{b:pane_current_path},#W} '
576 # #setw -g window-status-format ' #W '
577 # #setw -g window-status-current-format ' #W '
583 # for editing directly to config.nu
588 case_sensitive: false # case-sensitive completions
589 quick: true # set to false to prevent auto-selecting completions
590 partial: true # set to false to prevent partial filling of the prompt
591 algorithm: "fuzzy" # prefix or fuzzy
594 command_not_found: { |cmd| (command-not-found $cmd | str trim) }
604 # programs.carapace = {
606 # enableNushellIntegration = true;
609 # programs.starship = {
612 # add_newline = false;
614 # success_symbol = "[➜](bold green)";
615 # error_symbol = "[➜](bold red)";
625 "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
626 "browser.fullscreen.autohide" = false;
627 "browser.toolbars.bookmarks.visibility" = "never";
628 "browser.tabs.inTitlebar" = 0;
629 "browser.compactmode.show" = true;
630 "browser.uidensity" = 1;
634 visibility: collapse !important;
641 "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
642 "browser.fullscreen.autohide" = false;
643 "browser.toolbars.bookmarks.visibility" = "never";
644 "browser.tabs.inTitlebar" = 0;
645 "browser.compactmode.show" = true;
646 "browser.uidensity" = 1;
650 visibility: collapse !important;
653 visibility: collapse !important;
656 border-bottom: none !important;
663 xdg.desktopEntries = {
666 genericName = "Messenger";
667 exec = "app web.whatsapp.com";
669 categories = [ "Application" ];
670 icon = pkgs.fetchurl {
671 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";
672 sha256 = "sha256-0eE3EEGnWFlpObfraTXMIqJz0Uya/h0hDsUA528qKCY=";
677 genericName = "Documents";
680 categories = [ "Application" ];
681 icon = pkgs.fetchurl {
682 url = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Markdown-mark.svg/1024px-Markdown-mark.svg.png";
683 sha256 = "0v161jvmcfxp9lwd86y789430w1vpvxnnm5n2hzgr1kfh03psvb2";
693 # programs.gnome-shell.theme = {
695 # name = "Qogir-Dark";
698 # package = pkgs.vimix-icon-theme;
699 # name = "vimix-doder-dark";
701 home.pointerCursor = {
705 name = "volantes_light_cursors";
707 package = pkgs.volantes-cursors;
710 # This value determines the Home Manager release that your configuration is
711 # compatible with. This helps avoid breakage when a new Home Manager release
712 # introduces backwards incompatible changes.
714 # You should not change this value, even if you update Home Manager. If you do
715 # want to update the value, then make sure to first check the Home Manager
717 home.stateVersion = "24.05"; # Please read the comment before changing.
719 # The home.packages option allows you to install Nix packages into your
721 home.packages = with pkgs; [
728 fzf bat delta silver-searcher ripgrep perl universal-ctags
735 linuxPackages_latest.perf
765 wineWowPackages.unstableFull winetricks
768 # # It is sometimes useful to fine-tune packages, for example, by applying
769 # # overrides. You can do that directly here, just don't forget the
770 # # parentheses. Maybe you want to install Nerd Fonts with a limited number of
772 # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
774 # # You can also create simple shell scripts directly inside your
775 # # configuration. For example, this adds a command 'my-hello' to your
777 # (pkgs.writeShellScriptBin "my-hello" ''
778 # echo "Hello, ${config.home.username}!"
780 # $@ - Liste aller Parameter
781 # $* - String aller Parameter
782 # $# - Anzahl aller Parameter
783 # &> - stdout und stderr pipen
787 (pkgs.writeShellScriptBin "app" ''
788 ${pkgs.firefox}/bin/firefox -p appmode --new-window "$@"
790 (pkgs.writeShellScriptBin "md" ''
791 file=$(mktemp --suffix=.html) && \
793 ${pkgs.pandoc}/bin/pandoc -o $file $1 -s -H ${markdownStyleHeader} && \
797 (pkgs.writeShellScriptBin "run" ''
798 (nohup "$@" &>/dev/null &); sleep 0
800 (pkgs.writeShellScriptBin "popup" ''
801 ${pkgs.kitty}/bin/kitty -o hide_window_decorations=yes -o background_opacity=0.5 \
802 --class kitty-popup -o remember_window_size=no \
803 -o initial_window_width=120c -o initial_window_height=40c \
806 (pkgs.writeShellScriptBin "fzfdir" ''
807 find "$1" -name "$2" | ${pkgs.fzf}/bin/fzf --layout=reverse
809 (pkgs.writeShellScriptBin "md-app" ''
810 #popup bash -c 'file=$(fzfdir "md" "*.md") && run md $file'
811 firefox -p appmode --new-window localhost:8123/home/ps/sync/txt/hsrm
813 (pkgs.writeShellScriptBin "run-popup" ''
814 popup bash -c 'file=$(compgen -c | grep -v fzf | sort -u | fzf --layout=reverse --print-query | tail -n 1) && run $file'
816 (pkgs.writeShellScriptBin "set-wallpaper" ''
817 ${pkgs.feh}/bin/feh --bg-fill --no-fehbg ${wallpaper}
819 (pkgs.writeShellScriptBin "mirror-phone" "IP=$(select-ip) && sudo scrcpy --tcpip=$IP --no-audio -K --kill-adb-on-close")
820 (pkgs.writeShellScriptBin "select-ip" ''
821 FILE=$HOME/.cache/select-ip.txt
822 IP=$( ${pkgs.rofi}/bin/rofi -dmenu -input $FILE -p IP ) || exit 1
824 gawk -i inplace 'FNR==1{delete a} !a[$0]++' $FILE
827 (pkgs.writeShellScriptBin "create-repo" ''
828 ssh psch.dev sudo -u git git init --bare /srv/git/$1
832 # Home Manager is pretty good at managing dotfiles. The primary way to manage
833 # plain files is through 'home.file'.
835 # # Building this configuration will create a copy of 'dotfiles/screenrc' in
836 # # the Nix store. Activating the configuration will then make '~/.screenrc' a
837 # # symlink to the Nix store copy.
838 # ".screenrc".source = dotfiles/screenrc;
840 # # You can also set the file content immediately.
841 # ".gradle/gradle.properties".text = ''
842 # org.gradle.console=verbose
843 # org.gradle.daemon.idletimeout=3600000
847 # Home Manager can also manage your environment variables through
848 # 'home.sessionVariables'. These will be explicitly sourced when using a
849 # shell provided by Home Manager. If you don't want to manage your shell
850 # through Home Manager then you have to manually source 'hm-session-vars.sh'
853 # ~/.nix-profile/etc/profile.d/hm-session-vars.sh
857 # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
861 # /etc/profiles/per-user/ps/etc/profile.d/hm-session-vars.sh
863 home.sessionVariables = {
867 # Let Home Manager install and manage itself.
868 programs.home-manager.enable = true;