looking-glass-client: add module

This commit is contained in:
j-brn 2022-10-09 20:11:59 +02:00 committed by Robert Helgesson
parent e901c8d860
commit 42f81ac107
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
9 changed files with 150 additions and 0 deletions

3
.github/CODEOWNERS vendored
View file

@ -176,6 +176,9 @@ Makefile @thiagokokada
/modules/programs/lieer.nix @tadfisher /modules/programs/lieer.nix @tadfisher
/modules/programs/looking-glass-client.nix @j-brn
/tests/modules/programs/looking-glass-client @j-brn
/modules/programs/lsd.nix @marsam /modules/programs/lsd.nix @marsam
/modules/programs/matplotlib.nix @rprospero /modules/programs/matplotlib.nix @rprospero

View file

@ -762,6 +762,14 @@ in
want to automatically run scheduled backups. want to automatically run scheduled backups.
''; '';
} }
{
time = "2022-10-18T08:07:43+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'programs.looking-glass-client'.
'';
}
]; ];
}; };
} }

View file

@ -110,6 +110,7 @@ let
./programs/lf.nix ./programs/lf.nix
./programs/librewolf.nix ./programs/librewolf.nix
./programs/lieer.nix ./programs/lieer.nix
./programs/looking-glass-client.nix
./programs/lsd.nix ./programs/lsd.nix
./programs/man.nix ./programs/man.nix
./programs/mangohud.nix ./programs/mangohud.nix

View file

@ -0,0 +1,60 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.looking-glass-client;
settingsFormat = pkgs.formats.ini { };
in {
meta.maintainers = with maintainers; [ j-brn ];
options.programs.looking-glass-client = {
enable = mkEnableOption "looking-glass-client";
package = mkPackageOption pkgs "looking-glass-client" { };
settings = mkOption {
type = settingsFormat.type;
default = { };
description = "looking-glass-client settings.";
example = literalExpression ''
{
app = {
allowDMA = true;
shmFile = "/dev/kvmfr0";
};
win = {
fullScreen = true;
showFPS = false;
jitRender = true;
};
spice = {
enable = true;
audio = true;
};
input = {
rawMouse = true;
escapeKey = 62;
};
}
'';
};
};
config = mkIf cfg.enable {
assertions = [
(hm.assertions.assertPlatform "programs.looking-glass-client" pkgs
platforms.linux)
];
home.packages = [ cfg.package ];
xdg.configFile."looking-glass/client.ini" = mkIf (cfg.settings != { }) {
source =
settingsFormat.generate ("looking-glass-client.ini") cfg.settings;
};
};
}

View file

@ -149,6 +149,7 @@ import nmt {
./modules/programs/hexchat ./modules/programs/hexchat
./modules/programs/i3status-rust ./modules/programs/i3status-rust
./modules/programs/kodi ./modules/programs/kodi
./modules/programs/looking-glass-client
./modules/programs/mangohud ./modules/programs/mangohud
./modules/programs/ncmpcpp-linux ./modules/programs/ncmpcpp-linux
./modules/programs/neovim # Broken package dependency on Darwin. ./modules/programs/neovim # Broken package dependency on Darwin.

View file

@ -0,0 +1,4 @@
{
looking-glass-client-example-settings = ./example-settings.nix;
looking-glass-client-empty-settings = ./empty-settings.nix;
}

View file

@ -0,0 +1,16 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
programs.looking-glass-client = {
enable = true;
package = config.lib.test.mkStubPackage { };
};
nmt.script = ''
assertPathNotExists home-files/.config/looking-glass/client.ini
'';
};
}

View file

@ -0,0 +1,16 @@
[app]
allowDMA=true
shmFile=/dev/kvmfr0
[input]
escapeKey=62
rawMouse=true
[spice]
audio=true
enable=true
[win]
fullScreen=true
jitRender=true
showFPS=false

View file

@ -0,0 +1,41 @@
{ config, lib, ... }:
with lib;
{
config = {
programs.looking-glass-client = {
enable = true;
package = config.lib.test.mkStubPackage { };
settings = {
app = {
allowDMA = true;
shmFile = "/dev/kvmfr0";
};
win = {
fullScreen = true;
showFPS = false;
jitRender = true;
};
spice = {
enable = true;
audio = true;
};
input = {
rawMouse = true;
escapeKey = 62;
};
};
};
nmt.script = ''
assertFileContent \
home-files/.config/looking-glass/client.ini \
${./example-config.ini}
'';
};
}