mirror of
https://github.com/nix-community/home-manager
synced 2024-11-16 08:09:45 +01:00
592da767bd
nnn is a terminal file manager. It is configured mostly using environment variables, so the way I found it to avoid needing to write either shell specific code or using `home.sessionVariables` (that would need to make the user relogin at every configuration change) is to wrap the program using `wrapProgram`.
57 lines
1.3 KiB
Nix
57 lines
1.3 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 = ''
|
|
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
|
|
|
|
assertFileRegex \
|
|
home-path/bin/nnn \
|
|
"^export NNN_BMS='D:~/Downloads;d:~/Documents;p:~/Pictures;v:~/Videos'\''${NNN_BMS:+':'}\$NNN_BMS$"
|
|
|
|
assertFileRegex \
|
|
home-path/bin/nnn \
|
|
"^export NNN_PLUG='c:fzcd;f:finder;v:imgview'\''${NNN_PLUG:+':'}\$NNN_PLUG$"
|
|
|
|
assertFileRegex \
|
|
home-path/bin/nnn \
|
|
"/nix/store/.*-"{foo,bar}"/bin"
|
|
'';
|
|
};
|
|
};
|
|
}
|