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.
This commit is contained in:
parent
bb83c8a12c
commit
a640e42e6a
1 changed files with 13 additions and 13 deletions
|
@ -1,12 +1,12 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
# NOTE: I'm trying to keep the list of dependencies herein constrained to a
|
inherit (builtins) path;
|
||||||
# list of generic dependencies (i.e. not project or language specific). For
|
inherit (pkgs) emacs26 emacsPackagesNgGen writeShellScript writeShellScriptBin;
|
||||||
# language-specific tooling, I'm intending to use shell.nix alongside lorri
|
inherit (pkgs.lib.strings) makeBinPath;
|
||||||
# and direnv.
|
|
||||||
emacsBinPath = pkgs.lib.strings.makeBinPath (with pkgs; [
|
emacsBinPath = makeBinPath (with pkgs; [
|
||||||
tdesktop # native telegram client
|
tdesktop
|
||||||
ripgrep
|
ripgrep
|
||||||
gitAndTools.hub
|
gitAndTools.hub
|
||||||
kubectl
|
kubectl
|
||||||
|
@ -16,7 +16,7 @@ let
|
||||||
clipmenu
|
clipmenu
|
||||||
]);
|
]);
|
||||||
|
|
||||||
emacsWithPackages = (pkgs.emacsPackagesNgGen pkgs.emacs26).emacsWithPackages;
|
emacsWithPackages = (emacsPackagesNgGen emacs26).emacsWithPackages;
|
||||||
|
|
||||||
wpcarrosEmacs = emacsWithPackages (epkgs:
|
wpcarrosEmacs = emacsWithPackages (epkgs:
|
||||||
(with epkgs.elpaPackages; [
|
(with epkgs.elpaPackages; [
|
||||||
|
@ -111,28 +111,28 @@ let
|
||||||
magit
|
magit
|
||||||
]));
|
]));
|
||||||
|
|
||||||
vendorDir = builtins.path {
|
vendorDir = path {
|
||||||
path = ./.emacs.d/vendor;
|
path = ./.emacs.d/vendor;
|
||||||
name = "emacs-vendor";
|
name = "emacs-vendor";
|
||||||
};
|
};
|
||||||
|
|
||||||
wpcDir = builtins.path {
|
wpcDir = path {
|
||||||
path = ./.emacs.d/wpc;
|
path = ./.emacs.d/wpc;
|
||||||
name = "emacs-libs";
|
name = "emacs-libs";
|
||||||
};
|
};
|
||||||
|
|
||||||
wpcPackageEl = builtins.path {
|
wpcPackageEl = path {
|
||||||
path = ./.emacs.d/wpc/wpc-package.el;
|
path = ./.emacs.d/wpc/wpc-package.el;
|
||||||
name = "wpc-package.el";
|
name = "wpc-package.el";
|
||||||
};
|
};
|
||||||
|
|
||||||
initEl = builtins.path {
|
initEl = path {
|
||||||
path = ./.emacs.d/init.el;
|
path = ./.emacs.d/init.el;
|
||||||
name = "init.el";
|
name = "init.el";
|
||||||
};
|
};
|
||||||
|
|
||||||
withEmacsPath = { emacsBin, briefcasePath }:
|
withEmacsPath = { emacsBin, briefcasePath }:
|
||||||
pkgs.writeShellScriptBin "wpcarros-emacs" ''
|
writeShellScriptBin "wpcarros-emacs" ''
|
||||||
export XMODIFIERS=emacs
|
export XMODIFIERS=emacs
|
||||||
export BRIEFCASE=${briefcasePath}
|
export BRIEFCASE=${briefcasePath}
|
||||||
export PATH="${emacsBinPath}:$PATH"
|
export PATH="${emacsBinPath}:$PATH"
|
||||||
|
@ -150,7 +150,7 @@ in {
|
||||||
|
|
||||||
# I need to start my Emacs from CI without the call to `--load ${initEl}`.
|
# I need to start my Emacs from CI without the call to `--load ${initEl}`.
|
||||||
runScript = { script, briefcasePath }:
|
runScript = { script, briefcasePath }:
|
||||||
pkgs.writeShellScript "run-emacs-script" ''
|
writeShellScript "run-emacs-script" ''
|
||||||
export BRIEFCASE=${briefcasePath}
|
export BRIEFCASE=${briefcasePath}
|
||||||
export PATH="${emacsBinPath}:$PATH"
|
export PATH="${emacsBinPath}:$PATH"
|
||||||
export EMACSLOADPATH="${wpcDir}:${vendorDir}:${wpcarrosEmacs.deps}/share/emacs/site-lisp"
|
export EMACSLOADPATH="${wpcDir}:${vendorDir}:${wpcarrosEmacs.deps}/share/emacs/site-lisp"
|
||||||
|
|
Loading…
Reference in a new issue