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; [
366 set foldmethod=marker
373 inoremap <Down> <C-o>gj
374 inoremap <Up> <C-o>gk
375 tnoremap <Esc> <C-\><C-n>
378 require('lspconfig').zls.setup{}
379 require('formatter').setup {
386 home.file.".config/vis/plugins/vis-lspc" = {
387 source = builtins.fetchGit {
388 url = "https://gitlab.com/muhq/vis-lspc.git";
389 rev = "e184eb6c971abfcd0dc7f836f402aae6c33a8d13";
393 home.file.".config/vis/plugins/vis-commentary" = {
394 source = builtins.fetchGit {
395 url = "https://github.com/lutobler/vis-commentary.git";
396 rev = "0e06ed8212c12c6651cb078b822390094b396f08";
400 home.file.".config/vis/visrc.lua".text = ''
402 require('plugins/vis-commentary')
403 lspc = require('plugins/vis-lspc')
405 lspc.menu_cmd = 'vis-menu'
406 lspc.fallback_dirname_as_root = true
407 lspc.ls_map.zig = {name='zls',cmd='zls',roots={'build.zig'}}
409 vis.events.subscribe(vis.events.INIT, function()
410 -- Your global configuration options
413 vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused args
414 -- Your per window configuration options e.g.
415 vis:command('set number on')
416 vis:command('set autoindent')
417 vis:command('set tabwidth 4')
418 vis:command('set expandtab on')
428 (global-display-line-numbers-mode)
430 display-line-numbers-type 'relative
431 make-backup-files nil
432 inhibit-startup-screen t)
433 (load-theme 'tango-dark t)
435 extraPackages = epkgs: [
445 set-option -g default-terminal screen-256color
446 set -g history-limit 10000
448 set-option -g renumber-windows on
449 bind-key -n M-n new-window -c "#{pane_current_path}"
450 bind-key -n M-1 select-window -t :1
451 bind-key -n M-2 select-window -t :2
452 bind-key -n M-3 select-window -t :3
453 bind-key -n M-4 select-window -t :4
454 bind-key -n M-5 select-window -t :5
455 bind-key -n M-6 select-window -t :6
456 bind-key -n M-7 select-window -t :7
457 bind-key -n M-8 select-window -t :8
458 bind-key -n M-9 select-window -t :9
459 bind-key -n M-0 select-window -t :0
460 bind-key -n M-. select-window -n
461 bind-key -n M-, select-window -p
462 bind-key -n M-S-. swap-window -t +1
463 bind-key -n M-S-, swap-window -t -1
464 bind-key -n M-X confirm-before "kill-window"
465 bind-key -n M-v split-window -h -c "#{pane_current_path}"
466 bind-key -n M-b split-window -v -c "#{pane_current_path}"
467 bind-key -n M-R command-prompt -I "" "rename-window '%%'"
468 bind-key -n M-f resize-pane -Z
469 bind-key -n M-h select-pane -L
470 bind-key -n M-l select-pane -R
471 bind-key -n M-k select-pane -U
472 bind-key -n M-j select-pane -D
473 bind-key -n M-Left select-pane -L
474 bind-key -n M-Right select-pane -R
475 bind-key -n M-Up select-pane -U
476 bind-key -n M-Down select-pane -D
477 bind-key -n "M-H" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -L; tmux swap-pane -t $old'
478 bind-key -n "M-J" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -D; tmux swap-pane -t $old'
479 bind-key -n "M-K" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -U; tmux swap-pane -t $old'
480 bind-key -n "M-L" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -R; tmux swap-pane -t $old'
481 bind-key -n "M-S-Left" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -L; tmux swap-pane -t $old'
482 bind-key -n "M-S-Down" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -D; tmux swap-pane -t $old'
483 bind-key -n "M-S-Up" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -U; tmux swap-pane -t $old'
484 bind-key -n "M-S-Right" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -R; tmux swap-pane -t $old'
485 bind-key -n M-x confirm-before "kill-pane"
486 bind-key -n M-/ copy-mode
488 # Linux system clipboard
489 bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
490 bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "xclip -in -selection clipboard"
493 # set-option -g status-keys vi
494 # set-option -g set-titles on
495 # set-option -g set-titles-string 'tmux - #W'
496 # set -g bell-action any
497 # set-option -g visual-bell off
498 # set-option -g set-clipboard off
499 # setw -g mode-keys vi
500 # setw -g monitor-activity on
501 # set -g visual-activity on
502 # set -g status-style fg=colour15
503 # set -g status-justify centre
504 # set -g status-left ""
505 # set -g status-right ""
506 # set -g status-interval 1
507 # set -g message-style fg=colour0,bg=colour3
508 # setw -g window-status-bell-style fg=colour1
509 # setw -g window-status-current-style fg=yellow,bold
510 # setw -g window-status-style fg=colour250
511 # setw -g window-status-current-format ' #{?#{==:#W,#{b:SHELL}},#{b:pane_current_path},#W} '
512 # setw -g window-status-format ' #{?#{==:#W,#{b:SHELL}},#{b:pane_current_path},#W} '
514 # #setw -g window-status-format ' #W '
515 # #setw -g window-status-current-format ' #W '
521 # for editing directly to config.nu
526 case_sensitive: false # case-sensitive completions
527 quick: true # set to false to prevent auto-selecting completions
528 partial: true # set to false to prevent partial filling of the prompt
529 algorithm: "fuzzy" # prefix or fuzzy
532 command_not_found: { |cmd| (command-not-found $cmd | str trim) }
542 # programs.carapace = {
544 # enableNushellIntegration = true;
547 # programs.starship = {
550 # add_newline = false;
552 # success_symbol = "[➜](bold green)";
553 # error_symbol = "[➜](bold red)";
563 "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
564 "browser.fullscreen.autohide" = false;
565 "browser.toolbars.bookmarks.visibility" = "never";
566 "browser.tabs.inTitlebar" = 0;
567 "browser.compactmode.show" = true;
568 "browser.uidensity" = 1;
572 visibility: collapse !important;
579 "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
580 "browser.fullscreen.autohide" = false;
581 "browser.toolbars.bookmarks.visibility" = "never";
582 "browser.tabs.inTitlebar" = 0;
583 "browser.compactmode.show" = true;
584 "browser.uidensity" = 1;
588 visibility: collapse !important;
591 visibility: collapse !important;
594 border-bottom: none !important;
601 xdg.desktopEntries = {
604 genericName = "Messenger";
605 exec = "app web.whatsapp.com";
607 categories = [ "Application" ];
608 icon = pkgs.fetchurl {
609 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";
610 sha256 = "sha256-0eE3EEGnWFlpObfraTXMIqJz0Uya/h0hDsUA528qKCY=";
615 genericName = "Documents";
618 categories = [ "Application" ];
619 icon = pkgs.fetchurl {
620 url = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Markdown-mark.svg/1024px-Markdown-mark.svg.png";
621 sha256 = "0v161jvmcfxp9lwd86y789430w1vpvxnnm5n2hzgr1kfh03psvb2";
631 # programs.gnome-shell.theme = {
633 # name = "Qogir-Dark";
636 # package = pkgs.vimix-icon-theme;
637 # name = "vimix-doder-dark";
639 home.pointerCursor = {
643 name = "volantes_light_cursors";
645 package = pkgs.volantes-cursors;
648 # This value determines the Home Manager release that your configuration is
649 # compatible with. This helps avoid breakage when a new Home Manager release
650 # introduces backwards incompatible changes.
652 # You should not change this value, even if you update Home Manager. If you do
653 # want to update the value, then make sure to first check the Home Manager
655 home.stateVersion = "24.05"; # Please read the comment before changing.
657 # The home.packages option allows you to install Nix packages into your
659 home.packages = with pkgs; [
666 fzf bat delta silver-searcher ripgrep perl universal-ctags
673 linuxPackages_latest.perf
702 wineWowPackages.unstableFull winetricks
705 # # It is sometimes useful to fine-tune packages, for example, by applying
706 # # overrides. You can do that directly here, just don't forget the
707 # # parentheses. Maybe you want to install Nerd Fonts with a limited number of
709 # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
711 # # You can also create simple shell scripts directly inside your
712 # # configuration. For example, this adds a command 'my-hello' to your
714 # (pkgs.writeShellScriptBin "my-hello" ''
715 # echo "Hello, ${config.home.username}!"
717 # $@ - Liste aller Parameter
718 # $* - String aller Parameter
719 # $# - Anzahl aller Parameter
720 # &> - stdout und stderr pipen
724 (pkgs.writeShellScriptBin "app" ''
725 ${pkgs.firefox}/bin/firefox -p appmode --new-window "$@"
727 (pkgs.writeShellScriptBin "md" ''
728 file=$(mktemp --suffix=.html) && \
730 ${pkgs.pandoc}/bin/pandoc -o $file $1 -s -H ${markdownStyleHeader} && \
734 (pkgs.writeShellScriptBin "run" ''
735 (nohup "$@" &>/dev/null &); sleep 0
737 (pkgs.writeShellScriptBin "popup" ''
738 ${pkgs.kitty}/bin/kitty -o hide_window_decorations=yes -o background_opacity=0.5 \
739 --class kitty-popup -o remember_window_size=no \
740 -o initial_window_width=120c -o initial_window_height=40c \
743 (pkgs.writeShellScriptBin "fzfdir" ''
744 find "$1" -name "$2" | ${pkgs.fzf}/bin/fzf --layout=reverse
746 (pkgs.writeShellScriptBin "md-app" ''
747 #popup bash -c 'file=$(fzfdir "md" "*.md") && run md $file'
748 firefox -p appmode --new-window localhost:8123/home/ps/sync/txt/hsrm
750 (pkgs.writeShellScriptBin "run-popup" ''
751 popup bash -c 'file=$(compgen -c | grep -v fzf | sort -u | fzf --layout=reverse --print-query | tail -n 1) && run $file'
753 (pkgs.writeShellScriptBin "set-wallpaper" ''
754 ${pkgs.feh}/bin/feh --bg-fill --no-fehbg ${wallpaper}
756 (pkgs.writeShellScriptBin "mirror-phone" "IP=$(select-ip) && sudo scrcpy --tcpip=$IP --no-audio -K --kill-adb-on-close")
757 (pkgs.writeShellScriptBin "select-ip" ''
758 FILE=$HOME/.cache/select-ip.txt
759 IP=$( ${pkgs.rofi}/bin/rofi -dmenu -input $FILE -p IP ) || exit 1
761 gawk -i inplace 'FNR==1{delete a} !a[$0]++' $FILE
764 (pkgs.writeShellScriptBin "create-repo" ''
765 ssh psch.dev sudo -u git git init --bare /srv/git/$1
769 # Home Manager is pretty good at managing dotfiles. The primary way to manage
770 # plain files is through 'home.file'.
772 # # Building this configuration will create a copy of 'dotfiles/screenrc' in
773 # # the Nix store. Activating the configuration will then make '~/.screenrc' a
774 # # symlink to the Nix store copy.
775 # ".screenrc".source = dotfiles/screenrc;
777 # # You can also set the file content immediately.
778 # ".gradle/gradle.properties".text = ''
779 # org.gradle.console=verbose
780 # org.gradle.daemon.idletimeout=3600000
784 # Home Manager can also manage your environment variables through
785 # 'home.sessionVariables'. These will be explicitly sourced when using a
786 # shell provided by Home Manager. If you don't want to manage your shell
787 # through Home Manager then you have to manually source 'hm-session-vars.sh'
790 # ~/.nix-profile/etc/profile.d/hm-session-vars.sh
794 # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
798 # /etc/profiles/per-user/ps/etc/profile.d/hm-session-vars.sh
800 home.sessionVariables = {
804 # Let Home Manager install and manage itself.
805 programs.home-manager.enable = true;