nixos-config/modules/workstation/wireshark.nix

29 lines
702 B
Nix
Raw Normal View History

2024-08-03 22:32:36 +02:00
{ config, machineProps, ... }:
2024-08-03 22:17:23 +02:00
let
anyWiresharkUser =
if machineProps.enableHomeManager then
(builtins.any (user: user.my.development.tools.networking.enable) (
builtins.attrValues config.home-manager.users
))
else
false;
userUseWireshark = value: value.my.development.tools.networking.enable;
in
{
2024-08-03 22:32:36 +02:00
config =
{
programs.wireshark.enable = anyWiresharkUser;
2024-08-03 22:17:23 +02:00
2024-08-03 22:32:36 +02:00
}
// (
if machineProps.enableHomeManager then
{
users.users = builtins.mapAttrs (name: value: {
extraGroups = if (userUseWireshark value) then [ "wireshark" ] else [ ];
}) config.home-manager.users;
}
else
{ }
);
2024-08-03 22:17:23 +02:00
}