1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 03:29:45 +01:00

swayimg: add programs.swayimg module

This commit is contained in:
Adithya Nair 2024-07-20 17:47:35 +05:30
parent e83414058e
commit d2a0c523f2
No known key found for this signature in database
GPG key ID: B8857BFBA2C47B9C
9 changed files with 111 additions and 0 deletions

View file

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

View file

@ -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

View 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;
};
};
}

View file

@ -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

View 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

View file

@ -0,0 +1,5 @@
{
swayimg-disabled = import ./disabled.nix;
swayimg-enabled = import ./enabled.nix;
swayimg-settings = import ./settings.nix;
}

View file

@ -0,0 +1,6 @@
{ ... }: {
nmt.script = ''
assertPathNotExists home-files/.config/swayimg/config
'';
}

View file

@ -0,0 +1,10 @@
{ config, ... }: {
programs.swayimg = {
enable = true;
package = config.lib.test.mkStubPackage { };
};
nmt.script = ''
assertPathNotExists home-files/.config/swayimg/config
'';
}

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