Compare commits

..

No commits in common. "79c98d1e5da10da32bf5119d78d4abcd64b509ca" and "197af4cb558d6a34971df47aa14f3f05132ddd9d" have entirely different histories.

11 changed files with 119 additions and 352 deletions

View file

@ -566,16 +566,13 @@
:mode "\\.hs\\'" :mode "\\.hs\\'"
:config :config
(add-to-list 'eglot-server-programs (add-to-list 'eglot-server-programs
'(haskell-ts-mode . ("haskell-language-server" "--lsp")))) '(haskell-ts-mode . ("haskell-language-server-wrapper" "--lsp"))))
(use-package tidal
:custom ((tidal-interpreter "tidal")))
(use-package purescript-mode (use-package purescript-mode
:custom ((project-vc-extra-root-markers '("spago.dhall"))) :custom ((project-vc-extra-root-markers '("spago.dhall")))
:hook ((purescript-mode . eglot-ensure) :hook ((purescript-mode . eglot-ensure)
(purescript-mode . turn-on-purescript-indentation) (purescript-mode . turn-on-purescript-indentation)
(purescript-mode . (lambda () (setq project-vc-extra-root-markers '("spago.dhall")))))) (purescript-mode . (lambda () (setq project-vc-extra-root-markers '("spago.dhall"))))))
(use-package terraform-mode (use-package terraform-mode
:after eglot :after eglot
@ -599,15 +596,6 @@
(use-package gptscript-mode (use-package gptscript-mode
:mode "\\.gpt\\'") :mode "\\.gpt\\'")
(use-package gptscript-mode
:mode "\\.gpt\\'")
(use-package typst-ts-mode
:config
(add-to-list 'eglot-server-programs
'(typst-ts-mode . ("tinymist" "lsp")))
:mode "\\.typ\\'")
;; FIXME ;; FIXME
;; (use-package mmm-mode ;; (use-package mmm-mode
;; :config ;; :config
@ -625,7 +613,7 @@
(use-package paredit (use-package paredit
:delight :delight
:hook ((lisp-mode . enable-paredit-mode) :hook ((lisp-mode . enable-paredit-mode)
(emacs-lisp-mode . enable-paredit-mode))) (emacs-lisp-mode . enable-paredit-mode)))
(use-package aggressive-indent (use-package aggressive-indent
:hook ((lisp-mode . aggressive-indent-mode) :hook ((lisp-mode . aggressive-indent-mode)
@ -1031,15 +1019,15 @@ This is meant to be an helper to be called from the window manager."
:custom :custom
(gptel-model 'google/gemini-2.5-flash-preview) (gptel-model 'google/gemini-2.5-flash-preview)
(gptel-backend (gptel-make-openai "OpenRouter" (gptel-backend (gptel-make-openai "OpenRouter"
:host "openrouter.ai" :host "openrouter.ai"
:endpoint "/api/v1/chat/completions" :endpoint "/api/v1/chat/completions"
:key (lambda () (require 'f) (f-read-text (getenv "OPENAI_API_KEY_PATH"))) :key (lambda () (require 'f) (f-read-text (getenv "OPENAI_API_KEY_PATH")))
:stream t :stream t
:models '(google/gemini-2.5-flash-preview)) :models '(google/gemini-2.5-flash-preview))
) )
(gptel-default-mode 'org-mode) (gptel-default-mode 'org-mode)
(gptel-org-branching-context nil) ;; this is cool but I don't feel comfortable with it (gptel-org-branching-context nil) ;; this is cool but I don't feel comfortable with it
(gptel-use-tools 't) (gptel-use-tools nil)
:bind :bind
("C-c a a" . gptel-add) ("C-c a a" . gptel-add)
@ -1054,163 +1042,80 @@ This is meant to be an helper to be called from the window manager."
;; (add-hook 'gptel-post-response-functions 'gptel-end-of-response) ;; (add-hook 'gptel-post-response-functions 'gptel-end-of-response)
;; (add-hook 'gptel-post-stream-hook 'gptel-auto-scroll) ;; (add-hook 'gptel-post-stream-hook 'gptel-auto-scroll)
(defun ccr/edit-buffer (buffer-name old-string new-string) (setq gptel-tools (mapcar (lambda (tool) (apply #'gptel-make-tool tool))
"In BUFFER-NAME, replace OLD-STRING with NEW-STRING." '((
(with-current-buffer buffer-name :name "create_file"
(let ((case-fold-search nil)) ;; Case-sensitive search :function (lambda (path filename content)
(save-excursion (let ((full-path (expand-file-name filename path)))
(goto-char (point-min)) (with-temp-buffer
(let ((count 0)) (insert content)
(while (search-forward old-string nil t) (write-file full-path))
(setq count (1+ count))) (format-read "Created file %s in %s" filename path)))
(if (= count 0) :description "Create a new file with the specified content"
(format "Error: Could not find text to replace in buffer %s" buffer-name) :args (list '(:name "path"
(if (> count 1) :type string
(format "Error: Found %d matches for the text to replace in buffer %s" count buffer-name) :description "The directory where to create the file")
(goto-char (point-min)) '(:name "filename"
(search-forward old-string) :type string
(replace-match new-string t t) :description "The name of the file to create")
(format "Successfully edited buffer %s" buffer-name)))))))) '(:name "content"
:type string
(defun ccr/replace-buffer (buffer-name content) :description "The content to write to the file"))
"Completely replace contents of BUFFER-NAME with CONTENT." :category "filesystem"
(with-current-buffer buffer-name )
(erase-buffer) ;; (
(insert content) ;; :name "run_command"
(format "Buffer replaced: %s" buffer-name))) ;; :confirm 't
;; :function (lambda (command)
(setq gptel-tools `( ;; (shell-command-to-string command))
,(gptel-make-tool ;; :description "Run arbitrary commands"
:function (lambda (url) ;; :args (list '(:name "command"
(with-current-buffer (url-retrieve-synchronously url) ;; :type string
(goto-char (point-min)) ;; :description "The content to run e.g. 'ls *' or 'fd <pattern> <path>'"))
(forward-paragraph) ;; )
(let ((dom (libxml-parse-html-region (point) (point-max)))) (
(run-at-time 0 nil #'kill-buffer (current-buffer)) :name "get_weather"
(with-temp-buffer :function (lambda (location)
(shr-insert-document dom) (url-retrieve-synchronously "api.weather.com/..."
(buffer-substring-no-properties (point-min) (point-max)))))) location unit))
:name "read_url" :description "Get the current weather in a given location"
:description "Fetch and read the contents of a URL" :args (list '(:name "location"
:args (list '(:name "url" :type string
:type string :description "The city and state, e.g. San Francisco, CA")
:description "The URL to read")) '(:name "unit"
:category "web") :type string
,(gptel-make-tool :enum ["celsius" "farenheit"]
:function (lambda (filepath) :description
(with-temp-buffer "The unit of temperature, either 'celsius' or 'fahrenheit"
(insert-file-contents (expand-file-name filepath)) :optional t
(buffer-string))) ))
:name "read_file" )
:description "Read and display the contents of a file" ))
:args (list '(:name "filepath" )
:type string
:description "Path to the file to read. Supports relative paths and ~."))
:category "filesystem")
,(gptel-make-tool
:function (lambda (directory)
(mapconcat #'identity
(directory-files directory)
"\n"))
:name "list_directory"
:description "List the contents of a given directory"
:args (list '(:name "directory"
:type string
:description "The path to the directory to list"))
:category "filesystem")
,(gptel-make-tool
:function (lambda () (mapcar 'buffer-name (buffer-list)))
:name "list_buffers"
:description "Return a list containing all the Emacs buffers"
:category "emacs")
,(gptel-make-tool
:function (lambda (buffer)
(unless (buffer-live-p (get-buffer buffer))
(error "Error: buffer %s is not live." buffer))
(with-current-buffer buffer
(buffer-substring-no-properties (point-min) (point-max))))
:name "read_buffer"
:description "Return the contents of an Emacs buffer"
:args (list '(:name "buffer"
:type string
:description "The name of the buffer whose contents are to be retrieved"))
:category "emacs")
,(gptel-make-tool
:function (lambda (buffer text)
(with-current-buffer (get-buffer-create buffer)
(save-excursion
(goto-char (point-max))
(insert text)))
(format "Appended text to buffer %s" buffer))
:name "append_to_buffer"
:description "Append text to an Emacs buffer. If the buffer does not exist, it will be created."
:confirm t
:args (list '(:name "buffer"
:type string
:description "The name of the buffer to append text to.")
'(:name "text"
:type string
:description "The text to append to the buffer."))
:category "emacs")
,(gptel-make-tool
:name "EditBuffer"
:function #'ccr/edit-buffer
:description "Edits Emacs buffers"
:confirm t
:args '((:name "buffer_name"
:type string
:description "Name of the buffer to modify"
:required t)
(:name "old_string"
:type string
:description "Text to replace (must match exactly)"
:required t)
(:name "new_string"
:type string
:description "Text to replace old_string with"
:required t))
:category "edit")
,
(gptel-make-tool
:name "ReplaceBuffer"
:function #'ccr/replace-buffer
:description "Completely overwrites buffer contents"
:confirm t
:args '((:name "buffer_name"
:type string
:description "Name of the buffer to overwrite"
:required t)
(:name "content"
:type string
:description "Content to write to the buffer"
:required t))
:category "edit")
))
(defun ccr/suggest-eshell-command () (defun ccr/suggest-eshell-command ()
(interactive) (interactive)
(save-excursion (save-excursion
(eshell-bol) (eshell-bol)
(let ((start-pos (point)) (let ((start-pos (point))
(end-pos (line-end-position))) (end-pos (line-end-position)))
(gptel-request (gptel-request
(buffer-substring-no-properties start-pos end-pos) ;the prompt (buffer-substring-no-properties start-pos end-pos) ;the prompt
:system "You are proficient with emacs shell (eshell), translate the following to something I could directly prompt to the shell. Your responses should only be code, without explanation or formatting or quoting." :system "You are proficient with emacs shell (eshell), translate the following to something I could directly prompt to the shell. Your responses should only be code, without explanation or formatting or quoting."
:buffer (current-buffer) :buffer (current-buffer)
:context (cons (set-marker (make-marker) start-pos) :context (cons (set-marker (make-marker) start-pos)
(set-marker (make-marker) end-pos)) (set-marker (make-marker) end-pos))
:callback :callback
(lambda (response info) (lambda (response info)
(if (not response) (if (not response)
(message "ChatGPT response failed with: %s" (plist-get info :status)) (message "ChatGPT response failed with: %s" (plist-get info :status))
(kill-region start-pos end-pos) (kill-region start-pos end-pos)
(insert response))))))) (insert response)))))))
(add-to-list 'display-buffer-alist (add-to-list 'display-buffer-alist
'("^\\*ChatGPT\\*" '("^\\*ChatGPT\\*"
(display-buffer-full-frame) (display-buffer-full-frame)
(name . "floating"))) (name . "floating")))
(defun ccr/start-chatgpt () ;; Used from outside Emacs by emacsclient --eval (defun ccr/start-chatgpt () ;; Used from outside Emacs by emacsclient --eval
(display-buffer (gptel "*ChatGPT*")) (display-buffer (gptel "*ChatGPT*"))
@ -1226,9 +1131,9 @@ This is meant to be an helper to be called from the window manager."
(require 'password-store-otp) ;; FIXME use `use-pacakge' idiomatic way (require 'password-store-otp) ;; FIXME use `use-pacakge' idiomatic way
:bind (("C-c p p" . password-store-copy) :bind (("C-c p p" . password-store-copy)
("C-c p o" . password-store-otp-token-copy) ("C-c p o" . password-store-otp-token-copy)
("C-c p e" . password-store-edit) ("C-c p e" . password-store-edit)
("C-c p i" . password-store-insert))) ("C-c p i" . password-store-insert)))
(use-package with-editor (use-package with-editor
:init (shell-command-with-editor-mode +1)) :init (shell-command-with-editor-mode +1))

View file

@ -2,7 +2,7 @@
{ {
services.gpg-agent = { services.gpg-agent = {
enable = true; enable = true;
pinentry.package = pkgs.pinentry-rofi.override { pinentryPackage = pkgs.pinentry-rofi.override {
rofi = pkgs.rofi-wayland; rofi = pkgs.rofi-wayland;
}; };
extraConfig = '' extraConfig = ''

View file

@ -1,61 +0,0 @@
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"palette": {
"os": "#ACB0BE",
"closer": "p:os",
"pink": "#F5C2E7",
"lavender": "#B4BEFE",
"blue": "#89B4FA"
},
"blocks": [
{
"alignment": "left",
"segments": [
{
"foreground": "p:blue",
"style": "plain",
"template": "{{ .UserName }}@{{ .HostName }} ",
"type": "session"
},
{
"foreground": "p:pink",
"properties": {
"folder_icon": "..\ue5fe..",
"home_icon": "~",
"style": "agnoster_short"
},
"style": "plain",
"template": "{{ .Path }} ",
"type": "path"
},
{
"foreground": "p:lavender",
"properties": {
"branch_icon": "\ue725 ",
"cherry_pick_icon": "\ue29b ",
"commit_icon": "\uf417 ",
"fetch_status": false,
"fetch_upstream_icon": false,
"merge_icon": "\ue727 ",
"no_commits_icon": "\uf0c3 ",
"rebase_icon": "\ue728 ",
"revert_icon": "\uf0e2 ",
"tag_icon": "\uf412 "
},
"template": "{{ .HEAD }} ",
"style": "plain",
"type": "git"
},
{
"style": "plain",
"foreground": "p:closer",
"template": "\uf105",
"type": "text"
}
],
"type": "prompt"
}
],
"final_space": true,
"version": 3
}

View file

@ -84,12 +84,7 @@
programs.thefuck.enable = true; programs.thefuck.enable = true;
programs.oh-my-posh = { programs.oh-my-posh = {
enable = true; enable = true;
# same as "captuccin_mocha" but without the OS logo useTheme = "catppuccin_mocha";
settings = lib.mkForce (
builtins.fromJSON (
builtins.unsafeDiscardStringContext (builtins.readFile ./catppuccin_mocha.omp.json)
)
);
}; };
programs.zellij.enableBashIntegration = false; programs.zellij.enableBashIntegration = false;

View file

@ -9,18 +9,18 @@ in
{ {
home.packages = [ spotify-adblocked ]; home.packages = [ spotify-adblocked ];
# systemd.user.services.spotify-adblocked = { systemd.user.services.spotify-adblocked = {
# Install.WantedBy = [ "graphical-session.target" ]; Install.WantedBy = [ "graphical-session.target" ];
# Unit = { Unit = {
# Description = "Spotify"; Description = "Spotify";
# PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
# }; };
# Service = { Service = {
# ExecStart = lib.getExe spotify-adblocked; ExecStart = lib.getExe spotify-adblocked;
# Restart = "on-failure"; Restart = "on-failure";
# RestartSec = 3; RestartSec = 3;
# }; };
# }; };
} }

View file

@ -36,8 +36,6 @@
"amule" "amule"
"adguard-home" "adguard-home"
"garmin-grafana" "garmin-grafana"
# "dump1090"
"arbi"
] ]
++ [ ++ [
./disko.nix ./disko.nix

View file

@ -1,46 +1,34 @@
{ config, pkgs, ... }: { config, lib, ... }:
let
rev = "966199fe1dccc9c6c7016bdb1d9582f27797bc02";
amule-flake = builtins.getFlake "github:NixOS/nixpkgs/${rev}";
inherit (amule-flake.legacyPackages.${pkgs.system}) amule-daemon amule-web;
in
{ {
disabledModules = [ "services/networking/amuled.nix" ]; users.users.amule = {
documentation.nixos.enable = false; isSystemUser = true;
group = "amule";
imports = [ "${amule-flake}/nixos/modules/services/networking/amuled.nix" ]; extraGroups = [ "amule" ];
home = config.services.amule.dataDir;
services.amule = {
enable = true;
package = amule-daemon;
amuleWebPackage = amule-web;
openPeerPorts = true;
openWebServerPort = true;
# TODO the service is accessible only from the VPN
# however better using agenix
ExternalConnectPasswordFile = pkgs.writeText "password" "pippo";
WebServerPasswordFile = pkgs.writeText "password" "pippo";
settings = {
eMule = {
IncomingDir = "/mnt/hd/amule";
TempDir = "/mnt/hd/amule/Temp";
};
WebServer = {
Enabled = 1;
};
};
}; };
users.groups.amule = { };
services.amule = {
dataDir = "/mnt/hd/amule";
enable = true;
user = "amule";
};
# sometimes the service crashes with a segfeault without any reason...
systemd.services.amuled.serviceConfig.Restart = lib.mkForce "always";
environment.persistence."/persist".directories = [ environment.persistence."/persist".directories = [
config.services.amule.dataDir config.services.amule.dataDir
]; ];
services.nginx.virtualHosts."amule.sisko.wg.aciceri.dev" = { networking.firewall = {
forceSSL = true; allowedTCPPorts = [ 4662 ];
useACMEHost = "aciceri.dev"; allowedUDPPortRanges = [
locations."/" = { {
proxyPass = "http://localhost:${builtins.toString config.services.amule.settings.WebServer.Port}"; from = 4665;
}; to = 4672;
serverAliases = [ "amule.sisko.zt.aciceri.dev" ]; }
];
}; };
} }

View file

@ -1,22 +0,0 @@
{ config, pkgs, ... }:
let
rev = "d531730d9640160f0519ef4b3640f8da49dd96f8";
arbi-flake = builtins.getFlake "git+ssh://git@github.com/aciceri/arbi.git?rev=${rev}";
in
{
imports = [ arbi-flake.nixosModules.arbi ];
services.arbi = {
enable = true;
log_level = "debug";
configFile = pkgs.writeText "arbi-config.kdl" ''
endpoint "wss://eth-mainnet.g.alchemy.com/v2/<REDACTED>"
pairs_file "pairs.json"
concurrency 4
'';
};
environment.persistence."/persist".directories = [
config.services.arbi.dataDir
];
}

View file

@ -1,31 +0,0 @@
{
pkgs,
...
}:
let
dump1090-flake = builtins.getFlake "github:NixOS/nixpkgs/541f05042033467730fb8cedb08355dc91b94c74";
inherit (dump1090-flake.legacyPackages.${pkgs.system}) dump1090-fa;
in
{
imports = [ "${dump1090-flake}/nixos/modules/services/misc/dump1090-fa.nix" ];
hardware.rtl-sdr.enable = true;
disabledModules = [ "services/misc/dump10190-fa.nix" ];
documentation.nixos.enable = false;
services.dump1090-fa = {
enable = true;
package = dump1090-fa;
};
services.nginx.virtualHosts."dump1090.sisko.wg.aciceri.dev" = {
forceSSL = true;
useACMEHost = "aciceri.dev";
locations = {
"/".alias = "${dump1090-fa}/share/dump1090/";
"/data/".alias = "/run/dump1090-fa/";
};
serverAliases = [ "dump1090.sisko.zt.aciceri.dev" ];
};
}

View file

@ -5,8 +5,7 @@
... ...
}: }:
let let
rev = "f24579d13ee035af96d4a68b765af2aa4b1018b6"; garmin-grafana-flake = builtins.getFlake "github:NixOS/nixpkgs/1f03fefb44665cd2377912033de22ffaba2be48d";
garmin-grafana-flake = builtins.getFlake "github:NixOS/nixpkgs/${rev}";
inherit (garmin-grafana-flake.legacyPackages.${pkgs.system}) garmin-grafana; inherit (garmin-grafana-flake.legacyPackages.${pkgs.system}) garmin-grafana;
in in
{ {

View file

@ -206,7 +206,6 @@ let
mixed-pitch mixed-pitch
visual-replace visual-replace
org-super-agenda org-super-agenda
tidal
# org-re-reveal # FIXME very not nice hash mismatch when building # org-re-reveal # FIXME very not nice hash mismatch when building
] ]
) )
@ -223,9 +222,6 @@ let
eat eat
corfu-terminal corfu-terminal
haskell-ts-mode haskell-ts-mode
])
++ (with epkgs; [
typst-ts-mode # why this doesn't seem to be in elpaPackages?
]); ]);
in in
mainPackages ++ (builtins.attrValues extraPackages) mainPackages ++ (builtins.attrValues extraPackages)