From d6d6498ee93ad074855bac8e5d6de2509e078d1f Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 29 Nov 2024 11:12:57 +0100 Subject: [PATCH 01/15] Enable pulsar on Emacs --- hmModules/emacs/init.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hmModules/emacs/init.el b/hmModules/emacs/init.el index d69b69c..82e92b7 100644 --- a/hmModules/emacs/init.el +++ b/hmModules/emacs/init.el @@ -123,9 +123,20 @@ (use-package rainbow-delimiters :hook (prog-mode . rainbow-delimiters-mode)) +(use-package pulsar + :after (consult imenu) + :config + (pulsar-global-mode) + ;; TODO use :hook (I've tried but it didn't work, why?) + (add-hook 'consult-after-jump-hook #'pulsar-recenter-top) + (add-hook 'consult-after-jump-hook #'pulsar-reveal-entry) + (add-hook 'imenu-after-jump-hook #'pulsar-recenter-top) + (add-hook 'imenu-after-jump-hook #'pulsar-reveal-entry) + (add-hook 'next-error-hook #'pulsar-pulse-line) + ) + (use-package clipetty :delight - :ensure t :hook (after-init . global-clipetty-mode)) (use-package nerd-icons) From 1bbd87d36eb40b7310f62428417e9cfd603cdbdc Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 29 Nov 2024 11:13:44 +0100 Subject: [PATCH 02/15] Try consult-focus-lines --- hmModules/emacs/init.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hmModules/emacs/init.el b/hmModules/emacs/init.el index 82e92b7..f192117 100644 --- a/hmModules/emacs/init.el +++ b/hmModules/emacs/init.el @@ -388,8 +388,9 @@ ("C-c f f" . consult-find) ("C-c F" . consult-ripgrep) ("C-c f" . consult-find) - ("C-c l" . consult-line) - ("C-c m" . wconsult-mark) + ("C-c l" . consult-line) + ("C-c L" . consult-focus-lines) + ("C-c m" . consult-mark) ("C-c o o" . consult-outline) ("C-c e" . consult-flymake)) :custom From b676b70273fe40c50375e2e74f0f055f1d84936d Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 29 Nov 2024 11:14:17 +0100 Subject: [PATCH 03/15] Try vundo --- hmModules/emacs/init.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hmModules/emacs/init.el b/hmModules/emacs/init.el index f192117..aaa2856 100644 --- a/hmModules/emacs/init.el +++ b/hmModules/emacs/init.el @@ -274,7 +274,7 @@ '("s" . meow-kill) '("t" . meow-till) '("u" . meow-undo) - '("U" . meow-undo-in-selection) + '("U" . vundo) '("/" . meow-visit) '("v" . meow-visit) '("w" . meow-mark-word) From 5938a873b306036ca78c888dcc2736ec8592a900 Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 29 Nov 2024 11:14:28 +0100 Subject: [PATCH 04/15] Try orderless partial-completion for files --- hmModules/emacs/init.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hmModules/emacs/init.el b/hmModules/emacs/init.el index aaa2856..f3bc5fa 100644 --- a/hmModules/emacs/init.el +++ b/hmModules/emacs/init.el @@ -400,6 +400,8 @@ (use-package orderless :custom (completion-styles '(orderless))) + (completion-styles '(orderless basic)) + (completion-category-overrides '((file (styles basic partial-completion))))) (use-package embark :bind (("C-'" . embark-act) From ff2c16e55eb8ec4ca1facfa221a5fe186198dbbb Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 29 Nov 2024 11:14:45 +0100 Subject: [PATCH 05/15] Enable aggressive-indent for lisps --- hmModules/emacs/init.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hmModules/emacs/init.el b/hmModules/emacs/init.el index f3bc5fa..c60fe35 100644 --- a/hmModules/emacs/init.el +++ b/hmModules/emacs/init.el @@ -564,6 +564,9 @@ :hook ((lisp-mode . enable-paredit-mode) (emacs-lisp-mode . enable-paredit-mode))) +(use-package aggressive-indent + :hook ((lisp-mode . aggressive-indent-mode) + (emacs-lisp-mode . aggressive-indent-mode))) (use-package eldoc :delight) From 6efc109f1cd775979037795d24daa3b9d3dbe3dc Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 29 Nov 2024 11:16:06 +0100 Subject: [PATCH 06/15] Format --- hmModules/emacs/init.el | 197 ++++++++++++++++++++-------------------- 1 file changed, 99 insertions(+), 98 deletions(-) diff --git a/hmModules/emacs/init.el b/hmModules/emacs/init.el index c60fe35..e1bd97a 100644 --- a/hmModules/emacs/init.el +++ b/hmModules/emacs/init.el @@ -33,8 +33,8 @@ (use-package consult-eglot :after (consult eglot embark) :config - (require 'consult-eglot-embark) - (consult-eglot-embark-mode) + (require 'consult-eglot-embark) + (consult-eglot-embark-mode) ) (use-package emacs @@ -156,8 +156,8 @@ (treemacs-load-theme "nerd-icons")) (use-package nerd-icons-dired - :hook - (dired-mode . nerd-icons-dired-mode)) + :hook + (dired-mode . nerd-icons-dired-mode)) (use-package indent-bars :config @@ -169,7 +169,7 @@ (indent-bars-color-by-depth '(:regexp "outline-\\([0-9]+\\)" :blend 0.4)) (indent-bars-no-stipple-char (string-to-char "┋")) (indent-bars-prefer-character 't) ;; so it works also in terminal -) + ) (use-package diredfl :config (diredfl-global-mode)) @@ -321,27 +321,27 @@ (call-interactively 'ccr/h-resize)) (t (push key unread-command-events)))) :bind (("C-c w k" . windmove-up) - ("C-c w l" . windmove-right) - ("C-c w j" . windmove-down) - ("C-c w h" . windmove-left) - ("M-k" . windmove-up) - ("M-l" . windmove-right) - ("M-j" . windmove-down) - ("M-h" . windmove-left) - ("C-c w " . windmove-up) - ("C-c w " . windmove-right) - ("C-c w " . windmove-down) - ("C-c w " . windmove-left) - ("C-c w q" . delete-window) - ("C-c w K" . windmove-delete-up) - ("C-c w L" . windmove-delete-right) - ("C-c w J" . windmove-delete-down) - ("C-c w H" . windmove-delete-left) - ("C-c w x" . kill-buffer-and-window) - ("C-c w v" . split-window-right) - ("C-c w s" . split-window-below) - ("C-c w V" . ccr/v-resize) - ("C-c w S" . ccr/h-resize))) + ("C-c w l" . windmove-right) + ("C-c w j" . windmove-down) + ("C-c w h" . windmove-left) + ("M-k" . windmove-up) + ("M-l" . windmove-right) + ("M-j" . windmove-down) + ("M-h" . windmove-left) + ("C-c w " . windmove-up) + ("C-c w " . windmove-right) + ("C-c w " . windmove-down) + ("C-c w " . windmove-left) + ("C-c w q" . delete-window) + ("C-c w K" . windmove-delete-up) + ("C-c w L" . windmove-delete-right) + ("C-c w J" . windmove-delete-down) + ("C-c w H" . windmove-delete-left) + ("C-c w x" . kill-buffer-and-window) + ("C-c w v" . split-window-right) + ("C-c w s" . split-window-below) + ("C-c w V" . ccr/v-resize) + ("C-c w S" . ccr/h-resize))) (use-package vertico :custom @@ -352,8 +352,8 @@ (vertico-cycle t) (vertico-mode t) :bind (:map vertico-map - (("DEL" . vertico-directory-delete-char) - ("C-DEL" . vertico-directory-delete-word)))) + (("DEL" . vertico-directory-delete-char) + ("C-DEL" . vertico-directory-delete-word)))) ;; (use-package vertico-posframe ;; :after vertico @@ -381,25 +381,24 @@ ([remap goto-line] . consult-goto-line) ([remazp imenu] . consult-imenu) ([remap project-switch-to-buffer] . consult-project-buffer) - ("C-c b b" . consult-project-buffer) - ("C-c b B" . consult-buffer) - ("C-c g l" . consult-goto-line) - ("C-c b i" . consult-imenu) - ("C-c f f" . consult-find) - ("C-c F" . consult-ripgrep) - ("C-c f" . consult-find) - ("C-c l" . consult-line) - ("C-c L" . consult-focus-lines) - ("C-c m" . consult-mark) - ("C-c o o" . consult-outline) - ("C-c e" . consult-flymake)) + ("C-c b b" . consult-project-buffer) + ("C-c b B" . consult-buffer) + ("C-c g l" . consult-goto-line) + ("C-c b i" . consult-imenu) + ("C-c f f" . consult-find) + ("C-c F" . consult-ripgrep) + ("C-c f" . consult-find) + ("C-c l" . consult-line) + ("C-c L" . consult-focus-lines) + ("C-c m" . consult-mark) + ("C-c o o" . consult-outline) + ("C-c e" . consult-flymake)) :custom (xref-show-xrefs-function #'consult-xref) (xref-show-definitions-function #'consult-xref)) (use-package orderless :custom - (completion-styles '(orderless))) (completion-styles '(orderless basic)) (completion-category-overrides '((file (styles basic partial-completion))))) @@ -417,9 +416,9 @@ (tab-always-indent 'complete) (kind-icon-default-face 'corfu-default) :bind (:map corfu-map - (("M-d" . corfu-doc-toggle) - ("M-l" . corfu-show-location) - ("SPC" . corfu-insert-separator))) + (("M-d" . corfu-doc-toggle) + ("M-l" . corfu-show-location) + ("SPC" . corfu-insert-separator))) :init (global-corfu-mode)) @@ -487,7 +486,7 @@ :feature 'function :override t `((formal) @font-lock-type-face) - + :language 'nix :feature 'function `((attrpath) @font-lock-function-name-face) @@ -509,8 +508,8 @@ (use-package typescript-ts-mode :hook ((typescript-ts-mode . (lambda () - (require 'eglot) - (eglot-ensure)))) + (require 'eglot) + (eglot-ensure)))) :mode "\\.ts\\'") (use-package haskell-ts-mode @@ -567,6 +566,7 @@ (use-package aggressive-indent :hook ((lisp-mode . aggressive-indent-mode) (emacs-lisp-mode . aggressive-indent-mode))) + (use-package eldoc :delight) @@ -577,10 +577,10 @@ (eldoc-box-lighter "ElBox") :bind (("C-c h" . eldoc-box-help-at-point))) - (use-package diff-hl - :init - (global-diff-hl-mode 1) - (diff-hl-margin-mode 1)) +(use-package diff-hl + :init + (global-diff-hl-mode 1) + (diff-hl-margin-mode 1)) (use-package envrc :config @@ -612,7 +612,7 @@ (use-package eshell :init (require 'eshell) ;; this slows down Emacs startup but it's needed when starting eshell with - ;; emacsclient --eval before opening another eshell buffer directly from inside Emacs + ;; emacsclient --eval before opening another eshell buffer directly from inside Emacs (eat-eshell-mode) (eat-eshell-visual-command-mode) :custom ((eshell-prefer-lisp-functions t) @@ -669,18 +669,19 @@ (use-package popper :custom - (popper-reference-buffers '("\*Messages\*" - "Output\*$" - "\\*Async Shell Command\\*" - (completion-list-mode . hide) - help-mode - compilation-mode - "^\\*Nix-REPL*\\*$" nix-repl-mode ;eshell as a popup - "^\\*.+-eshell.*\\*$" eshell-mode ;eshell as a popup - "^\\*shell.*\\*$" shell-mode ;shell as a popup - "^\\*term.*\\*$" term-mode ;term as a popup - "^\\*eat.*\\*$" eat-mode ;eat as a popup - )) + (popper-reference-buffers + '("\*Messages\*" + "Output\*$" + "\\*Async Shell Command\\*" + (completion-list-mode . hide) + help-mode + compilation-mode + "^\\*Nix-REPL*\\*$" nix-repl-mode + "^\\*.+-eshell.*\\*$" eshell-mode + "^\\*shell.*\\*$" shell-mode + "^\\*term.*\\*$" term-mode + "^\\*eat.*\\*$" eat-mode + )) (popper-window-height 0.33) (popper-echo-lines 1) (popper-mode-line nil) @@ -768,18 +769,18 @@ This is meant to be an helper to be called from the window manager." ;; FIXME the following doesn't work when using the daemon, it should be executed only ;; one time after the first frame is created :hook (server-after-make-frame . (lambda () - (set-face-font 'variable-pitch "Dejavu Serif-14") - (set-face-font 'fixed-pitch "Iosevka Comfy-14") - (set-face-font 'org-table "Iosevka Comfy-14") - (set-face-font 'org-meta-line "Iosevka Comfy-14") - (set-face-font 'org-drawer "Iosevka Comfy-14") - (set-face-font 'org-special-keyword "Iosevka Comfy-14") - (set-face-font 'org-property-value "Iosevka Comfy-14") - (set-face-font 'org-block "Iosevka Comfy-14") - (set-face-font 'org-modern-tag "Iosevka Comfy-14") - (set-face-font 'org-modern-date-active "Iosevka Comfy-14") - (set-face-font 'org-modern-date-inactive "Iosevka Comfy-14"))) -) + (set-face-font 'variable-pitch "Dejavu Serif-14") + (set-face-font 'fixed-pitch "Iosevka Comfy-14") + (set-face-font 'org-table "Iosevka Comfy-14") + (set-face-font 'org-meta-line "Iosevka Comfy-14") + (set-face-font 'org-drawer "Iosevka Comfy-14") + (set-face-font 'org-special-keyword "Iosevka Comfy-14") + (set-face-font 'org-property-value "Iosevka Comfy-14") + (set-face-font 'org-block "Iosevka Comfy-14") + (set-face-font 'org-modern-tag "Iosevka Comfy-14") + (set-face-font 'org-modern-date-active "Iosevka Comfy-14") + (set-face-font 'org-modern-date-inactive "Iosevka Comfy-14"))) + ) (use-package org-roam :custom @@ -812,23 +813,23 @@ This is meant to be an helper to be called from the window manager." (string-to-number (cdr (assoc "SPENT" (org-roam-node-properties node))))) (defun org-roam-node-date (node) "Return the org datestring when a node was created (obtained from the filename)" - (format "<%s>" (file-name-sans-extension (file-name-nondirectory (org-roam-node-file node))))) + (format "<%s>" (file-name-sans-extension (file-name-nondirectory (org-roam-node-file node))))) (org-roam-ql-defpred - 'date-range - "Check if node was created in given time range" - #'org-roam-node-date - #'(lambda (node-date start-date end-date) - (let ((node-date (condition-case nil - ;; if the entry is not from the journal (i.e. the filename is not something like "2024-10-10.org") - ;; then it's always discarded (the epoch time is given to it) - (encode-time (org-parse-time-string node-date)) - (error (encode-time (org-parse-time-string "<1970-01-01>"))))) - (start-date (encode-time (org-parse-time-string start-date))) - (end-date (encode-time (org-parse-time-string end-date)))) - (and (time-less-p start-date node-date) - (time-less-p node-date end-date))) - )) + 'date-range + "Check if node was created in given time range" + #'org-roam-node-date + #'(lambda (node-date start-date end-date) + (let ((node-date (condition-case nil + ;; if the entry is not from the journal (i.e. the filename is not something like "2024-10-10.org") + ;; then it's always discarded (the epoch time is given to it) + (encode-time (org-parse-time-string node-date)) + (error (encode-time (org-parse-time-string "<1970-01-01>"))))) + (start-date (encode-time (org-parse-time-string start-date))) + (end-date (encode-time (org-parse-time-string end-date)))) + (and (time-less-p start-date node-date) + (time-less-p node-date end-date))) + )) (defun ccr/org-roam-spent-hours (client &optional date-start date-end) "Return the total spent hours on something (usually a client)" @@ -868,13 +869,13 @@ This is meant to be an helper to be called from the window manager." ("C-c n s" . consult-org-roam-search)) (use-package org-roam-ui - :after org-roam - :hook (after-init . org-roam-ui-mode) ;; don't care about startup time since I'm using Emacs daemonized - :config - (setq org-roam-ui-sync-theme t - org-roam-ui-follow t - org-roam-ui-update-on-save t - org-roam-ui-open-on-start nil)) + :after org-roam + :hook (after-init . org-roam-ui-mode) ;; don't care about startup time since I'm using Emacs daemonized + :config + (setq org-roam-ui-sync-theme t + org-roam-ui-follow t + org-roam-ui-update-on-save t + org-roam-ui-open-on-start nil)) (use-package gptel :custom From da236805f58c4b57a10cf282033336934630934b Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 29 Nov 2024 11:17:35 +0100 Subject: [PATCH 07/15] Add chirp home-manager module --- hmModules/chirp/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 hmModules/chirp/default.nix diff --git a/hmModules/chirp/default.nix b/hmModules/chirp/default.nix new file mode 100644 index 0000000..7353aee --- /dev/null +++ b/hmModules/chirp/default.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +let +in +# nixpkgs = builtins.getFlake "github:NixOS/nixpkgs/932fc16b263f26803d3960e4400bc13dde84a972"; +# chirp = nixpkgs.legacyPackages.${pkgs.system}.chirp; +{ + home.packages = [ pkgs.chirp ]; +} From a121569f84ac91d380924b42fb66a010b72c6b49 Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 29 Nov 2024 11:17:45 +0100 Subject: [PATCH 08/15] Do not use gpg for ssh keys anymore --- hmModules/gpg/default.nix | 1 - hosts/janeway/default.nix | 1 - lib/default.nix | 1 - modules/ssh-initrd/default.nix | 1 - secrets/secrets.nix | 58 +++++++++++++++------------------- 5 files changed, 26 insertions(+), 36 deletions(-) diff --git a/hmModules/gpg/default.nix b/hmModules/gpg/default.nix index 469c27a..d3aa919 100644 --- a/hmModules/gpg/default.nix +++ b/hmModules/gpg/default.nix @@ -3,7 +3,6 @@ services.gpg-agent = { enable = true; enableSshSupport = true; - sshKeys = [ "CE2FD0D9BECBD8876811714925066CC257413416" ]; extraConfig = let pinentryRofi = pkgs.writeShellApplication { diff --git a/hosts/janeway/default.nix b/hosts/janeway/default.nix index 150e4e0..59733f6 100644 --- a/hosts/janeway/default.nix +++ b/hosts/janeway/default.nix @@ -46,7 +46,6 @@ in $DRY_RUN_CMD echo ${hosts.sisko} >> "${config.user.home}/.ssh/authorized_keys" $DRY_RUN_CMD echo ${hosts.kirk} >> "${config.user.home}/.ssh/authorized_keys" $DRY_RUN_CMD echo ${users.ccr-ssh} >> "${config.user.home}/.ssh/authorized_keys" - $DRY_RUN_CMD echo ${users.ccr-gpg} >> "${config.user.home}/.ssh/authorized_keys" if [[ ! -d "${sshdDirectory}" ]]; then $DRY_RUN_CMD rm $VERBOSE_ARG --recursive --force "${sshdTmpDirectory}" diff --git a/lib/default.nix b/lib/default.nix index 7b98ca0..a923f7d 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,7 +1,6 @@ { keys = { users = { - ccr-gpg = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC5cEUx25pnZiH3eBrE2xNbJ92gJiKSznDUNRzcEL4ti6FlJm+75p4q0hgdqHwStR8+uCWBL6viVFCGutOVMFE5MX1Oc3A8fJdR6H9Rrwvk/1UQzqzc9tWxw1qPLKz+fnPDomjOvNofghCWQRwX3Xf1HnIqvRwELpNbR9i+/cHkDGzLJxkstbt4gol8ywMPkw02QdKk8s5MEd1vawxc+7Chs0JPW57RDqDYFErYys52JLeAViCBB9bofF+KT42LuRXKSjWlvCV9kR5TL49vUeBgzMQWMh++WQdN4m9lpqFqYyc75I49/E0HGf8LChDSS+hvRnb5MbtnVGjEA4WDHyldmJCvUNob5CUo4FjoSPRi+S/J3Ads8D4JVwaJOJEVqmMKEhiQ0Hzk4hwe3eV/VumlZj4U/QjaCrqqi4TW/iP0gNRfzcfiM+G/z5R7w1NMUpTX7oilyKjMQmGnXB857D3SSptS7dwh5OiKhVmrQMRCduooUsj236abqLU28K//RnxhOgh8kDGgoUHApnTiMZNKhgLiR42lKrubNcW1tAAqoNyFLMwwXeMLjh0iP1b5y8ntfNPNIcGb7vcwpS24z/aIjW7rQ4J7x5EBphHGhys6ne+irdhOM8c7kFr+c8+Q2oU0YAtFuMYztAFOHm1e20X00Zvys2nuee+hT9F1NungAQ== andrea.ciceri@autistici.org"; ccr-ssh = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCzCmDCtlGscpesHuoiruVWD2IjYEFtaIl9Y2JZGiOAyf3V17KPx0MikcknfmxSHi399SxppiaXQHxo/1wjGxXkXNTTv6h1fBuqwhJE6C8+ZSV+gal81vEnXX+/9w2FQqtVgnG2/mO7oJ0e3FY+6kFpOsGEhYexoGt/UxIpAZoqIN+CWNhJIASUkneaZWtgwiL8Afb59kJQ2E7WbBu+PjYZ/s5lhPobhlkz6s8rkhItvYdiSHT0DPDKvp1oEbxsxd4E4cjJFbahyS8b089NJd9gF5gs0b74H/2lUUymnl63cV37Mp4iXB4rtE69MbjqsGEBKTPumLualmc8pOGBHqWIdhAqGdZQeBajcb6VK0E3hcU0wBB+GJgm7KUzlAHGdC3azY0KlHMrLaZN0pBrgCVR6zBNWtZz2B2qMBZ8Cw+K4vut8GuspdXZscID10U578GxQvJAB9CdxNUtrzSmKX2UtZPB1udWjjIAlejzba4MG73uXgQEdv0NcuHNwaLuCWxTUT5QQF18IwlJ23Mg8aPK8ojUW5A+kGHAu9wtgZVcX1nS5cmYKSgLzcP1LA1l9fTJ1vqBSuy38GTdUzfzz7AbnkRfGPj2ALDgyx17Rc5ommjc1k0gFoeIqiLaxEs5FzDcRyo7YvZXPsGeIqNCYwQWw3+U+yUEJby8bxGb2d/6YQ== andrea.ciceri@autistici.org"; oneplus8t = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO8da1Mf11vXFF0kVDgxocVoGwpHHMEs9emS9T+v8hLb oneplus8t"; hercules-ci-agent = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGPupm00BiveTIYF6CNwuMijF5VvEaPDMjvt+vMlAy+N hercules-ci-agent"; diff --git a/modules/ssh-initrd/default.nix b/modules/ssh-initrd/default.nix index a67e1f3..067f08d 100644 --- a/modules/ssh-initrd/default.nix +++ b/modules/ssh-initrd/default.nix @@ -15,7 +15,6 @@ HostKey /ssh_initrd_host_ed25519_key ''; authorizedKeys = with (import ../../lib).keys; [ - users.ccr-gpg users.ccr-ssh hosts.sisko ]; diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 52a3217..2cebf84 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -6,7 +6,6 @@ with keys.users; { "cachix-personal-token.age".publicKeys = [ ccr-ssh - ccr-gpg mothership kirk sisko @@ -15,90 +14,85 @@ with keys.users; ]; "magit-forge-github-token.age".publicKeys = [ ccr-ssh - ccr-gpg mothership kirk ]; "git-workspace-tokens.age".publicKeys = [ ccr-ssh - ccr-gpg mothership kirk picard ]; "hydra-admin-password.age".publicKeys = [ ccr-ssh - ccr-gpg mothership ]; "hydra-github-token.age".publicKeys = [ ccr-ssh - ccr-gpg mothership ]; "cache-private-key.age".publicKeys = [ ccr-ssh - ccr-gpg mothership ]; "autistici-password.age".publicKeys = [ ccr-ssh - ccr-gpg + kirk picard sisko ]; "hercules-ci-join-token.age".publicKeys = [ ccr-ssh - ccr-gpg + mothership sisko picard ]; "hercules-ci-binary-caches.age".publicKeys = [ ccr-ssh - ccr-gpg + mothership sisko picard ]; "hercules-ci-secrets-json.age".publicKeys = [ ccr-ssh - ccr-gpg + mothership sisko picard ]; "minio-credentials.age".publicKeys = [ ccr-ssh - ccr-gpg + picard sisko ]; "aws-credentials.age".publicKeys = [ ccr-ssh - ccr-gpg + picard sisko ]; "nextcloud-admin-pass.age".publicKeys = [ ccr-ssh - ccr-gpg + sisko ]; "home-planimetry.age".publicKeys = [ ccr-ssh - ccr-gpg + sisko ]; "home-assistant-token.age".publicKeys = [ ccr-ssh - ccr-gpg + sisko ]; "chatgpt-token.age".publicKeys = [ ccr-ssh - ccr-gpg + kirk mothership picard @@ -106,86 +100,86 @@ with keys.users; ]; "cloudflare-dyndns-api-token.age".publicKeys = [ ccr-ssh - ccr-gpg + sisko ]; "restic-hetzner-password.age".publicKeys = [ ccr-ssh - ccr-gpg + picard sisko kirk ]; "hass-ssh-key.age".publicKeys = [ ccr-ssh - ccr-gpg + sisko ]; "grafana-password.age".publicKeys = [ ccr-ssh - ccr-gpg + sisko ]; "matrix-registration-shared-secret.age".publicKeys = [ ccr-ssh - ccr-gpg + sisko ]; "matrix-sliding-sync-secret.age".publicKeys = [ ccr-ssh - ccr-gpg + sisko ]; "forgejo-runners-token.age".publicKeys = [ ccr-ssh - ccr-gpg + picard ]; "forgejo-nix-access-tokens.age".publicKeys = [ ccr-ssh - ccr-gpg + picard ]; "garmin-collector-environment.age".publicKeys = [ ccr-ssh - ccr-gpg + sisko ]; "hetzner-storage-box-sisko-ssh-password.age".publicKeys = [ ccr-ssh - ccr-gpg + sisko ]; "sisko-restic-password.age".publicKeys = [ ccr-ssh - ccr-gpg + sisko ]; "sisko-attic-environment-file.age".publicKeys = [ ccr-ssh - ccr-gpg + sisko ]; # WireGuard "picard-wireguard-private-key.age".publicKeys = [ ccr-ssh - ccr-gpg + picard ]; "sisko-wireguard-private-key.age".publicKeys = [ ccr-ssh - ccr-gpg + sisko ]; "kirk-wireguard-private-key.age".publicKeys = [ ccr-ssh - ccr-gpg + kirk ]; "deltaflyer-wireguard-private-key.age".publicKeys = [ ccr-ssh - ccr-gpg + deltaflyer ]; } From 49f2ada271af79a0c5707e5fe26affa70e3cb26e Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 29 Nov 2024 11:18:55 +0100 Subject: [PATCH 09/15] Persist adguard-home state --- modules/adguard-home/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/adguard-home/default.nix b/modules/adguard-home/default.nix index 988b8ca..a1ec2aa 100644 --- a/modules/adguard-home/default.nix +++ b/modules/adguard-home/default.nix @@ -2,6 +2,7 @@ services.adguardhome = { enable = true; port = 3000; + mutableSettings = true; settings = { openFirewall = true; }; @@ -11,4 +12,7 @@ 53 ]; networking.firewall.allowedUDPPorts = [ 53 ]; + environment.persistence."/persist".directories = [ + "/var/lib/AdGuardHome" + ]; } From f4feb18c9aa854a2cbfc9692edf67d211e542467 Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 29 Nov 2024 11:19:15 +0100 Subject: [PATCH 10/15] Add vundo, pulsar and aggressive-indent emacs packages --- packages/emacs/packages.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/emacs/packages.nix b/packages/emacs/packages.nix index 7b1d204..cf81eca 100644 --- a/packages/emacs/packages.nix +++ b/packages/emacs/packages.nix @@ -117,6 +117,7 @@ let agenix solidity-mode telega + aggressive-indent # org-re-reveal # FIXME very not nice hash mismatch when building ] ) @@ -126,6 +127,8 @@ let ef-themes indent-bars ement + vundo + pulsar ]) ++ (with nongnuPackages; [ eat From d7000927a39c2caa4aeaf7c9b5c603402157c279 Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 29 Nov 2024 11:19:47 +0100 Subject: [PATCH 11/15] Enable chirp on picard --- hosts/picard/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts/picard/default.nix b/hosts/picard/default.nix index fd17130..5842bf7 100644 --- a/hosts/picard/default.nix +++ b/hosts/picard/default.nix @@ -90,6 +90,7 @@ "libreoffice" "emacs" "vial" + "chirp" ]; extraGroups = [ ]; backupPaths = [ ]; From 96bca1f66985f60ea93d15f11567c35bda367f1e Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 29 Nov 2024 11:20:08 +0100 Subject: [PATCH 12/15] Catpuccin theme for forgejo --- modules/forgejo/default.nix | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/modules/forgejo/default.nix b/modules/forgejo/default.nix index d67ccc5..a0940ab 100644 --- a/modules/forgejo/default.nix +++ b/modules/forgejo/default.nix @@ -1,11 +1,35 @@ { config, + pkgs, + lib, ... }: +let + theme = pkgs.fetchzip { + url = "https://github.com/catppuccin/gitea/releases/download/v1.0.1/catppuccin-gitea.tar.gz"; + hash = "sha256-et5luA3SI7iOcEIQ3CVIu0+eiLs8C/8mOitYlWQa/uI="; + stripRoot = false; + }; +in { + systemd.services = { + forgejo = { + preStart = + let + inherit (config.services.forgejo) stateDir; + in + lib.mkAfter '' + rm -rf ${stateDir}/custom/public/assets + mkdir -p ${stateDir}/custom/public/assets + ln -sf ${theme} ${stateDir}/custom/public/assets/css + ''; + }; + }; + services.forgejo = { # TODO migrate to Postgres enable = true; + package = pkgs.forgejo; settings = { DEFAULT = { RUN_MODE = "prod"; # set to prod for better logs (worse performance) @@ -18,6 +42,7 @@ HTTP_PORT = 3002; ROOT_URL = "https://git.aciceri.dev"; }; + federation.ENABLED = true; mailer = { ENABLED = true; PROTOCOL = "smtp+starttls"; @@ -29,6 +54,20 @@ other = { SHOW_FOOTER_VERSION = false; }; + ui = { + DEFAULT_THEME = "catppuccin-mocha-blue"; + THEMES = builtins.concatStringsSep "," ( + [ "auto,forgejo-auto,forgejo-dark,forgejo-light,arc-gree,gitea" ] + ++ (map (name: lib.removePrefix "theme-" (lib.removeSuffix ".css" name)) ( + builtins.attrNames (builtins.readDir theme) + )) + ); + }; + "ui.meta" = { + AUTHOR = "Andrea Ciceri"; + DESCRIPTION = "My personal git forge"; + KEYWORDS = "git,self-hosted,forgejo,open-source,nix,nixos"; + }; }; secrets.mailer.PASSWD = config.age.secrets.autistici-password.path; dump.enable = true; From 4da58e8adc572af882007f6828f193ccc8873503 Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 29 Nov 2024 11:20:28 +0100 Subject: [PATCH 13/15] Update garmin-connect home assistant integration --- modules/home-assistant/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/home-assistant/default.nix b/modules/home-assistant/default.nix index 9cde4b4..a7cf05f 100644 --- a/modules/home-assistant/default.nix +++ b/modules/home-assistant/default.nix @@ -13,8 +13,8 @@ let garmin_connect = pkgs.fetchFromGitHub { owner = "cyberjunky"; repo = "home-assistant-garmin_connect"; - rev = "d42edcabc67ba6a7f960e849c8aaec1aabef87c0"; - hash = "sha256-KqbP6TpH9B0/AjtsW5TcWSNgUhND+w8rO6X8fHqtsDI="; + rev = "e2deaed42b66c982b150ca9a9e543031ad51228c"; + hash = "sha256-TtrcgLGnhNRBF1SqKMkPlEi/XEBUtDAnaWfzkh50+D8="; }; in { From 45a78e44b49614bd8d16296cd7a54f75b9b68e6b Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 29 Nov 2024 11:20:41 +0100 Subject: [PATCH 14/15] Use home assistant local tuya integrations --- modules/home-assistant/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/home-assistant/default.nix b/modules/home-assistant/default.nix index a7cf05f..b0e4a63 100644 --- a/modules/home-assistant/default.nix +++ b/modules/home-assistant/default.nix @@ -51,6 +51,10 @@ in "wake_on_lan" "prometheus" ]; + customComponents = with pkgs.home-assistant-custom-components; [ + tuya_local + localtuya + ]; extraPackages = python3Packages: with python3Packages; [ # used by pun_sensor From 54d97e55d9f97da9ffa50ab660fd8dab62189e5f Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 29 Nov 2024 11:21:00 +0100 Subject: [PATCH 15/15] CI script to report checks to forgejo --- modules/forgejo-runners/default.nix | 2 ++ .../forgejo-report-checks/forgejo-report-checks.py | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/forgejo-runners/default.nix b/modules/forgejo-runners/default.nix index e9b52b9..3234a46 100644 --- a/modules/forgejo-runners/default.nix +++ b/modules/forgejo-runners/default.nix @@ -3,6 +3,7 @@ config, pkgs, lib, + fleetFlake, ... }: let @@ -24,6 +25,7 @@ let curl tea attic-client + fleetFlake.packages.${pkgs.system}.forgejo-report-checks ] }; do for bin in "$dir"/bin/*; do diff --git a/packages/forgejo-report-checks/forgejo-report-checks.py b/packages/forgejo-report-checks/forgejo-report-checks.py index 7ea3f2c..a66a825 100644 --- a/packages/forgejo-report-checks/forgejo-report-checks.py +++ b/packages/forgejo-report-checks/forgejo-report-checks.py @@ -6,16 +6,17 @@ from os import environ client = AuthenticatedClient(base_url=environ["GITHUB_API_URL"], token=environ["GITHUB_TOKEN"]) -print("hello") - with open('result.json', 'r') as file: data = json.load(file) +print("Reporting statuses acording to the following result.json") +print(json.dumps(data, indent=2)) + for result in data['results']: attr = result['attr'] success = result['success'] type = result['type'] - print(attr) + print(f"Report status success={success} for {type} {attr}") response = repo_create_status.sync_detailed( owner="aciceri", repo="nixfleet", @@ -24,7 +25,9 @@ for result in data['results']: body=CreateStatusOption( context=type, description=attr, - target_url="https://google.com", + target_url="https://git.aciceri.dev", # FIXME state="success" if success else "failure" # ma be pending,success,failure,error_message ) ) + +print("Done reporting statuses")