treewide: implement auto importing for modules
Reduce maintenance burden and increase efficiency by automatically importing modules following a specific convention. Co-authored-by: awwpotato <awwpotato@voidq.com> Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
fefeb0e928
commit
4fca600cb1
461 changed files with 72 additions and 474 deletions
60
modules/programs/imv/default.nix
Normal file
60
modules/programs/imv/default.nix
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.programs.imv;
|
||||
|
||||
toConfig =
|
||||
attrs:
|
||||
''
|
||||
# Generated by Home Manager.
|
||||
''
|
||||
+ lib.generators.toINI { } attrs;
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ lib.maintainers.christoph-heiss ];
|
||||
|
||||
options.programs.imv = {
|
||||
enable = lib.mkEnableOption "imv: a command line image viewer intended for use with tiling window managers";
|
||||
|
||||
package = lib.mkPackageOption pkgs "imv" { nullable = true; };
|
||||
|
||||
settings = lib.mkOption {
|
||||
default = { };
|
||||
type =
|
||||
with lib.types;
|
||||
attrsOf (
|
||||
attrsOf (oneOf [
|
||||
bool
|
||||
int
|
||||
str
|
||||
])
|
||||
);
|
||||
description = ''
|
||||
Configuration options for imv. See
|
||||
{manpage}`imv(5)`.
|
||||
'';
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
options.background = "ffffff";
|
||||
aliases.x = "close";
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "programs.imv" pkgs lib.platforms.linux)
|
||||
];
|
||||
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
|
||||
xdg.configFile = lib.mkIf (cfg.settings != { }) {
|
||||
"imv/config".text = toConfig cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue