direnv: add initial test for bash integration

This commit is contained in:
Damien Cassou 2020-06-01 10:08:33 +02:00 committed by Robert Helgesson
parent 68b931aef8
commit 575cd4b8ba
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 41 additions and 0 deletions

View file

@ -40,6 +40,7 @@ import nmt {
./modules/programs/bash
./modules/programs/browserpass
./modules/programs/dircolors
./modules/programs/direnv
./modules/programs/fish
./modules/programs/git
./modules/programs/gpg

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

View file

@ -0,0 +1,4 @@
{
direnv-bash = ./bash.nix;
direnv-stdlib = ./stdlib.nix;
}

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