mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
formiko: add module
This commit is contained in:
parent
9f408dc51c
commit
9093a3f200
4 changed files with 93 additions and 0 deletions
53
modules/programs/formiko.nix
Normal file
53
modules/programs/formiko.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkIf
|
||||||
|
mkEnableOption
|
||||||
|
mkPackageOption
|
||||||
|
mkOption
|
||||||
|
;
|
||||||
|
|
||||||
|
cfg = config.programs.formiko;
|
||||||
|
iniFormat = pkgs.formats.ini { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||||
|
options.programs.formiko = {
|
||||||
|
enable = mkEnableOption "formiko";
|
||||||
|
package = mkPackageOption pkgs "formiko" { nullable = true; };
|
||||||
|
settings = mkOption {
|
||||||
|
inherit (iniFormat) type;
|
||||||
|
default = { };
|
||||||
|
example = {
|
||||||
|
main = {
|
||||||
|
preview = 0;
|
||||||
|
parser = "json";
|
||||||
|
auto_scroll = true;
|
||||||
|
writer = "tiny";
|
||||||
|
};
|
||||||
|
|
||||||
|
editor = {
|
||||||
|
period_save = true;
|
||||||
|
check_spelling = false;
|
||||||
|
auto_indent = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
|
Configuration settings for formiko. All the available options
|
||||||
|
can be found by looking at ~/.config/formiko.ini.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||||
|
xdg.configFile."formiko.ini" = mkIf (cfg.settings != { }) {
|
||||||
|
source = iniFormat.generate "formiko.ini" cfg.settings;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
5
tests/modules/programs/formiko/default.nix
Normal file
5
tests/modules/programs/formiko/default.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
|
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||||
|
formiko-example-config = ./example-config.nix;
|
||||||
|
}
|
||||||
25
tests/modules/programs/formiko/example-config.nix
Normal file
25
tests/modules/programs/formiko/example-config.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
programs.formiko = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
main = {
|
||||||
|
preview = 0;
|
||||||
|
parser = "json";
|
||||||
|
auto_scroll = true;
|
||||||
|
writer = "tiny";
|
||||||
|
};
|
||||||
|
|
||||||
|
editor = {
|
||||||
|
period_save = true;
|
||||||
|
check_spelling = false;
|
||||||
|
auto_indent = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/formiko.ini
|
||||||
|
assertFileContent home-files/.config/formiko.ini \
|
||||||
|
${./formiko.ini}
|
||||||
|
'';
|
||||||
|
}
|
||||||
10
tests/modules/programs/formiko/formiko.ini
Normal file
10
tests/modules/programs/formiko/formiko.ini
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
[editor]
|
||||||
|
auto_indent=false
|
||||||
|
check_spelling=false
|
||||||
|
period_save=true
|
||||||
|
|
||||||
|
[main]
|
||||||
|
auto_scroll=true
|
||||||
|
parser=json
|
||||||
|
preview=0
|
||||||
|
writer=tiny
|
||||||
Loading…
Add table
Add a link
Reference in a new issue