1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-18 00:59:44 +01:00
home-manager/tests/modules/programs/nnn/nnn.nix
2023-07-08 10:12:35 +02:00

53 lines
1.1 KiB
Nix

{ pkgs, ... }:
{
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
'';
};
}