summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Coquand <marc@mccd.space>2024-11-26 11:05:50 +0200
committerMarc Coquand <marc@mccd.space>2024-11-26 11:05:50 +0200
commitd555a9c6bb8f224ac32f3d26c482fa78d3891511 (patch)
tree4561ba36c2bec9542b58cc0d0b6236a1edeaa61f
parentf2267f63134432923e9e7a7ad900532bec6a5bd6 (diff)
downloadguix-d555a9c6bb8f224ac32f3d26c482fa78d3891511.tar.gz
guix-d555a9c6bb8f224ac32f3d26c482fa78d3891511.tar.bz2
guix-d555a9c6bb8f224ac32f3d26c482fa78d3891511.zip
-rw-r--r--guix.org3
-rw-r--r--home/config.scm10
-rw-r--r--home/dots/.config/kmonad.config33
-rw-r--r--home/dots/.emacs236
-rwxr-xr-xhome/dots/.xinitrc4
-rw-r--r--os/config.scm28
-rwxr-xr-xos/custom/caps-brightness2
-rw-r--r--os/custom/caps-brightness.scm31
8 files changed, 245 insertions, 102 deletions
diff --git a/guix.org b/guix.org
index 2f686d9..1ae0124 100644
--- a/guix.org
+++ b/guix.org
@@ -14,6 +14,9 @@
[[file:../runs/results-system-reconfigure.txt]]
* Adding nonguix to guile
+:PROPERTIES:
+:ID: 6d74275e-5dbe-4f59-9b8d-3d7f94e91a8a
+:END:
You'll need to clone nonguix
diff --git a/home/config.scm b/home/config.scm
index 131bdbe..3474ad9 100644
--- a/home/config.scm
+++ b/home/config.scm
@@ -53,13 +53,15 @@
#:use-module (gnu packages man)
#:use-module (gnu packages chromium)
#:use-module (gnu packages llvm)
- #:use-module (gnu packages cmake)
+ #:use-module (gnu packages cmake)
+ #:use-module (gnu packages version-control)
#:use-module (guix gexp)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (gnu packages video)
#:use-module (gnu packages mp3)
- #:use-module (gnu packages haskell-xyz)
+ #:use-module (gnu packages haskell-xyz)
+ #:use-module (gnu packages haskell-apps)
#:use-module (guix build-system go)
#:use-module (gnu home services pm)
#:use-module (gnu home services xdg)
@@ -94,6 +96,10 @@
mp3info
ungoogled-chromium
pandoc
+ kmonad
+ git
+ ((compose list specification->package+output)
+ "git:send-email")
steam
diff --git a/home/dots/.config/kmonad.config b/home/dots/.config/kmonad.config
new file mode 100644
index 0000000..f0f26e5
--- /dev/null
+++ b/home/dots/.config/kmonad.config
@@ -0,0 +1,33 @@
+(defcfg
+ input (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd")
+ output (uinput-sink "My KMonad output" "sleep 2; xset r rate 200 60;")
+
+ ;; Comment this if you want unhandled events not to be emitted
+ fallthrough true
+
+ ;; Set this to false to disable any command-execution in KMonad
+ allow-cmd true
+ )
+
+(defsrc caps lmet lalt lsft rsft lmet rmet)
+
+;; (defalias
+;; ctl-lck (stepped
+;; (around (cmd-button "dbus-send --session --print-reply --reply-timeout=2000 --type=method_call --dest=org.emacs.ctrl /on org.freedesktop.DBus.Introspectable.Introspect") (press-only lctl))
+;; (around (cmd-button "dbus-send --session --print-reply --reply-timeout=2000 --type=method_call --dest=org.emacs.ctrl /off org.freedesktop.DBus.Introspectable.Introspect") (release-only lctl))))
+
+(defalias
+ slc (sticky-key 700 lctl)
+ slm (sticky-key 700 lmet)
+ sla (sticky-key 700 lalt)
+ slf (sticky-key 700 lsft)
+ srf (sticky-key 700 rsft))
+
+(deflayer mine
+ @slc
+ @slm
+ @sla
+ @slf
+ @srf
+ (sticky-key 700 lmet)
+ (sticky-key 700 rmet))
diff --git a/home/dots/.emacs b/home/dots/.emacs
index 0d04e89..4be104a 100644
--- a/home/dots/.emacs
+++ b/home/dots/.emacs
@@ -298,6 +298,15 @@
(use-package window
:custom
(switch-to-buffer-obey-display-actions t)
+ :bind
+ (("C-x C-}" . enlarge-window-horizontally)
+ ("C-x C-o" . other-window)
+ :repeat-map
+ move-up-repeat-map
+ (("v" . scroll-down-command))
+ :repeat-map
+ move-down-repeat-map
+ (("v" . scroll-up-command)))
:config
(add-to-list 'display-buffer-alist '("*Async Shell Command*" display-buffer-no-window (nil))))
@@ -403,69 +412,59 @@
(:map scheme-mode-map
("C-." . nil)))
-(defun mccd/store-remarks ()
- (concat "~/personal-db/notes/"
- (file-name-base (org-remark-notes-file-name-function))
- "-remark.org"))
-
-(use-package battery
- :init
- (display-battery-mode t))
-
-(use-package comint
- :bind
- ((:repeat-map
- repeat-hist-line-map
- ("n" . comint-next-input)
- ("p" . comint-previous-input))))
-
(use-package repeat
:demand t
:bind
(("C-z" . repeat)
- :repeat-map
- repeat-basic-movement-map
+ :repeat-map move-repeat-map
("n" . next-line)
- ("p" . previous-line)
- ("f" . forward-char)
- ("M-f" . forward-word)
- ("M-b" . backward-word)
- ("o" . avy-goto-char-timer)
- ("b" . backward-char)
("e" . move-end-of-line)
- ("v" . scroll-up-command)
- ("M-v" . scroll-down-command)
- ("M-e" . forward-sentence)
("a" . move-beginning-of-line)
- :repeat-map
- repeat-repeat-map
- ("z" . repeat)
- :repeat-map
- repeat-undo-map
- ("/" . undo)
- ("?" . undo-redo)
- :repeat-map
- repeat-kill-map
- ("d" . delete-char)
- ("M-d" . kill-word)
- ("k" . kill-line)
- :repeat-map
- repeat-movement-map
+ ("b" . backward-char)
+ ("f" . forward-char)
+ ("p" . previous-line)
+ ("o" . avy-goto-char-timer)
+ :repeat-map sexp-move-repeat-map
+ ("n" . forward-list)
+ ("p" . backward-list)
("e" . end-of-defun)
+ ("a" . beginning-of-defun)
("f" . forward-sexp)
- ("n" . forward-list)
- ("p" . backward-list)
- ("d" . down-list)
- ("u" . up-list)
("b" . backward-sexp)
- ("a" . beginning-of-defun))
+ :repeat-map forward-words-repeat-map
+ ("f" . forward-word)
+ ("e" . forward-sentence)
+ ("a" . backward-sentence)
+ ("b" . backward-word)
+ :repeat-map undo-redo-repeat-map
+ ("/" . undo)
+ ("?" . redo)
+ :repeat-map kill-lines-repeat-map
+ ("k" . kill-line)
+ :repeat-map kill-lines-org-repeat-map
+ ("k" . org-kill-line)
+ :repeat-map delete-repeat-map
+ ("d" . delete-char)
+ :repeat-map kill-word-repeat-map
+ ("d" . kill-word))
:custom
(repeat-on-final-keystroke t)
(set-mark-command-repeat-pop t)
- (repeat-exit-key (kbd "<TAB>"))
+ (repeat-exit-key (kbd "i"))
:config
(repeat-mode 1))
+(use-package battery
+ :init
+ (display-battery-mode t))
+
+(use-package comint
+ :bind
+ ((:repeat-map
+ repeat-hist-line-map
+ ("n" . comint-next-input)
+ ("p" . comint-previous-input))))
+
(use-package eww
:custom
(eww-auto-rename-buffer t)
@@ -507,18 +506,6 @@
("p" . git-gutter:previous-hunk))
:ensure t)
-;; (use-package gnus
-;; :custom
-;; (gnus-select-method
-;; '(nnimap "imap.fastmail.com"
-;; (nnimap-expunge t)))
-;; (mail-sources '((file)))
-;; (gnus-secondary-select-methods '((nnml "")))
-;; (gnus-asynchronous t)
-;; (gnus-use-article-prefetch t)
-;; (gnus-agent t))
-
-
(use-package git-gutter-fringe
:ensure t)
@@ -576,8 +563,9 @@
:ensure t
:custom
(avy-timeout-seconds 0.2)
+ :bind
+ ("M-o" . avy-goto-char-timer)
:config
- (global-set-key (kbd "M-o") 'avy-goto-char-timer)
(set-face-attribute 'avy-lead-face nil :inherit 'fixed-pitch)
(set-face-attribute 'avy-lead-face-0 nil :inherit 'fixed-pitch)
(set-face-attribute 'avy-lead-face-1 nil :inherit 'fixed-pitch)
@@ -609,7 +597,6 @@
(save-excursion (yank))
t)
-
(setf (alist-get ?y avy-dispatch-alist) 'avy-action-yank
(alist-get ?w avy-dispatch-alist) 'avy-action-copy
(alist-get ?W avy-dispatch-alist) 'avy-action-copy-whole-line
@@ -663,7 +650,8 @@
(use-package expand-region
:ensure t
:bind
- ("C-." . er/expand-region))
+ ("C-." . er/expand-region)
+ ("C--" . er/contract-region))
(use-package devdocs
:ensure t
@@ -759,6 +747,45 @@
(global-set-key (kbd "M-<") 'insert-pair)
(global-set-key (kbd "M-[") 'insert-pair))
+(use-package dbus
+ :config
+ (defun ctrl-lock-on ()
+ (set-cursor-color "red")
+ (setq ctrl-lock-state t)
+ (force-mode-line-update t))
+ (defun ctrl-lock-off ()
+ (set-cursor-color "black")
+ (setq ctrl-lock-state nil)
+ (force-mode-line-update t))
+ :bind
+ (("C-x C-2" . split-window-below)
+ ("C-x C-0" . delete-window)
+ ("C-<return>" . newline)
+ ("C-M-d" . kill-word)
+ ("C-x C-3" . split-window-right))
+ :init
+ (setq ctrl-lock-state nil)
+ (push '(ctrl-lock-state " [CTRL] " "") global-mode-string)
+ (dbus-register-method
+ :session
+ "org.emacs.ctrl"
+ "/on"
+ dbus-interface-introspectable
+ "Introspect"
+ #'ctrl-lock-on)
+ (dbus-register-method
+ :session
+ "org.emacs.ctrl"
+ "/off"
+ dbus-interface-introspectable
+ "Introspect"
+ #'ctrl-lock-off))
+
+
+
+
+
+
(use-package ido
:init
(ido-mode t))
@@ -887,7 +914,7 @@
(org-hierarchical-todo-statistics t)
(org-refile-allow-creating-parent-nodes 'confirm)
(org-outline-path-complete-in-steps nil)
- (org-refile-use-outline-path 'file)
+ (org-refile-use-outline-path 'level1)
(org-log-done 'time)
(org-indent-line 2)
(org-tags-column 0)
@@ -929,21 +956,27 @@
(org-mode . variable-pitch-mode)))
-(defun me/org-id-insert-link ()
- "Insert at point a link to any heading from `org-agenda-files'."
- (interactive)
- (let ((buffer-pos
- (org-id-find
- (org-id-get-with-outline-path-completion '((nil :maxlevel . 5)
- (org-agenda-files :maxlevel . 5))))))
- (save-excursion
- (with-current-buffer (get-file-buffer (car buffer-pos))
- (goto-char (cdr buffer-pos))
- (call-interactively 'org-store-link)))
- (org-insert-all-links 1 "" " ")))
+
(use-package org-id
:after org
+ :init
+ (defun me/org-id-insert-link ()
+ "Insert at point a link to any heading from `org-agenda-files'."
+ (interactive)
+ (let ((buffer-pos
+ (org-id-find
+ (org-id-get-with-outline-path-completion '((nil :maxlevel . 5)
+ (org-agenda-files :maxlevel . 5))))))
+ (save-excursion
+ (with-current-buffer (get-file-buffer (car buffer-pos))
+ (org-with-wide-buffer
+ (goto-char (cdr buffer-pos))
+ (call-interactively 'org-store-link))))
+ (org-insert-all-links 1 "" " ")))
+ :bind
+ (:map org-mode-map
+ (("C-c i" . me/org-id-insert-link)))
:custom
(org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id))
@@ -981,7 +1014,7 @@
:empty-lines 1)
("g" "Log Coffee"
entry (file+headline "~/personal-db/notes/notes.org" "Log")
- "* Brewed pour-over :coffee:cyprus:paramytha:\n:PROPERTIES:\n:WATER: 320g\n:COFFEE: 25g\n:TYPE: [[id:815450d3-d772-4207-9eb4-e1e185fd8356][La Pastora]] | [[id:9d136656-2965-4be9-87cf-4ecafcf62707][Alemayehu]] | [[id:73a92627-f076-4090-a78c-ef8204191611][Los Chorros]]\n:TEMP: 90\n:RATING:\n:PREHEAT: YES\n:TOTALBREWTIME:\n:END:\n%T\n*** Observations "
+ "* Brewed pour-over :coffee:cyprus:paramytha:\n:PROPERTIES:\n:WATER: 320g\n:COFFEE: 25g\n:TYPE: [[id:815450d3-d772-4207-9eb4-e1e185fd8356][La Pastora]] | [[id:9d136656-2965-4be9-87cf-4ecafcf62707][Alemayehu]] | [[id:73a92627-f076-4090-a78c-ef8204191611][Los Chorros]]\n:TEMP: 90\n:RATING:\n:PREHEAT: YES\n:TOTALBREWTIME:\n:CLICKS:\n:END:\n%T\n*** Observations "
:empty-lines 0
:prepend t)
("r" "Reference"
@@ -1104,19 +1137,7 @@
(use-package simple
:diminish visual-line-mode)
-(defun marc/set-msmtp-account ()
- (if (message-mail-p)
- (save-excursion
- (let*
- ((from (save-restriction
- (message-narrow-to-headers)
- (message-fetch-field "from")))
- (account
- (cond
- ((string-match "marcc@fastmail.fr" from) "home")
- ((string-match "marc.coquand@sustainably.app" from) "work")
- ((string-match "marc@mccd.space" from) "home"))))
- (setq message-sendmail-extra-arguments (list '"-a" account))))))
+
(use-package message
:custom
@@ -1133,6 +1154,21 @@
(use-package sendmail
:defer t
+ :init
+ (defun marc/set-msmtp-account ()
+ (if (message-mail-p)
+ (save-excursion
+ (let*
+ ((from (save-restriction
+ (message-narrow-to-headers)
+ (message-fetch-field "from")))
+ (account
+ (cond
+ ((string-match "marcc@fastmail.fr" from) "home")
+ ((string-match "marc.coquand@sustainably.app" from) "work")
+ ((string-match "marc@coquand.email" from) "home")
+ ((string-match "marc@mccd.space" from) "home"))))
+ (setq message-sendmail-extra-arguments (list '"-a" account))))))
:hook
(message-send-mail . marc/set-msmtp-account)
(message-send-mail . flyspell-mode)
@@ -1143,21 +1179,25 @@
(sendmail-program (executable-find "msmtp"))
(mail-user-agent 'message-user-agent))
-
-(defun rmail-reply-t ()
- "Reply only to the sender of the current message. (See rmail-reply.)"
- (interactive)
- (rmail-reply t))
-
-
(use-package rmail
:init
(defvar selected-rmail-account "")
+ (defun rmail-reply-t ()
+ "Reply only to the sender of the current message. (See rmail-reply.)"
+ (interactive)
+ (rmail-reply t))
+
+ (defun rmail-write-for-patch ()
+ "Writes the mail to an mbox file that you can later run git am on to apply it."
+ (interactive)
+ (rmail-output-as-seen "/tmp/new-patch.patch"))
:bind
(("C-c m" . rmail-open)
+ ("C-c M" . rmail-no-check)
:map rmail-mode-map
("r" . rmail-reply-t)
- ("R" . rmail-reply))
+ ("R" . rmail-reply)
+ ("O" . rmail-write-for-patch))
:config
(defun rmail-no-check ()
(interactive)
@@ -1197,6 +1237,8 @@
rmail-default-file "~/personal-db/mail/home/RMAIL"
rmail-remote-password-required nil
rmail-secondary-file-regexp "~/personal-db/mail/home/archives/*.mbox"
+ rmail-output-file-alist '(("\\[PATCH.*\\]" . "patch.mbox")
+ (".*" . "archive.mbox"))
rmail-file-name "~/personal-db/mail/home/RMAIL"
user-mail-address "marc@mccd.space"
unrmail-mbox-format 'mboxo
diff --git a/home/dots/.xinitrc b/home/dots/.xinitrc
index 81718b8..56e8aad 100755
--- a/home/dots/.xinitrc
+++ b/home/dots/.xinitrc
@@ -22,6 +22,6 @@ gsettings set org.gnome.desktop.interface cursor-size 32
gsettings set org.gnome.desktop.interface cursor-theme Adwaita
# xkbcomp $HOME/.config/keymap_locked_modifier.xkb $DISPLAY &
setxkbmap -layout us -variant colemak -option "caps:nocaps"
-xsetroot -cursor_name left_ptr
-xset r rate 200 60
+xsetroot -cursor_name left_ptr
+kmonad ~/.config/kmonad.config &
exec dbus-run-session emacsclient -c
diff --git a/os/config.scm b/os/config.scm
index 5a1b295..0f491e6 100644
--- a/os/config.scm
+++ b/os/config.scm
@@ -12,6 +12,8 @@
(use-modules (gnu)
(srfi srfi-1)
(nongnu packages linux)
+ (gnu packages haskell-apps)
+ (caps-brightness)
(nongnu system linux-initrd))
(use-service-modules cups desktop networking ssh xorg nix)
(use-package-modules package-management)
@@ -20,6 +22,22 @@
#~(string-append
font-terminus
"/share/consolefonts/ter-132n"))
+(define %sudoers-specification
+ (plain-file "sudoers" "\
+root ALL=(ALL) ALL
+%wheel ALL=(ALL) ALL
+%wheel ALL=(ALL) NOPASSWD: /run/current-system/profile/bin/cpupower
+%wheel ALL=(ALL) NOPASSWD: /run/current-system/profile/bin/umount
+%wheel ALL=(ALL) NOPASSWD: /run/current-system/profile/bin/caps-brightness
+"))
+
+(use-modules
+ (guix gexp)
+ (guix packages)
+ ;; (guix licenses)
+ (guix build-system trivial)
+ (gnu packages bash))
+
(operating-system
@@ -37,7 +55,7 @@
(comment "Marc")
(group "users")
(home-directory "/home/mccd")
- (supplementary-groups '("wheel" "netdev" "audio" "video")))
+ (supplementary-groups '("wheel" "netdev" "audio" "video" "input")))
%base-user-accounts))
;; Packages installed system-wide. Users can also install packages
@@ -46,6 +64,7 @@
(packages (append (list (specification->package "emacs")
(specification->package "emacs-exwm")
(specification->package "nix")
+ (specification->package "caps-brightness")
(specification->package "xf86-input-libinput")
(specification->package "xf86-video-fbdev")
(specification->package "xf86-video-nouveau")
@@ -91,6 +110,11 @@
'("lobste.rs" "lobste.rs")))))
(modify-services %desktop-services
(delete gdm-service-type)
+ (udev-service-type config =>
+ (udev-configuration
+ (inherit config)
+ (rules (cons kmonad
+ (udev-configuration-rules config)))))
(console-font-service-type
conf =>
(map (lambda (tty)
@@ -113,6 +137,8 @@
(target (uuid
"6ee329b8-9475-4675-9c46-b2f68ec97f08")))))
+ (sudoers-file %sudoers-specification)
+
;; The list of file systems that get "mounted". The unique
;; file system identifiers there ("UUIDs") can be obtained
;; by running 'blkid' in a terminal.
diff --git a/os/custom/caps-brightness b/os/custom/caps-brightness
new file mode 100755
index 0000000..4556c33
--- /dev/null
+++ b/os/custom/caps-brightness
@@ -0,0 +1,2 @@
+#!/bin/sh
+setleds -D +caps < /dev/console
diff --git a/os/custom/caps-brightness.scm b/os/custom/caps-brightness.scm
new file mode 100644
index 0000000..dbae748
--- /dev/null
+++ b/os/custom/caps-brightness.scm
@@ -0,0 +1,31 @@
+(define-module (caps-brightness)
+ #:use-module (guix gexp)
+ #:use-module (guix packages)
+ #:use-module (guix build-system trivial)
+ #:use-module (gnu packages bash))
+
+(define-public caps-brightness
+ (let ((script-name "caps-brightness"))
+ (package
+ (name script-name)
+ (version "0.1")
+ (source (local-file "/home/mccd/system/os/custom/caps-brightness"))
+ (build-system trivial-build-system)
+ (arguments
+ `(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (let* ((bin-dir (string-append %output "/bin"))
+ (bin-file (string-append bin-dir "/" ,script-name))
+ (bash-bin (string-append (assoc-ref %build-inputs "bash")
+ "/bin")))
+ (mkdir-p bin-dir)
+ (copy-file (assoc-ref %build-inputs "source") bin-file)
+ (patch-shebang bin-file (list bash-bin))
+ (chmod bin-file #o555)))))
+ (inputs `(("bash" ,bash)))
+ (home-page #f)
+ (synopsis "Set capslock brightness to $1")
+ (description "Set capslock brightness to $1")
+ (license #f))))