]> gitweb.ps.run Git - flake_thinkpad/blob - home.nix
add Mod-b shortcut to i3; this creates a new tabbed child layer
[flake_thinkpad] / home.nix
1 { config, pkgs, lib, wallpaper, ... }:
2
3 let
4   theme = pkgs.qogir-theme.override { tweaks = [ "square" ]; };
5   markdownStyleHeader = pkgs.writeText "style.html" ''
6     <style type="text/css">
7     html{
8       margin:40px auto;
9       max-width:650px;
10       line-height:1.6;
11       font-size:18px;
12       color:#444;
13       background-color:#EEE;
14       padding:0 10px
15     }
16     @media (prefers-color-scheme: dark) {
17     html{
18       color:#CCC;
19       background-color:#333;
20     }
21     }
22     h1,h2,h3{line-height:1.2}
23     </style>
24   '';
25   markdownCaddyfile = pkgs.writeText "Caddyfile" ''
26     :8123
27
28     encode zstd gzip
29     templates
30     file_server browse {
31             root "/"
32             hide ".*"
33     }
34
35     @md <<CEL
36       {file}.endsWith(".md")
37       || {file}.endsWith(".MD")
38       CEL
39
40     header @md Content-Type "text/html; charset=UTF-8"
41     respond @md <<HTML
42             <!DOCTYPE html>
43             <html>
44                     <head>
45                             <title>{{ "{file.base}" }}</title>
46                             <link rel="stylesheet" href="https://sindresorhus.com/github-markdown-css/github-markdown.css">
47                             <style>
48                             .markdown-body {
49                                         box-sizing: border-box;
50                                         min-width: 200px;
51                                         max-width: 980px;
52                                         margin: 0 auto;
53                                         padding: 45px;
54                                 }
55                             </style>
56                     </head>
57                     <body class="markdown-body">
58                     {{
59                     markdown (include "{path}")
60                     }}
61                     </body>
62             </html>
63             HTML 200
64   '';
65 in
66 {
67   # Home Manager needs a bit of information about you and the paths it should
68   # manage.
69   home.username = "ps";
70   home.homeDirectory = "/home/ps";
71
72   services.xcape = {
73     enable = true;
74     mapExpression = {
75       Caps_Lock = "Escape";
76     };
77   };
78
79   xfconf.settings = {
80     xfce4-desktop = {
81       "backdrop/screen0/monitor0/image-path" = "${wallpaper}";
82       "backdrop/screen0/monitor0/image-show" = true;
83       "backdrop/screen0/monitor0/image-style" = 5;
84     };
85   };
86
87   systemd.user.services.markdownCaddy = {
88     Unit = {
89       Description = "Run a web server serving Markdown files.";
90       Wants = [ "network-online.target" ];
91       After = [ "network-online.target" ];
92     };
93     Install = {
94       WantedBy = [ "default.target" ];
95     };
96     Service = {
97       WorkingDirectory = "/";
98       ExecStart = "${pkgs.writeShellScript "markdown-caddy" ''
99         ${pkgs.caddy}/bin/caddy run --config ${markdownCaddyfile} --adapter caddyfile
100       ''}";
101     };
102   };
103   
104   xsession.windowManager.i3 = {
105     enable = true;
106     config = {
107       bars = [];
108       modifier = "Mod4";
109       terminal = "${pkgs.kitty}/bin/kitty";
110       gaps = { inner = 0; outer = 0; };
111       keybindings =
112         let
113           mod = config.xsession.windowManager.i3.config.modifier;
114           i3-next = pkgs.writers.writePython3 "i3-next" {} ''
115             import json
116             from subprocess import check_output
117
118             workspaces = json.loads(check_output(
119               ["${pkgs.i3}/bin/i3-msg",
120                "-t", "get_workspaces"]))
121
122             outputs = {}
123             activeOutput = ""
124             activeWorkspace = -1
125
126             for w in workspaces:
127                 output = w["output"]
128                 workspace = int(w["num"])
129                 if output not in outputs:
130                     outputs[output] = set()
131                 outputs[output].add(workspace)
132                 if w["focused"]:
133                     activeOutput = output
134                     activeWorkspace = workspace
135
136             workspacesSorted = sorted(outputs[activeOutput])
137             activeWorkspaceIndex = workspacesSorted.index(activeWorkspace)
138
139             if activeWorkspaceIndex < len(workspacesSorted) - 1:
140                 print(workspacesSorted[activeWorkspaceIndex + 1])
141             else:
142                 allWorkspaces = set()
143                 for o in outputs.values():
144                     allWorkspaces = allWorkspaces.union(o)
145                 allWorkspacesSorted = sorted(allWorkspaces)
146                 print(allWorkspacesSorted[-1]+1)
147           '';
148   
149           i3-empty = pkgs.writers.writePython3 "i3-empty" {} ''
150             import json
151             from subprocess import check_output
152
153             workspaces = json.loads(check_output(
154               ["${pkgs.i3}/bin/i3-msg",
155                "-t", "get_workspaces"]))
156
157             nextWorkspace = 1
158       
159             for w in workspaces:
160                 wNum = int(w["num"])
161                 if wNum >= nextWorkspace:
162                     nextWorkspace = wNum + 1
163
164             print(nextWorkspace)
165           '';
166           
167           i3-max = pkgs.writers.writePython3 "i3-max" {} ''
168             import json
169             from subprocess import check_output
170
171             workspaces = json.loads(check_output(
172               ["${pkgs.i3}/bin/i3-msg",
173                "-t", "get_workspaces"]))
174
175             result = "MAX"
176       
177             for w in workspaces:
178                 wName = w["name"]
179                 wFocused = w["focused"]
180                 if wName == "MAX" and wFocused:
181                     result = "back_and_forth"
182                     break
183
184             print(f"move window to workspace {result}; workspace {result}")
185           '';
186           i3-move-max = pkgs.writers.writePython3 "i3-move-max" {} ''
187             import json
188             from subprocess import check_output
189
190             workspaces = json.loads(check_output(
191               ["${pkgs.i3}/bin/i3-msg",
192                "-t", "get_workspaces"]))
193
194             result = "MAX"
195       
196             for w in workspaces:
197                 wName = w["name"]
198                 wFocused = w["focused"]
199                 if wName == "MAX" and wFocused:
200                     result = "back_and_forth"
201                     break
202
203             print(f"workspace {result}")
204           '';
205         in lib.mkOptionDefault
206           {
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";
225           };
226     };
227     extraConfig = ''
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
232
233       for_window [class="kitty-popup"] floating enable
234       for_window [class="Xfce4-appfinder"] floating enable
235       for_window [class=".blueman-manager-wrapped"] floating enable
236       for_window [class="yakuake"] floating enable
237       for_window [class="systemsettings"] floating enable
238       for_window [title="win7"] floating enable; border none
239
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
246
247       focus_follows_mouse no
248       mouse_warping none
249       popup_during_fullscreen all
250     '';
251   };
252
253   services.picom = {
254     enable = true;
255     vSync = true;
256     opacityRules = [
257       "0:_NET_WM_STATE@[*]:a = '_NET_WM_STATE_HIDDEN'"
258     ];
259   };
260
261   programs.git = {
262     userName = "patrick-scho";
263     userEmail = "patrick.schoenberger@posteo.de";
264     includes = [{ contents = {
265         user = {
266           email = "patrick.schoenberger@posteo.de";
267           name = "psch";
268         };
269     };}];
270   };
271
272   programs.bash = {
273     enable = true;
274     historySize = -1;
275     historyFileSize = -1;
276     shellAliases = {  
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";
284       n = "nvim";
285     };
286   };
287
288   programs.fzf = {
289     enable = true;
290     enableBashIntegration = true;
291   };
292
293   programs.readline = {
294     enable = true;
295     bindings = {
296       "\\e[A" = "history-search-backward";
297       "\\e[B" = "history-search-forward";
298     };
299   };
300
301   programs.kitty = {
302     enable = true;
303     themeFile = "Adapta_Nokto_Maia";
304     settings = {
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";
311     };
312   };
313
314   programs.helix = {
315     enable = true;
316     settings = {
317       theme = "base16_terminal";
318       editor.cursor-shape = {
319         insert = "bar";
320         normal = "block";
321         select = "underline";
322       };
323       editor.soft-wrap = {
324         enable = true;
325       };
326       editor.file-picker = {
327         hidden = false;
328       };
329       keys.normal."space" = {
330         "space" = "goto_word";
331       };
332     };
333     languages = {
334       language = [{
335         name = "c";
336         auto-format = true;
337         formatter = { command = "clang-format"; args = ["--style=microsoft"]; };
338       }];
339     };
340   };
341
342   home.file.".config/zls.json".text = ''
343     {
344       "enable_build_on_save": true,
345       "build_on_save_step": "check"
346     }
347   '';
348   
349   programs.neovim = {
350     enable = true;
351     defaultEditor = true;
352     plugins = with pkgs.vimPlugins; [
353       # fzfWrapper
354       # fzf-vim
355       formatter-nvim
356       goyo-vim
357       vim-visual-multi
358       nvim-lspconfig
359       blink-cmp
360       telescope-nvim
361       undotree
362       which-key-nvim
363       guess-indent-nvim
364     ];
365     extraConfig = ''
366       set number
367       set relativenumber
368       set tabstop=4
369       set shiftwidth=4
370       set expandtab
371       set foldmethod=marker
372       set autoindent
373       set smartindent
374       filetype plugin indent on
375       set signcolumn=yes
376
377       colorscheme habamax
378
379       nnoremap <Down> gj
380       nnoremap <Up> gk
381       vnoremap <Down> gj
382       vnoremap <Up> gk
383       inoremap <Down> <C-o>gj
384       inoremap <Up> <C-o>gk
385       tnoremap <Esc> <C-\><C-n>
386       map <Space> <Leader>
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>
403
404       " augroup FormatAutogroup
405       "   autocmd!
406       "   autocmd BufWritePost * FormatWrite
407       " augroup END
408
409       autocmd BufReadPost *
410       \ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit'
411       \ |   exe "normal! g`\""
412       \ | endif
413
414       " Use persistent history.
415       if !isdirectory("/tmp/.vim-undo-dir")
416           call mkdir("/tmp/.vim-undo-dir", "", 0700)
417       endif
418       set undodir=/tmp/.vim-undo-dir
419       set undofile
420     '';
421     extraLuaConfig = ''
422       vim.lsp.enable('zls')
423       vim.lsp.enable('clangd')
424       vim.lsp.config('zuban', {})
425       vim.lsp.enable('zuban')
426       require('guess-indent').setup {}
427       local util = require('formatter.util')
428       local telescope = require('telescope')
429       require('formatter').setup {
430         logging = true,
431         log_level = vim.log.levels.WARN,
432         filetype = {
433           c = { require("formatter.filetypes.c").clangformat },
434           cpp = { require("formatter.filetypes.cpp").clangformat },
435           zig = { require("formatter.filetypes.zig").zigfmt },
436         }
437       }
438       require('blink.cmp').setup {
439         keymap = {
440           preset = 'none',
441           
442           ['<C-space>'] = { 'show', 'show_documentation', 'hide_documentation' },
443           ['<C-e>'] = { 'hide', 'fallback' },
444           ['<CR>'] = { 'accept', 'fallback' },
445
446           ['<Tab>'] = { 'select_next', 'fallback_to_mappings' },
447           ['<S-Tab>'] = { 'select_prev', 'fallback_to_mappings' },
448
449           ['<C-p>'] = { 'scroll_documentation_up', 'fallback' },
450           ['<C-n'] = { 'scroll_documentation_down', 'fallback' },
451
452           ['<C-k>'] = { 'show_signature', 'hide_signature', 'fallback' },
453         },
454         completion = {
455           list = { selection = { preselect = false, } },
456           documentation = {
457             auto_show = true,
458             -- treesitter_highlighting = false,
459           },
460         },
461         signature = { enabled = true },
462       }
463     '';
464   };
465
466
467   home.file.".config/vis/plugins/vis-lspc" = {
468     source = builtins.fetchGit {
469       url = "https://gitlab.com/muhq/vis-lspc.git";
470       rev = "e184eb6c971abfcd0dc7f836f402aae6c33a8d13";
471     };
472     recursive = true;
473   };
474   home.file.".config/vis/plugins/vis-commentary" = {
475     source = builtins.fetchGit {
476       url = "https://github.com/lutobler/vis-commentary.git";
477       rev = "0e06ed8212c12c6651cb078b822390094b396f08";
478     };
479     recursive = true;
480   };
481   home.file.".config/vis/visrc.lua".text = ''
482       require('vis')
483       require('plugins/vis-commentary')
484       lspc = require('plugins/vis-lspc')
485
486       lspc.menu_cmd = 'vis-menu'
487       lspc.fallback_dirname_as_root = true
488       lspc.ls_map.zig = {name='zls',cmd='zls',roots={'build.zig'}}
489     
490       vis.events.subscribe(vis.events.INIT, function()
491         -- Your global configuration options
492       end)
493
494       vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused args
495         -- Your per window configuration options e.g.
496         vis:command('set number on')
497         vis:command('set autoindent')
498         vis:command('set tabwidth 4')
499         vis:command('set expandtab on')
500       end)
501     '';
502
503   programs.emacs = {
504     enable = true;
505     extraConfig = ''
506       (menu-bar-mode 1)
507       (tool-bar-mode 0)
508       (scroll-bar-mode 0)
509       (global-display-line-numbers-mode)
510       (setq-default
511         display-line-numbers-type 'relative
512         make-backup-files nil
513         inhibit-startup-screen t)
514       (load-theme 'tango-dark t)
515     '';
516     extraPackages = epkgs: [
517       epkgs.zig-mode
518       epkgs.lsp-mode
519     ];
520   };
521
522   programs.tmux = {
523     enable = true;
524     escapeTime = 0;
525     extraConfig = ''
526       set-option -g default-terminal screen-256color
527       set -g history-limit 10000
528       set -g base-index 1
529       set-option -g renumber-windows on
530       bind-key -n M-n new-window -c "#{pane_current_path}"
531       bind-key -n M-1 select-window -t :1
532       bind-key -n M-2 select-window -t :2
533       bind-key -n M-3 select-window -t :3
534       bind-key -n M-4 select-window -t :4
535       bind-key -n M-5 select-window -t :5
536       bind-key -n M-6 select-window -t :6
537       bind-key -n M-7 select-window -t :7
538       bind-key -n M-8 select-window -t :8
539       bind-key -n M-9 select-window -t :9
540       bind-key -n M-0 select-window -t :0
541       bind-key -n M-. select-window -n
542       bind-key -n M-, select-window -p
543       bind-key -n M-S-. swap-window -t +1
544       bind-key -n M-S-, swap-window -t -1
545       bind-key -n M-X confirm-before "kill-window"
546       bind-key -n M-v split-window -h -c "#{pane_current_path}"
547       bind-key -n M-b split-window -v -c "#{pane_current_path}"
548       bind-key -n M-R command-prompt -I "" "rename-window '%%'"
549       bind-key -n M-f resize-pane -Z
550       bind-key -n M-h select-pane -L
551       bind-key -n M-l select-pane -R
552       bind-key -n M-k select-pane -U
553       bind-key -n M-j select-pane -D
554       bind-key -n M-Left select-pane -L
555       bind-key -n M-Right select-pane -R
556       bind-key -n M-Up select-pane -U
557       bind-key -n M-Down select-pane -D
558       bind-key -n "M-H" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -L; tmux swap-pane -t $old'
559       bind-key -n "M-J" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -D; tmux swap-pane -t $old'
560       bind-key -n "M-K" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -U; tmux swap-pane -t $old'
561       bind-key -n "M-L" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -R; tmux swap-pane -t $old'
562       bind-key -n "M-S-Left" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -L; tmux swap-pane -t $old'
563       bind-key -n "M-S-Down" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -D; tmux swap-pane -t $old'
564       bind-key -n "M-S-Up" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -U; tmux swap-pane -t $old'
565       bind-key -n "M-S-Right" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -R; tmux swap-pane -t $old'
566       bind-key -n M-x confirm-before "kill-pane"
567       bind-key -n M-/ copy-mode
568
569       # Linux system clipboard
570       bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
571       bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "xclip -in -selection clipboard"
572
573       set -g mouse on
574       # set-option -g status-keys vi
575       # set-option -g set-titles on
576       # set-option -g set-titles-string 'tmux - #W'
577       # set -g bell-action any
578       # set-option -g visual-bell off
579       # set-option -g set-clipboard off
580       # setw -g mode-keys vi
581       # setw -g monitor-activity on
582       # set -g visual-activity on
583       # set -g status-style fg=colour15
584       # set -g status-justify centre
585       # set -g status-left ""
586       # set -g status-right ""
587       # set -g status-interval 1
588       # set -g message-style fg=colour0,bg=colour3
589       # setw -g window-status-bell-style fg=colour1
590       # setw -g window-status-current-style fg=yellow,bold
591       # setw -g window-status-style fg=colour250
592       # setw -g window-status-current-format ' #{?#{==:#W,#{b:SHELL}},#{b:pane_current_path},#W} '
593       # setw -g window-status-format ' #{?#{==:#W,#{b:SHELL}},#{b:pane_current_path},#W} '
594       # # For older tmux:
595       # #setw -g window-status-format ' #W '
596       # #setw -g window-status-current-format ' #W '
597     '';
598   };
599
600   programs.nushell = {
601     enable = true;
602     # for editing directly to config.nu 
603     extraConfig = ''
604       $env.config = {
605         show_banner: false,
606         completions: {
607           case_sensitive: false # case-sensitive completions
608           quick: true           # set to false to prevent auto-selecting completions
609           partial: true         # set to false to prevent partial filling of the prompt
610           algorithm: "fuzzy"    # prefix or fuzzy
611         }
612         hooks: {
613           command_not_found: { |cmd| (command-not-found $cmd | str trim)  }
614         }
615       } 
616     '';
617     #  shellAliases = {
618     #  vi = "hx";
619     #  vim = "hx";
620     #  nano = "hx";
621     # };
622   };  
623   # programs.carapace = {
624   #   enable = true;
625   #   enableNushellIntegration = true;
626   # };
627
628   # programs.starship = {
629   #   enable = true;
630   #   settings = {
631   #     add_newline = false;
632   #     character = { 
633   #       success_symbol = "[➜](bold green)";
634   #       error_symbol = "[➜](bold red)";
635   #     };
636   #   };
637   # };
638
639   programs.firefox = {
640     enable = true;
641     profiles = {
642       default = {
643         settings = {
644           "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
645           "browser.fullscreen.autohide" = false;
646           "browser.toolbars.bookmarks.visibility" = "never";
647           "browser.tabs.inTitlebar" = 0;
648           "browser.compactmode.show" = true;
649           "browser.uidensity" = 1;
650         };
651         userChrome = ''
652         #TabsToolbar {
653           visibility: collapse !important;
654         }
655         '';
656       };
657       appmode = {
658         id = 1;
659         settings = {
660           "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
661           "browser.fullscreen.autohide" = false;
662           "browser.toolbars.bookmarks.visibility" = "never";
663           "browser.tabs.inTitlebar" = 0;
664           "browser.compactmode.show" = true;
665           "browser.uidensity" = 1;
666         };
667         userChrome = ''
668         #TabsToolbar {
669           visibility: collapse !important;
670         }
671         #nav-bar {
672           visibility: collapse !important;
673         }
674         #navigator-toolbox {
675           border-bottom: none !important;
676         }
677         '';        
678       };
679     };
680   };
681
682   xdg.desktopEntries = {
683     whatsapp = {
684       name = "WhatsApp";
685       genericName = "Messenger";
686       exec = "app web.whatsapp.com";
687       terminal = false;
688       categories = [ "Application" ];
689       icon = pkgs.fetchurl {
690         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";
691         sha256 = "sha256-0eE3EEGnWFlpObfraTXMIqJz0Uya/h0hDsUA528qKCY=";
692       };
693     };
694     md = {
695       name = "Markdown";
696       genericName = "Documents";
697       exec = "md-app";
698       terminal = false;
699       categories = [ "Application" ];
700       icon = pkgs.fetchurl {
701         url = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Markdown-mark.svg/1024px-Markdown-mark.svg.png";
702         sha256 = "0v161jvmcfxp9lwd86y789430w1vpvxnnm5n2hzgr1kfh03psvb2";
703       };
704     };
705   };
706
707   gtk.enable = true;
708   gtk.theme = {
709     package = theme;
710     name = "Qogir-Dark";
711   };
712   # programs.gnome-shell.theme = {
713   #   package = theme;
714   #   name = "Qogir-Dark";
715   # };
716   # gtk.iconTheme = {
717   #   package = pkgs.vimix-icon-theme;
718   #   name = "vimix-doder-dark";
719   # };
720   home.pointerCursor = {
721     gtk.enable = true;
722     x11.enable = true;
723
724     name = "volantes_light_cursors";
725     size = 24;
726     package = pkgs.volantes-cursors;
727   };
728
729   # This value determines the Home Manager release that your configuration is
730   # compatible with. This helps avoid breakage when a new Home Manager release
731   # introduces backwards incompatible changes.
732   #
733   # You should not change this value, even if you update Home Manager. If you do
734   # want to update the value, then make sure to first check the Home Manager
735   # release notes.
736   home.stateVersion = "24.05"; # Please read the comment before changing.
737
738   # The home.packages option allows you to install Nix packages into your
739   # environment.
740   home.packages = with pkgs; [
741     nixos-icons
742     spotify-player
743     prismlauncher
744     pandoc
745     ghidra
746     gnome-firmware
747     fzf bat delta silver-searcher ripgrep perl universal-ctags
748     rofi
749     # bintools
750     htop
751     unzip
752     rr wrk
753     clang-tools bear
754     linuxPackages_latest.perf
755     texliveFull
756     asciidoctor-with-extensions
757     emscripten
758     caddy
759     python3
760     qogir-icon-theme
761     volantes-cursors
762     xorg.xkill
763     lf nnn yazi
764     feh
765     xarchiver
766     tig lazygit gitui
767     thunderbird
768     aerc
769     libreoffice
770     gimp
771     guvcview
772     arandr
773     vial
774     ncdu
775     gnumake gcc
776     linux-wifi-hotspot
777     esptool picocom
778     wireshark
779     nil
780     bc
781     ffmpeg-full
782     sc-im visidata
783     localsend
784     vis
785     wineWowPackages.unstableFull winetricks
786     signal-desktop
787
788     # # It is sometimes useful to fine-tune packages, for example, by applying
789     # # overrides. You can do that directly here, just don't forget the
790     # # parentheses. Maybe you want to install Nerd Fonts with a limited number of
791     # # fonts?
792     # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
793
794     # # You can also create simple shell scripts directly inside your
795     # # configuration. For example, this adds a command 'my-hello' to your
796     # # environment:
797     # (pkgs.writeShellScriptBin "my-hello" ''
798     #   echo "Hello, ${config.home.username}!"
799     # '')
800     # $@ - Liste aller Parameter
801     # $* - String aller Parameter
802     # $# - Anzahl aller Parameter
803     # &> - stdout und stderr pipen
804     # '' - Literal
805     # "" - Expanded
806     # 
807     (pkgs.writeShellScriptBin "app" ''
808       ${pkgs.firefox}/bin/firefox -p appmode --new-window "$@"
809     '')
810     (pkgs.writeShellScriptBin "md" ''
811       file=$(mktemp --suffix=.html) && \
812       echo $file && \
813       ${pkgs.pandoc}/bin/pandoc -o $file $1 -s -H ${markdownStyleHeader} && \
814       app $file && \
815       rm $file
816     '')
817     (pkgs.writeShellScriptBin "run" ''
818       (nohup "$@" &>/dev/null &); sleep 0
819     '')
820     (pkgs.writeShellScriptBin "popup" ''
821       ${pkgs.kitty}/bin/kitty -o hide_window_decorations=yes -o background_opacity=0.5 \
822         --class kitty-popup -o remember_window_size=no \
823         -o initial_window_width=120c -o initial_window_height=40c \
824         "$@"
825     '')
826     (pkgs.writeShellScriptBin "fzfdir" ''
827       find "$1" -name "$2" | ${pkgs.fzf}/bin/fzf --layout=reverse
828     '')
829     (pkgs.writeShellScriptBin "file-app" ''
830       app localhost:8123
831     '')
832     (pkgs.writeShellScriptBin "run-popup" ''
833       popup bash -c 'file=$(compgen -c | grep -v fzf | sort -u | fzf --layout=reverse --print-query | tail -n 1) && run $file'
834     '')
835     (pkgs.writeShellScriptBin "set-wallpaper" ''
836       ${pkgs.feh}/bin/feh --bg-fill --no-fehbg ${wallpaper}
837     '')
838     (pkgs.writeShellScriptBin "mirror-phone" "IP=$(select-ip) && sudo scrcpy --tcpip=$IP --no-audio -K --kill-adb-on-close")
839     (pkgs.writeShellScriptBin "select-ip" ''
840       FILE=$HOME/.cache/select-ip.txt
841       IP=$( ${pkgs.rofi}/bin/rofi -dmenu -input $FILE -p IP ) || exit 1
842       echo $IP >> $FILE
843       gawk -i inplace 'FNR==1{delete a} !a[$0]++' $FILE
844       echo $IP
845     '')
846     (pkgs.writeShellScriptBin "create-repo" ''
847       ssh psch.dev sudo -u git git init --bare /srv/git/$1
848     '')
849   ];
850
851   # Home Manager is pretty good at managing dotfiles. The primary way to manage
852   # plain files is through 'home.file'.
853   home.file = {
854     # # Building this configuration will create a copy of 'dotfiles/screenrc' in
855     # # the Nix store. Activating the configuration will then make '~/.screenrc' a
856     # # symlink to the Nix store copy.
857     # ".screenrc".source = dotfiles/screenrc;
858
859     # # You can also set the file content immediately.
860     # ".gradle/gradle.properties".text = ''
861     #   org.gradle.console=verbose
862     #   org.gradle.daemon.idletimeout=3600000
863     # '';
864   };
865
866   # Home Manager can also manage your environment variables through
867   # 'home.sessionVariables'. These will be explicitly sourced when using a
868   # shell provided by Home Manager. If you don't want to manage your shell
869   # through Home Manager then you have to manually source 'hm-session-vars.sh'
870   # located at either
871   #
872   #  ~/.nix-profile/etc/profile.d/hm-session-vars.sh
873   #
874   # or
875   #
876   #  ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
877   #
878   # or
879   #
880   #  /etc/profiles/per-user/ps/etc/profile.d/hm-session-vars.sh
881   #
882   home.sessionVariables = {
883     # EDITOR = "emacs";
884   };
885
886   # Let Home Manager install and manage itself.
887   programs.home-manager.enable = true;
888 }