pqiv: add module

This commit is contained in:
Donovan Glover 2023-07-03 14:30:13 -04:00 committed by Robert Helgesson
parent 75cfe974e2
commit 9db5b89f40
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
6 changed files with 91 additions and 0 deletions

View file

@ -1186,6 +1186,13 @@ in
A new module is available: 'programs.xplr'. A new module is available: 'programs.xplr'.
''; '';
} }
{
time = "2023-08-16T15:43:30+00:00";
message = ''
A new module is available: 'programs.pqiv'.
'';
}
]; ];
}; };
} }

View file

@ -169,6 +169,7 @@ let
./programs/piston-cli.nix ./programs/piston-cli.nix
./programs/pls.nix ./programs/pls.nix
./programs/powerline-go.nix ./programs/powerline-go.nix
./programs/pqiv.nix
./programs/pubs.nix ./programs/pubs.nix
./programs/pyenv.nix ./programs/pyenv.nix
./programs/pylint.nix ./programs/pylint.nix

56
modules/programs/pqiv.nix Normal file
View file

@ -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
<filename>$XDG_CONFIG_HOME/pqivrc</filename>. See <link
xlink:href="https://github.com/phillipberndt/pqiv/blob/master/pqiv.1"/>
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;
};
};
}

View file

@ -118,6 +118,7 @@ import nmt {
./modules/programs/pistol ./modules/programs/pistol
./modules/programs/pls ./modules/programs/pls
./modules/programs/powerline-go ./modules/programs/powerline-go
./modules/programs/pqiv
./modules/programs/pubs ./modules/programs/pubs
./modules/programs/pyenv ./modules/programs/pyenv
./modules/programs/qutebrowser ./modules/programs/qutebrowser

View file

@ -0,0 +1 @@
{ pqiv-settings = ./settings.nix; }

View file

@ -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
''
}
'';
}