mirror of
https://github.com/nix-community/home-manager
synced 2024-11-22 20:53:14 +00:00
imv: add module (#4032)
* imv: add module Signed-off-by: Christoph Heiss <christoph@c8h4.io> * imv: add test cases Signed-off-by: Christoph Heiss <christoph@c8h4.io> --------- Signed-off-by: Christoph Heiss <christoph@c8h4.io> Co-authored-by: Naïm Favier <n@monade.li>
This commit is contained in:
parent
3512a6dafb
commit
39c7d0a97a
8 changed files with 102 additions and 0 deletions
|
@ -1055,6 +1055,13 @@ in
|
|||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2023-06-07T12:16:55+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'programs.imv'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -97,6 +97,7 @@ let
|
|||
./programs/hyfetch.nix
|
||||
./programs/i3status-rust.nix
|
||||
./programs/i3status.nix
|
||||
./programs/imv.nix
|
||||
./programs/info.nix
|
||||
./programs/ion.nix
|
||||
./programs/irssi.nix
|
||||
|
|
49
modules/programs/imv.nix
Normal file
49
modules/programs/imv.nix
Normal file
|
@ -0,0 +1,49 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.imv;
|
||||
|
||||
toConfig = attrs:
|
||||
''
|
||||
# Generated by Home Manager.
|
||||
'' + generators.toINI { } attrs;
|
||||
in {
|
||||
meta.maintainers = [ maintainers.christoph-heiss ];
|
||||
|
||||
options.programs.imv = {
|
||||
enable = mkEnableOption
|
||||
"imv: a command line image viewer intended for use with tiling window managers";
|
||||
|
||||
package = mkPackageOption pkgs "imv" { };
|
||||
|
||||
settings = mkOption {
|
||||
default = { };
|
||||
type = with types; attrsOf (attrsOf (oneOf [ bool int str ]));
|
||||
description = ''
|
||||
Configuration options for imv. See
|
||||
<citerefentry>
|
||||
<refentrytitle>imv</refentrytitle>
|
||||
<manvolnum>5</manvolnum>
|
||||
</citerefentry>.
|
||||
'';
|
||||
example = literalExpression ''
|
||||
{
|
||||
options.background = "ffffff";
|
||||
aliases.x = "close";
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
assertions =
|
||||
[ (hm.assertions.assertPlatform "programs.imv" pkgs platforms.linux) ];
|
||||
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
xdg.configFile =
|
||||
mkIf (cfg.settings != { }) { "imv/config".text = toConfig cfg.settings; };
|
||||
};
|
||||
}
|
|
@ -164,6 +164,7 @@ import nmt {
|
|||
./modules/programs/gnome-terminal
|
||||
./modules/programs/hexchat
|
||||
./modules/programs/i3status-rust
|
||||
./modules/programs/imv
|
||||
./modules/programs/kodi
|
||||
./modules/programs/looking-glass-client
|
||||
./modules/programs/mangohud
|
||||
|
|
6
tests/modules/programs/imv/basic-configuration.conf
Normal file
6
tests/modules/programs/imv/basic-configuration.conf
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Generated by Home Manager.
|
||||
[aliases]
|
||||
x=close
|
||||
|
||||
[options]
|
||||
background=ffffff
|
20
tests/modules/programs/imv/basic-configuration.nix
Normal file
20
tests/modules/programs/imv/basic-configuration.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.imv = {
|
||||
enable = true;
|
||||
package = pkgs.writeScriptBin "dummy-imv" "";
|
||||
settings = {
|
||||
options.background = "ffffff";
|
||||
aliases.x = "close";
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/imv/config
|
||||
assertFileContent home-files/.config/imv/config \
|
||||
${./basic-configuration.conf}
|
||||
'';
|
||||
};
|
||||
}
|
4
tests/modules/programs/imv/default.nix
Normal file
4
tests/modules/programs/imv/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
imv-basic-configuration = ./basic-configuration.nix;
|
||||
imv-empty-configuration = ./empty-configuration.nix;
|
||||
}
|
14
tests/modules/programs/imv/empty-configuration.nix
Normal file
14
tests/modules/programs/imv/empty-configuration.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.imv = {
|
||||
enable = true;
|
||||
package = pkgs.writeScriptBin "dummy-imv" "";
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/imv/config
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue