Skip to content

Commit

Permalink
add some explanatory comments
Browse files Browse the repository at this point in the history
  • Loading branch information
willruggiano committed Mar 13, 2024
1 parent 2c4fb98 commit 9550fa3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion modules/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@
...
}: let
cfg = config.neovim;
toEnvVar = name: value: ''export ${name}="''${${name}:-${toString value}}"'';
in
pkgs.writeShellApplication {
name = "nvim";
text = concatStringsSep "\n" (
optionals (cfg.env != {}) (mapAttrsToList (name: value: ''export ${name}="''${${name}:-${toString value}}"'') cfg.env)
# NOTE: We don't use writeShellApplication's `runtimeEnv` argument since
# it does not allow the specified environment variables to be overridden
# (e.g. by direnv).
optionals (cfg.env != {}) (mapAttrsToList toEnvVar cfg.env)
# NOTE: Similar sentiment here. We don't use writeShellApplication's
# `runtimeInputs` because it would *prepend* `cfg.paths`. What we want,
# rather, is to *append* them such that they too can be overridden.
++ optional (cfg.paths != []) ''
export PATH="$PATH:${makeBinPath (unique cfg.paths)}"
''
Expand Down

0 comments on commit 9550fa3

Please sign in to comment.