diff --git a/modules/misc/news.nix b/modules/misc/news.nix
index fea907858..c27ba8b4d 100644
--- a/modules/misc/news.nix
+++ b/modules/misc/news.nix
@@ -1186,6 +1186,13 @@ in
A new module is available: 'programs.xplr'.
'';
}
+
+ {
+ time = "2023-08-16T15:43:30+00:00";
+ message = ''
+ A new module is available: 'programs.pqiv'.
+ '';
+ }
];
};
}
diff --git a/modules/modules.nix b/modules/modules.nix
index a23d6ebaa..d4fc5afdc 100644
--- a/modules/modules.nix
+++ b/modules/modules.nix
@@ -169,6 +169,7 @@ let
./programs/piston-cli.nix
./programs/pls.nix
./programs/powerline-go.nix
+ ./programs/pqiv.nix
./programs/pubs.nix
./programs/pyenv.nix
./programs/pylint.nix
diff --git a/modules/programs/pqiv.nix b/modules/programs/pqiv.nix
new file mode 100644
index 000000000..046ed9aa9
--- /dev/null
+++ b/modules/programs/pqiv.nix
@@ -0,0 +1,56 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+ cfg = config.programs.pqiv;
+ iniFormat = pkgs.formats.ini { };
+
+in {
+ meta.maintainers = with lib.maintainers; [ donovanglover ];
+
+ options.programs.pqiv = {
+ enable = mkEnableOption "pqiv image viewer";
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.pqiv;
+ defaultText = literalExpression "pkgs.pqiv";
+ description = "The pqiv package to install.";
+ };
+
+ settings = mkOption {
+ type = iniFormat.type;
+ default = { };
+ description = ''
+ Configuration written to
+ $XDG_CONFIG_HOME/pqivrc. See
+ for a list of available options. To set a boolean flag, set the value to 1.
+ '';
+ example = literalExpression ''
+ {
+ options = {
+ lazy-load = 1;
+ hide-info-box = 1;
+ background-pattern = "black";
+ thumbnail-size = "256x256";
+ command-1 = "thunar";
+ };
+ };
+ '';
+ };
+ };
+
+ config = mkIf cfg.enable {
+ assertions =
+ [ (hm.assertions.assertPlatform "programs.pqiv" pkgs platforms.linux) ];
+
+ home.packages = [ cfg.package ];
+
+ xdg.configFile."pqivrc" = mkIf (cfg.settings != { }) {
+ source = iniFormat.generate "pqivrc" cfg.settings;
+ };
+ };
+}
diff --git a/tests/default.nix b/tests/default.nix
index 33331264b..62d1505cd 100644
--- a/tests/default.nix
+++ b/tests/default.nix
@@ -118,6 +118,7 @@ import nmt {
./modules/programs/pistol
./modules/programs/pls
./modules/programs/powerline-go
+ ./modules/programs/pqiv
./modules/programs/pubs
./modules/programs/pyenv
./modules/programs/qutebrowser
diff --git a/tests/modules/programs/pqiv/default.nix b/tests/modules/programs/pqiv/default.nix
new file mode 100644
index 000000000..24798b354
--- /dev/null
+++ b/tests/modules/programs/pqiv/default.nix
@@ -0,0 +1 @@
+{ pqiv-settings = ./settings.nix; }
diff --git a/tests/modules/programs/pqiv/settings.nix b/tests/modules/programs/pqiv/settings.nix
new file mode 100644
index 000000000..6a5abe604
--- /dev/null
+++ b/tests/modules/programs/pqiv/settings.nix
@@ -0,0 +1,25 @@
+{ config, ... }:
+
+{
+ programs.pqiv = {
+ enable = true;
+ package = config.lib.test.mkStubPackage { name = "pqiv"; };
+ settings = {
+ options = {
+ hide-info-box = 1;
+ thumbnail-size = "256x256";
+ };
+ };
+ };
+
+ nmt.script = ''
+ assertFileExists home-files/.config/pqivrc
+ assertFileContent home-files/.config/pqivrc ${
+ builtins.toFile "pqiv.expected" ''
+ [options]
+ hide-info-box=1
+ thumbnail-size=256x256
+ ''
+ }
+ '';
+}