From a640e42e6a9526acd0484603a00be73f026995fe Mon Sep 17 00:00:00 2001 From: William Carroll Date: Mon, 31 Aug 2020 11:31:00 +0100 Subject: Prefer inherit pattern to import Nix dependencies I'm starting to prefer the `inherit (builtins) path` pattern in my Nix expressions. I know this is idiomatic, so even if I don't like it, I am trying to learn to like it. --- emacs/default.nix | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'emacs/default.nix') diff --git a/emacs/default.nix b/emacs/default.nix index 480b418ad38e..4eb4dd2b2881 100644 --- a/emacs/default.nix +++ b/emacs/default.nix @@ -1,12 +1,12 @@ { pkgs, ... }: let - # 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 - # and direnv. - emacsBinPath = pkgs.lib.strings.makeBinPath (with pkgs; [ - tdesktop # native telegram client + inherit (builtins) path; + inherit (pkgs) emacs26 emacsPackagesNgGen writeShellScript writeShellScriptBin; + inherit (pkgs.lib.strings) makeBinPath; + + emacsBinPath = makeBinPath (with pkgs; [ + tdesktop ripgrep gitAndTools.hub kubectl @@ -16,7 +16,7 @@ let clipmenu ]); - emacsWithPackages = (pkgs.emacsPackagesNgGen pkgs.emacs26).emacsWithPackages; + emacsWithPackages = (emacsPackagesNgGen emacs26).emacsWithPackages; wpcarrosEmacs = emacsWithPackages (epkgs: (with epkgs.elpaPackages; [ @@ -111,28 +111,28 @@ let magit ])); - vendorDir = builtins.path { + vendorDir = path { path = ./.emacs.d/vendor; name = "emacs-vendor"; }; - wpcDir = builtins.path { + wpcDir = path { path = ./.emacs.d/wpc; name = "emacs-libs"; }; - wpcPackageEl = builtins.path { + wpcPackageEl = path { path = ./.emacs.d/wpc/wpc-package.el; name = "wpc-package.el"; }; - initEl = builtins.path { + initEl = path { path = ./.emacs.d/init.el; name = "init.el"; }; withEmacsPath = { emacsBin, briefcasePath }: - pkgs.writeShellScriptBin "wpcarros-emacs" '' + writeShellScriptBin "wpcarros-emacs" '' export XMODIFIERS=emacs export BRIEFCASE=${briefcasePath} export PATH="${emacsBinPath}:$PATH" @@ -150,7 +150,7 @@ in { # I need to start my Emacs from CI without the call to `--load ${initEl}`. runScript = { script, briefcasePath }: - pkgs.writeShellScript "run-emacs-script" '' + writeShellScript "run-emacs-script" '' export BRIEFCASE=${briefcasePath} export PATH="${emacsBinPath}:$PATH" export EMACSLOADPATH="${wpcDir}:${vendorDir}:${wpcarrosEmacs.deps}/share/emacs/site-lisp" -- cgit 1.4.1