From 451dfa6d84586b5cb83e6a7254689dff66b4523a Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Sun, 5 Mar 2023 13:08:04 -0300 Subject: [PATCH] elisp-packages/manual-packages.nix: get rid of `with` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As related in https://nix.dev/anti-patterns/language#with-attrset-expression: - Static analysis can’t reason about the code, because it would have to actually evaluate this file to see what variables are in scope; - As soon as there are two with used, it’s not clear anymore from which the variables are coming from; - Scoping rules around with are not intuitive. Examples: - https://github.com/NixOS/nix/issues/490 - https://github.com/pikajude/nixpkgs/commit/eea78e554e03906524f87406bb3a17d5c5264029 --- .../emacs/elisp-packages/manual-packages.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/editors/emacs/elisp-packages/manual-packages.nix b/pkgs/applications/editors/emacs/elisp-packages/manual-packages.nix index 5e70f86f1228..3f6cd1e40c0a 100644 --- a/pkgs/applications/editors/emacs/elisp-packages/manual-packages.nix +++ b/pkgs/applications/editors/emacs/elisp-packages/manual-packages.nix @@ -1,7 +1,10 @@ { lib, pkgs }: -self: with self; { - +self: +let + inherit (pkgs) callPackage; +in +{ agda-input = callPackage ./manual-packages/agda-input { }; agda2-mode = callPackage ./manual-packages/agda2-mode { }; @@ -84,8 +87,8 @@ self: with self; { sunrise-commander = callPackage ./manual-packages/sunrise-commander { }; # camelCase aliases for some of the kebab-case expressions above - colorThemeSolarized = color-theme-solarized; - emacsSessionManagement = session-management-for-emacs; - rectMark = rect-mark; - sunriseCommander = sunrise-commander; + colorThemeSolarized = self.color-theme-solarized; + emacsSessionManagement = self.session-management-for-emacs; + rectMark = self.rect-mark; + sunriseCommander = self.sunrise-commander; }