diff --git a/home/default.nix b/home/default.nix index e10ee31..f0b2fa5 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,6 +1,10 @@ { pkgs, ... }: { + imports = [ + ./services + ]; + home = { username = "elias"; homeDirectory = "/home/elias"; diff --git a/home/programs/git.nix b/home/programs/git.nix index 9e213f6..990cd8f 100644 --- a/home/programs/git.nix +++ b/home/programs/git.nix @@ -1,15 +1,52 @@ -{ ... }: +{ lib, pkgs, ... }: { + home.packages = with pkgs; [ + nodejs_22 + cz-cli + tig + ]; programs.git = { enable = true; - settings.user = { - name = "4Lost"; - email = "elias.schroeter@e.email"; + settings = { + init = { + defaultBranch = "main"; + }; + user = { + email = "elias.schroeter@e.email"; + name = "Elias Schröter"; + }; }; signing = { - key = "0x99D2EF975FE523CC"; - signByDefault = false; + key = "04F3A2ED4B33F254"; + format = lib.mkForce "openpgp"; + signByDefault = true; + }; + }; + + programs.lazygit = { + enable = true; + # https://github.com/catppuccin/lazygit + settings = { + gui = { + theme = { + activeBorderColor = [ + "#f4dbd6" + "bold" + ]; + inactiveBorderColor = [ "#a5adcb" ]; + optionsTextColor = [ "#8aadf4" ]; + selectedLineBgColor = [ "#363a4f" ]; + cherryPickedCommitBgColor = [ "#494d64" ]; + cherryPickedCommitFgColor = [ "#f4dbd6" ]; + unstagedChangesColor = [ "#ed8796" ]; + defaultFgColor = [ "#cad3f5" ]; + searchingActiveBorderColor = [ "#eed49f" ]; + }; + authorColors = { + "*" = "#b7bdf8"; + }; + }; }; }; } diff --git a/home/programs/nixvim/plugins/barbar.nix b/home/programs/nixvim/plugins/barbar.nix index 2392280..932ac57 100644 --- a/home/programs/nixvim/plugins/barbar.nix +++ b/home/programs/nixvim/plugins/barbar.nix @@ -82,4 +82,3 @@ ]; }; } - diff --git a/home/programs/nixvim/plugins/comment-box.nix b/home/programs/nixvim/plugins/comment-box.nix index 4cefedb..42c2451 100644 --- a/home/programs/nixvim/plugins/comment-box.nix +++ b/home/programs/nixvim/plugins/comment-box.nix @@ -1,4 +1,4 @@ -{...}: +{ ... }: { programs.nixvim = { @@ -9,7 +9,7 @@ which-key.settings.spec = [ { __unkeyed-1 = "c"; - group = "Boxes"; + group = "Comment Boxes"; icon = "□ "; } ]; @@ -53,4 +53,3 @@ ]; }; } - diff --git a/home/programs/nixvim/plugins/default.nix b/home/programs/nixvim/plugins/default.nix index 562a96c..902d9d7 100644 --- a/home/programs/nixvim/plugins/default.nix +++ b/home/programs/nixvim/plugins/default.nix @@ -30,6 +30,7 @@ ./peek.nix ./markdown-preview.nix ./smart-splits.nix + ./snippets.nix ./sniprun.nix ./startup.nix ./surround.nix @@ -43,10 +44,9 @@ ./typst-vim.nix ./undotree.nix ./vimtex.nix + ./web-devicons.nix ./which-key.nix ./yanky.nix ./zk.nix - - ./snippets.nix ]; } diff --git a/home/programs/nixvim/plugins/dynomark.nix b/home/programs/nixvim/plugins/dynomark.nix index ba922aa..6363cbe 100644 --- a/home/programs/nixvim/plugins/dynomark.nix +++ b/home/programs/nixvim/plugins/dynomark.nix @@ -19,7 +19,7 @@ in dynomark-nvim ]; - extraConfigLua = ''require('dynomark').setup({})''; + extraConfigLua = "require('dynomark').setup({})"; keymaps = [ { @@ -35,7 +35,7 @@ in action = "(DynomarkRun)"; mode = [ "n" ]; options = { - desc = "Run dynomark query under cursor"; + desc = "Run Dynomark query under cursor"; }; } ]; diff --git a/home/programs/nixvim/plugins/mkdnflow.nix b/home/programs/nixvim/plugins/mkdnflow.nix index 4068f44..f350fac 100644 --- a/home/programs/nixvim/plugins/mkdnflow.nix +++ b/home/programs/nixvim/plugins/mkdnflow.nix @@ -105,65 +105,65 @@ }; }; mappings = { - MkdnEnter = { - key = ""; - modes = [ + MkdnEnter = [ + [ "n" "v" "i" - ]; - }; - MkdnGoBack = { - key = ""; - modes = "n"; - }; - MkdnDecreaseHeading = { - key = "-"; - modes = "n"; - }; - MkdnIncreaseHeading = { - key = "+"; - modes = "n"; - }; - MkdnNewListItemAboveInsert = { - key = "O"; - modes = "n"; - }; - MkdnNewListItemBelowInsert = { - key = "o"; - modes = "n"; - }; - MkdnTableNewColAfter = { - key = "ic"; - modes = "n"; - }; - MkdnTableNewColBefore = { - key = "iC"; - modes = "n"; - }; - MkdnTableNewRowAbove = { - key = "iR"; - modes = "n"; - }; - MkdnTableNewRowBelow = { - key = "ir"; - modes = "n"; - }; - MkdnTableNextCell = { - key = ""; - modes = "i"; - }; - MkdnTablePrevCell = { - key = ""; - modes = "i"; - }; - MkdnToggleToDo = { - key = ""; - modes = [ + ] + "" + ]; + MkdnGoBack = [ + "n" + "" + ]; + MkdnDecreaseHeading = [ + "n" + "-" + ]; + MkdnIncreaseHeading = [ + "n" + "+" + ]; + MkdnNewListItemAboveInsert = [ + "n" + "O" + ]; + MkdnNewListItemBelowInsert = [ + "n" + "o" + ]; + MkdnTableNewColAfter = [ + "n" + "ic" + ]; + MkdnTableNewColBefore = [ + "n" + "iC" + ]; + MkdnTableNewRowAbove = [ + "n" + "iR" + ]; + MkdnTableNewRowBelow = [ + "n" + "ir" + ]; + MkdnTableNextCell = [ + "i" + "" + ]; + MkdnTablePrevCell = [ + "i" + "" + ]; + MkdnToggleToDo = [ + [ "n" "v" - ]; - }; + ] + "" + ]; }; create_dirs = true; new_file_template = { diff --git a/home/programs/nixvim/plugins/web-devicons.nix b/home/programs/nixvim/plugins/web-devicons.nix new file mode 100644 index 0000000..d577745 --- /dev/null +++ b/home/programs/nixvim/plugins/web-devicons.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + programs.nixvim = { + plugins = { + web-devicons.enable = true; + }; + }; +} diff --git a/home/programs/river/default.nix b/home/programs/river/default.nix index 00b5cb0..95a50be 100644 --- a/home/programs/river/default.nix +++ b/home/programs/river/default.nix @@ -15,120 +15,131 @@ source = ./src; }; - wayland.windowManager.river = let - all_tags = "$(((1 << 32) - 1))"; - scratch_tag = "$((1 << 20 ))"; - all_but_scratch_tag = "$(( ((1 << 32) - 1) ^ ${scratch_tag} ))"; - tags = i: "$((1 << (${i} - 1)))"; + wayland.windowManager.river = + let + all_tags = "$(((1 << 32) - 1))"; + scratch_tag = "$((1 << 20 ))"; + all_but_scratch_tag = "$(( ((1 << 32) - 1) ^ ${scratch_tag} ))"; + tags = i: "$((1 << (${i} - 1)))"; - genTagMappings = key: command: - lib.attrsets.mergeAttrsList - (map (i: { "${key (toString i)}" = "${command (toString i)}"; }) - (lib.lists.range 1 9)); - in { - enable = true; - extraSessionVariables = { - MOZ_ENABLE_WAYLAND = "1"; - GDK_BACKEND = "wayland"; - }; - systemd.enable = true; - xwayland.enable = true; - extraConfig = ''rivertile -view-padding 0 -outer-padding 0 &''; - settings = { - spawn = [ - "/home/elias/.config/helperscripts/startEww.sh" - "nextcloud" - ]; - spawn-tagmask = "${all_but_scratch_tag}"; - keyboard-layout = "de"; - default-layout = "rivertile"; - rule-add = { - "-app-id" = { - "'bar'" = "csd"; - "'float*'" = { "-title" = { "'foo'" = "float"; }; }; + genTagMappings = + key: command: + lib.attrsets.mergeAttrsList ( + map (i: { "${key (toString i)}" = "${command (toString i)}"; }) (lib.lists.range 1 9) + ); + in + { + enable = true; + extraSessionVariables = { + MOZ_ENABLE_WAYLAND = "1"; + GDK_BACKEND = "wayland"; + }; + systemd.enable = true; + xwayland.enable = true; + extraConfig = "rivertile -view-padding 0 -outer-padding 0 &"; + settings = { + spawn = [ + "/home/elias/.config/helperscripts/startEww.sh" + # "nextcloud" + ]; + spawn-tagmask = "${all_but_scratch_tag}"; + keyboard-layout = "de"; + default-layout = "rivertile"; + rule-add = { + "-app-id" = { + "'bar'" = "csd"; + "'float*'" = { + "-title" = { + "'foo'" = "float"; + }; + }; + }; + }; + map-pointer = { + normal = { + "Super BTN_LEFT" = "move-view"; + "Super BTN_RIGHT" = "resize-view"; + "Super BTN_MIDDLE" = "toggle-float"; + }; + }; + map = { + normal = { + "Super+Shift Return" = "spawn alacritty"; + # Messages + "Control+Super W" = "spawn 'yad --text=\"Hello from Wayland!\" --button=OK'"; + # System + "Super P" = "spawn 'rofi -show drun'"; + "Super+Shift C" = "close"; + # Screenshots + "None Print" = + "spawn 'grim ~/Pictures/screenshot_$(date +%F_%H-%M-%S).png; yad --text=\"Screenshot - Whole Screen to File (/home/$USER/Pictures/screenshot-$(date -u +%Y-%m-%d-%H:%M:%S))\"'"; # Whole Screen to File + "Super Print" = + "spawn 'grim -g \"$(slurp)\" ~/Pictures/screenshot_$(date +%F_%H-%M-%S).png; yad --text=\"Screenshot - Selection to File (/home/$USER/Pictures/screenshot-$(date -u +%Y-%m-%d-%H:%M:%S))\"'"; # Selection to File + "Shift Print" = + "spawn 'grim -g \"$(riverctl windows --focused | awk '{print $3,$4,$5,$6}')\" ~/Pictures/active_window_$(date +%F_%H-%M-%S).png; yad --text=\"Screenshot - Active Window to File (/home/$USER/Pictures/screenshot-$(date -u +%Y-%m-%d-%H:%M:%S))\"'"; # Active Window to File + "Control Print" = + "spawn 'grim -g \"$(slurp)\" - | wl-copy --type image/png; yad --text=\"Screenshot - Whole Screen to Clipboard\"'"; # Whole Screen to Clipboard + "Control+Super Print" = + "spawn 'grim -g \"$(slurp)\" - | wl-copy --type image/png; yad --text=\"Screenshot - Selection to Clipboard\"'"; # Selection to Clipboard + "Control+Shift Print" = + "spawn 'grim -g \"$(riverctl windows --focused | awk '{print $3,$4,$5,$6}')\" - | wl-copy --type image/png; yad --text=\"Screenshot - Active Window to Clipboard\"'"; # Active Window to Clipboard + # Window Control + "Super J" = "focus-view next"; + "Super K" = "focus-view previous"; + "Super+Shift J" = "swap next"; + "Super+Shift K" = "swap previous"; + "Super Period" = "focus-output next"; + "Super Comma" = "focus-output previous"; + "Super+Shift Period" = "send-to-output next"; + "Super+Shift Comma" = "send-to-output previous"; + "Super H" = ''send-layout-cmd rivertile "main-ratio -0.05"''; + "Super L" = ''send-layout-cmd rivertile "main-ratio +0.05"''; + "Super+Shift H" = ''send-layout-cmd rivertile "main-count +1"''; + "Super+Shift L" = ''send-layout-cmd rivertile "main-count -1"''; + "Super+Alt H" = "move left 100"; + "Super+Alt J" = "move down 100"; + "Super+Alt K" = "move up 100"; + "Super+Alt L" = "move right 100"; + "Super+Alt+Control H" = "snap left"; + "Super+Alt+Control J" = "snap down"; + "Super+Alt+Control K" = "snap up"; + "Super+Alt+Control L" = "snap right"; + "Super+Alt+Shift H" = "resize horizontal -100"; + "Super+Alt+Shift J" = "resize vertical 100"; + "Super+Alt+Shift K" = "resize vertical -100"; + "Super+Alt+Shift L" = "resize horizontal 100"; + + "Super+Shift P" = "set-view-tags ${scratch_tag}"; + + "Super 0" = "set-focused-tags ${all_tags}"; + "Super+Shift 0" = "set-view-tags ${all_tags}"; + "Super Space" = "toggle-float"; + "Super F" = "toggle-fullscreen"; + "Super Up" = ''send-layout-cmd rivertile "main-location top"''; + "Super Right" = ''send-layout-cmd rivertile "main-location right"''; + "Super Down" = ''send-layout-cmd rivertile "main-location bottom"''; + "Super Left" = ''send-layout-cmd rivertile "main-location left"''; + # Audio + "None XF86AudioRaiseVolume" = "spawn 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+'"; + "None XF86AudioLowerVolume" = "spawn 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-'"; + "None XF86AudioMute" = "spawn 'wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle'"; + "None XF86AudioMicMute" = "spawn 'wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle'"; + # Brightness + "None XF86MonBrightnessUp" = "spawn 'xbacklight -inc 10'"; + "None XF86MonBrightnessDown" = "spawn 'xbacklight -dec 10'"; + # Powerbutton + "None XF86PowerOff" = "spawn '/home/$USER/.config/eww/scripts/powermenu.sh'"; + # Program + "Super C" = "spawn 'firefox'"; + "Super Y" = "spawn 'signal-desktop'"; + "Super X" = "spawn 'telegram-desktop'"; + "Super V" = "spawn 'thunderbird'"; + } + // genTagMappings (i: "Super ${i}") (i: "set-focused-tags ${tags i}") + // genTagMappings (i: "Super+Shift ${i}") (i: "set-view-tags ${tags i}") + // genTagMappings (i: "Super+Control ${i}") (i: "toggle-focused-tags ${tags i}") + // genTagMappings (i: "Super+Shift+Control ${i}") (i: "toggle-view-tags ${tags i}"); }; }; - map-pointer = { - normal = { - "Super BTN_LEFT" = "move-view"; - "Super BTN_RIGHT" = "resize-view"; - "Super BTN_MIDDLE" = "toggle-float"; - }; - }; - map = { - normal = { - "Super+Shift Return" = "spawn alacritty"; - # Messages - "Control+Super W" = "spawn 'yad --text=\"Hello from Wayland!\" --button=OK'"; - # System - "Super P" = "spawn 'rofi -show drun'"; - "Super+Shift C" = "close"; - # Screenshots - "None Print" = "spawn 'grim ~/Pictures/screenshot_$(date +%F_%H-%M-%S).png; yad --text=\"Screenshot - Whole Screen to File (/home/$USER/Pictures/screenshot-$(date -u +%Y-%m-%d-%H:%M:%S))\"'"; # Whole Screen to File - "Super Print" = "spawn 'grim -g \"$(slurp)\" ~/Pictures/screenshot_$(date +%F_%H-%M-%S).png; yad --text=\"Screenshot - Selection to File (/home/$USER/Pictures/screenshot-$(date -u +%Y-%m-%d-%H:%M:%S))\"'"; # Selection to File - "Shift Print" = "spawn 'grim -g \"$(riverctl windows --focused | awk '{print $3,$4,$5,$6}')\" ~/Pictures/active_window_$(date +%F_%H-%M-%S).png; yad --text=\"Screenshot - Active Window to File (/home/$USER/Pictures/screenshot-$(date -u +%Y-%m-%d-%H:%M:%S))\"'"; # Active Window to File - "Control Print" = "spawn 'grim -g \"$(slurp)\" - | wl-copy --type image/png; yad --text=\"Screenshot - Whole Screen to Clipboard\"'"; # Whole Screen to Clipboard - "Control+Super Print" = "spawn 'grim -g \"$(slurp)\" - | wl-copy --type image/png; yad --text=\"Screenshot - Selection to Clipboard\"'"; # Selection to Clipboard - "Control+Shift Print" = "spawn 'grim -g \"$(riverctl windows --focused | awk '{print $3,$4,$5,$6}')\" - | wl-copy --type image/png; yad --text=\"Screenshot - Active Window to Clipboard\"'"; # Active Window to Clipboard - # Window Control - "Super J" = "focus-view next"; - "Super K" = "focus-view previous"; - "Super+Shift J" = "swap next"; - "Super+Shift K" = "swap previous"; - "Super Period" = "focus-output next"; - "Super Comma" = "focus-output previous"; - "Super+Shift Period" = "send-to-output next"; - "Super+Shift Comma" = "send-to-output previous"; - "Super H" = ''send-layout-cmd rivertile "main-ratio -0.05"''; - "Super L" = ''send-layout-cmd rivertile "main-ratio +0.05"''; - "Super+Shift H" = ''send-layout-cmd rivertile "main-count +1"''; - "Super+Shift L" = ''send-layout-cmd rivertile "main-count -1"''; - "Super+Alt H" = "move left 100"; - "Super+Alt J" = "move down 100"; - "Super+Alt K" = "move up 100"; - "Super+Alt L" = "move right 100"; - "Super+Alt+Control H" = "snap left"; - "Super+Alt+Control J" = "snap down"; - "Super+Alt+Control K" = "snap up"; - "Super+Alt+Control L" = "snap right"; - "Super+Alt+Shift H" = "resize horizontal -100"; - "Super+Alt+Shift J" = "resize vertical 100"; - "Super+Alt+Shift K" = "resize vertical -100"; - "Super+Alt+Shift L" = "resize horizontal 100"; - - "Super+Shift P" = "set-view-tags ${scratch_tag}"; - - "Super 0" = "set-focused-tags ${all_tags}"; - "Super+Shift 0" = "set-view-tags ${all_tags}"; - "Super Space" = "toggle-float"; - "Super F" = "toggle-fullscreen"; - "Super Up" = ''send-layout-cmd rivertile "main-location top"''; - "Super Right" = ''send-layout-cmd rivertile "main-location right"''; - "Super Down" = ''send-layout-cmd rivertile "main-location bottom"''; - "Super Left" = ''send-layout-cmd rivertile "main-location left"''; - # Audio - "None XF86AudioRaiseVolume" = "spawn 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+'"; - "None XF86AudioLowerVolume" = "spawn 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-'"; - "None XF86AudioMute" = "spawn 'wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle'"; - "None XF86AudioMicMute" = "spawn 'wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle'"; - # Brightness - "None XF86MonBrightnessUp" = "spawn 'xbacklight -inc 10'"; - "None XF86MonBrightnessDown" = "spawn 'xbacklight -dec 10'"; - # Powerbutton - "None XF86PowerOff" = "spawn '/home/$USER/.config/eww/scripts/powermenu.sh'"; - # Program - "Super C" = "spawn 'firefox'"; - "Super Y" = "spawn 'signal-desktop'"; - "Super X" = "spawn 'telegram-desktop'"; - "Super V" = "spawn 'thunderbird'"; - } // genTagMappings (i: "Super ${i}") (i: "set-focused-tags ${tags i}") - // genTagMappings (i: "Super+Shift ${i}") - (i: "set-view-tags ${tags i}") - // genTagMappings (i: "Super+Control ${i}") - (i: "toggle-focused-tags ${tags i}") - // genTagMappings (i: "Super+Shift+Control ${i}") - (i: "toggle-view-tags ${tags i}"); - }; }; - }; } diff --git a/home/services/default.nix b/home/services/default.nix index cd66027..7ce7e43 100644 --- a/home/services/default.nix +++ b/home/services/default.nix @@ -2,8 +2,8 @@ { imports = [ - ./ssh-agent - ./gpg-agent + ./ssh-agent.nix + ./gpg-agent.nix ./hypridle.nix ./nextcloud.nix ]; diff --git a/home/services/gpg-agent.nix b/home/services/gpg-agent.nix index 6d92097..737b47d 100644 --- a/home/services/gpg-agent.nix +++ b/home/services/gpg-agent.nix @@ -1,18 +1,64 @@ { pkgs, ... }: +# See https://github.com/nix-community/home-manager/issues/3095 +let + pinentryRofi = pkgs.writeShellApplication { + name = "pinentry-rofi-with-env"; + text = '' + PATH="$PATH:${pkgs.coreutils}/bin:${pkgs.rofi}/bin" + "${pkgs.pinentry-rofi}/bin/pinentry-rofi" "$@" + ''; + }; +in { - home.packages = with pkgs; [ pinentry-rofi pinentry-gnome3 ]; + home.packages = with pkgs; [ + pinentry-rofi + pinentry-gnome3 + ]; + + programs.gpg = { + enable = true; + scdaemonSettings = { + disable-ccid = true; + }; + settings = { + personal-cipher-preferences = "AES256 AES192 AES"; + personal-digest-preferences = "SHA512 SHA384 SHA256"; + personal-compress-preferences = "ZLIB BZIP2 ZIP Uncompressed"; + default-preference-list = "SHA512 SHA384 SHA256 AES256 AES192 AES ZLIB BZIP2 ZIP Uncompressed"; + cert-digest-algo = "SHA512"; + s2k-digest-algo = "SHA512"; + s2k-cipher-algo = "AES256"; + charset = "utf-8"; + no-comments = true; + no-emit-version = true; + no-greeting = true; + keyid-format = "0xlong"; + list-options = "show-uid-validity"; + verify-options = "show-uid-validity"; + with-fingerprint = true; + require-cross-certification = true; + no-symkey-cache = true; + armor = true; + use-agent = true; + throw-keyids = true; + keyserver = "hkps://keyserver.ubuntu.com:443"; + }; + }; - programs.gpg.enable = true; services.gpg-agent = { enable = true; - pinentryPackage = pkgs.pinentry-gnome3; enableZshIntegration = true; - defaultCacheTtl = 7200; # 2h - maxCacheTtl = 28800; # 8h + enableNushellIntegration = true; + defaultCacheTtl = 60; + maxCacheTtl = 120; + enableSshSupport = true; + sshKeys = [ "8E42E6C65D5F9894CFFF294851AB0CEB5F0B1FAA" ]; + pinentry.package = pkgs.pinentry-gnome3; + # under extraConfig + # pinentry-program ${pinentryRofi}/bin/pinentry-rofi-with-env extraConfig = '' ttyname $GPG_TTY ''; }; } - diff --git a/home/services/nextcloud.nix b/home/services/nextcloud.nix index b56008b..af8e4de 100644 --- a/home/services/nextcloud.nix +++ b/home/services/nextcloud.nix @@ -1,17 +1,8 @@ -{ pkgs, ... }: +{ ... }: { - systemd.user.services.nextcloud = { - description = "Nextcloud Desktop Client"; - after = [ "graphical-session.target" ]; # started nach der grafischen Sitzung - serviceConfig = { - ExecStart = "${pkgs.nextcloud}/bin/nextcloud"; - Restart = "on-failure"; - Environment = '' - MOZ_ENABLE_WAYLAND=1 - GDK_BACKEND=wayland - ''; - }; - wantedBy = [ "default.target" ]; + services.nextcloud-client = { + enable = true; + startInBackground = true; }; }