diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2024-08-15 13:08:00 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2024-08-15 13:08:00 +0200 |
commit | a8056c5575e22c814fce2a87f5b1b0d71c8fc402 (patch) | |
tree | fa34d6c813e816590edf57ee80b8ee8742599ed5 /accounts | |
parent | 8094ac39153017239eb7cd2525b2df7e93550490 (diff) | |
download | nixos-a8056c5575e22c814fce2a87f5b1b0d71c8fc402.tar nixos-a8056c5575e22c814fce2a87f5b1b0d71c8fc402.tar.gz nixos-a8056c5575e22c814fce2a87f5b1b0d71c8fc402.tar.bz2 nixos-a8056c5575e22c814fce2a87f5b1b0d71c8fc402.tar.xz nixos-a8056c5575e22c814fce2a87f5b1b0d71c8fc402.zip |
...
Diffstat (limited to 'accounts')
-rw-r--r-- | accounts/gkleen@sif/default.nix | 172 | ||||
-rw-r--r-- | accounts/gkleen@sif/hyprland.nix | 26 | ||||
-rw-r--r-- | accounts/gkleen@sif/systemd.nix | 20 | ||||
-rw-r--r-- | accounts/gkleen@sif/zshrc | 175 |
4 files changed, 35 insertions, 358 deletions
diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix index 3a051a7a..231913d9 100644 --- a/accounts/gkleen@sif/default.nix +++ b/accounts/gkleen@sif/default.nix | |||
@@ -4,13 +4,6 @@ with lib; | |||
4 | 4 | ||
5 | let | 5 | let |
6 | cfg = config.home-manager.users.${userName}; | 6 | cfg = config.home-manager.users.${userName}; |
7 | deHaskell = flakeInputs.nixpkgs-stable.legacyPackages.x86_64-linux.haskell.packages.ghc92.override (oldAttrs: { | ||
8 | overrides = pkgs.lib.composeExtensions (oldAttrs.overrides or (_: _: {})) | ||
9 | (hself: hsuper: { | ||
10 | dbus = pkgs.haskell.lib.doJailbreak hsuper.dbus; | ||
11 | }); | ||
12 | }); | ||
13 | xmonad = import ./xmonad deHaskell; | ||
14 | emacsScratch = pkgs.stdenv.mkDerivation (sources.emacs-scratch_el // rec { | 7 | emacsScratch = pkgs.stdenv.mkDerivation (sources.emacs-scratch_el // rec { |
15 | phases = [ "installPhase" ]; | 8 | phases = [ "installPhase" ]; |
16 | 9 | ||
@@ -151,15 +144,6 @@ in { | |||
151 | 144 | ||
152 | config = { | 145 | config = { |
153 | services.displayManager.defaultSession = "Hyprland"; # "none+xmonad"; | 146 | services.displayManager.defaultSession = "Hyprland"; # "none+xmonad"; |
154 | services.xserver = { | ||
155 | windowManager.session = [{ | ||
156 | name = "xmonad"; | ||
157 | start = '' | ||
158 | ${pkgs.systemd}/bin/systemd-cat -t xmonad -- ${pkgs.coreutils}/bin/env -u SHLVL -- ${xmonad}/bin/xmonad & | ||
159 | waitPID=$! | ||
160 | ''; | ||
161 | }]; | ||
162 | }; | ||
163 | 147 | ||
164 | home-manager.users.${userName} = { | 148 | home-manager.users.${userName} = { |
165 | imports = [ | 149 | imports = [ |
@@ -254,12 +238,8 @@ in { | |||
254 | }; | 238 | }; |
255 | }; | 239 | }; |
256 | 240 | ||
257 | alacritty = { | ||
258 | enable = true; | ||
259 | settings = import ./alacritty.nix; | ||
260 | }; | ||
261 | |||
262 | zathura.enable = true; | 241 | zathura.enable = true; |
242 | imv.enable = true; | ||
263 | 243 | ||
264 | mpv.config = { | 244 | mpv.config = { |
265 | demuxer-max-bytes = 1073741824; | 245 | demuxer-max-bytes = 1073741824; |
@@ -267,24 +247,6 @@ in { | |||
267 | # gpu-api = "vulkan"; | 247 | # gpu-api = "vulkan"; |
268 | }; | 248 | }; |
269 | 249 | ||
270 | autorandr = { | ||
271 | enable = true; | ||
272 | hooks = { | ||
273 | preswitch = { | ||
274 | "stop-tray" = '' | ||
275 | ${pkgs.systemd}/bin/systemctl --user try-restart tray.target | ||
276 | ''; | ||
277 | }; | ||
278 | postswitch = { | ||
279 | # "restart-compton" = "${pkgs.systemd}/bin/systemctl --user try-restart picom"; | ||
280 | "restart-tray" = '' | ||
281 | ${pkgs.systemd}/bin/systemctl --user try-restart tray.target | ||
282 | ''; | ||
283 | }; | ||
284 | }; | ||
285 | profiles = customUtils.nixImport rec { dir = ./autorandr-profiles; _import = name: _base: import "${toString dir}/${name}" inputs; }; | ||
286 | }; | ||
287 | |||
288 | zsh.initExtra = "source ${./zshrc}"; | 250 | zsh.initExtra = "source ${./zshrc}"; |
289 | zsh.dirHashes = let | 251 | zsh.dirHashes = let |
290 | flakeHashes = mapAttrs' (n: v: nameValuePair (inputNames.${n} or n) (toString v)) flakeInputs; | 252 | flakeHashes = mapAttrs' (n: v: nameValuePair (inputNames.${n} or n) (toString v)) flakeInputs; |
@@ -333,14 +295,6 @@ in { | |||
333 | # notify_on_cmd_finish = "invisible 120"; | 295 | # notify_on_cmd_finish = "invisible 120"; |
334 | }; | 296 | }; |
335 | }; | 297 | }; |
336 | wofi = { | ||
337 | enable = true; | ||
338 | settings = { | ||
339 | location = "top"; | ||
340 | run-always_parse_args = true; | ||
341 | run-show_all = false; | ||
342 | }; | ||
343 | }; | ||
344 | waybar = { | 298 | waybar = { |
345 | enable = true; | 299 | enable = true; |
346 | systemd = { | 300 | systemd = { |
@@ -605,41 +559,6 @@ in { | |||
605 | mode = "center"; | 559 | mode = "center"; |
606 | }; | 560 | }; |
607 | }; | 561 | }; |
608 | hyprlock = { | ||
609 | enable = false; | ||
610 | settings = { | ||
611 | general = { | ||
612 | disable_loading_bar = false; | ||
613 | grace = 60; | ||
614 | hide_cursor = true; | ||
615 | no_fade_in = false; | ||
616 | }; | ||
617 | |||
618 | background = [ | ||
619 | { | ||
620 | path = "screenshot"; | ||
621 | blur_passes = 3; | ||
622 | blur_size = 8; | ||
623 | } | ||
624 | ]; | ||
625 | |||
626 | input-field = [ | ||
627 | { | ||
628 | size = "200, 50"; | ||
629 | position = "0, -80"; | ||
630 | monitor = ""; | ||
631 | dots_center = true; | ||
632 | fade_on_empty = false; | ||
633 | font_color = "rgb(202, 211, 245)"; | ||
634 | inner_color = "rgb(91, 96, 120)"; | ||
635 | outer_color = "rgb(24, 25, 38)"; | ||
636 | outline_thickness = 5; | ||
637 | placeholder_text = "'<span foreground=\"##cad3f5\">Password...</span>'"; | ||
638 | shadow_passes = 2; | ||
639 | } | ||
640 | ]; | ||
641 | }; | ||
642 | }; | ||
643 | fuzzel = { | 562 | fuzzel = { |
644 | enable = true; | 563 | enable = true; |
645 | settings = { | 564 | settings = { |
@@ -690,13 +609,7 @@ in { | |||
690 | grab | 609 | grab |
691 | ''; | 610 | ''; |
692 | }; | 611 | }; |
693 | taffybar = { | ||
694 | enable = false; | ||
695 | package = import ./taffybar { haskellPackages = deHaskell; }; | ||
696 | }; | ||
697 | # status-notifier-watcher.enable = true; | ||
698 | xembed-sni-proxy.enable = true; | 612 | xembed-sni-proxy.enable = true; |
699 | pasystray.enable = false; | ||
700 | udiskie = { | 613 | udiskie = { |
701 | enable = true; | 614 | enable = true; |
702 | automount = false; | 615 | automount = false; |
@@ -709,23 +622,9 @@ in { | |||
709 | }; | 622 | }; |
710 | }; | 623 | }; |
711 | }; | 624 | }; |
712 | unclutter = { | ||
713 | enable = false; | ||
714 | timeout = 5; | ||
715 | }; | ||
716 | network-manager-applet.enable = true; | 625 | network-manager-applet.enable = true; |
717 | blueman-applet.enable = true; | 626 | blueman-applet.enable = true; |
718 | 627 | ||
719 | sxhkd = { | ||
720 | enable = true; | ||
721 | keybindings = { | ||
722 | "button8" = "${muteScript}/bin/mute unmute"; | ||
723 | "@button8" = "${muteScript}/bin/mute mute"; | ||
724 | "button9" = "${pkgs.pulseaudio}/bin/pacmd set-sink-mute @DEFAULT_SINK@ 1"; | ||
725 | "@button9" = "${pkgs.pulseaudio}/bin/pacmd set-sink-mute @DEFAULT_SINK@ 0"; | ||
726 | }; | ||
727 | }; | ||
728 | |||
729 | unison = { | 628 | unison = { |
730 | enable = true; | 629 | enable = true; |
731 | pairs = { | 630 | pairs = { |
@@ -746,24 +645,6 @@ in { | |||
746 | 645 | ||
747 | easyeffects = { | 646 | easyeffects = { |
748 | enable = true; | 647 | enable = true; |
749 | preset = "LoudnessEqualizer"; | ||
750 | }; | ||
751 | |||
752 | screen-locker = { | ||
753 | enable = false; | ||
754 | lockCmd = toString (pkgs.writeShellScript "lock" '' | ||
755 | ${pkgs.playerctl}/bin/playerctl -a status | ${pkgs.gnugrep}/bin/grep -q "Playing" && exit 0 | ||
756 | |||
757 | cleanup() { | ||
758 | ${cfg.services.dunst.package}/bin/dunstctl set-paused false | ||
759 | } | ||
760 | trap cleanup EXIT INT TERM | ||
761 | |||
762 | # ${pkgs.playerctl}/bin/playerctl -a pause | ||
763 | ${cfg.services.dunst.package}/bin/dunstctl set-paused true | ||
764 | ${pkgs.xsecurelock}/bin/xsecurelock | ||
765 | ''); | ||
766 | xss-lock.extraOptions = ["--transfer-sleep-lock"]; | ||
767 | }; | 648 | }; |
768 | 649 | ||
769 | etesync-dav = { | 650 | etesync-dav = { |
@@ -771,30 +652,6 @@ in { | |||
771 | serverUrl = "https://etesync.yggdrasil.li"; | 652 | serverUrl = "https://etesync.yggdrasil.li"; |
772 | }; | 653 | }; |
773 | 654 | ||
774 | hypridle = { | ||
775 | enable = false; | ||
776 | settings = { | ||
777 | general = { | ||
778 | after_sleep_cmd = "hyprctl dispatch dpms on"; | ||
779 | before_sleep_cmd = "hyprlock"; | ||
780 | ignore_dbus_inhibit = false; | ||
781 | ignore_systemd_inhibit = false; | ||
782 | lock_cmd = "hyprlock"; | ||
783 | }; | ||
784 | |||
785 | listener = [ | ||
786 | { | ||
787 | timeout = 300; | ||
788 | on-timeout = "hyprlock"; | ||
789 | } | ||
790 | { | ||
791 | timeout = 600; | ||
792 | on-timeout = "hyprctl dispatch dpms off"; | ||
793 | on-resume = "hyprctl dispatch dpms on"; | ||
794 | } | ||
795 | ]; | ||
796 | }; | ||
797 | }; | ||
798 | swayidle = { | 655 | swayidle = { |
799 | enable = true; | 656 | enable = true; |
800 | events = [ | 657 | events = [ |
@@ -856,33 +713,23 @@ in { | |||
856 | }; | 713 | }; |
857 | }; | 714 | }; |
858 | 715 | ||
859 | xsession = { | 716 | xsession.preferStatusNotifierItems = true; |
860 | enable = true; | ||
861 | |||
862 | initExtra = '' | ||
863 | ${pkgs.xorg.xinput}/bin/xinput disable 'Synaptics TM3512-010' | ||
864 | ${pkgs.xorg.xmodmap}/bin/xmodmap -e 'keysym Caps_Lock = Multi_key' | ||
865 | ''; | ||
866 | |||
867 | preferStatusNotifierItems = true; | ||
868 | }; | ||
869 | 717 | ||
870 | xresources.properties = import ./xresources.nix; | 718 | xresources.properties = import ./xresources.nix; |
871 | 719 | ||
872 | home = { | 720 | home = { |
873 | packages = with pkgs; [ | 721 | packages = with pkgs; [ |
874 | fira fira-code powerline-fonts nerdfonts pavucontrol | 722 | fira fira-code powerline-fonts nerdfonts pavucontrol |
875 | wrappedKeepassxc sxiv xclip mumble pulseaudio-ctl pamixer | 723 | wrappedKeepassxc wl-clipboard-rs mumble pulseaudio-ctl |
876 | libnotify synergy xorg.xbacklight screen-message | 724 | pamixer libnotify screen-message wrappedYTMDesktop qt5ct |
877 | wrappedYTMDesktop qt5ct playerctl evince thunderbird | 725 | playerctl evince thunderbird zoom-us steam steam-run |
878 | zoom-us steam steam-run wireshark virt-manager | 726 | wireshark virt-manager rclone cached-nix-shell worktime |
879 | rclone cached-nix-shell xournal xmonad worktime | ||
880 | fira-code-symbols libreoffice xournalpp google-chrome | 727 | fira-code-symbols libreoffice xournalpp google-chrome |
881 | nixos-shell virt-viewer freerdp gnome-icon-theme | 728 | nixos-shell virt-viewer freerdp gnome-icon-theme |
882 | paper-icon-theme sshpassSecret weechat element-desktop | 729 | paper-icon-theme sshpassSecret weechat element-desktop |
883 | matrix-synapse-tools.synadm | 730 | matrix-synapse-tools.synadm |
884 | flakeInputs.deploy-rs.packages.${config.nixpkgs.system}.deploy-rs | 731 | flakeInputs.deploy-rs.packages.${config.nixpkgs.system}.deploy-rs |
885 | sieve-connect gimp inkscape udiskie glab scrot nitrokey-app | 732 | sieve-connect gimp inkscape udiskie glab nitrokey-app |
886 | pynitrokey gtklock wlrctl nvidiaOffloadScript | 733 | pynitrokey gtklock wlrctl nvidiaOffloadScript |
887 | ]; | 734 | ]; |
888 | 735 | ||
@@ -935,6 +782,9 @@ in { | |||
935 | "gtklock/config.ini" = { | 782 | "gtklock/config.ini" = { |
936 | source = (pkgs.formats.ini {}).generate "config.ini" { | 783 | source = (pkgs.formats.ini {}).generate "config.ini" { |
937 | main = { | 784 | main = { |
785 | idle-hide = true; | ||
786 | follow-focus = true; | ||
787 | start-hidden = true; | ||
938 | }; | 788 | }; |
939 | }; | 789 | }; |
940 | }; | 790 | }; |
@@ -1035,7 +885,7 @@ in { | |||
1035 | doFilter = n: v: (filters.${n} or id) (filter (d: d != "emacs.desktop") v); | 885 | doFilter = n: v: (filters.${n} or id) (filter (d: d != "emacs.desktop") v); |
1036 | in mapAttrs doFilter (cfg.lib.xdg.mimeAssociations [ | 886 | in mapAttrs doFilter (cfg.lib.xdg.mimeAssociations [ |
1037 | cfg.programs.zathura.package | 887 | cfg.programs.zathura.package |
1038 | pkgs.sxiv | 888 | cfg.programs.imv.package |
1039 | cfg.programs.emacs.package | 889 | cfg.programs.emacs.package |
1040 | cfg.programs.firefox.package | 890 | cfg.programs.firefox.package |
1041 | ]) // { | 891 | ]) // { |
diff --git a/accounts/gkleen@sif/hyprland.nix b/accounts/gkleen@sif/hyprland.nix index c295997b..7491dcb4 100644 --- a/accounts/gkleen@sif/hyprland.nix +++ b/accounts/gkleen@sif/hyprland.nix | |||
@@ -15,7 +15,7 @@ in { | |||
15 | ]; | 15 | ]; |
16 | 16 | ||
17 | env = [ | 17 | env = [ |
18 | # "XCURSOR_SIZE,12" | 18 | "XCURSOR_SIZE,12" |
19 | "NIXOS_OZONE_WL,1" | 19 | "NIXOS_OZONE_WL,1" |
20 | "QT_QPA_PLATFORM,wayland" | 20 | "QT_QPA_PLATFORM,wayland" |
21 | "GDK_BACKEND,wayland" | 21 | "GDK_BACKEND,wayland" |
@@ -29,7 +29,7 @@ in { | |||
29 | general = { | 29 | general = { |
30 | gaps_in = 3; | 30 | gaps_in = 3; |
31 | gaps_out = 9; | 31 | gaps_out = 9; |
32 | "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; | 32 | "col.active_border" = "rgba(33ccffee) rgba(00ff95ee) 45deg"; |
33 | "col.inactive_border" = "rgba(595959aa)"; | 33 | "col.inactive_border" = "rgba(595959aa)"; |
34 | 34 | ||
35 | resize_on_border = false; | 35 | resize_on_border = false; |
@@ -294,14 +294,26 @@ in { | |||
294 | "suppressevent maximize fullscreen, class:.*" | 294 | "suppressevent maximize fullscreen, class:.*" |
295 | 295 | ||
296 | # "maximize, class:^(Element|thunderbird)$" | 296 | # "maximize, class:^(Element|thunderbird)$" |
297 | "workspace special:keepass, class:^org\.keepassxc\.KeePassXC$, title:^(?!KeePassXC - Access Request)$" | 297 | "workspace special:pavucontrol, class:^org\.pulseaudio\.pavucontrol$" |
298 | "workspace special:easyeffects, class:^com\.github\.wwmm\.easyeffects$" | ||
299 | "workspace special:blueman, class:^\.blueman-manager-wrapped$" | ||
300 | "workspace special:keepass silent, class:^org\.keepassxc\.KeePassXC$, title:^(?!Unlock Database.*)(?!.*Access Request)" | ||
298 | # "group set always lock invade, class:^Element$" | 301 | # "group set always lock invade, class:^Element$" |
302 | "workspace 2, class:^firefox$" | ||
299 | "workspace 4, class:^evince$" | 303 | "workspace 4, class:^evince$" |
304 | "workspace 4, class:^imv$" | ||
305 | "workspace 4, class:^org\.pwmt\.zathura$" | ||
300 | "workspace 10, class:^mpv$" | 306 | "workspace 10, class:^mpv$" |
301 | "float, class:^org\.keepassxc\.KeePassXC$, title:^KeePassXC - Access Request$" | 307 | "float, class:^org\.keepassxc\.KeePassXC$, title:Access Request$" |
302 | "center, class:^org\.keepassxc\.KeePassXC$, title:^KeePassXC - Access Request$" | 308 | "center, class:^org\.keepassxc\.KeePassXC$, title:Access Request$" |
303 | 309 | "float, class:^org\.keepassxc\.KeePassXC$, title:^Unlock Database" | |
304 | "bordercolor rgba(ffee33ee) rgba(ff9500ee) 45deg, fullscreen:1" | 310 | "center, class:^org\.keepassxc\.KeePassXC$, title:^Unlock Database" |
311 | "float, class:^xdg-desktop-portal-gtk$" | ||
312 | "center, class:^xdg-desktop-portal-gtk$" | ||
313 | |||
314 | "bordercolor rgba(ffaa33ee) rgba(bfff00ee) 45deg, fullscreen:1" | ||
315 | "bordercolor rgba(3366ffee) rgba(6a00ffee) 45deg, xwayland:1" | ||
316 | "bordercolor rgba(6633ffee) rgba(ea00ffee) 45deg, xwayland:1, fullscreen:1" | ||
305 | ]; | 317 | ]; |
306 | 318 | ||
307 | workspace = [ | 319 | workspace = [ |
diff --git a/accounts/gkleen@sif/systemd.nix b/accounts/gkleen@sif/systemd.nix index 5902946c..92404b61 100644 --- a/accounts/gkleen@sif/systemd.nix +++ b/accounts/gkleen@sif/systemd.nix | |||
@@ -126,11 +126,6 @@ in { | |||
126 | After = ["graphical-session-pre.target"]; | 126 | After = ["graphical-session-pre.target"]; |
127 | }; | 127 | }; |
128 | }; | 128 | }; |
129 | taffybar = { | ||
130 | Service = { | ||
131 | Environment = with pkgs; "PATH=${worktime}/bin:${systemd}/bin"; | ||
132 | }; | ||
133 | }; | ||
134 | dunst = { | 129 | dunst = { |
135 | Service = { | 130 | Service = { |
136 | ExecStart = lib.mkForce "${cfg.services.dunst.package}/bin/dunst"; | 131 | ExecStart = lib.mkForce "${cfg.services.dunst.package}/bin/dunst"; |
@@ -140,14 +135,6 @@ in { | |||
140 | WantedBy = ["graphical-session.target"]; | 135 | WantedBy = ["graphical-session.target"]; |
141 | }; | 136 | }; |
142 | }; | 137 | }; |
143 | xiccd = { | ||
144 | Service = { | ||
145 | Type = "simple"; | ||
146 | WorkingDirectory = "~"; | ||
147 | ExecStart = "${pkgs.xiccd}/bin/xiccd"; | ||
148 | Restart = "always"; | ||
149 | }; | ||
150 | }; | ||
151 | keepassxc = { | 138 | keepassxc = { |
152 | Service = { | 139 | Service = { |
153 | Type = "dbus"; | 140 | Type = "dbus"; |
@@ -161,11 +148,6 @@ in { | |||
161 | After = ["graphical-session-pre.target"]; | 148 | After = ["graphical-session-pre.target"]; |
162 | }; | 149 | }; |
163 | }; | 150 | }; |
164 | xss-lock = { | ||
165 | Service = { | ||
166 | Environment = [ "XSECURELOCK_WANT_FIRST_KEYPRESS=1" ]; | ||
167 | }; | ||
168 | }; | ||
169 | mpris-proxy = { | 151 | mpris-proxy = { |
170 | Unit.Description = "Mpris proxy"; | 152 | Unit.Description = "Mpris proxy"; |
171 | Unit.After = [ "network.target" "sound.target" ]; | 153 | Unit.After = [ "network.target" "sound.target" ]; |
@@ -244,7 +226,7 @@ in { | |||
244 | }; | 226 | }; |
245 | tray = { | 227 | tray = { |
246 | Unit = { | 228 | Unit = { |
247 | Wants = ["blueman-applet.service" "udiskie.service" "pasystray.service" "network-manager-applet.service"]; | 229 | Wants = ["blueman-applet.service" "udiskie.service" "network-manager-applet.service"]; |
248 | }; | 230 | }; |
249 | }; | 231 | }; |
250 | }; | 232 | }; |
diff --git a/accounts/gkleen@sif/zshrc b/accounts/gkleen@sif/zshrc index 83e86270..82e66337 100644 --- a/accounts/gkleen@sif/zshrc +++ b/accounts/gkleen@sif/zshrc | |||
@@ -1,106 +1,3 @@ | |||
1 | filebin() { | ||
2 | basePath=/srv/www/files | ||
3 | ssh ymir find /srv/www/files -type f -printf "$'%T@ %TY-%Tm-%TdT%TH:%TM %P\\\\0'" | sort -zn | cut -z -d ' ' -f 2- \ | ||
4 | | while IFS= read -r -d $'\0' l; do | ||
5 | IFS=' ' read -r t p <<<"${l}" | ||
6 | printf "%s https://f.141.li/%s\n" "${t}" "${p}" | ||
7 | done | ||
8 | } | ||
9 | |||
10 | push2bin() { | ||
11 | if [[ ${#@} -eq 1 && ! -r ${1} ]]; then | ||
12 | uux -p 'ymir!push2bin' $(echo -n "${1:t}" | tr -c $'[:alnum:]+-=.' '_') | ||
13 | else | ||
14 | for f (${@}); do | ||
15 | uux -p 'ymir!push2bin' $(echo -n "${f:t}" | tr -c $'[:alnum:]+-=.' '_') <${f} | ||
16 | done | ||
17 | fi | ||
18 | } | ||
19 | |||
20 | genmail() { | ||
21 | local baseName="" | ||
22 | local target="" | ||
23 | if [[ ${#@} -ge 1 ]]; then | ||
24 | target=${1} | ||
25 | shift | ||
26 | fi | ||
27 | |||
28 | if [[ ${#@} -ge 1 ]]; then | ||
29 | baseName=$(pwgen ${@}) | ||
30 | else | ||
31 | baseName=$(pwgen -v -A -0 16 1) | ||
32 | fi | ||
33 | baseName=$(tr -cd $'[:alnum:]!#$%&*+-/=?^_{|}~.' <<<${baseName}) | ||
34 | address=${baseName}@141.li | ||
35 | insertAddr() { | ||
36 | echo "${baseName} gkleen" | ssh ymir tee -a /srv/mail/spm 1>/dev/null \ | ||
37 | } | ||
38 | |||
39 | printf "%s\n" ${address} | ||
40 | read -q 'cont?Continue [y/N]? ' || return | ||
41 | |||
42 | insertAddr | ||
43 | } | ||
44 | |||
45 | s() { | ||
46 | dir=$(pwd) | ||
47 | [[ ${#@} -ge 1 ]] && dir=$1 | ||
48 | |||
49 | shellFile=$(findNix ${@}) | ||
50 | [[ ${#@} -ge 1 ]] && shift | ||
51 | |||
52 | typeset -a cmd | ||
53 | if [[ -d ${dir}/.nix-gc-roots ]]; then | ||
54 | cmd=(persistent-nix-shell ${shellFile} ${S_EXTRA_ARGS} ${@}) | ||
55 | else | ||
56 | cmd=(nix-shell ${shellFile} ${S_EXTRA_ARGS} ${@}) | ||
57 | fi | ||
58 | |||
59 | if [[ -n "${S_SYSTEMD}" ]]; then | ||
60 | systemd-run --user --slice=development.slice --collect -E PATH=${PATH} -p WorkingDirectory=${dir} -- ${cmd} | ||
61 | else | ||
62 | ( | ||
63 | cd ${dir} | ||
64 | |||
65 | exec ${cmd} | ||
66 | ) | ||
67 | fi | ||
68 | } | ||
69 | |||
70 | sz() { | ||
71 | typeset -a S_EXTRA_ARGS | ||
72 | S_EXTRA_ARGS=(--run "env __ETC_ZSHENV_SOURCED=1 zsh") s ${@} | ||
73 | } | ||
74 | st() { | ||
75 | typeset -a S_EXTRA_ARGS | ||
76 | S_EXTRA_ARGS=(--run "tmux new-session env __ETC_ZSHENV_SOURCED=1 zsh") s ${@} | ||
77 | } | ||
78 | stt() { | ||
79 | typeset -a S_EXTRA_ARGS | ||
80 | S_SYSTEMD=true S_EXTRA_ARGS=(--run "urxvt -e tmux -S .tmux.sock new-session env __ETC_ZSHENV_SOURCED=1 zsh") s ${@} | ||
81 | } | ||
82 | se() { | ||
83 | typeset -a S_EXTRA_ARGS | ||
84 | S_SYSTEMD=true S_EXTRA_ARGS=(--run "emacs") s ${@} | ||
85 | } | ||
86 | |||
87 | findNix() { | ||
88 | if [[ $#@ -eq 0 ]]; then | ||
89 | findNix $(pwd) | ||
90 | elif [[ -f "$1" ]]; then | ||
91 | print ${1:a} | ||
92 | elif [[ -d "$1" && -f "$1"/shell.nix ]]; then | ||
93 | print ${1:a}/shell.nix | ||
94 | elif [[ -d "$1" && -f "$1"/default.nix ]]; then | ||
95 | print ${1:a}/default.nix | ||
96 | elif [[ -d "$1" && "$1" != "/" ]]; then | ||
97 | findNix ${1:h} | ||
98 | else | ||
99 | printf "Traversed directories to ‘/’ and found no shell specification\n" >&2 | ||
100 | return 1 | ||
101 | fi | ||
102 | } | ||
103 | |||
104 | dir() { | 1 | dir() { |
105 | curlArchive=false | 2 | curlArchive=false |
106 | templateArchive="" | 3 | templateArchive="" |
@@ -231,60 +128,9 @@ dir() { | |||
231 | fi | 128 | fi |
232 | 129 | ||
233 | 130 | ||
234 | # if [[ -n ${notmuchMsg} ]]; then | ||
235 | # getMimeTypes() { | ||
236 | # nix-shell -p mailcap --run "find \${buildInputs} -path '*/etc/mime.types' | head -n 1 | xargs -- cat" | ||
237 | # } | ||
238 | |||
239 | # typeset -a messages | ||
240 | # messages=(${(z)$(notmuch search --output=messages ${notmuchMsg})}) | ||
241 | |||
242 | # for message (${messages}); do | ||
243 | # typeset -A notmuchAtts | ||
244 | # notmuchAtts=() | ||
245 | |||
246 | # while IFS= read -r -d $'\n' line; do | ||
247 | # [[ ${line} =~ '(attachment|part)\{ ID: ([0-9]+)' ]] || continue | ||
248 | # attId=${match[2]} | ||
249 | |||
250 | # [[ ${line} =~ 'Content-type: multipart/' ]] && continue | ||
251 | |||
252 | # fName="part_${attId}" | ||
253 | # [[ ${line} =~ 'Filename: (([^,]|,[^ ])+)' ]] && fName=${match[1]} | ||
254 | |||
255 | # if [[ ${#messages} -gt 1 ]]; then | ||
256 | # fName="${message}/${fName}" | ||
257 | # fi | ||
258 | |||
259 | # fExt="${fName:e}" | ||
260 | # [[ -n "${fExt}" ]] && fName="${fName:r}" | ||
261 | |||
262 | # if [[ -z "${fExt}" && ${line} =~ 'Content-type: (([^,]|,[^ ])+)$' ]]; then | ||
263 | # fExt=$(getMimeTypes | grep ${match[1]}$'\t' | head -n 1 | awk '{ print $2; }') | ||
264 | # fi | ||
265 | |||
266 | # mkdir -p ${fName:h} | ||
267 | # if [[ -n "${fExt}" ]]; then | ||
268 | # fName=$(mktemp -p . "${fName}.XXXXXX.${fExt}") | ||
269 | # else | ||
270 | # fName=$(mktemp -p . "${fName}.XXXXXX") | ||
271 | # fi | ||
272 | |||
273 | # notmuchAtts[${attId}]=${fName} | ||
274 | # done <<(notmuch show --decrypt=false -- ${message} | tr -d $'\f') | ||
275 | |||
276 | # for attId fName in ${(kv)notmuchAtts}; do | ||
277 | # [[ -d ${fName:h} ]] || mkdir -p ${fName:h} | ||
278 | # printf "#%d → ‘%s’\n" "${attId}" "${fName}" >&2 | ||
279 | |||
280 | # notmuch show --decrypt=false --part=${attId} -- ${message} | pv -W -D 2 -i 0.1 >${fName} | ||
281 | # done | ||
282 | # done | ||
283 | # fi | ||
284 | |||
285 | |||
286 | ${wormhole} && wormhole receive | 131 | ${wormhole} && wormhole receive |
287 | 132 | ||
133 | |||
288 | if ${quickserve}; then | 134 | if ${quickserve}; then |
289 | quickserve --root . --upload . --show-hidden --tar gz | 135 | quickserve --root . --upload . --show-hidden --tar gz |
290 | fi | 136 | fi |
@@ -370,16 +216,6 @@ tmpdir() { | |||
370 | ) | 216 | ) |
371 | } | 217 | } |
372 | 218 | ||
373 | inhibit-sleep() { | ||
374 | if systemctl --user is-active prevent-suspend.service 1>/dev/null; then | ||
375 | echo "Allowing suspend" | ||
376 | systemctl --user stop prevent-suspend.service | ||
377 | else | ||
378 | echo "Inhibiting suspend" | ||
379 | systemctl --user start prevent-suspend.service | ||
380 | fi | ||
381 | } | ||
382 | |||
383 | qr() { | 219 | qr() { |
384 | qrencode -l M -o - -t ANSIUTF8 $@ | 220 | qrencode -l M -o - -t ANSIUTF8 $@ |
385 | } | 221 | } |
@@ -422,7 +258,7 @@ swap() { | |||
422 | } | 258 | } |
423 | 259 | ||
424 | ls() { | 260 | ls() { |
425 | exa --all --group-directories-first --colour=always $@ | less --mouse -FR | 261 | eza --all --group-directories-first --colour=always $@ | less --mouse -FR |
426 | } | 262 | } |
427 | 263 | ||
428 | l() { | 264 | l() { |
@@ -437,10 +273,6 @@ ure() { | |||
437 | systemctl --user --restart $@ | 273 | systemctl --user --restart $@ |
438 | } | 274 | } |
439 | 275 | ||
440 | u2wdb() { | ||
441 | ssh -t postgres@uniworxdb2 psql uni2work | ||
442 | } | ||
443 | |||
444 | ssh-installer() { | 276 | ssh-installer() { |
445 | ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentityFile=~/.ssh/gkleen@sif.midgard.yggdrasil $@ | 277 | ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o IdentityFile=~/.ssh/gkleen@sif.midgard.yggdrasil $@ |
446 | } | 278 | } |
@@ -483,4 +315,5 @@ bindkey -e | |||
483 | bindkey ';5C' emacs-forward-word | 315 | bindkey ';5C' emacs-forward-word |
484 | bindkey ';5D' emacs-backward-word | 316 | bindkey ';5D' emacs-backward-word |
485 | bindkey '^[[1;5C' emacs-forward-word | 317 | bindkey '^[[1;5C' emacs-forward-word |
486 | bindkey '^[[1;5D' emacs-backward-word \ No newline at end of file | 318 | bindkey '^[[1;5D' emacs-backward-word |
319 | bindkey '^H' backward-kill-word | ||