From 401ec6a7a15041341124308197b726c4f908d97c Mon Sep 17 00:00:00 2001 From: William Carroll Date: Thu, 2 Apr 2020 14:37:47 +0100 Subject: Tidy up emacs/default.nix When I run `nix-env -f '' -iA emacs`, Nix builds a derivation of wpcarros-emacs using the path to the Emacs derivation. This doesn't work well on glinux and causes strange behavior. For instance, Chrome crashes when it tries to browse for files. Building with `nix-env -iA emacs.glinux` fixes this and other problems. Miscellaneous other changes: - Remove unnecessary fix-point recursion - Drop support for unused dottime.el - Remove unused overrideEmacs - Remove unused withLocalConfig - Support emacs.glinux and emacs.nixos alternative derivations --- emacs/default.nix | 46 +++++++++++++--------------------------------- 1 file changed, 13 insertions(+), 33 deletions(-) (limited to 'emacs') diff --git a/emacs/default.nix b/emacs/default.nix index aa0fa9017d08..5ee63f7c9e3f 100644 --- a/emacs/default.nix +++ b/emacs/default.nix @@ -1,7 +1,6 @@ -{ pkgs, depot, ... }: +{ pkgs, ... }: let - utils = import ; # NOTE: I'm trying to keep the list of dependencies herein constrained to a # list of generic dependencies (i.e. not project or language specific). For # language-specific tooling, I'm intending to use shell.nix alongside lorri @@ -16,7 +15,9 @@ let scrot clipmenu ]); + emacsWithPackages = (pkgs.emacsPackagesNgGen pkgs.emacs26).emacsWithPackages; + wpcarrosEmacs = emacsWithPackages (epkgs: (with epkgs.elpaPackages; [ exwm @@ -108,38 +109,9 @@ let flycheck ivy magit - ]) ++ - - (with depot.tools.emacs-pkgs; [ - dottime ])); -# TODO: Do I need `pkgs.lib.fix`? -in pkgs.lib.fix(self: l: f: pkgs.writeShellScriptBin "wpcarros-emacs" '' - # TODO: Is this the best way to handle environment variables using Nix? - export BRIEFCASE=$HOME/briefcase - export DEPOT=$HOME/depot - - export PATH="${emacsBinPath}:$PATH" - exec ${wpcarrosEmacs}/bin/emacs \ - --debug-init \ - --no-site-file \ - --no-site-lisp \ - --directory ${ ./.emacs.d/vendor } \ - --directory ${ ./.emacs.d/wpc } \ - --load ${ ./.emacs.d/wpc/wpc-package.el } \ - --load ${ ./.emacs.d/init.el } \ - --no-init-file $@ -'' // { - # TODO: Ascertain whether I need this. - overrideEmacs = f': self l f'; - - # Call with a local.el file containing local system configuration. - withLocalConfig = confDir: self confDir f; - - # This accepts the path to an Emacs binary outside of /nix/store. On gLinux, - # this will ensure that X and GL linkage behaves as expected. - withLocalEmacs = emacsBin: pkgs.writeShellScriptBin "wpcarros-emacs" '' + withEmacsPath = emacsBin: pkgs.writeShellScriptBin "wpcarros-emacs" '' # TODO: Is this the best way to handle environment variables using Nix? export BRIEFCASE=$HOME/briefcase export DEPOT=$HOME/depot @@ -156,4 +128,12 @@ in pkgs.lib.fix(self: l: f: pkgs.writeShellScriptBin "wpcarros-emacs" '' --load ${ ./.emacs.d/init.el } \ --no-init-file $@ ''; -}) null utils.identity +in { + # Use `nix-env -f '' emacs.glinux` to install `wpcarro-emacs` on + # gLinux machines. This will ensure that X and GL linkage behaves as expected. + glinux = withEmacsPath "/usr/bin/emacs"; + + # Use `nix-env -f '' emacs.nixos` to install `wpcarros-emacs` on + # NixOS machines. + nixos = withEmacsPath "${wpcarrosEmacs}/bin/emacs"; +} -- cgit 1.4.1