mirror of
https://github.com/nix-community/home-manager
synced 2024-12-05 01:19:46 +01:00
406d34d919
Don't try to validate a limited set of hardcoded options, instead just convert them as-is. Now, users can keep all their options in a single attribute set, including arbitrary `user_{option}`s which was impossible to express with a hard-coded submodule. As a plus, there is also less maintainence burden.
85 lines
1.4 KiB
Nix
85 lines
1.4 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
pvScript = builtins.toFile "pv.sh" "cat $1";
|
|
expected = builtins.toFile "settings-expected" ''
|
|
set icons
|
|
set noignorecase
|
|
set ratios "2:2:3"
|
|
set tabstop 4
|
|
|
|
cmd added :echo "foo"
|
|
cmd multiline :{{
|
|
push gg
|
|
echo "bar"
|
|
push i
|
|
}}
|
|
cmd removed
|
|
|
|
map aa should-be-added
|
|
map ab
|
|
|
|
cmap <c-a> should-be-added
|
|
cmap <c-b>
|
|
|
|
set previewer ${pvScript}
|
|
map i ${"$"}${pvScript} "$f" | less -R
|
|
|
|
|
|
|
|
# More config...
|
|
|
|
'';
|
|
in {
|
|
config = {
|
|
programs.lf = {
|
|
enable = true;
|
|
|
|
cmdKeybindings = {
|
|
"<c-a>" = "should-be-added";
|
|
"<c-b>" = null;
|
|
};
|
|
|
|
commands = {
|
|
added = '':echo "foo"'';
|
|
removed = null;
|
|
multiline = ''
|
|
:{{
|
|
push gg
|
|
echo "bar"
|
|
push i
|
|
}}'';
|
|
};
|
|
|
|
extraConfig = ''
|
|
# More config...
|
|
'';
|
|
|
|
keybindings = {
|
|
aa = "should-be-added";
|
|
ab = null;
|
|
};
|
|
|
|
previewer = {
|
|
keybinding = "i";
|
|
source = pvScript;
|
|
};
|
|
|
|
settings = {
|
|
ignorecase = false;
|
|
icons = true;
|
|
tabstop = 4;
|
|
ratios = [ 2 2 3 ];
|
|
};
|
|
};
|
|
|
|
test.stubs.lf = { };
|
|
|
|
nmt.script = ''
|
|
assertFileExists home-files/.config/lf/lfrc
|
|
assertFileContent home-files/.config/lf/lfrc ${expected}
|
|
'';
|
|
};
|
|
}
|