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 nvim -c 'autocmd VimEnter * ++once Telescope find_files'";
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 for_window [window_role="pop-up"] floating enable
229 for_window [window_role="task_dialog"] floating enable
230 for_window [workspace="9"] floating enable
232 for_window [class="kitty-popup"] floating enable
233 for_window [class="Xfce4-appfinder"] floating enable
234 for_window [class="yakuake"] floating enable
235 for_window [class="systemsettings"] floating enable
236 for_window [title="win7"] floating enable; border none
237 for_window [title="Arbeitsfläche.*"] kill, floating enable, border none
239 # class border backgr. text indicator child_border
240 client.focused #000000bf #000000bf #e6ebef #000000bf #000000bf
241 client.focused_inactive #00000080 #00000080 #e6ebef #00000080 #00000080
242 client.unfocused #00000040 #00000040 #e6ebef #00000040 #00000040
243 client.urgent #2f343a #900000 #e6ebef #900000 #2f343a
244 client.placeholder #000000 #0c0c0c #e6ebef #000000 #0c0c0c
246 focus_follows_mouse no
248 popup_during_fullscreen all
256 "0:_NET_WM_STATE@[*]:a = '_NET_WM_STATE_HIDDEN'"
261 userName = "patrick-scho";
262 userEmail = "patrick.schoenberger@posteo.de";
263 includes = [{ contents = {
265 email = "patrick.schoenberger@posteo.de";
274 historyFileSize = -1;
276 snrs = "sudo nixos-rebuild switch --flake /etc/nixos#default";
277 snrt = "sudo nixos-rebuild test --flake /etc/nixos#default";
278 snrb = "sudo nixos-rebuild boot --flake /etc/nixos#default";
279 senc = "sudo $EDITOR /etc/nixos/configuration.nix";
280 senh = "sudo $EDITOR /etc/nixos/home-ps.nix";
281 senhc = "sudo $EDITOR /etc/nixos/home-common.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";
314 home.file.".config/zls.json".text = ''
316 "enable_build_on_save": true,
317 "build_on_save_step": "check"
321 home.file.".config/vis/plugins/vis-lspc" = {
322 source = builtins.fetchGit {
323 url = "https://gitlab.com/muhq/vis-lspc.git";
324 rev = "e184eb6c971abfcd0dc7f836f402aae6c33a8d13";
328 home.file.".config/vis/plugins/vis-commentary" = {
329 source = builtins.fetchGit {
330 url = "https://github.com/lutobler/vis-commentary.git";
331 rev = "0e06ed8212c12c6651cb078b822390094b396f08";
335 home.file.".config/vis/visrc.lua".text = ''
337 require('plugins/vis-commentary')
338 lspc = require('plugins/vis-lspc')
340 lspc.menu_cmd = 'vis-menu'
341 lspc.fallback_dirname_as_root = true
342 lspc.ls_map.zig = {name='zls',cmd='zls',roots={'build.zig'}}
344 vis.events.subscribe(vis.events.INIT, function()
345 -- Your global configuration options
348 vis.events.subscribe(vis.events.WIN_OPEN, function(win) -- luacheck: no unused args
349 -- Your per window configuration options e.g.
350 vis:command('set number on')
351 vis:command('set autoindent')
352 vis:command('set tabwidth 4')
353 vis:command('set expandtab on')
363 (global-display-line-numbers-mode)
365 display-line-numbers-type 'relative
366 make-backup-files nil
367 inhibit-startup-screen t)
368 (load-theme 'tango-dark t)
370 extraPackages = epkgs: [
380 set-option -g default-terminal screen-256color
381 set -g history-limit 10000
383 set-option -g renumber-windows on
384 bind-key -n M-n new-window -c "#{pane_current_path}"
385 bind-key -n M-1 select-window -t :1
386 bind-key -n M-2 select-window -t :2
387 bind-key -n M-3 select-window -t :3
388 bind-key -n M-4 select-window -t :4
389 bind-key -n M-5 select-window -t :5
390 bind-key -n M-6 select-window -t :6
391 bind-key -n M-7 select-window -t :7
392 bind-key -n M-8 select-window -t :8
393 bind-key -n M-9 select-window -t :9
394 bind-key -n M-0 select-window -t :0
395 bind-key -n M-. select-window -n
396 bind-key -n M-, select-window -p
397 bind-key -n M-S-. swap-window -t +1
398 bind-key -n M-S-, swap-window -t -1
399 bind-key -n M-X confirm-before "kill-window"
400 bind-key -n M-v split-window -h -c "#{pane_current_path}"
401 bind-key -n M-b split-window -v -c "#{pane_current_path}"
402 bind-key -n M-R command-prompt -I "" "rename-window '%%'"
403 bind-key -n M-f resize-pane -Z
404 bind-key -n M-h select-pane -L
405 bind-key -n M-l select-pane -R
406 bind-key -n M-k select-pane -U
407 bind-key -n M-j select-pane -D
408 bind-key -n M-Left select-pane -L
409 bind-key -n M-Right select-pane -R
410 bind-key -n M-Up select-pane -U
411 bind-key -n M-Down select-pane -D
412 bind-key -n "M-H" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -L; tmux swap-pane -t $old'
413 bind-key -n "M-J" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -D; tmux swap-pane -t $old'
414 bind-key -n "M-K" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -U; tmux swap-pane -t $old'
415 bind-key -n "M-L" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -R; tmux swap-pane -t $old'
416 bind-key -n "M-S-Left" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -L; tmux swap-pane -t $old'
417 bind-key -n "M-S-Down" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -D; tmux swap-pane -t $old'
418 bind-key -n "M-S-Up" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -U; tmux swap-pane -t $old'
419 bind-key -n "M-S-Right" run-shell 'old=`tmux display -p "#{pane_index}"`; tmux select-pane -R; tmux swap-pane -t $old'
420 bind-key -n M-x confirm-before "kill-pane"
421 bind-key -n M-/ copy-mode
423 # Linux system clipboard
424 bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
425 bind-key -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "xclip -in -selection clipboard"
428 # set-option -g status-keys vi
429 # set-option -g set-titles on
430 # set-option -g set-titles-string 'tmux - #W'
431 # set -g bell-action any
432 # set-option -g visual-bell off
433 # set-option -g set-clipboard off
434 # setw -g mode-keys vi
435 # setw -g monitor-activity on
436 # set -g visual-activity on
437 # set -g status-style fg=colour15
438 # set -g status-justify centre
439 # set -g status-left ""
440 # set -g status-right ""
441 # set -g status-interval 1
442 # set -g message-style fg=colour0,bg=colour3
443 # setw -g window-status-bell-style fg=colour1
444 # setw -g window-status-current-style fg=yellow,bold
445 # setw -g window-status-style fg=colour250
446 # setw -g window-status-current-format ' #{?#{==:#W,#{b:SHELL}},#{b:pane_current_path},#W} '
447 # setw -g window-status-format ' #{?#{==:#W,#{b:SHELL}},#{b:pane_current_path},#W} '
449 # #setw -g window-status-format ' #W '
450 # #setw -g window-status-current-format ' #W '
456 # for editing directly to config.nu
461 case_sensitive: false # case-sensitive completions
462 quick: true # set to false to prevent auto-selecting completions
463 partial: true # set to false to prevent partial filling of the prompt
464 algorithm: "fuzzy" # prefix or fuzzy
467 command_not_found: { |cmd| (command-not-found $cmd | str trim) }
477 # programs.carapace = {
479 # enableNushellIntegration = true;
482 # programs.starship = {
485 # add_newline = false;
487 # success_symbol = "[➜](bold green)";
488 # error_symbol = "[➜](bold red)";
498 "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
499 "browser.fullscreen.autohide" = false;
500 "browser.toolbars.bookmarks.visibility" = "never";
501 "browser.tabs.inTitlebar" = 0;
502 "browser.compactmode.show" = true;
503 "browser.uidensity" = 1;
507 visibility: collapse !important;
514 "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
515 "browser.fullscreen.autohide" = false;
516 "browser.toolbars.bookmarks.visibility" = "never";
517 "browser.tabs.inTitlebar" = 0;
518 "browser.compactmode.show" = true;
519 "browser.uidensity" = 1;
523 visibility: collapse !important;
526 visibility: collapse !important;
529 border-bottom: none !important;
536 xdg.desktopEntries = {
539 genericName = "Messenger";
540 exec = "app web.whatsapp.com";
542 categories = [ "Application" ];
543 icon = pkgs.fetchurl {
544 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";
545 sha256 = "sha256-0eE3EEGnWFlpObfraTXMIqJz0Uya/h0hDsUA528qKCY=";
550 genericName = "Documents";
553 categories = [ "Application" ];
554 icon = pkgs.fetchurl {
555 url = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/48/Markdown-mark.svg/1024px-Markdown-mark.svg.png";
556 sha256 = "0v161jvmcfxp9lwd86y789430w1vpvxnnm5n2hzgr1kfh03psvb2";
566 # programs.gnome-shell.theme = {
568 # name = "Qogir-Dark";
571 # package = pkgs.vimix-icon-theme;
572 # name = "vimix-doder-dark";
574 home.pointerCursor = {
578 name = "volantes_light_cursors";
580 package = pkgs.volantes-cursors;
583 # This value determines the Home Manager release that your configuration is
584 # compatible with. This helps avoid breakage when a new Home Manager release
585 # introduces backwards incompatible changes.
587 # You should not change this value, even if you update Home Manager. If you do
588 # want to update the value, then make sure to first check the Home Manager
590 home.stateVersion = "24.05"; # Please read the comment before changing.
592 # The home.packages option allows you to install Nix packages into your
594 home.packages = with pkgs; [
601 fzf bat delta silver-searcher ripgrep perl universal-ctags
608 linuxPackages_latest.perf
610 asciidoctor-with-extensions
639 wineWowPackages.unstableFull winetricks
642 # # It is sometimes useful to fine-tune packages, for example, by applying
643 # # overrides. You can do that directly here, just don't forget the
644 # # parentheses. Maybe you want to install Nerd Fonts with a limited number of
646 # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
648 # # You can also create simple shell scripts directly inside your
649 # # configuration. For example, this adds a command 'my-hello' to your
651 # (pkgs.writeShellScriptBin "my-hello" ''
652 # echo "Hello, ${config.home.username}!"
654 # $@ - Liste aller Parameter
655 # $* - String aller Parameter
656 # $# - Anzahl aller Parameter
657 # &> - stdout und stderr pipen
661 (pkgs.writeShellScriptBin "app" ''
662 ${pkgs.firefox}/bin/firefox -p appmode --new-window "$@"
664 (pkgs.writeShellScriptBin "md" ''
665 file=$(mktemp --suffix=.html) && \
667 ${pkgs.pandoc}/bin/pandoc -o $file $1 -s -H ${markdownStyleHeader} && \
671 (pkgs.writeShellScriptBin "run" ''
672 (nohup "$@" &>/dev/null &); sleep 0
674 (pkgs.writeShellScriptBin "popup" ''
675 ${pkgs.kitty}/bin/kitty -o hide_window_decorations=yes -o background_opacity=0.5 \
676 --class kitty-popup -o remember_window_size=no \
677 -o initial_window_width=120c -o initial_window_height=40c \
680 (pkgs.writeShellScriptBin "fzfdir" ''
681 find "$1" -name "$2" | ${pkgs.fzf}/bin/fzf --layout=reverse
683 (pkgs.writeShellScriptBin "file-app" ''
686 (pkgs.writeShellScriptBin "run-popup" ''
687 popup bash -c 'file=$(compgen -c | grep -v fzf | sort -u | fzf --layout=reverse --print-query | tail -n 1) && run $file'
689 (pkgs.writeShellScriptBin "set-wallpaper" ''
690 ${pkgs.feh}/bin/feh --bg-fill --no-fehbg ${wallpaper}
692 (pkgs.writeShellScriptBin "mirror-phone" "IP=$(select-ip) && sudo scrcpy --tcpip=$IP --no-audio -K --kill-adb-on-close")
693 (pkgs.writeShellScriptBin "select-ip" ''
694 FILE=$HOME/.cache/select-ip.txt
695 IP=$( ${pkgs.rofi}/bin/rofi -dmenu -input $FILE -p IP ) || exit 1
697 gawk -i inplace 'FNR==1{delete a} !a[$0]++' $FILE
700 (pkgs.writeShellScriptBin "create-repo" ''
701 ssh psch.dev sudo -u git git init --bare /srv/git/$1
705 # Home Manager is pretty good at managing dotfiles. The primary way to manage
706 # plain files is through 'home.file'.
708 # # Building this configuration will create a copy of 'dotfiles/screenrc' in
709 # # the Nix store. Activating the configuration will then make '~/.screenrc' a
710 # # symlink to the Nix store copy.
711 # ".screenrc".source = dotfiles/screenrc;
713 # # You can also set the file content immediately.
714 # ".gradle/gradle.properties".text = ''
715 # org.gradle.console=verbose
716 # org.gradle.daemon.idletimeout=3600000
718 ".background-image".source = wallpaper;
721 # Home Manager can also manage your environment variables through
722 # 'home.sessionVariables'. These will be explicitly sourced when using a
723 # shell provided by Home Manager. If you don't want to manage your shell
724 # through Home Manager then you have to manually source 'hm-session-vars.sh'
727 # ~/.nix-profile/etc/profile.d/hm-session-vars.sh
731 # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
735 # /etc/profiles/per-user/ps/etc/profile.d/hm-session-vars.sh
737 home.sessionVariables = {
741 # Let Home Manager install and manage itself.
742 programs.home-manager.enable = true;