diff --git a/flake.lock b/flake.lock index 6cecf43..3a89554 100644 --- a/flake.lock +++ b/flake.lock @@ -80,11 +80,11 @@ ] }, "locked": { - "lastModified": 1730190761, - "narHash": "sha256-o5m5WzvY6cGIDupuOvjgNSS8AN6yP2iI9MtUC6q/uos=", + "lastModified": 1730675461, + "narHash": "sha256-Mhqz3p/HEiI/zxBJWO57LYQf6gGlJB0tci6fiVXLjd8=", "owner": "nix-community", "repo": "disko", - "rev": "3979285062d6781525cded0f6c4ff92e71376b55", + "rev": "380847d94ff0fedee8b50ee4baddb162c06678df", "type": "github" }, "original": { @@ -100,11 +100,11 @@ "pyproject-nix": "pyproject-nix" }, "locked": { - "lastModified": 1729932741, - "narHash": "sha256-Ko3a3hWt7CbVn9Db0/Tj9zln3bB/CMIhlQsP92mUejU=", + "lastModified": 1730723587, + "narHash": "sha256-3ewuvm7VB/q3sxn9vzzQ0902PlSdqKqqagr8XbC1hIo=", "owner": "nix-community", "repo": "dream2nix", - "rev": "7acdae705dcc79f307e752f749a9f513a0ed9b83", + "rev": "51943fca6b95cb9649236bacf5d7c8d9af4c3bec", "type": "github" }, "original": { @@ -119,11 +119,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1730640754, - "narHash": "sha256-SfZ5m2hENlYkKQd254iF4zkBZ0TnGdGDn0umCYE6CZc=", + "lastModified": 1730711584, + "narHash": "sha256-7XpfL6x0or0qH3NjtiujcyUzFrZu72b/pyLCbwk0+2s=", "owner": "nix-community", "repo": "emacs-overlay", - "rev": "711566e17e7b414a24973dfd00a63eb62efb3836", + "rev": "ca2129b1d5afb32e46299dc48e03467522352bd5", "type": "github" }, "original": { @@ -571,11 +571,11 @@ "lix": { "flake": false, "locked": { - "lastModified": 1730610940, - "narHash": "sha256-ZsTpii4kZcioRF3bu3/pS374R9GYQVyrMpBNr2ZUnVg=", + "lastModified": 1730726176, + "narHash": "sha256-kXaJRGoWdyDSIO32zC2/1mGFOKiApJcSS9HVwFX3YM8=", "ref": "refs/heads/main", - "rev": "b1a0e3c0029c2dd5fb7c8dd2db4f9e0b309c9f54", - "revCount": 16445, + "rev": "6b7076f81c25941559f7d132a5ebc2fcfcedcc4d", + "revCount": 16447, "type": "git", "url": "https://git@git.lix.systems/lix-project/lix" }, @@ -679,11 +679,11 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1730600078, - "narHash": "sha256-BoyFmE59HDF3uybBySsWVoyjNuHvz3Wv8row/mSb958=", + "lastModified": 1730698801, + "narHash": "sha256-sq68bCmk4tCXSt5CoRNimfigIZSLJSpNi/gjFtNLjRE=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "4652874d014b82cb746173ffc64f6a70044daa7e", + "rev": "189d2d422c773fa065cc9c72e6806f007ebb9be0", "type": "github" }, "original": { diff --git a/hmModules/emacs/init.el b/hmModules/emacs/init.el index e630922..435ad0a 100644 --- a/hmModules/emacs/init.el +++ b/hmModules/emacs/init.el @@ -787,11 +787,30 @@ This is meant to be an helper to be called from the window manager." (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))))) + + (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))) + )) - (defun ccr/org-roam-spent-hours (client) + (defun ccr/org-roam-spent-hours (client &optional date-start date-end) "Return the total spent hours on something (usually a client)" - (apply #'+(mapcar #'org-roam-node-spent (org-roam-ql-nodes `(tags ,client "billable"))))) - ) + (let* ((query-tags `(tags ,client "billable")) + (query (if (and date-start date-end) + `(and ,query-tags (date-range ,date-start ,date-end)) + query-tags))) + (apply #'+(mapcar #'org-roam-node-spent (org-roam-ql-nodes query)))))) (use-package org-roam-ql :after org-roam diff --git a/hmModules/email/default.nix b/hmModules/email/default.nix index 5ae160a..ab37b05 100644 --- a/hmModules/email/default.nix +++ b/hmModules/email/default.nix @@ -22,183 +22,183 @@ ); }; - home.file.".config/aerc/stylesets" = - let - catppuccin-aerc = pkgs.fetchFromGitHub { - owner = "catppuccin"; - repo = "aerc"; - rev = "ca404a9f2d125ef12db40db663d43c9d94116a05"; - hash = "sha256-OWIkHsKFts/zkrDUtbBPXHVSrHL/F0v3LB1rnlFAKmE="; - }; - in - { - source = "${catppuccin-aerc}/dist"; - recursive = true; - }; + # home.file.".config/aerc/stylesets" = + # let + # catppuccin-aerc = pkgs.fetchFromGitHub { + # owner = "catppuccin"; + # repo = "aerc"; + # rev = "ca404a9f2d125ef12db40db663d43c9d94116a05"; + # hash = "sha256-OWIkHsKFts/zkrDUtbBPXHVSrHL/F0v3LB1rnlFAKmE="; + # }; + # in + # { + # source = "${catppuccin-aerc}/dist"; + # recursive = true; + # }; - programs.aerc = { - enable = true; - extraBinds = { - global = { - "" = ":prev-tab"; - "" = ":next-tab"; - "?" = ":help keys"; - }; + # programs.aerc = { + # enable = true; + # extraBinds = { + # global = { + # "" = ":prev-tab"; + # "" = ":next-tab"; + # "?" = ":help keys"; + # }; - messages = { - "h" = ":prev-tab"; - "l" = ":next-tab"; + # messages = { + # "h" = ":prev-tab"; + # "l" = ":next-tab"; - "j" = ":next"; - "" = ":next"; - "" = ":next 50%"; - "" = ":next 100%"; - "" = ":next 100%"; + # "j" = ":next"; + # "" = ":next"; + # "" = ":next 50%"; + # "" = ":next 100%"; + # "" = ":next 100%"; - "k" = ":prev"; - "" = ":prev"; - "" = ":prev 50%"; - "" = ":prev 100%"; - "" = ":prev 100%"; - "g" = ":select 0"; - "G" = ":select -1"; + # "k" = ":prev"; + # "" = ":prev"; + # "" = ":prev 50%"; + # "" = ":prev 100%"; + # "" = ":prev 100%"; + # "g" = ":select 0"; + # "G" = ":select -1"; - "J" = ":next-folder"; - "K" = ":prev-folder"; - "H" = ":collapse-folder"; - "L" = ":expand-folder"; + # "J" = ":next-folder"; + # "K" = ":prev-folder"; + # "H" = ":collapse-folder"; + # "L" = ":expand-folder"; - "v" = ":mark -t"; - "x" = ":mark -t:next"; - "V" = ":mark -v"; + # "v" = ":mark -t"; + # "x" = ":mark -t:next"; + # "V" = ":mark -v"; - "T" = ":toggle-threads"; + # "T" = ":toggle-threads"; - "" = ":view"; - "d" = ":prompt 'Really delete this message?' 'delete-message'"; - "D" = ":delete"; - "A" = ":archive flat"; + # "" = ":view"; + # "d" = ":prompt 'Really delete this message?' 'delete-message'"; + # "D" = ":delete"; + # "A" = ":archive flat"; - "C" = ":compose"; + # "C" = ":compose"; - "rr" = ":reply -a"; - "rq" = ":reply -aq"; - "Rr" = ":reply"; - "Rq" = ":reply -q"; + # "rr" = ":reply -a"; + # "rq" = ":reply -aq"; + # "Rr" = ":reply"; + # "Rq" = ":reply -q"; - "c" = ":cf"; - "$" = ":term"; - "!" = ":term"; - "|" = ":pipe"; + # "c" = ":cf"; + # "$" = ":term"; + # "!" = ":term"; + # "|" = ":pipe"; - "/" = ":search"; - "\\" = ":filter"; - "n" = ":next-result"; - "N" = ":prev-result"; - "" = ":clear"; - }; + # "/" = ":search"; + # "\\" = ":filter"; + # "n" = ":next-result"; + # "N" = ":prev-result"; + # "" = ":clear"; + # }; - "messages:folder=Drafts" = { - "" = ":recall"; - }; + # "messages:folder=Drafts" = { + # "" = ":recall"; + # }; - view = { - "/" = ":toggle-key-passthrough/"; - "q" = ":close"; - "O" = ":open"; - "S" = ":save"; - "|" = ":pipe"; - "D" = ":delete"; - "A" = ":archive flat"; + # view = { + # "/" = ":toggle-key-passthrough/"; + # "q" = ":close"; + # "O" = ":open"; + # "S" = ":save"; + # "|" = ":pipe"; + # "D" = ":delete"; + # "A" = ":archive flat"; - "" = ":open-link "; + # "" = ":open-link "; - "f" = ":forward"; - "rr" = ":reply -a"; - "rq" = ":reply -aq"; - "Rr" = ":reply"; - "Rq" = ":reply -q"; + # "f" = ":forward"; + # "rr" = ":reply -a"; + # "rq" = ":reply -aq"; + # "Rr" = ":reply"; + # "Rq" = ":reply -q"; - "H" = ":toggle-headers"; - "" = ":prev-part"; - "" = ":next-part"; - "J" = ":next"; - "K" = ":prev"; - }; + # "H" = ":toggle-headers"; + # "" = ":prev-part"; + # "" = ":next-part"; + # "J" = ":next"; + # "K" = ":prev"; + # }; - "view::passthrough" = { - "$noinherit" = true; - "$ex" = ""; - "" = ":toggle-key-passthrough"; - }; + # "view::passthrough" = { + # "$noinherit" = true; + # "$ex" = ""; + # "" = ":toggle-key-passthrough"; + # }; - compose = { - "$noinherit" = "true"; - "$ex" = ""; - "" = ":prev-field"; - "" = ":next-field"; - "" = ":switch-account -p"; - "" = ":switch-account -n"; - "" = ":next-field"; - "" = ":prev-tab"; - "" = ":next-tab"; - }; + # compose = { + # "$noinherit" = "true"; + # "$ex" = ""; + # "" = ":prev-field"; + # "" = ":next-field"; + # "" = ":switch-account -p"; + # "" = ":switch-account -n"; + # "" = ":next-field"; + # "" = ":prev-tab"; + # "" = ":next-tab"; + # }; - "compose::editor" = { - "$noinherit" = "true"; - "$ex" = ""; - "" = ":prev-field"; - "" = ":next-field"; - "" = ":prev-tab"; - "" = ":next-tab"; - }; + # "compose::editor" = { + # "$noinherit" = "true"; + # "$ex" = ""; + # "" = ":prev-field"; + # "" = ":next-field"; + # "" = ":prev-tab"; + # "" = ":next-tab"; + # }; - "compose::review" = { - "y" = ":send"; - "n" = ":abort"; - "p" = ":postpone"; - "q" = ":choose -o d discard abort -o p postpone postpone"; - "e" = ":edit"; - "a" = ":attach"; - "d" = ":detach"; - }; + # "compose::review" = { + # "y" = ":send"; + # "n" = ":abort"; + # "p" = ":postpone"; + # "q" = ":choose -o d discard abort -o p postpone postpone"; + # "e" = ":edit"; + # "a" = ":attach"; + # "d" = ":detach"; + # }; - terminal = { - "$noinherit" = "true"; - "$ex" = ""; + # terminal = { + # "$noinherit" = "true"; + # "$ex" = ""; - "" = ":prev-tab"; - "" = ":next-tab"; - }; - }; - extraConfig = { - general.unsafe-accounts-conf = true; - ui = { - styleset-name = "catppuccin-mocha"; - this-day-time-format = ''" 15:04"''; - this-year-time-format = "Mon Jan 02 15:04"; - timestamp-format = "2006-01-02 15:04"; + # "" = ":prev-tab"; + # "" = ":next-tab"; + # }; + # }; + # extraConfig = { + # general.unsafe-accounts-conf = true; + # ui = { + # styleset-name = "catppuccin-mocha"; + # this-day-time-format = ''" 15:04"''; + # this-year-time-format = "Mon Jan 02 15:04"; + # timestamp-format = "2006-01-02 15:04"; - spinner = "[ ⡿ ],[ ⣟ ],[ ⣯ ],[ ⣷ ],[ ⣾ ],[ ⣽ ],[ ⣻ ],[ ⢿ ]"; - border-char-vertical = "┃"; - border-char-horizontal = "━"; - }; - viewer = { - always-show-mime = true; - }; - compose = { - no-attachment-warning = "^[^>]*attach(ed|ment)"; - }; - filters = { - "text/plain" = "colorize"; - "text/html" = "html"; - "text/calendar" = "calendar"; - "message/delivery-status" = "colorize"; - "message/rfc822" = "colorize"; - "image/*" = "${pkgs.catimg}/bin/catimg -"; - }; - }; - }; + # spinner = "[ ⡿ ],[ ⣟ ],[ ⣯ ],[ ⣷ ],[ ⣾ ],[ ⣽ ],[ ⣻ ],[ ⢿ ]"; + # border-char-vertical = "┃"; + # border-char-horizontal = "━"; + # }; + # viewer = { + # always-show-mime = true; + # }; + # compose = { + # no-attachment-warning = "^[^>]*attach(ed|ment)"; + # }; + # filters = { + # "text/plain" = "colorize"; + # "text/html" = "html"; + # "text/calendar" = "calendar"; + # "message/delivery-status" = "colorize"; + # "message/rfc822" = "colorize"; + # "image/*" = "${pkgs.catimg}/bin/catimg -"; + # }; + # }; + # }; programs.notmuch = { enable = true; diff --git a/hmModules/foot/default.nix b/hmModules/foot/default.nix index e8ac8d3..840b866 100644 --- a/hmModules/foot/default.nix +++ b/hmModules/foot/default.nix @@ -10,7 +10,7 @@ lib.mkMerge [ server.enable = true; settings = { main = { - term = "xterm-256color"; + term = "xterm-direct"; login-shell = "yes"; dpi-aware = "no"; horizontal-letter-offset = "1"; diff --git a/hmModules/shell/default.nix b/hmModules/shell/default.nix index 22ced2b..048a65f 100644 --- a/hmModules/shell/default.nix +++ b/hmModules/shell/default.nix @@ -3,6 +3,7 @@ pkgs, age, hostname, + config, ... }: { @@ -47,13 +48,19 @@ Install = { WantedBy = [ "default.target" ]; }; - Service.ExecStart = "${lib.getExe pkgs.atuin} daemon"; + Service = { + # ExecStartPre = "${lib.getExe' pkgs.toybox "rm"} -f ${config.programs.atuin.settings.daemon.socket_path}"; + ExecStart = "${lib.getExe pkgs.atuin} daemon"; + }; }; programs.atuin = { enable = true; settings = { - daemon.enabled = true; + daemon = { + enabled = true; + socket_path = "/home/ccr/.local/share/atuin/atuin.sock"; # FIXME using ~ or $HOME doesn't work: https://github.com/atuinsh/atuin/issues/2289 + }; auto_sync = true; sync_frequency = "5m"; sync_address = "http://sisko.fleet:8889"; diff --git a/hosts/default.nix b/hosts/default.nix index 0498e19..5636017 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -115,7 +115,6 @@ owner = "grafana"; group = "forgejo"; }; - "garmin-collector-environment".owner = "garmin-collector"; }; }; }; diff --git a/hosts/sisko/default.nix b/hosts/sisko/default.nix index 6295c63..ba45c12 100644 --- a/hosts/sisko/default.nix +++ b/hosts/sisko/default.nix @@ -25,7 +25,6 @@ "prometheus-exporters" "loki" "promtail" - "garmin-collector" "restic" "atuin" "immich" @@ -63,10 +62,18 @@ ]; boot.kernelParams = [ + "earlycon" + "consoleblank=0" "console=tty1" - "console=ttyS0,1500000" + "console=ttyS2,1500000" ]; + systemd.services."serial-getty@ttyS2" = { + enable = true; + wantedBy = [ "getty.target" ]; + serviceConfig.restart = "always"; + }; + environment.persistence."/persist" = { hideMounts = true; directories = [ diff --git a/modules/restic/default.nix b/modules/restic/default.nix index c3ba948..7aedfcd 100644 --- a/modules/restic/default.nix +++ b/modules/restic/default.nix @@ -55,5 +55,19 @@ in ]; timerConfig.OnCalendar = "daily"; timerConfig.RandomizedDelaySec = "1h"; + backupPrepareCommand = '' + ${pkgs.systemd}/bin/systemctl stop podman-* + ${pkgs.systemd}/bin/systemctl stop syncthing + ${pkgs.systemd}/bin/systemctl stop paperless-* + ${pkgs.systemd}/bin/systemctl stop forgejo + ${pkgs.systemd}/bin/systemctl stop home-assistant + ''; + backupCleanupCommand = '' + ${pkgs.systemd}/bin/systemctl start --no-block --all "podman-*" + ${pkgs.systemd}/bin/systemctl start syncthing + ${pkgs.systemd}/bin/systemctl start --no-block --all "paperless-*" + ${pkgs.systemd}/bin/systemctl start forgejo + ${pkgs.systemd}/bin/systemctl start home-assistant + ''; }; } diff --git a/modules/syncthing/default.nix b/modules/syncthing/default.nix index eb25947..b1b9857 100644 --- a/modules/syncthing/default.nix +++ b/modules/syncthing/default.nix @@ -20,7 +20,7 @@ ]; }; sisko = { - id = "5JYQLMP-KNBMSOE-I452UDU-UTKPXJI-K27X2DI-MSCSRCG-6V54Q6U-NVGXPQA"; + id = "TOC7QXZ-JLB4LYP-VNIJAV5-DCKVGFN-UE45SPX-PPFJHSG-O3UHFCK-2PEMAQ6"; addresses = [ "tcp://sisko.fleet" ];