Skip to content

Commit 25d2555

Browse files
committed
style(wrapperModues.direnv): apply nix fmt
1 parent 601f748 commit 25d2555

1 file changed

Lines changed: 29 additions & 21 deletions

File tree

wrapperModules/d/direnv/module.nix

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
{ config, lib, wlib, pkgs, ... }:
1+
{
2+
config,
3+
lib,
4+
wlib,
5+
pkgs,
6+
...
7+
}:
28
let
39
cfg = config;
410

@@ -27,7 +33,7 @@ in
2733
};
2834
lib = lib.mkOption {
2935
type = with lib.types; attrsOf lines;
30-
default = {};
36+
default = { };
3137
};
3238
extraConfig = lib.mkOption {
3339
inherit (tomlFmt) type;
@@ -40,19 +46,19 @@ in
4046
};
4147
config = {
4248
package = lib.mkDefault pkgs.direnv;
43-
env = {
49+
env = {
4450
# **IMPORTANT** DIRENV_CONFIG needs to be explicitly set in your shells environment
45-
# because right now, direnv will use the `direnv` binary directly in its shell
46-
# hook and not the wrapper (in which $DIRENV_CONFIG got injected).
47-
# Hence the wrapped config will not be picked up unless you explicitly reference
48-
# this variable and set it.
49-
#
51+
# because right now, direnv will use the `direnv` binary directly in its shell
52+
# hook and not the wrapper (in which $DIRENV_CONFIG got injected).
53+
# Hence the wrapped config will not be picked up unless you explicitly reference
54+
# this variable and set it.
55+
#
5056
# If the PR below will ever be merged, this issue can be fixed by setting:
5157
#
5258
# env.DIRENV_EXE_PATH = "${placeholder "out"}/bin/direnv";
5359
#
5460
# This would make the direnv hook use the wrapper instead of the original binary.
55-
#
61+
#
5662
# https://github.com/direnv/direnv/pull/1564
5763

5864
# **IMPORTANT** Using `placeholder "out"` here seems to cause issues if this wrapper issue
@@ -61,9 +67,8 @@ in
6167
# DIRENV_CONFIG = "${placeholder "out"}/${config.configDirname}";
6268
};
6369
passthru.DIRENV_CONFIG = "${config.wrapper.${config.outputName}}/${config.configDirname}";
64-
lib."nix-direnv.sh" = lib.mkIf
65-
(config.nix-direnv.enable)
66-
"source ${cfg.nix-direnv.package}/share/nix-direnv/direnvrc";
70+
lib."nix-direnv.sh" =
71+
lib.mkIf (config.nix-direnv.enable) "source ${cfg.nix-direnv.package}/share/nix-direnv/direnvrc";
6772
extraConfig = {
6873
global = lib.mkIf (config.silent) {
6974
log_format = "-";
@@ -79,14 +84,17 @@ in
7984
content = config.direnvrc;
8085
relPath = "${config.configDirname}/direnvrc";
8186
};
82-
} //
83-
# TODO: As of now, construcFiles does not accept keys like 'nix-direnv.sh'.
84-
# This hack somehow avoids the issue. Find out if this needs to be fixed in
85-
# `constructFiles`.
86-
lib.mapAttrs' (name: value: lib.nameValuePair (builtins.replaceStrings ["." "-"] ["" ""] name) {
87-
content = value;
88-
relPath = "${config.configDirname}/lib/${name}";
89-
}) config.lib;
87+
}
88+
//
89+
# TODO: As of now, construcFiles does not accept keys like 'nix-direnv.sh'.
90+
# This hack somehow avoids the issue. Find out if this needs to be fixed in
91+
# `constructFiles`.
92+
lib.mapAttrs' (
93+
name: value:
94+
lib.nameValuePair (builtins.replaceStrings [ "." "-" ] [ "" "" ] name) {
95+
content = value;
96+
relPath = "${config.configDirname}/lib/${name}";
97+
}
98+
) config.lib;
9099
};
91100
}
92-

0 commit comments

Comments
 (0)