direnv: add initial test for bash integration
(cherry picked from commit 575cd4b8ba
)
This commit is contained in:
parent
d8fdbbdf03
commit
3a8e036f4a
|
@ -30,6 +30,7 @@ import nmt {
|
||||||
./modules/programs/bash
|
./modules/programs/bash
|
||||||
./modules/programs/browserpass
|
./modules/programs/browserpass
|
||||||
./modules/programs/dircolors
|
./modules/programs/dircolors
|
||||||
|
./modules/programs/direnv
|
||||||
./modules/programs/fish
|
./modules/programs/fish
|
||||||
./modules/programs/git
|
./modules/programs/git
|
||||||
./modules/programs/gpg
|
./modules/programs/gpg
|
||||||
|
|
17
tests/modules/programs/direnv/bash.nix
Normal file
17
tests/modules/programs/direnv/bash.nix
Normal file
|
@ -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)"'
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
4
tests/modules/programs/direnv/default.nix
Normal file
4
tests/modules/programs/direnv/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
direnv-bash = ./bash.nix;
|
||||||
|
direnv-stdlib = ./stdlib.nix;
|
||||||
|
}
|
19
tests/modules/programs/direnv/stdlib.nix
Normal file
19
tests/modules/programs/direnv/stdlib.nix
Normal file
|
@ -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}'
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue