about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2022-01-28T20·40-0800
committerwpcarro <wpcarro@gmail.com>2022-01-28T22·31+0000
commit45da3bce86faec9d21c2e38df325635f5df3d94e (patch)
tree316b53c74a895bea1e3f0fb708d0d3877ba2f69d
parent4b8998c9c8ff352b0bed96f70e4c2eaa162bf4b9 (diff)
refactor(wpcarro/emacs): Drop meta.ci.extraSteps r/3697
...in favor of `meta.targets = [ "check" ]`.

Change-Id: I08b035b7d7bbe5ef4eab10a9f55481048c67330a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/5104
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
Tested-by: BuildkiteCI
-rw-r--r--users/wpcarro/emacs/.emacs.d/wpc/wpc-misc.el5
-rw-r--r--users/wpcarro/emacs/.emacs.d/wpc/wpc-ui.el9
-rw-r--r--users/wpcarro/emacs/ci.el2
-rw-r--r--users/wpcarro/emacs/default.nix42
4 files changed, 27 insertions, 31 deletions
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/wpc-misc.el b/users/wpcarro/emacs/.emacs.d/wpc/wpc-misc.el
index e2d01e2d23..1131e7fecf 100644
--- a/users/wpcarro/emacs/.emacs.d/wpc/wpc-misc.el
+++ b/users/wpcarro/emacs/.emacs.d/wpc/wpc-misc.el
@@ -225,8 +225,9 @@
 
 (use-package yasnippet
   :config
-  (setq yas-snippet-dirs (list (f-join user-emacs-directory "snippets")))
-  (yas-global-mode 1))
+  (unless constants-ci?
+    (setq yas-snippet-dirs (list (f-join user-emacs-directory "snippets")))
+    (yas-global-mode 1)))
 
 (use-package projectile
   :config
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/wpc-ui.el b/users/wpcarro/emacs/.emacs.d/wpc/wpc-ui.el
index f3fb8324c2..f4ed1dd9ad 100644
--- a/users/wpcarro/emacs/.emacs.d/wpc/wpc-ui.el
+++ b/users/wpcarro/emacs/.emacs.d/wpc/wpc-ui.el
@@ -110,16 +110,17 @@
 (use-package ivy-prescient
   :config
   (ivy-prescient-mode 1)
-  (prescient-persist-mode 1))
+  (unless constants-ci?
+    (prescient-persist-mode 1)))
 
 (use-package ivy-pass)
 
 ;; all-the-icons
 (use-package all-the-icons
   :config
-  (when (not constants-ci?)
-    (unless (f-exists? "~/.local/share/fonts/all-the-icons.ttf")
-      (all-the-icons-install-fonts t))))
+  (unless (or constants-ci?
+              (f-exists? "~/.local/share/fonts/all-the-icons.ttf"))
+    (all-the-icons-install-fonts t)))
 
 ;; icons for Ivy
 (use-package all-the-icons-ivy
diff --git a/users/wpcarro/emacs/ci.el b/users/wpcarro/emacs/ci.el
index da079b64ba..9dfaf3056f 100644
--- a/users/wpcarro/emacs/ci.el
+++ b/users/wpcarro/emacs/ci.el
@@ -40,5 +40,5 @@
       (message "Encountered warnings in *Warnings* buffer: %s" (buffer-string)))
     (kill-emacs 1)))
 
-(message "Successfully init'd Emacs without encountering errors or warnings!")
+(message "Successfully initialized Emacs without errors or warnings!")
 (kill-emacs 0)
diff --git a/users/wpcarro/emacs/default.nix b/users/wpcarro/emacs/default.nix
index b8c97ac176..2986dd7b51 100644
--- a/users/wpcarro/emacs/default.nix
+++ b/users/wpcarro/emacs/default.nix
@@ -6,7 +6,7 @@ let
   inherit (builtins) path;
   inherit (depot.third_party.nixpkgs) emacsPackagesGen emacs27;
   inherit (depot.users) wpcarro;
-  inherit (pkgs) writeShellScript writeShellScriptBin;
+  inherit (pkgs) runCommand writeShellScriptBin;
   inherit (lib) mapAttrsToList;
   inherit (lib.strings) concatStringsSep makeBinPath;
 
@@ -165,20 +165,6 @@ let
         --load ${initEl} \
         "$@"
     '';
-
-  # I need this to start my Emacs from CI without the call to
-  # `--load ${initEl}`.
-  runScript = script: writeShellScript "run-emacs-script" ''
-    export PATH="${emacsBinPath}:$PATH"
-    export EMACSLOADPATH="${loadPath}"
-    exec ${wpcarrosEmacs}/bin/emacs \
-      --no-site-file \
-      --no-site-lisp \
-      --no-init-file \
-      --script ${script} \
-      "$@"
-    '';
-
 in {
   inherit withEmacsPath;
 
@@ -186,13 +172,21 @@ in {
     emacsBin = "${wpcarrosEmacs}/bin/emacs";
   };
 
-  meta = {
-    targets = [ "nixos" ];
-    extraSteps = [
-      {
-        label = ":gnu: initialize Emacs";
-        command = "${runScript ./ci.el} ${./.emacs.d/init.el}";
-      }
-    ];
-  };
+  # Script that asserts my Emacs can initialize without warnings or errors.
+  check = runCommand "check-emacs" {} ''
+    # Even though Buildkite defines this, I'd still like still be able to test
+    # this locally without depending on my ability to remember to set CI=true.
+    export CI=true
+    export PATH="${emacsBinPath}:$PATH"
+    export EMACSLOADPATH="${loadPath}"
+    ${wpcarrosEmacs}/bin/emacs \
+      --no-site-file \
+      --no-site-lisp \
+      --no-init-file \
+      --script ${./ci.el} \
+      ${./.emacs.d/init.el} && \
+    touch $out
+  '';
+
+  meta.targets = [ "nixos" "check" ];
 }