mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
swayimg: add programs.swayimg
module
This commit is contained in:
parent
e83414058e
commit
d2a0c523f2
9 changed files with 111 additions and 0 deletions
|
@ -1813,6 +1813,16 @@ in {
|
|||
systems" section in the Home Manager mantual for more.
|
||||
'';
|
||||
}
|
||||
{
|
||||
time = "2024-07-20T12:05:41+00:00";
|
||||
condition = hostPlatform.isLinux;
|
||||
message = ''
|
||||
A new module is available: 'programs.swayimg'.
|
||||
|
||||
Swayimg is a lightweight image viewer for Wayland display servers.
|
||||
See https://github.com/artemsen/swayimg for more.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -226,6 +226,7 @@ let
|
|||
./programs/sqls.nix
|
||||
./programs/ssh.nix
|
||||
./programs/starship.nix
|
||||
./programs/swayimg.nix
|
||||
./programs/swaylock.nix
|
||||
./programs/swayr.nix
|
||||
./programs/taskwarrior.nix
|
||||
|
|
39
modules/programs/swayimg.nix
Normal file
39
modules/programs/swayimg.nix
Normal file
|
@ -0,0 +1,39 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
let
|
||||
cfg = config.programs.swayimg;
|
||||
iniFormat = pkgs.formats.ini { };
|
||||
in {
|
||||
meta.maintainers = [ lib.maintainers.adtya ];
|
||||
|
||||
options.programs.swayimg = {
|
||||
enable = lib.mkEnableOption "swayimg";
|
||||
package = lib.mkPackageOption pkgs "swayimg" { };
|
||||
settings = lib.mkOption {
|
||||
type = iniFormat.type;
|
||||
default = { };
|
||||
example = lib.literalExpression ''
|
||||
{
|
||||
general = {
|
||||
scale = "optimal";
|
||||
fullscreen = "no";
|
||||
};
|
||||
};
|
||||
'';
|
||||
description = ''
|
||||
Configuration written to {file}`$XDG_CONFIG_HOME/swayimg/config`. See
|
||||
{manpage}`swayimgrc(5)` for a list of available options.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "programs.swayimg" pkgs
|
||||
lib.platforms.linux)
|
||||
];
|
||||
home.packages = [ cfg.package ];
|
||||
xdg.configFile."swayimg/config" = lib.mkIf (cfg.settings != { }) {
|
||||
text = lib.generators.toINI { } cfg.settings;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -216,6 +216,7 @@ in import nmtSrc {
|
|||
./modules/programs/rbw
|
||||
./modules/programs/rofi
|
||||
./modules/programs/rofi-pass
|
||||
./modules/programs/swayimg
|
||||
./modules/programs/swaylock
|
||||
./modules/programs/swayr
|
||||
./modules/programs/terminator
|
||||
|
|
12
tests/modules/programs/swayimg/config
Normal file
12
tests/modules/programs/swayimg/config
Normal file
|
@ -0,0 +1,12 @@
|
|||
[font]
|
||||
name=monospace
|
||||
size=14
|
||||
|
||||
[general]
|
||||
antialiasing=no
|
||||
fixed=yes
|
||||
fullscreen=no
|
||||
position=parent
|
||||
scale=optimal
|
||||
size=parent
|
||||
transparency=grid
|
5
tests/modules/programs/swayimg/default.nix
Normal file
5
tests/modules/programs/swayimg/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
swayimg-disabled = import ./disabled.nix;
|
||||
swayimg-enabled = import ./enabled.nix;
|
||||
swayimg-settings = import ./settings.nix;
|
||||
}
|
6
tests/modules/programs/swayimg/disabled.nix
Normal file
6
tests/modules/programs/swayimg/disabled.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{ ... }: {
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/swayimg/config
|
||||
'';
|
||||
}
|
10
tests/modules/programs/swayimg/enabled.nix
Normal file
10
tests/modules/programs/swayimg/enabled.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ config, ... }: {
|
||||
programs.swayimg = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertPathNotExists home-files/.config/swayimg/config
|
||||
'';
|
||||
}
|
27
tests/modules/programs/swayimg/settings.nix
Normal file
27
tests/modules/programs/swayimg/settings.nix
Normal file
|
@ -0,0 +1,27 @@
|
|||
{ config, ... }: {
|
||||
programs.swayimg = {
|
||||
enable = true;
|
||||
package = config.lib.test.mkStubPackage { };
|
||||
settings = {
|
||||
general = {
|
||||
scale = "optimal";
|
||||
fullscreen = "no";
|
||||
antialiasing = "no";
|
||||
fixed = "yes";
|
||||
transparency = "grid";
|
||||
position = "parent";
|
||||
size = "parent";
|
||||
};
|
||||
font = {
|
||||
name = "monospace";
|
||||
size = 14;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
nmt.script = let homeConfig = "home-files/.config/swayimg/config";
|
||||
in ''
|
||||
assertFileExists ${homeConfig}
|
||||
assertFileContents ${homeConfig} ${./config}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue