Simplify org-agenda-api.nix to only produce tangled elisp files

Container construction moved to colonelpanic-org-agenda-api repo.
This flake now only exports org-agenda-custom-config (tangled files).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-17 12:11:59 -05:00
parent b27ff12180
commit 3e805b172e
2 changed files with 32 additions and 124 deletions

60
nixos/flake.lock generated
View File

@@ -221,11 +221,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1765835352, "lastModified": 1768135262,
"narHash": "sha256-XswHlK/Qtjasvhd1nOa1e8MgZ8GS//jBoTqWtrS1Giw=", "narHash": "sha256-PVvu7OqHBGWN16zSi6tEmPwwHQ4rLPU9Plvs8/1TUBY=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "a34fae9c08a15ad73f295041fec82323541400a9", "rev": "80daad04eddbbf5a4d883996a73f3f542fa437ac",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1041,11 +1041,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1768243660, "lastModified": 1768263332,
"narHash": "sha256-6ndmGTW2wrU0+kAzcrv4HPbB8dPeCQiTGwLhxaIG6G0=", "narHash": "sha256-0bWm54W2kkhrLdvVboT2KVxBliEkc2sNf+INaDhvEDU=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "hercules-ci-effects", "repo": "hercules-ci-effects",
"rev": "7674575b71d317799ee2c3d1703144d885eb3ea3", "rev": "796ba31ee88bcec5c3cbc80ee34c5e157705aab5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1183,11 +1183,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1768434960, "lastModified": 1768598210,
"narHash": "sha256-cJbFn17oyg6qAraLr+NVeNJrXsrzJdrudkzI4H2iTcg=", "narHash": "sha256-kkgA32s/f4jaa4UG+2f8C225Qvclxnqs76mf8zvTVPg=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "b4d88c9ac42ae1a745283f6547701da43b6e9f9b", "rev": "c47b2cc64a629f8e075de52e4742de688f930dc6",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1318,11 +1318,11 @@
"nixpkgs-regression": "nixpkgs-regression" "nixpkgs-regression": "nixpkgs-regression"
}, },
"locked": { "locked": {
"lastModified": 1768430150, "lastModified": 1768607897,
"narHash": "sha256-PPMZg7BV1oZeCA9zxh9QTeng3YJzXjyi3IQ4FwdRewc=", "narHash": "sha256-bJV5vMMpXp1HZp9Y9MH5F4i7L9V/lh1tqGNYFA+gytk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nix", "repo": "nix",
"rev": "f162bb62f773ca20553de361934fdd105d09b2d0", "rev": "af7c7b672355c697617d1b83aafc11f5c4555d6e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1337,11 +1337,11 @@
"nixpkgs": "nixpkgs_7" "nixpkgs": "nixpkgs_7"
}, },
"locked": { "locked": {
"lastModified": 1768285773, "lastModified": 1768647869,
"narHash": "sha256-WjogGWTFsDttnt1lX0AdAWU8JfeSCJWIHHXabUAZhKk=", "narHash": "sha256-TkyqRRz3HGoi98inr6TiCsTmPGK2KDys+2g/J2f3A78=",
"owner": "nixified-ai", "owner": "nixified-ai",
"repo": "flake", "repo": "flake",
"rev": "7f504671f6b1d8b0d072ab6d39d5e1916a489acd", "rev": "e2c37f8859c2e6c29229cbac444a59d70fff7419",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1652,11 +1652,11 @@
}, },
"nixpkgs_7": { "nixpkgs_7": {
"locked": { "locked": {
"lastModified": 1766121155, "lastModified": 1768380750,
"narHash": "sha256-Vll702HVchvXuk2Ji+UnjYngYQLF/ClnxBMMUhnokwY=", "narHash": "sha256-V5drPOmaGA7bszxKxyViYEZyT2h6RYa/Ll+3aJL4Grs=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "7ca89e6f807ca2bd53eb5e7e6f88c733d5e66cbb", "rev": "5961ffe0035b187988f499b19ad37c072ef9e4e9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1684,11 +1684,11 @@
}, },
"nixpkgs_9": { "nixpkgs_9": {
"locked": { "locked": {
"lastModified": 1768305791, "lastModified": 1768564909,
"narHash": "sha256-AIdl6WAn9aymeaH/NvBj0H9qM+XuAuYbGMZaP0zcXAQ=", "narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1412caf7bf9e660f2f962917c14b1ea1c3bc695e", "rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1706,11 +1706,11 @@
"osx-kvm": "osx-kvm" "osx-kvm": "osx-kvm"
}, },
"locked": { "locked": {
"lastModified": 1764686341, "lastModified": 1768493011,
"narHash": "sha256-CnvesUXyktZygnHURa4bk9eCxNAI/Am9Y/b6vBNhS/A=", "narHash": "sha256-Ea03KemeOtpLgfRCyjOlWChRM3HklkTJDHTKyQKvoBk=",
"owner": "matthewcroughan", "owner": "matthewcroughan",
"repo": "nixtheplanet", "repo": "nixtheplanet",
"rev": "0c0e433fa01789d33a191adb0533a6bca817383f", "rev": "1f7095e2b649122da2d9071279de36483adec436",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -1756,11 +1756,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1768557696, "lastModified": 1768558276,
"narHash": "sha256-J3goAJlitt7HNIZTuKpVMopU2RiJ5hJR5iCvBx3PgHs=", "narHash": "sha256-pfJEORUHXc4nU8bqP/3TJM+VbBkHN1DZKE2fmnJ3e+E=",
"owner": "colonelpanic8", "owner": "colonelpanic8",
"repo": "org-agenda-api", "repo": "org-agenda-api",
"rev": "d626e30e146f8e1e070747575d3f4e6e8cc67029", "rev": "97a0654004a346946b77427014c26dc55ed9a5a1",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -2300,11 +2300,11 @@
}, },
"unstable_3": { "unstable_3": {
"locked": { "locked": {
"lastModified": 1768305791, "lastModified": 1768564909,
"narHash": "sha256-AIdl6WAn9aymeaH/NvBj0H9qM+XuAuYbGMZaP0zcXAQ=", "narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1412caf7bf9e660f2f962917c14b1ea1c3bc695e", "rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -1,10 +1,10 @@
# org-agenda-api.nix - Container and config for org-agenda-api # org-agenda-api.nix - Tangled org-config for org-agenda-api container
{ pkgs, inputs, system }: { pkgs, inputs, system }:
let let
# Path to org-config.org in the dotfiles # Path to org-config.org in the dotfiles
orgConfigOrg = ../dotfiles/emacs.d/org-config.org; orgConfigOrg = ../dotfiles/emacs.d/org-config.org;
# Tangle org-config.org and create a loader for the container # Tangle org-config.org to produce elisp files
orgAgendaCustomConfig = pkgs.runCommand "org-agenda-custom-config" { orgAgendaCustomConfig = pkgs.runCommand "org-agenda-custom-config" {
buildInputs = [ pkgs.emacs-nox ]; buildInputs = [ pkgs.emacs-nox ];
} '' } ''
@@ -27,100 +27,8 @@ let
sed -e 's/:straight nil//g' -e 's/:straight t//g' "$f" > "$out/$(basename "$f")" sed -e 's/:straight nil//g' -e 's/:straight t//g' "$f" > "$out/$(basename "$f")"
fi fi
done done
# Create a loader that sets up paths and loads files in order
cat > $out/custom-config.el << 'ELISP'
;;; custom-config.el --- Container config loader -*- lexical-binding: t; -*-
;; Set org directory for container
(defvar imalison:org-dir "/data/org")
(defvar imalison:shared-org-dir nil)
;; Helper function used by org-config
(defun imalison:join-paths (&rest paths)
"Join PATHS together into a single path."
(let ((result (car paths)))
(dolist (p (cdr paths))
(setq result (expand-file-name p result)))
result))
;; Load tangled config files in order
(let ((config-dir (file-name-directory load-file-name)))
(when (file-exists-p (expand-file-name "org-config-preface.el" config-dir))
(load (expand-file-name "org-config-preface.el" config-dir)))
;; org-config-custom.el uses customize format (var value), convert to setq
(when (file-exists-p (expand-file-name "org-config-custom.el" config-dir))
(with-temp-buffer
(insert-file-contents (expand-file-name "org-config-custom.el" config-dir))
(goto-char (point-min))
(condition-case nil
(while t
(let ((form (read (current-buffer))))
(when (and (listp form) (symbolp (car form)))
(set (car form) (eval (cadr form))))))
(end-of-file nil))))
(when (file-exists-p (expand-file-name "org-config-config.el" config-dir))
(load (expand-file-name "org-config-config.el" config-dir))))
;; Define no-op stubs for unavailable packages (overwrite autoloads)
(defun org-bullets-mode (&optional _arg)
"No-op stub for org-bullets-mode (package not available in container)."
nil)
;; Override shared-org-file-p to handle nil imalison:shared-org-dir
;; The original calls (file-truename imalison:shared-org-dir) which errors when nil
(defun imalison:shared-org-file-p ()
"Check if current file is in the shared org directory.
Returns nil if imalison:shared-org-dir is not set."
(and imalison:shared-org-dir
(string-prefix-p (file-truename imalison:shared-org-dir)
(file-truename default-directory))))
;; Helper functions used by org-agenda-custom-commands
;; These are defined in README.org but needed for custom views
(defun imalison:compare-int-list (a b)
"Compare two lists of integers lexicographically."
(when (and a b)
(cond ((> (car a) (car b)) 1)
((< (car a) (car b)) -1)
(t (imalison:compare-int-list (cdr a) (cdr b))))))
(defun get-date-created-from-agenda-entry (agenda-entry)
"Get the CREATED property timestamp from an agenda entry."
(org-time-string-to-time
(org-entry-get (get-text-property 1 'org-marker agenda-entry) "CREATED")))
;; Capture templates for API
(setq org-agenda-api-capture-templates
`(("gtd-todo"
:name "GTD Todo"
:template ("g" "GTD Todo" entry (file ,imalison:org-gtd-file)
(function (lambda () (imalison:make-org-todo-template :content "%^{Title}")))
:immediate-finish t)
:prompts (("Title" :type string :required t)))
("scheduled-todo"
:name "Scheduled Todo"
:template ("s" "Scheduled" entry (file ,(imalison:join-paths imalison:org-dir "inbox.org"))
"* INBOX %^{Title}\nSCHEDULED: %^{When}t\n:PROPERTIES:\n:CREATED: %U\n:END:\n"
:immediate-finish t)
:prompts (("Title" :type string :required t)
("When" :type date :required t)))
("deadline-todo"
:name "Todo with Deadline"
:template ("d" "Deadline" entry (file ,(imalison:join-paths imalison:org-dir "inbox.org"))
"* INBOX %^{Title}\nDEADLINE: %^{When}t\n:PROPERTIES:\n:CREATED: %U\n:END:\n"
:immediate-finish t)
:prompts (("Title" :type string :required t)
("When" :type date :required t)))))
ELISP
''; '';
# Build customized org-agenda-api container
orgAgendaApiContainer = inputs.org-agenda-api.lib.${system}.mkContainer {
customElispFile = "${orgAgendaCustomConfig}/custom-config.el";
};
in { in {
org-agenda-custom-config = orgAgendaCustomConfig; org-agenda-custom-config = orgAgendaCustomConfig;
org-agenda-api-container = orgAgendaApiContainer;
} }