infat: add module

This commit is contained in:
Mirko Lenz 2025-11-24 08:16:29 +01:00 committed by Austin Horstman
parent ab8e4b2b5a
commit 06f81463bb
5 changed files with 149 additions and 0 deletions

View file

@ -0,0 +1,6 @@
{ lib, pkgs, ... }:
lib.optionalAttrs pkgs.stdenv.hostPlatform.isDarwin {
infat-example-settings = ./example-settings.nix;
infat-no-settings = ./no-settings.nix;
}

View file

@ -0,0 +1,39 @@
{ pkgs, ... }:
{
programs.infat = {
enable = true;
settings = {
extensions = {
md = "TextEdit";
};
schemes = {
web = "Safari";
};
types = {
plain-text = "VSCode";
};
};
};
test.stubs.infat = { };
nmt.script =
let
expectedConfigPath = "home-files/.config/infat/config.toml";
expectedConfigContent = pkgs.writeText "infat.config.expected" ''
[extensions]
md = "TextEdit"
[schemes]
web = "Safari"
[types]
plain-text = "VSCode"
'';
in
''
assertFileExists "${expectedConfigPath}"
assertFileContent "${expectedConfigPath}" "${expectedConfigContent}"
'';
}

View file

@ -0,0 +1,13 @@
{
programs.infat.enable = true;
test.stubs.infat = { };
nmt.script =
let
expectedConfigPath = "home-files/.config/infat/config.toml";
in
''
assertPathNotExists "${expectedConfigPath}"
'';
}