mirror of
https://github.com/nix-community/home-manager
synced 2024-11-22 19:19:45 +01:00
direnv: add support for mise integration
This commit is contained in:
parent
0c0268a3c8
commit
93435d27d2
3 changed files with 33 additions and 1 deletions
|
@ -19,7 +19,7 @@ in {
|
|||
"Flake support is now always enabled.")
|
||||
];
|
||||
|
||||
meta.maintainers = [ lib.maintainers.rycee ];
|
||||
meta.maintainers = [ lib.maintainers.rycee lib.maintainers.shikanime ];
|
||||
|
||||
options.programs.direnv = {
|
||||
enable = mkEnableOption "direnv, the environment switcher";
|
||||
|
@ -95,6 +95,14 @@ in {
|
|||
package = mkPackageOption pkgs "nix-direnv" { };
|
||||
};
|
||||
|
||||
mise = {
|
||||
enable = mkEnableOption ''
|
||||
[mise](https://mise.jdx.dev/direnv.html),
|
||||
integration of use_mise for direnv'';
|
||||
|
||||
package = mkPackageOption pkgs "mise" { };
|
||||
};
|
||||
|
||||
silent = mkEnableOption "silent mode, that is, disabling direnv logging";
|
||||
};
|
||||
|
||||
|
@ -112,6 +120,12 @@ in {
|
|||
xdg.configFile."direnv/direnvrc" =
|
||||
lib.mkIf (cfg.stdlib != "") { text = cfg.stdlib; };
|
||||
|
||||
xdg.configFile."direnv/lib/hm-mise.sh" = mkIf cfg.mise.enable {
|
||||
text = ''
|
||||
eval "$(${getExe cfg.mise.package} direnv activate)"
|
||||
'';
|
||||
};
|
||||
|
||||
programs.bash.initExtra = mkIf cfg.enableBashIntegration (
|
||||
# Using mkAfter to make it more likely to appear after other
|
||||
# manipulations of the prompt.
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
direnv-bash = ./bash.nix;
|
||||
direnv-mise = ./mise.nix;
|
||||
direnv-nix-direnv = ./nix-direnv.nix;
|
||||
direnv-nushell = ./nushell.nix;
|
||||
direnv-stdlib = ./stdlib.nix;
|
||||
|
|
17
tests/modules/programs/direnv/mise.nix
Normal file
17
tests/modules/programs/direnv/mise.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
programs.bash.enable = true;
|
||||
programs.direnv = {
|
||||
enable = true;
|
||||
mise = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { name = "mise"; };
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.bashrc
|
||||
assertFileExists home-files/.config/direnv/lib/hm-mise.sh
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue