From 73af89d935df5a8166114c9257f9f247f29850bf Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Fri, 26 Apr 2024 18:21:56 +0200 Subject: Migrate from stumpwm to sway and from manifests to home-services. --- .bin/chiaki | 21 ++++ .bin/oath | 14 +++ .bin/whois-at-hsp | 84 +++++++++++++++ .config/guix/manifests/desktop.scm | 73 ------------- .config/guix/manifests/emacs.scm | 126 ----------------------- .config/sway/config | 193 ++++++++++++++++++++++++++++++++++ .config/waybar/config | 159 ++++++++++++++++++++++++++++ .config/waybar/style.css | 205 +++++++++++++++++++++++++++++++++++++ .emacs.d/init.el | 10 +- .emacs.d/jd/jd-custom.el | 16 +++ .emacs.d/jd/jd-keys.el | 10 ++ .emacs.d/jd/jd-org.el | 2 + .emacs.d/jd/jd-ui.el | 15 ++- guix/jd/desktops/base.scm | 128 ++++++++++++++--------- guix/jd/desktops/mimir.scm | 6 +- guix/jd/home/services/desktop.scm | 178 ++++++++++++++++++++++++++------ guix/jd/home/services/emacs.scm | 112 ++++++++++++++++++++ guix/jd/packages/emacs.scm | 57 +++++++++++ guix/jd/utils.scm | 21 ++-- 19 files changed, 1135 insertions(+), 295 deletions(-) create mode 100755 .bin/chiaki create mode 100755 .bin/oath create mode 100755 .bin/whois-at-hsp delete mode 100644 .config/guix/manifests/desktop.scm delete mode 100644 .config/guix/manifests/emacs.scm create mode 100644 .config/sway/config create mode 100644 .config/waybar/config create mode 100644 .config/waybar/style.css create mode 100644 guix/jd/home/services/emacs.scm create mode 100644 guix/jd/packages/emacs.scm diff --git a/.bin/chiaki b/.bin/chiaki new file mode 100755 index 0000000..5fa6547 --- /dev/null +++ b/.bin/chiaki @@ -0,0 +1,21 @@ +#!/bin/sh + +CHIAKI_SHELL=/tmp/.chiaki.nix + +cat < $CHIAKI_SHELL +let + nixgl = import (fetchTarball https://github.com/guibou/nixGL/archive/main.tar.gz) { }; +in +{ nixpkgs ? import {} }: +with nixpkgs; mkShell { + buildInputs = [ + chiaki + nixgl.auto.nixGLDefault + ]; + shellHook = '' + nixGL chiaki && exit; + ''; +} +EOF + +nix-shell $CHIAKI_SHELL diff --git a/.bin/oath b/.bin/oath new file mode 100755 index 0000000..7444993 --- /dev/null +++ b/.bin/oath @@ -0,0 +1,14 @@ +#!/bin/sh + +if [[ $1 ]]; then + PASS=$(oathtool -b --totp $(pass show "oath/$1")) + printf $PASS | wl-copy + echo "pass: $PASS" + echo "Password should be in your clipboard!" +else + echo "Usage: oath " + echo "Available pass:" + pass oath +fi + + diff --git a/.bin/whois-at-hsp b/.bin/whois-at-hsp new file mode 100755 index 0000000..0cd03f7 --- /dev/null +++ b/.bin/whois-at-hsp @@ -0,0 +1,84 @@ +#!/usr/bin/env -S guix shell guile guile-json -- guile --no-auto-compile -e main -s +-*- scheme -*- +!# + +(use-modules (srfi srfi-1) + (ice-9 iconv) + (ice-9 receive) + (web client) + (json)) + +(define whois-at-hsp-endpoint "https://whois.at.hsp.sh/api/now") + +(define (http-get-serialize-json url) + (receive (response data) (http-request url) + (values (json-string->scm (bytevector->string data "UTF-8")) + response))) + +(define (whois-data->users whois-data) + (assoc-ref whois-data "users")) + +(define (whois-data->unknown-devices whois-data) + (assoc-ref whois-data "unknown_devices")) + +(define (whois-data->head-count whois-data) + (assoc-ref whois-data "headcount")) + +(define (whois-data->formated-users whois-data) + (let ((users (vector->list (whois-data->users whois-data)))) + (if (> (length users) 0) + (fold-right + (lambda (a b) (string-append a " " b)) + "" + users) + "No visible users!"))) + +(define (whois-data->summary whois-data) + (string-append + "Unknown devices: " + (number->string (whois-data->unknown-devices whois-data)) + "\nUsers: [" (number->string (whois-data->head-count whois-data)) "] " + (whois-data->formated-users whois-data))) + +(define (notify data) + (system* "notify-send" + "WHOIS AT HSP" + (whois-data->summary data))) + +(define (command-line-option? option args) + (> (length (or (member option args) + '())) + 0)) + +(define-syntax-rule (command-line-args-handle args default ((option ...) body ...) ...) + (let ((option? (lambda (o) (command-line-option? o args))) + (something-executed? #f)) + (when (or (option? option) ...) + (set! something-executed? #t) + body ...) ... + (when (not something-executed?) + default))) + +(define (main args) + (let ((whois-data (http-get-serialize-json whois-at-hsp-endpoint))) + (command-line-args-handle args + (begin (display (whois-data->summary whois-data)) + (newline)) + (("-h" "--help") + (display (string-append "-h, --help Help message\n" + "-n, --notify Notification massage with whois information.\n" + "-u Get users\n" + "-H Get head count\n" + "-U Get unknown devices\n"))) + (("-n" "--notify") + (notify whois-data)) + (("-u") + (display (whois-data->formated-users whois-data)) + (newline)) + (("-H") + (display (whois-data->head-count whois-data)) + (newline)) + (("-U") + (display (whois-data->unknown-devices whois-data)) + (newline))))) + diff --git a/.config/guix/manifests/desktop.scm b/.config/guix/manifests/desktop.scm deleted file mode 100644 index f238951..0000000 --- a/.config/guix/manifests/desktop.scm +++ /dev/null @@ -1,73 +0,0 @@ -(specifications->manifest - '("qutebrowser" - "ungoogled-chromium" - "firefox" - "tor-client" - - "pulsemixer" - "pavucontrol" - "alsa-utils" - - "virt-manager" - - "flatpak" - "redshift" - "fontmanager" - - "polybar" - - "blueman" - - "xdg-utils" - "xdg-dbus-proxy" - "xdg-desktop-portal-gtk" - "glib:bin" - "gtk+:bin" - "gnome-keyring" - "shared-mime-info" - "libnotify" - "dconf" - "hicolor-icon-theme" - - "dunst" - - "gimp" - "inkscape" - - "mpv" - "youtube-dl" - - "pamixer" - "playerctl" - "scrot" - "brightnessctl" - "upower" - "tlp" - "feh" - "alacritty" - - "curl" - "wget" - "zip" - "unzip" - "qrencode" - "trash-cli" - "pandoc" - "password-store" - "pinentry" - - "syncthing" - "syncthing-gtk" - - "xmodmap" - "xrandr" - "arandr" - "xss-lock" - "libinput" - "xinput" - "xprop" - "rlwrap" - - "nheko" - "quassel" - )) diff --git a/.config/guix/manifests/emacs.scm b/.config/guix/manifests/emacs.scm deleted file mode 100644 index db809eb..0000000 --- a/.config/guix/manifests/emacs.scm +++ /dev/null @@ -1,126 +0,0 @@ -;; This file is auto-generated by Emacs function: jd/manifest-generate-to-file -(use-modules (gnu packages emacs-xyz) - (gnu packages) - (guix packages) - (guix git-download) - (guix build-system emacs) - ((guix licenses) #:prefix license:)) - - -(define-public emacs-org-roam-ui - (let ((commit "9474a254390b1e42488a1801fed5826b32a8030b") - (revision "0")) - (package - (name "emacs-org-roam-ui") - (version (git-version "0" revision commit)) - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/org-roam/org-roam-ui") - (commit commit))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "0v54vxh95izch74wz2dl2dkdqicbvshra55l6qvd4xl5qmfhpjdc")))) - (build-system emacs-build-system) - (arguments - `(#:include (cons "^out" %default-include))) - (propagated-inputs - (list emacs-org-roam emacs-websocket emacs-simple-httpd emacs-f)) - (home-page "https://github.com/org-roam/org-roam-ui") - (synopsis "A graphical frontend for your org-roam Zettelkasten") - (description " Org-Roam-UI is a frontend for exploring and interacting -with your @code{org-roam} notes. It is meant a successor of -@code{org-roam-server} that extends functionality of org-roam with a Web app -that runs side-by-side with Emacs.") - (license license:gpl3+)))) - - - -(define emacs-lsp-mode--new - (let ((commit "808c4d0ab9f19bb92c56716cf59df89432b63f5d") - (revision "1")) - (package - (inherit emacs-lsp-mode) - (name "emacs-lsp-mode") - (version (git-version "8.0.1" revision commit)) - (source - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/emacs-lsp/lsp-mode") - (commit commit))) - (file-name (git-file-name name version)) - (sha256 - (base32 "0ridjhzndwjj8947vabq05njgnns74hi69x77axgcbv1c4nasz2y"))))))) - - -(define emacs-packages - (specifications->manifest - '("emacs-ytdl" - "emacs-desktop-environment" - "emacs-exwm" - "emacs-perspective" - "emacs-mu4e-alert" - "mu" - "isync" - "emacs-htmlize" - "emacs-bluetooth" - "emacs-nov-el" - "emacs-password-store" - "emacs-mastodon" - "emacs-elfeed" - "emacs-pdf-tools" - "emacs-emms" - "emacs-all-the-icons-dired" - "emacs-vterm" - "emacs-restclient" - "emacs-magit" - "emacs-neotree" - "emacs-projectile" - "emacs-company-box" - "emacs-company" - "emacs-docker" - "emacs-yaml-mode" - "emacs-web-mode" - "emacs-flycheck" - "emacs-tide" - "emacs-cider" - "emacs-typescript-mode" - "emacs-pyvenv" - "emacs-geiser-guile" - "emacs-racket-mode" - "emacs-geiser-racket" - "emacs-geiser" - "emacs-sly" - "emacs-rainbow-delimiters" - "emacs-paredit" - ;; "emacs-lsp-ivy" - ;; "emacs-lsp-mode" - "emacs-org-roam" - "emacs-org-roam-bibtex" - "emacs-org-superstar" - "emacs-org" - "emacs-ox-pandoc" - "emacs-beacon" - "emacs-all-the-icons" - "emacs-which-key" - "emacs-counsel" - "emacs-ivy" - "emacs-hl-todo" - "emacs-diminish" - "emacs-solarized-theme" - "font-terminus" - "emacs-undo-tree" - "emacs-hydra" - "emacs-general" - "emacs-guix" - "emacs" - "emacs-use-package" - ))) - - -(concatenate-manifests - (list emacs-packages - (packages->manifest (list emacs-lsp-mode--new - emacs-org-roam-ui)))) diff --git a/.config/sway/config b/.config/sway/config new file mode 100644 index 0000000..2807f08 --- /dev/null +++ b/.config/sway/config @@ -0,0 +1,193 @@ +set $mod Mod4 + +set $left h +set $down j +set $up k +set $right l + +set $term alacritty +set $emacs emacsclient -c +set $menu fuzzel -r0 -b 282828f2 -C 458588f2 -B 3 -s 458588f2 -S 282828FF --font "Terminus:size=12" -p "run: " + +set $laptop-display eDP-1 +set $generic-display HDMI-A-1 +set $primary-home-display 'Iiyama North America PLE2407HDSD 0x01010101' +set $secondary-home-display 'Dell Inc. DELL E190S M8VPV186CELI' + +set $primary-display-layout $primary-home-display $generic-display $laptop-display +set $secondary-display-layout $secondary-home-display $laptop-display + +output * bg SPOILER_33.png fill + +output $laptop-display resolution 1920x1080 position 1920,0 +output $generic-display resolution 1920x1080 position 0,0 +output $primary-home-display resolution 1920x1080 position 0,0 +output $secondary-home-display resolution 1280x1024 position 1920,0 +set $opacity 0.9 + +client.focused #002b36 #586e75 #eee8d5 #268bd2 +client.focused_inactive #002b36 #073642 #93a1a1 #268bd2 +client.unfocused #002b36 #073642 #93a1a1 #268bd2 +client.urgent #002b36 #dc322f #fdf6e3 #002b36 + +input type:keyboard { + xkb_layout pl,us +} + +input type:touchpad { + tap enabled + middle_emulation enabled +} + +bindsym $mod+Shift+s output $laptop-display toggle + +set $swaylock 'swaylock -f -c 000000 --font "Terminus"' +exec swayidle -w \ + timeout 280 $swaylock \ + timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \ + before-sleep $swaylock + +# inhibit_idle fullscreen + +bindsym $mod+Escape exec $swaylock + +bindsym XF86MonBrightnessUp exec brightnessctl set 5%+ +bindsym XF86MonBrightnessDown exec brightnessctl set 5%- + +bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle +bindsym XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5% +bindsym XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5% + +bindsym XF86AudioNext exec playerctl next +bindsym XF86AudioPrev exec playerctl previous +bindsym XF86AudioPlay exec playerctl play-pause +bindsym XF86AudioPause exec playerctl pause + +bindsym print exec grimshot --notify copy area +bindsym $mod+print exec grimshot --notify copy output + +bindsym $mod+Return exec $term + +bindsym $mod+Shift+q kill + +floating_modifier $mod normal + +bindsym $mod+Shift+c reload +bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit' + +bindsym $mod+$left focus left +bindsym $mod+$down focus down +bindsym $mod+$up focus up +bindsym $mod+$right focus right + +bindsym $mod+Shift+$left move left +bindsym $mod+Shift+$down move down +bindsym $mod+Shift+$up move up +bindsym $mod+Shift+$right move right + +workspace 1 output $primary-display-layout +workspace 2 output $primary-display-layout +workspace 3 output $secondary-display-layout +workspace 4 output $secondary-display-layout +workspace 9 output $primary-display-layout +workspace 10 output $secondary-display-layout + +bindsym $mod+1 workspace number 1 +bindsym $mod+2 workspace number 2 +bindsym $mod+3 workspace number 3 +bindsym $mod+4 workspace number 4 +bindsym $mod+5 workspace number 5 +bindsym $mod+6 workspace number 6 +bindsym $mod+7 workspace number 7 +bindsym $mod+8 workspace number 8 +bindsym $mod+9 workspace number 9 +bindsym $mod+0 workspace number 10 + +bindsym $mod+Shift+1 move container to workspace number 1 +bindsym $mod+Shift+2 move container to workspace number 2 +bindsym $mod+Shift+3 move container to workspace number 3 +bindsym $mod+Shift+4 move container to workspace number 4 +bindsym $mod+Shift+5 move container to workspace number 5 +bindsym $mod+Shift+6 move container to workspace number 6 +bindsym $mod+Shift+7 move container to workspace number 7 +bindsym $mod+Shift+8 move container to workspace number 8 +bindsym $mod+Shift+9 move container to workspace number 9 +bindsym $mod+Shift+0 move container to workspace number 10 + +assign [app_id="(firefox-default|qutebrowser|Chromium-browser)"] 2 +assign [instance="(chromium-browser)"] 2 +assign [instance="(spotify)"] 3 +assign [app_id=".blueman-manager-real"] 3 +assign [app_id="pavucontrol"] 3 +assign [app_id="(org.telegram.desktop)"] 4 +assign [app_id="vesktop"] 4 +assign [app_id="com.ktechpit.whatsie"] 4 +assign [instance="(discord)"] 4 + +for_window [app_id="vesktop"] opacity $opacity + + +bindsym $mod+b splith +bindsym $mod+v splitv + +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +bindsym $mod+f fullscreen +bindsym $mod+Shift+space floating toggle +bindsym $mod+space focus mode_toggle +bindsym $mod+a focus parent + +bindsym $mod+Shift+minus move scratchpad +bindsym $mod+minus scratchpad show + +mode "resize" { + bindsym $left resize shrink width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + + bindsym Return mode "default" + bindsym Control+g mode "default" + bindsym Escape mode "default" +} +bindsym $mod+r mode "resize" + +set $default swaymsg mode default +mode "menu" { + bindsym --no-repeat e exec '$default; $emacs;' + bindsym --no-repeat w exec "$default; whois-at-hsp -n" + + bindsym Return mode "default" + bindsym Control+g mode "default" + bindsym Escape mode "default" + +} +bindsym $mod+o mode "menu" + + +workspace_layout tabbed + +default_border normal 3 +gaps outer 0 +gaps inner 6 +font Terminus (TTF) 12 +corner_radius 4 +blur_xray disable +blur enable +layer_effects "waybar" blur enable +bindsym $mod+p exec $menu + + +# Taken from dawivil dotfiles. +exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway + +# exec udiskie -t +exec mako --font "Terminus (TTF)" --outer-margin=5 --margin=3 --border-size=3 --default-timeout=7000 --background="#282828e0" + +exec nm-applet --indicator +exec blueman-applet +exec waybar +exec udiskie -t +exec wlsunset -l 51.919438 -L 19.145136 diff --git a/.config/waybar/config b/.config/waybar/config new file mode 100644 index 0000000..5ebee30 --- /dev/null +++ b/.config/waybar/config @@ -0,0 +1,159 @@ +{ + "layer": "top", + "position": "top", + + "modules-left": [ + "sway/workspaces", + "sway/mode" + ], + + "modules-right": [ +// "custom/whois", + "pulseaudio", + "network", + "memory", + "cpu", + "temperature", + "battery", + "sway/language", + "clock#date", + "clock#time", + "idle_inhibitor", + "tray" + ], + + // Modules + "idle_inhibitor": { + "format": "{icon}", + "format-icons": { + "activated": "", + "deactivated": "" + } + }, + + "battery": { + "interval": 10, + "states": { + "warning": 30, + "critical": 15 + }, + "format-time": "{H}:{M:02}", + "format": "{icon} {capacity}% ({time})", + "format-charging": " {capacity}% ({time})", + "format-charging-full": " {capacity}%", + "format-full": "{icon} {capacity}%", + "format-alt": "{icon} {power}W", + "format-icons": [ + "", + "", + "", + "", + "" + ], + "tooltip": false + }, + + "clock#time": { + "interval": 10, + "format": "{:%H:%M}", + "tooltip": false + }, + + "clock#date": { + "interval": 20, + "format": " {:%e %b %Y}", + "tooltip": false + //"tooltip-format": "{:%e %B %Y}" + }, + + "cpu": { + "interval": 5, + "tooltip": false, + "format": " {usage}%", + "format-alt": " {load}", + "states": { + "warning": 70, + "critical": 90 + } + }, + + "sway/language": { + "format": " {}", + "min-length": 5, + "on-click": "swaymsg 'input * xkb_switch_layout next'", + "tooltip": false + }, + + "memory": { + "interval": 5, + "format": " {used:0.1f}G/{total:0.1f}G", + "states": { + "warning": 70, + "critical": 90 + }, + "tooltip": false + }, + + "network": { + "interval": 5, + "format-wifi": " {essid} ({signalStrength}%)", + "format-ethernet": " {ifname}", + "format-disconnected": "No connection", + "format-alt": " {ipaddr}/{cidr}", + "tooltip": false + }, + + "sway/mode": { + "format": "{}", + "tooltip": false + }, + + "sway/window": { + "format": "{}", + "max-length": 30, + "tooltip": false + }, + + "sway/workspaces": { + "disable-scroll-wraparound": true, + "smooth-scrolling-threshold": 4, + "enable-bar-scroll": true, + "format": "{name}" + }, + + "pulseaudio": { + "format": "{icon} {volume}%", + "format-bluetooth": "{icon} {volume}%", + "format-muted": "", + "format-icons": { + "headphone": "", + "hands-free": "", + "headset": "", + "phone": "", + "portable": "", + "car": "", + "default": ["", ""] + }, + "scroll-step": 1, + "on-click": "pactl set-sink-mute @DEFAULT_SINK@ toggle", + "tooltip": false + }, + + "temperature": { + "critical-threshold": 90, + "interval": 5, + "format": "{icon} {temperatureC}°", + "format-icons": [ + "", + "", + "", + "", + "" + ], + "tooltip": false + }, + + "tray": { + "icon-size": 18, + } +} diff --git a/.config/waybar/style.css b/.config/waybar/style.css new file mode 100644 index 0000000..53d732b --- /dev/null +++ b/.config/waybar/style.css @@ -0,0 +1,205 @@ +/* Keyframes */ + +@keyframes blink-critical { + to { + /*color: @white;*/ + background-color: @critical; + } +} + + +/* Styles */ + +/* Colors (gruvbox) */ +@define-color black #073642; +@define-color red #dc322f; +@define-color green #859900; +@define-color yellow #b58900; +@define-color blue #268bd2; +@define-color purple #d33682; +@define-color aqua #00afaf; +@define-color gray #1c1c1c; +@define-color brgray #928374; +@define-color brred #cb4b16; +@define-color brgreen #586e75; +@define-color bryellow #657b83; +@define-color brblue #839496; +@define-color brpurple #6c71c4; +@define-color braqua #93a1a1; +@define-color white #eee8d5; +@define-color bg1 #073642; +@define-color bg2 #002b36; + + +@define-color warning @bryellow; +@define-color critical @red; +@define-color mode @bg2; +@define-color unfocused @bg2; +@define-color focused @blue; +@define-color inactive @purple; +@define-color sound @green; +@define-color network @yellow; +@define-color memory @aqua; +@define-color cpu @blue; +@define-color temp @brpurple; +@define-color layout @green; +@define-color battery @yellow; +@define-color date @aqua; +@define-color time @bg2; +@define-color tray @bg2; + +/* Reset all styles */ +* { + border: none; + border-radius: 0; + min-height: 0; + margin: 0; + padding: 0; + box-shadow: none; + text-shadow: none; + icon-shadow: none; +} + +/* The whole bar */ +#waybar { + background: @bg2; + color: @white; + font-family: "Terminus (TTF)", FontAwesome; + font-size: 12pt; +} + +/* Each module */ +#battery, +#clock, +#cpu, +#language, +#memory, +#mode, +#network, +#pulseaudio, +#temperature, +#tray, +#backlight, +#idle_inhibitor, +#disk, +#user, +#mpris { + padding-left: 8pt; + padding-right: 8pt; +} + +/* Each critical module */ +#memory.critical, +#cpu.critical, +#temperature.critical, +#battery.critical.discharging { + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + animation-name: blink-critical; + animation-duration: 1s; +} + +/* Each warning */ +#network.disconnected, +#memory.warning, +#cpu.warning, +#temperature.warning, +#battery.warning.discharging { + color: @warning; +} + +/* And now modules themselves in their respective order */ + +/* Current sway mode (resize etc) */ +#mode { + color: @white; + background: @mode; +} + +/* Workspaces stuff */ +#workspaces button { + /*font-weight: bold;*/ + padding-left: 2pt; + padding-right: 2pt; + color: @white; + background: @unfocused; +} + +/* Inactive (on unfocused output) */ +#workspaces button.visible { + color: @white; + background: @inactive; +} + +/* Active (on focused output) */ +#workspaces button.focused { + color: @black; + background: @focused; +} + +/* Contains an urgent window */ +#workspaces button.urgent { + color: @black; + background: @warning; +} + +/* Style when cursor is on the button */ +#workspaces button:hover { + background: @black; + color: @white; +} + +#window { + margin-right: 35pt; + margin-left: 35pt; +} + +#pulseaudio { + background: @sound; + color: @black; +} + +#network { + background: @network; + color: @white; +} + +#memory { + background: @memory; + color: @black; +} + +#cpu { + background: @cpu; + color: @white; +} + +#temperature { + background: @temp; + color: @black; +} + +#language { + background: @layout; + color: @black; +} + +#battery { + background: @battery; + color: @white; +} + +#tray { + background: @tray; +} + +#clock.date { + background: @date; + color: @black; +} + +#clock.time { + background: @time; + color: @white; +} diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 96b81da..a0cb8a0 100755 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -3,7 +3,13 @@ ;;; Code: -(setq gc-cons-threshold (* 50 1000 1000)) +;; Minimize garbage collection during startup +(setq gc-cons-threshold most-positive-fixnum) + +;; Lower threshold back to 8 MiB (default is 800kB) +(add-hook 'emacs-startup-hook + (lambda () + (setq gc-cons-threshold (expt 2 23)))) (defvar jd/manifest-list nil @@ -119,7 +125,7 @@ (when jd/exwm-p (require 'jd-exwm)) -(setq gc-cons-threshold (* 2 1000 1000)) +;; (setq gc-cons-threshold (* 2 1000 1000)) ;;; init.el ends here (put 'upcase-region 'disabled nil) diff --git a/.emacs.d/jd/jd-custom.el b/.emacs.d/jd/jd-custom.el index f48f761..8383e41 100755 --- a/.emacs.d/jd/jd-custom.el +++ b/.emacs.d/jd/jd-custom.el @@ -39,6 +39,22 @@ (erc :server "195.74.91.18" :port "6697")) + +;; Repair load paths when tramp try to connect to guix instances +(require 'tramp) + +(connection-local-set-profile-variables + 'guix-system + '((tramp-remote-path . (tramp-own-remote-path)))) + +(connection-local-set-profiles + '(:application tramp :protocol "sudo" :machine "localhost") + 'guix-system) + +(connection-local-set-profiles + '(:application tramp :protocol "ssh" :machine "jdlugosz.com") + 'guix-system) + (provide 'jd-custom) ;;; jd-custom.el ends here diff --git a/.emacs.d/jd/jd-keys.el b/.emacs.d/jd/jd-keys.el index 7c0d6b2..26a6445 100755 --- a/.emacs.d/jd/jd-keys.el +++ b/.emacs.d/jd/jd-keys.el @@ -16,6 +16,16 @@ ;; (evil-set-initial-state 'exwm-mode 'emacs) ;; (evil-mode 1)) +(jd/use-package multiple-cursors "emacs-multiple-cursors" + :config + (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines) + (global-set-key (kbd "C->") 'mc/mark-next-like-this) + (global-set-key (kbd "C-<") 'mc/mark-previous-like-this) + (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)) + +(jd/use-package shackle "emacs-shackle") +(jd/use-package sway "emacs-sway") + (jd/use-package general "emacs-general" :config (general-create-definer jd/leader-key-def diff --git a/.emacs.d/jd/jd-org.el b/.emacs.d/jd/jd-org.el index f511846..a9565f3 100755 --- a/.emacs.d/jd/jd-org.el +++ b/.emacs.d/jd/jd-org.el @@ -16,6 +16,8 @@ (let ((d (or date "+0d"))) (org-insert-time-stamp (org-read-date nil t d)))) +(jd/use-package org-pomodoro "emacs-org-pomodoro") + (jd/use-package org "emacs-org" :pin org :commands (org-capture org-agenda) diff --git a/.emacs.d/jd/jd-ui.el b/.emacs.d/jd/jd-ui.el index f75711b..f3a39bc 100755 --- a/.emacs.d/jd/jd-ui.el +++ b/.emacs.d/jd/jd-ui.el @@ -11,11 +11,13 @@ (menu-bar-mode -1) (set-fringe-mode 10) -(jd/add-package-to-manifest "font-terminus") - +(set-frame-parameter (selected-frame) 'alpha '(92 . 92)) +(add-to-list 'default-frame-alist '(alpha . (92 . 92))) (custom-set-faces - '(default ((t (:inherit nil :height 100 :family "Terminus"))))) + '(default ((t (:inherit nil :height 125 :family "Terminus")))) + '(line-number ((t (:inherit nil :height 125 :family "Terminus")))) + '(line-number-current-line ((t (:inherit nil :height 125 :family "Terminus"))))) (add-hook 'prog-mode-hook 'menu-bar--display-line-numbers-mode-relative) @@ -27,9 +29,14 @@ (require 'diminish) +(jd/use-package doom-modeline "emacs-doom-modeline" + :config + (doom-modeline-mode)) + (jd/use-package solarized-theme "emacs-solarized-theme" :config - (load-theme 'solarized-selenized-black t)) + (load-theme 'solarized-dark-high-contrast t)) + (jd/use-package diminish "emacs-diminish") diff --git a/guix/jd/desktops/base.scm b/guix/jd/desktops/base.scm index db95939..c613c26 100644 --- a/guix/jd/desktops/base.scm +++ b/guix/jd/desktops/base.scm @@ -1,6 +1,7 @@ (define-module (jd desktops base) #:use-module (jd home services polkit) - #:use-module (jd home services desktop) + #:use-module (jd home services desktop) + #:use-module (jd home services emacs) #:use-module (jd services polkit) #:use-module (gnu) @@ -9,61 +10,46 @@ #:use-module (gnu home services desktop) #:use-module (gnu home services gnupg) #:use-module (gnu home services xdg) + #:use-module (gnu home services sound) #:use-module (gnu services) + #:use-module (guix packages) #:use-module (nongnu packages linux) #:use-module (nongnu system linux-initrd)) -(use-package-modules wm gnome gnupg networking virtualization - lisp lisp-xyz cups) +(use-package-modules wm gnome networking virtualization + lisp lisp-xyz cups fonts gnupg) (use-service-modules cups desktop networking ssh xorg docker virtualization pm sound dbus - nix) + nix sddm) (define-public %jd-base-home-services (list - (service home-xdg-mime-applications-service-type - (home-xdg-mime-applications-configuration - (default '((inode/directory . emacs-desktop.desktop) - (application/pdf . emacs-desktop.desktop))) - (desktop-entries - (list (xdg-desktop-entry - (file "emacs-desktop") - (name "Emacs") - (type 'application) - (config - '((exec . "emacsclient -a emacs %u")))))))) - - (service home-redshift-service-type - (home-redshift-configuration - (location-provider 'manual) - (latitude 51.919438) - (longitude 19.145136))) ;; Poland - - (simple-service 'some-useful-env-vars-service - home-environment-variables-service-type - `(("GTK_THEME" . "Adwaita:dark") - ("VISUAL" . "emacsclient") - ("EDITOR" . "emacsclient") - ("PATH" . "$HOME/.bin:$HOME/.npm-global/bin:$PATH") - ("XDG_DATA_DIRS" . "$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share") - ("SBCL_HOME" . "/run/current-system/profile/lib/sbcl/"))) - - (service home-gpg-agent-service-type - (home-gpg-agent-configuration - (pinentry-program - (file-append pinentry "/bin/pinentry")) - (ssh-support? #t) - (default-cache-ttl 28800) - (max-cache-ttl 28800) - (default-cache-ttl-ssh 28800) - (max-cache-ttl-ssh 28800))) + ;; (service home-redshift-service-type + ;; (home-redshift-configuration + ;; (location-provider 'manual) + ;; (latitude 51.919438) + ;; (longitude 19.145136))) + ;; Poland (service home-dbus-service-type) - + (service home-emacs-service-type) (service home-desktop-service-type) - (service home-polkit-gnome-service-type))) + + ;; Dont know why, but when i put home-gpg-agent-service-type as an + ;; extension in home-desktop-service-type service it doesn't work. + (service home-gpg-agent-service-type + (home-gpg-agent-configuration + (pinentry-program + (file-append pinentry-gnome3 "/bin/pinentry-gnome3")) + (ssh-support? #t) + (default-cache-ttl 28800) + (max-cache-ttl 28800) + (default-cache-ttl-ssh 28800) + (max-cache-ttl-ssh 28800))) + ;; (service home-polkit-gnome-service-type) + )) (define-public %jakub-user @@ -82,7 +68,6 @@ "audio" ;; control audio devices "video" ;; access to webcam "dialout" ;; access to /dev/ttyUSBX devices - "adbusers" )))) (define-public %jd-base-user-accounts @@ -105,6 +90,8 @@ sbcl-stumpwm-battery-portable sbcl-stumpwm-stumptray + sbcl-stumpwm-ttf-fonts + sbcl-drakma sbcl-yason @@ -121,21 +108,54 @@ "xf86-input-libinput" "intel-vaapi-driver" "libva-utils" ;; vainfo - "nss-certs" + ;; "nss-certs" -- it is in %base-packages from fdfd7667c66cf9ce746330f39bcd366e124460e1 "nix"))) (define-public %jd-base-packages (append %root-packages - %stumpwm-packages + ;; %stumpwm-packages %base-packages)) (define-public %jd-base-services (cons* (service openssh-service-type) - (set-xorg-configuration - (xorg-configuration ;for Xorg - (keyboard-layout (keyboard-layout "pl")))) + ;; (set-xorg-configuration + ;; (xorg-configuration ;for Xorg + ;; (keyboard-layout (keyboard-layout "pl")))) + ;; (service greetd-service-type + ;; (greetd-configuration + ;; ;; We need to give the greeter user these permissions, otherwise + ;; ;; Sway will crash on launch. + ;; (greeter-supplementary-groups (list "video" "input")) + ;; (terminals + ;; (list (greetd-terminal-configuration + ;; (terminal-vt "1") + ;; (terminal-switch #t)) + ;; (greetd-terminal-configuration + ;; (terminal-vt "2")) + ;; (greetd-terminal-configuration + ;; (terminal-vt "3")) + ;; (greetd-terminal-configuration + ;; (terminal-vt "4")) + ;; (greetd-terminal-configuration + ;; (terminal-vt "5")) + ;; (greetd-terminal-configuration + ;; (terminal-vt "6")))))) + + (service console-font-service-type + (map (lambda (tty) + (cons tty (file-append + font-terminus + "/share/consolefonts/ter-112n"))) + '("tty1" "tty2" "tty3" "tty4" "tty5" "tty6"))) + + (service screen-locker-service-type + (screen-locker-configuration + (name "swaylock") + (program (file-append swaylock "/bin/swaylock")) + (using-pam? #t) + (using-setuid? #f))) (service network-manager-service-type (network-manager-configuration @@ -180,7 +200,17 @@ (append (list (plain-file "non-guix.pub" "(public-key (ecc (curve Ed25519) (q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#)))")) %default-authorized-guix-keys)))) - (delete network-manager-service-type)))) + (delete network-manager-service-type) + ;; (delete mingetty-service-type) + (delete console-font-service-type) + + (delete pulseaudio-service-type) + (delete alsa-service-type) + (delete (if (string-prefix? "x86_64" + (or (%current-target-system) + (%current-system))) + gdm-service-type + sddm-service-type))))) ;; Odin is a base for my operating systems (define-public odin-free diff --git a/guix/jd/desktops/mimir.scm b/guix/jd/desktops/mimir.scm index 742f8c5..7d9823d 100644 --- a/guix/jd/desktops/mimir.scm +++ b/guix/jd/desktops/mimir.scm @@ -18,17 +18,17 @@ (swap-devices (list (swap-space (target (uuid - "658793cb-d374-426e-bcd5-00d032b003a0"))))) + "5402ec34-85b8-4716-9c37-3d38c452ef98"))))) (file-systems (cons* (file-system (mount-point "/boot/efi") - (device (uuid "64D8-134F" + (device (uuid "1A88-DB36" 'fat32)) (type "vfat")) (file-system (mount-point "/") (device (uuid - "1f9304b0-5623-4248-ab66-534b5ac85876" + "640c44ea-125f-4410-a8de-3ec0fb3656c4" 'ext4)) (type "ext4")) %base-file-systems)))) diff --git a/guix/jd/home/services/desktop.scm b/guix/jd/home/services/desktop.scm index bb4916e..c53377f 100644 --- a/guix/jd/home/services/desktop.scm +++ b/guix/jd/home/services/desktop.scm @@ -4,51 +4,165 @@ #:use-module (gnu packages networking) #:use-module (gnu packages syncthing) #:use-module (gnu packages gnome) + #:use-module (gnu packages gnupg) #:use-module (gnu services) #:use-module (gnu services configuration) #:use-module (gnu home services) #:use-module (gnu home services shepherd) #:use-module (gnu home services desktop) + #:use-module (gnu home services sound) + #:use-module (gnu home services xdg) + #:use-module (gnu home services gnupg) #:use-module (guix gexp)) (define (desktop-profile-service config) - (specifications->packages '("udiskie" + (specifications->packages '(;; sway + "swayfx" + "swaylock" + "swayidle" + "waybar" + "fuzzel" + "foot" + "mako" + "wl-clipboard" + "wlsunset" + "grimshot" + + "udiskie" + ;; rest + "qutebrowser" + "ungoogled-chromium" + "firefox" + "tor-client" + "signal-desktop" + + "pulsemixer" + "pavucontrol" + "alsa-utils" + + "virt-manager" + + "flatpak" + "redshift" + "fontmanager" + + "polybar" + + "blueman" + + "xdg-utils" + "xdg-dbus-proxy" + "xdg-desktop-portal-gtk" + "xdg-desktop-portal-wlr" + "glib:bin" + "gtk+:bin" + "gnome-keyring" + "shared-mime-info" + "libnotify" + "dconf" + "hicolor-icon-theme" + + "dunst" + + "gimp" + "inkscape" + + "mpv" + "youtube-dl" + + "pamixer" + "playerctl" + "scrot" + "brightnessctl" + "upower" + "tlp" + "feh" + "alacritty" + + "curl" + "wget" + "zip" + "unzip" + "qrencode" + "trash-cli" + "pandoc" + "password-store" + "oath-toolkit" + ;; "pinentry" + + "syncthing" "syncthing-gtk" - "network-manager-applet"))) - -(define (desktop-shepherd-services config) - (list (shepherd-service - (documentation "Udiskie daemon with tray.") - (provision '(udiskie)) - (start #~(make-forkexec-constructor - (list #$(file-append udiskie - "/bin/udiskie") - "-t"))) - (stop #~(make-kill-destructor))) - - (shepherd-service - (documentation "Syncthing daemon with tray.") - (provision '(syncthing-gtk)) - (start #~(make-forkexec-constructor - (list #$(file-append syncthing-gtk - "/bin/syncthing-gtk") - "-m"))) - (stop #~(make-kill-destructor))) - - (shepherd-service - (documentation "NetworkManager tray.") - (provision '(nm-applet)) - (start #~(make-forkexec-constructor - (list #$(file-append network-manager-applet - "/bin/nm-applet")))) - (stop #~(make-kill-destructor))))) + + "xmodmap" + "xrandr" + "arandr" + "xss-lock" + "libinput" + "xinput" + "xprop" + "rlwrap" + + "nheko" + "quassel"))) + +(define (desktop-environment-variables-service config) + `(("GTK_THEME" . "Adwaita:dark") + ("VISUAL" . "emacsclient") + ("EDITOR" . "emacsclient") + ("PATH" . "$HOME/.bin:$HOME/.npm-global/bin:$PATH") + ("XDG_DATA_DIRS" . "$XDG_DATA_DIRS:$HOME/.local/share/flatpak/exports/share") + ("SBCL_HOME" . "/run/current-system/profile/lib/sbcl/") + + ;; Set Wayland-specific environment variables (taken from RDE) + ("XDG_CURRENT_DESKTOP" . "sway") + ("XDG_SESSION_TYPE" . "wayland") + ("RTC_USE_PIPEWIRE" . "true") + ("SDL_VIDEODRIVER" . "wayland") + ("MOZ_ENABLE_WAYLAND" . "1") + ("CLUTTER_BACKEND" . "wayland") + ("ELM_ENGINE" . "wayland_egl") + ("ECORE_EVAS_ENGINE" . "wayland-egl") + ("QT_QPA_PLATFORM" . "wayland-egl"))) + +(define (desktop-xdg-mime-applications-service config) + (home-xdg-mime-applications-configuration + (default '((inode/directory . emacsclient.desktop) + (application/pdf . emacsclient.desktop) + (x-scheme-handler/http= . firefox.desktop) + (x-scheme-handler/https= . firefox.desktop))) + ;; (desktop-entries + ;; (list (xdg-desktop-entry + ;; (file "emacs-desktop") + ;; (name "Emacs") + ;; (type 'application) + ;; (config + ;; '((exec . "emacsclient -a emacs %u")))))) + )) + +(define (desktop-gpg-agent-service config) + (home-gpg-agent-configuration + (pinentry-program + (file-append pinentry-gnome3 "/bin/pinentry-gnome3")) + (ssh-support? #t) + (default-cache-ttl 28800) + (max-cache-ttl 28800) + (default-cache-ttl-ssh 28800) + (max-cache-ttl-ssh 28800))) + (define-public home-desktop-service-type - (service-type (name 'home-udiskie) + (service-type (name 'home-desktop) (extensions (list (service-extension home-profile-service-type desktop-profile-service) - (service-extension home-shepherd-service-type - desktop-shepherd-services))) + (service-extension home-environment-variables-service-type + desktop-environment-variables-service) + (service-extension home-pipewire-service-type + (lambda (_) (home-pipewire-configuration))) + (service-extension home-xdg-mime-applications-service-type + desktop-xdg-mime-applications-service) + (service-extension home-gpg-agent-service-type + desktop-gpg-agent-service) + )) (default-value #f) (description "Runs desktop services."))) diff --git a/guix/jd/home/services/emacs.scm b/guix/jd/home/services/emacs.scm new file mode 100644 index 0000000..5eb74e8 --- /dev/null +++ b/guix/jd/home/services/emacs.scm @@ -0,0 +1,112 @@ +(define-module (jd home services emacs) + #:use-module (jd packages emacs) + + #:use-module (gnu packages) + #:use-module (gnu packages emacs) + + #:use-module (gnu services) + #:use-module (gnu services configuration) + #:use-module (gnu home services) + #:use-module (gnu home services shepherd) + #:use-module (gnu home services desktop) + + #:use-module (guix gexp) + #:use-module (guix packages) + #:use-module (guix profiles)) + +(define-configuration home-emacs-service-configuration + (emacs-package + (package emacs-next-pgtk) + "Emacs packages")) + +(define (emacs-profile-service config) + (append (list emacs-org-roam-ui + emacs-lsp-mode! + (home-emacs-service-configuration-emacs-package + config)) + (specifications->packages '("emacs-sway" + "emacs-shackle" + "emacs-ytdl" + "emacs-desktop-environment" + "emacs-exwm" + "emacs-perspective" + "emacs-mu4e-alert" + "mu" + "isync" + "emacs-htmlize" + "emacs-bluetooth" + "emacs-nov-el" + "emacs-password-store" + "emacs-mastodon" + "emacs-elfeed" + "emacs-pdf-tools" + "emacs-emms" + "emacs-all-the-icons-dired" + "emacs-vterm" + "emacs-restclient" + "emacs-magit" + "emacs-neotree" + "emacs-projectile" + "emacs-company-box" + "emacs-company" + "emacs-docker" + "emacs-yaml-mode" + "emacs-web-mode" + "emacs-flycheck" + "emacs-tide" + "emacs-cider" + "emacs-typescript-mode" + "emacs-pyvenv" + "emacs-geiser-guile" + "emacs-racket-mode" + "emacs-geiser-racket" + "emacs-geiser" + "emacs-sly" + "emacs-rainbow-delimiters" + "emacs-paredit" + ;; "emacs-lsp-ivy" + ;; "emacs-lsp-mode" + "emacs-org-pomodoro" + "emacs-org-roam" + "emacs-org-roam-bibtex" + "emacs-org-superstar" + "emacs-org" + "emacs-ox-pandoc" + "emacs-beacon" + "emacs-all-the-icons" + "emacs-which-key" + "emacs-counsel" + "emacs-ivy" + "emacs-hl-todo" + "emacs-diminish" + "emacs-solarized-theme" + "font-terminus" + "emacs-undo-tree" + "emacs-hydra" + "emacs-multiple-cursors" + "emacs-general" + "emacs-guix" + "emacs-doom-modeline" + "emacs-use-package")))) + +(define (emacs-shepherd-services config) + (list (shepherd-service + (documentation "Emacs daemon.") + (provision '(emacs)) + (start #~(make-forkexec-constructor + (list #$(file-append (home-emacs-service-configuration-emacs-package + config) + "/bin/emacs") + "--fg-daemon"))) + (stop #~(make-kill-destructor))))) + +(define-public home-emacs-service-type + (service-type (name 'home-emacs) + (extensions (list (service-extension home-profile-service-type + emacs-profile-service) + (service-extension home-shepherd-service-type + emacs-shepherd-services) + )) + (default-value (home-emacs-service-configuration)) + (description "Runs emacs daemon service."))) + diff --git a/guix/jd/packages/emacs.scm b/guix/jd/packages/emacs.scm new file mode 100644 index 0000000..0b9b19d --- /dev/null +++ b/guix/jd/packages/emacs.scm @@ -0,0 +1,57 @@ +(define-module (jd packages emacs) + #:use-module (gnu packages emacs-xyz) + #:use-module (gnu packages) + #:use-module (guix packages) + #:use-module (guix git-download) + #:use-module (guix build-system emacs) + #:use-module ((guix licenses) #:prefix license:) + #:export (emacs-org-roam-ui + emacs-lsp-mode!)) + + +(define emacs-org-roam-ui + (let ((commit "9474a254390b1e42488a1801fed5826b32a8030b") + (revision "0")) + (package + (name "emacs-org-roam-ui") + (version (git-version "0" revision commit)) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/org-roam/org-roam-ui") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0v54vxh95izch74wz2dl2dkdqicbvshra55l6qvd4xl5qmfhpjdc")))) + (build-system emacs-build-system) + (arguments + `(#:include (cons "^out" %default-include))) + (propagated-inputs + (list emacs-org-roam emacs-websocket emacs-simple-httpd emacs-f)) + (home-page "https://github.com/org-roam/org-roam-ui") + (synopsis "A graphical frontend for your org-roam Zettelkasten") + (description " Org-Roam-UI is a frontend for exploring and interacting +with your @code{org-roam} notes. It is meant a successor of +@code{org-roam-server} that extends functionality of org-roam with a Web app +that runs side-by-side with Emacs.") + (license license:gpl3+)))) + + + +(define emacs-lsp-mode! + (let ((commit "808c4d0ab9f19bb92c56716cf59df89432b63f5d") + (revision "1")) + (package + (inherit emacs-lsp-mode) + (name "emacs-lsp-mode") + (version (git-version "8.0.1" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/emacs-lsp/lsp-mode") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0ridjhzndwjj8947vabq05njgnns74hi69x77axgcbv1c4nasz2y"))))))) diff --git a/guix/jd/utils.scm b/guix/jd/utils.scm index 5be7fa9..f4a35c1 100644 --- a/guix/jd/utils.scm +++ b/guix/jd/utils.scm @@ -3,15 +3,24 @@ ;; This code is copied and modified from (gnu packages) module. -(define %jd-patch-path +(define (make-custom-load-path dir-path) (make-parameter (map (lambda (directory) - (let ((jd-patch-dir (string-append directory "/jd/packages/patches"))) - (if (and (file-exists? jd-patch-dir) - (file-is-directory? jd-patch-dir)) - jd-patch-dir + (let ((custom-dir (string-append directory dir-path))) + (if (and (file-exists? custom-dir) + (file-is-directory? custom-dir)) + custom-dir directory))) - %load-path))) + %load-path))) + +(define (make-custom-searcher load-path) + (lambda (file-name) + (or (search-path (load-path) file-name) + (raise (string-append file-name + ": not found"))))) + +(define %jd-patch-path (make-custom-load-path "/jd/packages/patches")) +(define %jd-dot-files-path (make-custom-load-path "/jd/home/services/dotfiles")) (define (jd-search-patch file-name) "Search the patch FILE-NAME. Raise an error if not found." -- cgit v1.2.3