refactor(wpcarro/emacs): Expose env as kwarg in withEmacsPath
This allows me to remove google-briefcase references. Change-Id: I61234b2ac20e0de0f3d0d820a471342124d72f2d Reviewed-on: https://cl.tvl.fyi/c/depot/+/4996 Tested-by: BuildkiteCI Reviewed-by: wpcarro <wpcarro@gmail.com>
This commit is contained in:
parent
8a27ed19c3
commit
e37b8c9d8c
1 changed files with 9 additions and 4 deletions
|
@ -1,4 +1,4 @@
|
||||||
{ pkgs, depot, ... }:
|
{ depot, pkgs, lib, ... }:
|
||||||
|
|
||||||
# TODO(wpcarro): See if it's possible to expose emacsclient on PATH, so that I
|
# TODO(wpcarro): See if it's possible to expose emacsclient on PATH, so that I
|
||||||
# don't need to depend on wpcarros-emacs and emacs in my NixOS configurations.
|
# don't need to depend on wpcarros-emacs and emacs in my NixOS configurations.
|
||||||
|
@ -7,7 +7,8 @@ let
|
||||||
inherit (depot.third_party.nixpkgs) emacsPackagesGen emacs27;
|
inherit (depot.third_party.nixpkgs) emacsPackagesGen emacs27;
|
||||||
inherit (depot.users) wpcarro;
|
inherit (depot.users) wpcarro;
|
||||||
inherit (pkgs) writeShellScript writeShellScriptBin;
|
inherit (pkgs) writeShellScript writeShellScriptBin;
|
||||||
inherit (pkgs.lib.strings) concatStringsSep makeBinPath;
|
inherit (lib) mapAttrsToList;
|
||||||
|
inherit (lib.strings) concatStringsSep makeBinPath;
|
||||||
|
|
||||||
emacsBinPath = makeBinPath (
|
emacsBinPath = makeBinPath (
|
||||||
wpcarro.common.shell-utils ++
|
wpcarro.common.shell-utils ++
|
||||||
|
@ -146,12 +147,16 @@ let
|
||||||
"${wpcarrosEmacs.deps}/share/emacs/site-lisp:"
|
"${wpcarrosEmacs.deps}/share/emacs/site-lisp:"
|
||||||
];
|
];
|
||||||
|
|
||||||
withEmacsPath = { emacsBin }:
|
# Transform an attrset into "export k=v" statements.
|
||||||
|
makeEnvVars = env: concatStringsSep "\n"
|
||||||
|
(mapAttrsToList (k: v: "export ${k}=\"${v}\"") env);
|
||||||
|
|
||||||
|
withEmacsPath = { emacsBin, env ? {} }:
|
||||||
writeShellScriptBin "wpcarros-emacs" ''
|
writeShellScriptBin "wpcarros-emacs" ''
|
||||||
export XMODIFIERS=emacs
|
export XMODIFIERS=emacs
|
||||||
export GOOGLE_BRIEFCASE="$HOME/google-briefcase"
|
|
||||||
export PATH="${emacsBinPath}:$PATH"
|
export PATH="${emacsBinPath}:$PATH"
|
||||||
export EMACSLOADPATH="${loadPath}"
|
export EMACSLOADPATH="${loadPath}"
|
||||||
|
${makeEnvVars env}
|
||||||
exec ${emacsBin} \
|
exec ${emacsBin} \
|
||||||
--debug-init \
|
--debug-init \
|
||||||
--no-init-file \
|
--no-init-file \
|
||||||
|
|
Loading…
Reference in a new issue