1
0
Fork 0
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:
William Phetsinorath 2024-10-25 17:06:02 +02:00 committed by Robert Helgesson
parent 0c0268a3c8
commit 93435d27d2
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
3 changed files with 33 additions and 1 deletions

View file

@ -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.

View file

@ -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;

View 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
'';
}