b3af91d293
There seems to be some changes on how wrapped binaries are implemented on nixpkgs. This broke the nnn tests since the tests were coupled with the old implementation. This commit fix the tests, and also make it less coupled by just testing if the bookmarks/plugins/environment variables are available.
56 lines
1.2 KiB
Nix
56 lines
1.2 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
{
|
|
config = {
|
|
programs.nnn = {
|
|
enable = true;
|
|
bookmarks = {
|
|
d = "~/Documents";
|
|
D = "~/Downloads";
|
|
p = "~/Pictures";
|
|
v = "~/Videos";
|
|
};
|
|
package = pkgs.nnnDummy;
|
|
extraPackages = with pkgs; [ foo bar ];
|
|
plugins = {
|
|
src = ./plugins;
|
|
mappings = {
|
|
c = "fzcd";
|
|
f = "finder";
|
|
v = "imgview";
|
|
};
|
|
};
|
|
};
|
|
|
|
test.stubs = {
|
|
nnnDummy.buildScript = ''
|
|
runHook preInstall
|
|
|
|
mkdir -p "$out/bin"
|
|
touch "$out/bin/nnn"
|
|
chmod +x "$out/bin/nnn"
|
|
|
|
runHook postInstall
|
|
'';
|
|
foo = { name = "foo"; };
|
|
bar = { name = "bar"; };
|
|
};
|
|
|
|
nmt = {
|
|
description =
|
|
"Check if the binary is correctly wrapped and if the symlinks are made";
|
|
script = ''
|
|
assertDirectoryExists home-files/.config/nnn/plugins
|
|
|
|
for bookmark in 'export NNN_BMS' '~/Downloads' '~/Documents' '~/Pictures' '~/Videos'; do
|
|
assertFileRegex home-path/bin/nnn "$bookmark"
|
|
done
|
|
|
|
for plugin in 'export NNN_PLUG' 'fzcd' 'finder' 'imgview'; do
|
|
assertFileRegex home-path/bin/nnn "$plugin"
|
|
done
|
|
'';
|
|
};
|
|
};
|
|
}
|