mirror of
https://github.com/nix-community/home-manager
synced 2024-11-20 01:59:45 +01:00
pqiv: add module
This commit is contained in:
parent
75cfe974e2
commit
9db5b89f40
6 changed files with 91 additions and 0 deletions
|
@ -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'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
56
modules/programs/pqiv.nix
Normal file
56
modules/programs/pqiv.nix
Normal 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;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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
|
||||
|
|
1
tests/modules/programs/pqiv/default.nix
Normal file
1
tests/modules/programs/pqiv/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ pqiv-settings = ./settings.nix; }
|
25
tests/modules/programs/pqiv/settings.nix
Normal file
25
tests/modules/programs/pqiv/settings.nix
Normal 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
|
||||
''
|
||||
}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue