From 3d8849e68bc198efeb8a179a4bcf32771d7967fe Mon Sep 17 00:00:00 2001 From: William Carroll Date: Sat, 19 Nov 2022 10:20:12 -0800 Subject: fix(wpcarro/emacs): Support OSX build of Emacs **TL;DR:** Most of these changes predicate behavior on the platform: - At buildtime this is `localSystem == $something`. (`localSystem` is from `readTree`) - At runtime this is `(memq window-system '(ns))`. - Add `coreutils` so `dired` listing with `--group-directories-first` works because that flag depends on the GNU version of `ls`. **Background:** I need to support a bunch of OSX users at $WORK. As such, I'm planning on using my MBP for the next few weeks to build empathy for our userbase and polish some currently rough edges. If I'm going to get an serious work done, I need my Emacs setup. Step one is making sure it can build and run. Change-Id: I918efccfa5f149e218aeea476c2c7df1c7b64ae8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7309 Autosubmit: wpcarro Tested-by: BuildkiteCI Reviewed-by: wpcarro --- users/wpcarro/emacs/default.nix | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'users/wpcarro/emacs/default.nix') diff --git a/users/wpcarro/emacs/default.nix b/users/wpcarro/emacs/default.nix index 3ca65c292e..2fe879583d 100644 --- a/users/wpcarro/emacs/default.nix +++ b/users/wpcarro/emacs/default.nix @@ -1,3 +1,9 @@ +# My Emacs distribution, which is supporting the following platforms: +# - Linux +# - Darwin +# +# USAGE: +# $ mg build //users/wpcarro/emacs:osx { depot, pkgs, lib, ... }: # TODO(wpcarro): See if it's possible to expose emacsclient on PATH, so that I @@ -26,9 +32,11 @@ let rust-analyzer rustc rustfmt + ] ++ + (if pkgs.stdenv.isLinux then [ scrot xorg.xset - ]) + ] else [ ])) ); emacsWithPackages = (emacsPackagesFor emacs28).emacsWithPackages; @@ -114,8 +122,6 @@ let request pcre2el helpful - # TODO(wpcarro): Determine if Nix solves this problem. - exec-path-from-shell yasnippet projectile deadgrep @@ -171,14 +177,25 @@ let "$@" ''; in -{ - inherit withEmacsPath; - +depot.nix.readTree.drvTargets { + # TODO(wpcarro): Support this with base.overrideAttrs or something similar. nixos = { load ? [ ] }: withEmacsPath { inherit load; emacsBin = "${wpcarrosEmacs}/bin/emacs"; }; + osx = writeShellScriptBin "wpcarros-emacs" '' + export PATH="${emacsBinPath}:$PATH" + export EMACSLOADPATH="${loadPath}" + exec ${wpcarrosEmacs}/bin/emacs \ + --debug-init \ + --no-init-file \ + --no-site-file \ + --no-site-lisp \ + --load ${./.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 @@ -194,6 +211,4 @@ in ${./.emacs.d/init.el} && \ touch $out ''; - - meta.ci.targets = [ "check" ]; } -- cgit 1.4.1