1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 15:09:46 +01:00

direnv: add stdlib option

This commit is contained in:
Mario Rodas 2018-10-07 09:53:40 -05:00 committed by Robert Helgesson
parent 5770dc58b9
commit 68d3cdd722
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -14,6 +14,14 @@ in
options.programs.direnv = { options.programs.direnv = {
enable = mkEnableOption "direnv, the environment switcher"; enable = mkEnableOption "direnv, the environment switcher";
stdlib = mkOption {
type = types.lines;
default = "";
description = ''
Custom stdlib written to <filename>~/.config/direnv/direnvrc</filename>.
'';
};
enableBashIntegration = mkOption { enableBashIntegration = mkOption {
default = true; default = true;
type = types.bool; type = types.bool;
@ -42,6 +50,10 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
home.packages = [ pkgs.direnv ]; home.packages = [ pkgs.direnv ];
xdg.configFile."direnv/direnvrc" = mkIf (cfg.stdlib != "") {
text = cfg.stdlib;
};
programs.bash.initExtra = programs.bash.initExtra =
mkIf cfg.enableBashIntegration ( mkIf cfg.enableBashIntegration (
# Using mkAfter to make it more likely to appear after other # Using mkAfter to make it more likely to appear after other