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";
82 "backdrop/screen0/monitor0/image-path" = "${wallpaper}";
83 "backdrop/screen0/monitor0/image-show" = true;
84 "backdrop/screen0/monitor0/image-style" = 5;
88 systemd.user.services.markdownCaddy = {
90 Description = "Run a web server serving Markdown files.";
91 Wants = [ "network-online.target" ];
92 After = [ "network-online.target" ];
95 WantedBy = [ "default.target" ];
98 WorkingDirectory = "/";
99 ExecStart = "${pkgs.writeShellScript "markdown-caddy" ''
100 ${pkgs.caddy}/bin/caddy run --config ${markdownCaddyfile} --adapter caddyfile
105 xsession.windowManager.i3 = {
110 terminal = "${pkgs.kitty}/bin/kitty";
116 mod = config.xsession.windowManager.i3.config.modifier;
117 i3-next = pkgs.writers.writePython3 "i3-next" {} ''
119 from subprocess import check_output
121 workspaces = json.loads(check_output(
122 ["${pkgs.i3}/bin/i3-msg",
123 "-t", "get_workspaces"]))
131 workspace = int(w["num"])
132 if output not in outputs:
133 outputs[output] = set()
134 outputs[output].add(workspace)
136 activeOutput = output
137 activeWorkspace = workspace
139 workspacesSorted = sorted(outputs[activeOutput])
140 activeWorkspaceIndex = workspacesSorted.index(activeWorkspace)
142 if activeWorkspaceIndex < len(workspacesSorted) - 1:
143 print(workspacesSorted[activeWorkspaceIndex + 1])
145 allWorkspaces = set()
146 for o in outputs.values():
147 allWorkspaces = allWorkspaces.union(o)
148 allWorkspacesSorted = sorted(allWorkspaces)
149 print(allWorkspacesSorted[-1]+1)
152 i3-empty = pkgs.writers.writePython3 "i3-empty" {} ''
154 from subprocess import check_output
156 workspaces = json.loads(check_output(
157 ["${pkgs.i3}/bin/i3-msg",
158 "-t", "get_workspaces"]))
164 if wNum >= nextWorkspace:
165 nextWorkspace = wNum + 1
170 i3-max = pkgs.writers.writePython3 "i3-max" {} ''
172 from subprocess import check_output
174 workspaces = json.loads(check_output(
175 ["${pkgs.i3}/bin/i3-msg",
176 "-t", "get_workspaces"]))
182 wFocused = w["focused"]
183 if wName == "MAX" and wFocused:
184 result = "back_and_forth"
187 print(f"move window to workspace {result}; workspace {result}")
189 i3-move-max = pkgs.writers.writePython3 "i3-move-max" {} ''
191 from subprocess import check_output
193 workspaces = json.loads(check_output(
194 ["${pkgs.i3}/bin/i3-msg",
195 "-t", "get_workspaces"]))
201 wFocused = w["focused"]
202 if wName == "MAX" and wFocused:
203 result = "back_and_forth"
206 print(f"workspace {result}")
208 in lib.mkOptionDefault
210 # "${mod}+d" = "exec --no-startup-id krunner";
211 "${mod}+Shift+p" = "exec --no-startup-id set-wallpaper";
212 "${mod}+Shift+Return" = "exec --no-startup-id ${pkgs.kitty}/bin/kitty -d $(${pkgs.xcwd}/bin/xcwd)";
213 "${mod}+BackSpace" = "kill";
214 "${mod}+Prior" = "workspace prev_on_output";
215 "${mod}+Next" = "exec --no-startup-id i3-msg workspace number $(${i3-next})";
216 "${mod}+End" = "exec --no-startup-id i3-msg workspace $(${i3-empty})";
217 "${mod}+Shift+Prior" = "move container to workspace prev_on_output";
218 "${mod}+Shift+Next" = "exec --no-startup-id i3-msg move container to workspace number $(${i3-next})";
219 "${mod}+Shift+End" = "exec --no-startup-id i3-msg move container to workspace $(${i3-empty})";
220 "${mod}+Ctrl+Left" = "move workspace to output left";
221 "${mod}+Ctrl+Right" = "move workspace to output right";
222 "${mod}+y" = "exec --no-startup-id mirror-phone";
223 "${mod}+n" = "exec ${pkgs.kitty}/bin/kitty ${pkgs.helix}/bin/hx -w ~/sync/txt ~/sync/txt";
224 "${mod}+m" = "exec --no-startup-id i3-msg $(${i3-max})";
225 "${mod}+Shift+m" = "exec --no-startup-id i3-msg $(${i3-move-max})";
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=".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
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 ${pkgs.helix}/bin/hx /etc/nixos/configuration.nix";
281 senh = "sudo ${pkgs.helix}/bin/hx /etc/nixos/home.nix";
282 flakerun = "nix run --override-input nixpkgs nixpkgs";
288 enableBashIntegration = true;
291 programs.readline = {
294 "\\e[A" = "history-search-backward";
295 "\\e[B" = "history-search-forward";
301 themeFile = "Adapta_Nokto_Maia";
303 # hide_window_decorations = "yes";
304 background_opacity = "0.98";
305 background_blur = "1";
306 confirm_os_window_close = "0";
307 enable_audio_bell = "no";
308 scrollback_pager_history_size = "1024";
315 theme = "base16_terminal";
316 editor.cursor-shape = {
319 select = "underline";
324 editor.file-picker = {
327 keys.normal."space" = {
328 "space" = "goto_word";
335 formatter = { command = "clang-format"; args = ["--style=microsoft"]; };
340 home.file.".config/zls.json".text = ''
342 "enable_build_on_save": true,
343 "build_on_save_step": "check"
349 defaultEditor = true;
350 plugins = with pkgs.vimPlugins; [
363 set foldmethod=marker
370 inoremap <Down> <C-o>gj
371 inoremap <Up> <C-o>gk
372 tnoremap <Esc> <C-\><C-n>
375 require('lspconfig').zls.setup{}
376 require('formatter').setup {
383 home.file.".config/vis/plugins/vis-lspc" = {
384 source = builtins.fetchGit {
385 url = "https://gitlab.com/muhq/vis-lspc.git";
386 rev = "e184eb6c971abfcd0dc7f836f402aae6c33a8d13";
390 home.file.".config/vis/plugins/vis-commentary" = {
391 source = builtins.fetchGit {
392 url = "https://github.com/lutobler/vis-commentary.git";
393 rev = "0e06ed8212c12c6651cb078b822390094b396f08";
397 home.file.".config/vis/visrc.lua".text = ''
399 require('plugins/vis-commentary')
400 lspc = require('plugins/vis-lspc')
402 lspc.menu_cmd = 'vis-menu'
403 lspc.fallback_dirname_as_root = true
404 lspc.ls_map.zig = {name='zls',cmd='zls',roots={'build.zig'}}
406 vis.events.subscribe(vis.events.INIT, function()
407 -- Your global configuration options
410 vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused args
411 -- Your per window configuration options e.g.
412 vis:command('set number on')
413 vis:command('set autoindent')
414 vis:command('set tabwidth 4')
415 vis:command('set expandtab on')
425 (global-display-line-numbers-mode)
427 display-line-numbers-type 'relative
428 make-backup-files nil
429 inhibit-startup-screen t)
430 (load-theme 'tango-dark t)
432 extraPackages = epkgs: [
442 set-option -g default-terminal screen-256color
443 set -g history-limit 10000
445 set-option -g renumber-windows on
446 bind-key -n M-n new-window -c "#{pane_current_path}"
447 bind-key -n M-1 select-window -t :1
448 bind-key -n M-2 select-window -t :2
449 bind-key -n M-3 select-window -t :3
450 bind-key -n M-4 select-window -t :4
451 bind-key -n M-5 select-window -t :5
452 bind-key -n M-6 select-window -t :6
453 bind-key -n M-7 select-window -t :7
454 bind-key -n M-8 select-window -t :8
455 bind-key -n M-9 select-window -t :9
456 bind-key -n M-0 select-window -t :0
457 bind-key -n M-. select-window -n
458 bind-key -n M-, select-window -p
459 bind-key -n M-S-. swap-window -t +1
460 bind-key -n M-S-, swap-window -t -1
461 bind-key -n M-X confirm-before "kill-window"
462 bind-key -n M-v split-window -h -c "#{pane_current_path}"
463 bind-key -n M-b split-window -v -c "#{pane_current_path}"
464 bind-key -n M-R command-prompt -I "" "rename-window '%%'"
465 bind-key -n M-f resize-pane -Z
466 bind-key -n M-h select-pane -L
467 bind-key -n M-l select-pane -R
468 bind-key -n M-k select-pane -U
469 bind-key -n M-j select-pane -D
470 bind-key -n M-Left select-pane -L
471 bind-key -n M-Right select-pane -R
472 bind-key -n M-Up select-pane -U
473 bind-key -n M-Down select-pane -D
474 bind-key -n "M-H" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -L; tmux swap-pane -t $old'
475 bind-key -n "M-J" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -D; tmux swap-pane -t $old'
476 bind-key -n "M-K" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -U; tmux swap-pane -t $old'
477 bind-key -n "M-L" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -R; tmux swap-pane -t $old'
478 bind-key -n "M-S-Left" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -L; tmux swap-pane -t $old'
479 bind-key -n "M-S-Down" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -D; tmux swap-pane -t $old'
480 bind-key -n "M-S-Up" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -U; tmux swap-pane -t $old'
481 bind-key -n "M-S-Right" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -R; tmux swap-pane -t $old'
482 bind-key -n M-x confirm-before "kill-pane"
483 bind-key -n M-/ copy-mode
485 # Linux system clipboard
486 bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
487 bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "xclip -in -selection clipboard"
490 # set-option -g status-keys vi
491 # set-option -g set-titles on
492 # set-option -g set-titles-string 'tmux - #W'
493 # set -g bell-action any
494 # set-option -g visual-bell off
495 # set-option -g set-clipboard off
496 # setw -g mode-keys vi
497 # setw -g monitor-activity on
498 # set -g visual-activity on
499 # set -g status-style fg=colour15
500 # set -g status-justify centre
501 # set -g status-left ""
502 # set -g status-right ""
503 # set -g status-interval 1
504 # set -g message-style fg=colour0,bg=colour3
505 # setw -g window-status-bell-style fg=colour1
506 # setw -g window-status-current-style fg=yellow,bold
507 # setw -g window-status-style fg=colour250
508 # setw -g window-status-current-format ' #{?#{==:#W,#{b:SHELL}},#{b:pane_current_path},#W} '
509 # setw -g window-status-format ' #{?#{==:#W,#{b:SHELL}},#{b:pane_current_path},#W} '
511 # #setw -g window-status-format ' #W '
512 # #setw -g window-status-current-format ' #W '
518 # for editing directly to config.nu
523 case_sensitive: false # case-sensitive completions
524 quick: true # set to false to prevent auto-selecting completions
525 partial: true # set to false to prevent partial filling of the prompt
526 algorithm: "fuzzy" # prefix or fuzzy
529 command_not_found: { |cmd| (command-not-found $cmd | str trim) }
539 # programs.carapace = {
541 # enableNushellIntegration = true;
544 # programs.starship = {
547 # add_newline = false;
549 # success_symbol = "[➜](bold green)";
550 # error_symbol = "[➜](bold red)";
560 "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
561 "browser.fullscreen.autohide" = false;
562 "browser.toolbars.bookmarks.visibility" = "never";
563 "browser.tabs.inTitlebar" = 0;
564 "browser.compactmode.show" = true;
565 "browser.uidensity" = 1;
569 visibility: collapse !important;
576 "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
577 "browser.fullscreen.autohide" = false;
578 "browser.toolbars.bookmarks.visibility" = "never";
579 "browser.tabs.inTitlebar" = 0;
580 "browser.compactmode.show" = true;
581 "browser.uidensity" = 1;
585 visibility: collapse !important;
588 visibility: collapse !important;
591 border-bottom: none !important;
598 xdg.desktopEntries = {
601 genericName = "Messenger";
602 exec = "app web.whatsapp.com";
604 categories = [ "Application" ];
605 icon = pkgs.fetchurl {
606 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";
607 sha256 = "sha256-0eE3EEGnWFlpObfraTXMIqJz0Uya/h0hDsUA528qKCY=";
612 genericName = "Documents";
615 categories = [ "Application" ];
616 icon = pkgs.fetchurl {
617 url = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Markdown-mark.svg/1024px-Markdown-mark.svg.png";
618 sha256 = "0v161jvmcfxp9lwd86y789430w1vpvxnnm5n2hzgr1kfh03psvb2";
628 # programs.gnome-shell.theme = {
630 # name = "Qogir-Dark";
633 # package = pkgs.vimix-icon-theme;
634 # name = "vimix-doder-dark";
636 home.pointerCursor = {
640 name = "volantes_light_cursors";
642 package = pkgs.volantes-cursors;
645 # This value determines the Home Manager release that your configuration is
646 # compatible with. This helps avoid breakage when a new Home Manager release
647 # introduces backwards incompatible changes.
649 # You should not change this value, even if you update Home Manager. If you do
650 # want to update the value, then make sure to first check the Home Manager
652 home.stateVersion = "24.05"; # Please read the comment before changing.
654 # The home.packages option allows you to install Nix packages into your
656 home.packages = with pkgs; [
663 fzf bat delta silver-searcher ripgrep perl universal-ctags
670 linuxPackages_latest.perf
699 wineWowPackages.unstableFull winetricks
701 # # It is sometimes useful to fine-tune packages, for example, by applying
702 # # overrides. You can do that directly here, just don't forget the
703 # # parentheses. Maybe you want to install Nerd Fonts with a limited number of
705 # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
707 # # You can also create simple shell scripts directly inside your
708 # # configuration. For example, this adds a command 'my-hello' to your
710 # (pkgs.writeShellScriptBin "my-hello" ''
711 # echo "Hello, ${config.home.username}!"
713 # $@ - Liste aller Parameter
714 # $* - String aller Parameter
715 # $# - Anzahl aller Parameter
716 # &> - stdout und stderr pipen
720 (pkgs.writeShellScriptBin "app" ''
721 ${pkgs.firefox}/bin/firefox -p appmode --new-window "$@"
723 (pkgs.writeShellScriptBin "md" ''
724 file=$(mktemp --suffix=.html) && \
726 ${pkgs.pandoc}/bin/pandoc -o $file $1 -s -H ${markdownStyleHeader} && \
730 (pkgs.writeShellScriptBin "run" ''
731 (nohup "$@" &>/dev/null &); sleep 0
733 (pkgs.writeShellScriptBin "popup" ''
734 ${pkgs.kitty}/bin/kitty -o hide_window_decorations=yes -o background_opacity=0.5 \
735 --class kitty-popup -o remember_window_size=no \
736 -o initial_window_width=120c -o initial_window_height=40c \
739 (pkgs.writeShellScriptBin "fzfdir" ''
740 find "$1" -name "$2" | ${pkgs.fzf}/bin/fzf --layout=reverse
742 (pkgs.writeShellScriptBin "md-app" ''
743 #popup bash -c 'file=$(fzfdir "md" "*.md") && run md $file'
744 firefox -p appmode --new-window localhost:8123/home/ps/sync/txt/hsrm
746 (pkgs.writeShellScriptBin "run-popup" ''
747 popup bash -c 'file=$(compgen -c | grep -v fzf | sort -u | fzf --layout=reverse --print-query | tail -n 1) && run $file'
749 (pkgs.writeShellScriptBin "set-wallpaper" ''
750 ${pkgs.feh}/bin/feh --bg-fill --no-fehbg ${wallpaper}
752 (pkgs.writeShellScriptBin "mirror-phone" "IP=$(select-ip) && sudo scrcpy --tcpip=$IP --no-audio -K --kill-adb-on-close")
753 (pkgs.writeShellScriptBin "select-ip" ''
754 FILE=$HOME/.cache/select-ip.txt
755 IP=$( ${pkgs.rofi}/bin/rofi -dmenu -input $FILE -p IP ) || exit 1
757 gawk -i inplace 'FNR==1{delete a} !a[$0]++' $FILE
760 (pkgs.writeShellScriptBin "create-repo" ''
761 ssh psch.dev sudo -u git git init --bare /srv/git/$1
765 # Home Manager is pretty good at managing dotfiles. The primary way to manage
766 # plain files is through 'home.file'.
768 # # Building this configuration will create a copy of 'dotfiles/screenrc' in
769 # # the Nix store. Activating the configuration will then make '~/.screenrc' a
770 # # symlink to the Nix store copy.
771 # ".screenrc".source = dotfiles/screenrc;
773 # # You can also set the file content immediately.
774 # ".gradle/gradle.properties".text = ''
775 # org.gradle.console=verbose
776 # org.gradle.daemon.idletimeout=3600000
780 # Home Manager can also manage your environment variables through
781 # 'home.sessionVariables'. These will be explicitly sourced when using a
782 # shell provided by Home Manager. If you don't want to manage your shell
783 # through Home Manager then you have to manually source 'hm-session-vars.sh'
786 # ~/.nix-profile/etc/profile.d/hm-session-vars.sh
790 # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
794 # /etc/profiles/per-user/ps/etc/profile.d/hm-session-vars.sh
796 home.sessionVariables = {
800 # Let Home Manager install and manage itself.
801 programs.home-manager.enable = true;