diff --git a/tests/default.nix b/tests/default.nix index aac1dfee..6c83c8cd 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -30,6 +30,7 @@ import nmt { ./modules/programs/bash ./modules/programs/browserpass ./modules/programs/dircolors + ./modules/programs/direnv ./modules/programs/fish ./modules/programs/git ./modules/programs/gpg diff --git a/tests/modules/programs/direnv/bash.nix b/tests/modules/programs/direnv/bash.nix new file mode 100644 index 00000000..db0d6b39 --- /dev/null +++ b/tests/modules/programs/direnv/bash.nix @@ -0,0 +1,17 @@ +{ config, lib, pkgs, ... }: + +with lib; + +{ + config = { + programs.bash.enable = true; + programs.direnv.enable = true; + + nmt.script = '' + assertFileExists home-files/.bashrc + assertFileRegex \ + home-files/.bashrc \ + 'eval "\$(/nix/store/.*direnv.*/bin/direnv hook bash)"' + ''; + }; +} diff --git a/tests/modules/programs/direnv/default.nix b/tests/modules/programs/direnv/default.nix new file mode 100644 index 00000000..82ad15ff --- /dev/null +++ b/tests/modules/programs/direnv/default.nix @@ -0,0 +1,4 @@ +{ + direnv-bash = ./bash.nix; + direnv-stdlib = ./stdlib.nix; +} diff --git a/tests/modules/programs/direnv/stdlib.nix b/tests/modules/programs/direnv/stdlib.nix new file mode 100644 index 00000000..1d06a0bc --- /dev/null +++ b/tests/modules/programs/direnv/stdlib.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let expectedContent = "something important"; +in { + config = { + programs.bash.enable = true; + programs.direnv.enable = true; + programs.direnv.stdlib = expectedContent; + + nmt.script = '' + assertFileExists home-files/.bashrc + assertFileRegex \ + home-files/.config/direnv/direnvrc \ + '${expectedContent}' + ''; + }; +}