Added a module for Xpra

This commit is contained in:
Jan-Bulthuis 2025-04-18 21:49:36 +02:00
parent 41867fb653
commit 6b99c0f771
4 changed files with 75 additions and 4 deletions

View File

@ -33,6 +33,7 @@
./whatsapp/default.nix
./wprs/default.nix
./winbox/default.nix
./xpra/default.nix
./zathura/default.nix
# Import unfree helper

View File

@ -58,18 +58,18 @@ in
commands = entry.value;
hostEntries = [
{
name = "Attach";
name = "Wprs - Attach";
comment = host;
exec = "wprs --pulseaudio-forwarding False ${host} attach";
}
{
name = "Detach";
name = "Wprs - Detach";
comment = host;
exec = "wprs ${host} detach";
}
];
commandEntries = map (command: {
name = "${command.name}";
name = "Wprs - ${command.name}";
comment = host;
exec = "wprs --pulseaudio-forwarding False ${host} run \"${command.command}\"";
}) commands;

View File

@ -0,0 +1,63 @@
{
lib,
config,
pkgs,
...
}:
with lib;
let
cfg = config.modules.xpra;
in
{
options.modules.xpra = {
enable = mkEnableOption "Enable xpra";
hosts = mkOption {
type = types.listOf types.str;
default = { };
description = "xpra hosts";
};
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
xpra
];
xdg.desktopEntries = (
listToAttrs (
map
(entry: {
name = "xpra${
builtins.substring 0 12 (builtins.hashString "sha256" "${entry.name} (${entry.comment})")
}";
value = entry // {
type = "Application";
terminal = false;
genericName = entry.comment;
};
})
(
concatMap (
host:
let
uri = "tcp://${host}:15151/7";
in
[
{
name = "Xpra - Attach";
comment = host;
exec = "xpra attach --min-quality=100 --min-speed=100 --encoding=png --speaker=off ${uri}";
}
{
name = "Xpra - Detach";
comment = host;
exec = "xpra detach ${uri}";
}
]
) cfg.hosts
)
)
);
};
}

View File

@ -24,6 +24,7 @@
inkscape
ente-auth
bitwarden
carla
];
# desktop.development = "river-light";
@ -369,11 +370,17 @@
"mixer@10.20.60.251" = [
{
name = "Carla";
command = "carla -platform wayland";
command = "carla -platform xcb";
}
];
};
};
xpra = {
enable = true;
hosts = [
"mixer@10.20.60.251"
];
};
# Development
neovim.enable = true;