1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-05 18:59:44 +01:00
home-manager/tests/modules/programs/nnn/nnn.nix

54 lines
1.1 KiB
Nix
Raw Normal View History

2023-07-08 10:12:35 +02:00
{ pkgs, ... }:
{
2023-07-08 10:12:35 +02:00
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";
};
};
2023-07-08 10:12:35 +02:00
};
2023-07-08 10:12:35 +02:00
test.stubs = {
nnnDummy.buildScript = ''
runHook preInstall
2023-07-08 10:12:35 +02:00
mkdir -p "$out/bin"
touch "$out/bin/nnn"
chmod +x "$out/bin/nnn"
2023-07-08 10:12:35 +02:00
runHook postInstall
'';
foo = { name = "foo"; };
bar = { name = "bar"; };
};
2023-07-08 10:12:35 +02:00
nmt = {
description =
"Check if the binary is correctly wrapped and if the symlinks are made";
script = ''
assertDirectoryExists home-files/.config/nnn/plugins
2023-07-08 10:12:35 +02:00
for bookmark in 'export NNN_BMS' '~/Downloads' '~/Documents' '~/Pictures' '~/Videos'; do
assertFileRegex home-path/bin/nnn "$bookmark"
done
2023-07-08 10:12:35 +02:00
for plugin in 'export NNN_PLUG' 'fzcd' 'finder' 'imgview'; do
assertFileRegex home-path/bin/nnn "$plugin"
done
'';
};
}