2023-09-12 08:44:05 -06:00
|
|
|
{ config
|
|
|
|
, lib
|
2024-03-25 07:52:07 -06:00
|
|
|
, pkgs
|
2024-02-29 08:14:45 -07:00
|
|
|
, isUnstable
|
2023-09-12 08:44:05 -06:00
|
|
|
, ...
|
|
|
|
}:
|
2024-03-15 08:03:56 -06:00
|
|
|
let
|
|
|
|
inherit (lib) mkIf mkEnableOption mkMerge mkOption types;
|
2024-04-18 06:22:59 -06:00
|
|
|
kconnect = mkIf config.kdeConnect.enable
|
2024-04-17 20:52:06 -06:00
|
|
|
(if isUnstable then
|
|
|
|
pkgs.kdePackages.kdeconnect-kde
|
|
|
|
else
|
2024-04-18 06:22:59 -06:00
|
|
|
pkgs.plasma5Packages.kdeconnect-kde);
|
2024-03-15 08:03:56 -06:00
|
|
|
in
|
2024-04-17 20:52:06 -06:00
|
|
|
with pkgs;
|
2023-09-12 08:44:05 -06:00
|
|
|
{
|
2024-03-15 08:03:56 -06:00
|
|
|
options = {
|
|
|
|
kde = { enable = mkEnableOption "Enable KDE desktop."; };
|
|
|
|
kdeConnect = {
|
|
|
|
enable = mkEnableOption {
|
|
|
|
description = "Enable PipeWire";
|
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
interface = mkOption {
|
|
|
|
description = "listen interface for kde connect";
|
|
|
|
default = "tailscale0";
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2022-08-25 12:21:35 -06:00
|
|
|
|
2024-03-15 08:03:56 -06:00
|
|
|
config = mkIf config.kde.enable {
|
2024-04-01 16:08:08 -06:00
|
|
|
services =
|
2024-03-15 08:03:56 -06:00
|
|
|
mkMerge [
|
2024-03-12 07:48:11 -06:00
|
|
|
(if isUnstable then {
|
|
|
|
desktopManager.plasma6.enable = true;
|
2024-04-11 10:08:03 -06:00
|
|
|
displayManager.sddm.enable = true;
|
2024-03-12 07:48:11 -06:00
|
|
|
}
|
|
|
|
else {
|
2024-04-01 16:08:08 -06:00
|
|
|
xserver = {
|
|
|
|
desktopManager.plasma5.enable = true;
|
|
|
|
displayManager.sddm.enable = true;
|
|
|
|
};
|
2024-03-12 07:48:11 -06:00
|
|
|
})
|
|
|
|
];
|
2022-08-25 12:21:35 -06:00
|
|
|
|
|
|
|
# Listen for KDE Connect connections on the tailnet
|
2024-03-15 08:03:56 -06:00
|
|
|
networking.firewall.interfaces = mkIf config.kdeConnect.enable {
|
|
|
|
"${config.kdeConnect.interface}" =
|
|
|
|
let
|
|
|
|
range = {
|
|
|
|
from = 1714;
|
|
|
|
to = 1764;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
allowedUDPPortRanges = [ range ];
|
|
|
|
allowedTCPPortRanges = [ range ];
|
|
|
|
};
|
2022-08-25 12:21:35 -06:00
|
|
|
};
|
2024-04-17 20:52:06 -06:00
|
|
|
environment.systemPackages = [
|
|
|
|
kcolorchooser
|
|
|
|
kconnect
|
|
|
|
];
|
2022-08-25 12:21:35 -06:00
|
|
|
};
|
|
|
|
}
|