1
0
mirror of https://github.com/nix-community/home-manager synced 2024-07-03 03:48:31 +02:00
home-manager/tests/modules/programs/pistol/associations.nix
Matthew Toohey b7eb400d41
pistol: refactor
This pull requests refactors the pistol configuration options, since
the current options are deficient in a few ways.

Closes #3486
2022-12-16 17:05:30 +01:00

39 lines
963 B
Nix

{ pkgs, ... }:
{
programs.pistol = {
enable = true;
associations = [
{
mime = "application/json";
command = "bat %pistol-filename%";
}
{
mime = "application/*";
command = "hexyl %pistol-filename%";
}
{
fpath = ".*.md$";
command =
"sh: bat --paging=never --color=always %pistol-filename% | head -8";
}
];
};
test.stubs.pistol = { };
nmt.script = let
expected = builtins.toFile "config-expected" ''
application/json bat %pistol-filename%
application/* hexyl %pistol-filename%
fpath .*.md$ sh: bat --paging=never --color=always %pistol-filename% | head -8'';
path = if pkgs.stdenv.hostPlatform.isDarwin then
"home-files/Library/Application Support/pistol/pistol.conf"
else
"home-files/.config/pistol/pistol.conf";
in ''
assertFileExists '${path}'
assertFileContent '${path}' '${expected}'
'';
}