mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
direnv: add initial test for bash integration
This commit is contained in:
parent
68b931aef8
commit
575cd4b8ba
4 changed files with 41 additions and 0 deletions
|
@ -40,6 +40,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