Add wireshark option
This commit is contained in:
parent
b479eff04d
commit
38d7e61d74
|
@ -90,7 +90,8 @@
|
|||
];
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
my.development.embedded-tools.enable = true;
|
||||
my.development.tools.embedded.enable = true;
|
||||
my.development.tools.networking.enable = true;
|
||||
my.games.wine.enable = true;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{
|
||||
lib,
|
||||
config,
|
||||
pkgs,
|
||||
machineProps,
|
||||
|
@ -13,6 +12,7 @@
|
|||
./sound.nix
|
||||
./desktop.nix
|
||||
./bluetooth.nix
|
||||
./wireshark.nix
|
||||
];
|
||||
|
||||
config =
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
}:
|
||||
with lib;
|
||||
{
|
||||
imports = [ ./embedded.nix ];
|
||||
imports = [
|
||||
./embedded.nix
|
||||
./networking.nix
|
||||
];
|
||||
|
||||
options.my.development.git.enable = mkOption {
|
||||
type = types.bool;
|
||||
|
|
|
@ -4,9 +4,12 @@
|
|||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
toolsConfig = config.my.development.tools.embedded;
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
options.my.development.embedded-tools.enable = mkOption {
|
||||
options.my.development.tools.embedded.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
|
@ -15,7 +18,7 @@ with lib;
|
|||
'';
|
||||
};
|
||||
|
||||
options.my.development.embedded-tools.packages = mkOption {
|
||||
options.my.development.tools.embedded.packages = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = with pkgs; [
|
||||
qemu
|
||||
|
@ -23,5 +26,5 @@ with lib;
|
|||
];
|
||||
};
|
||||
|
||||
config.home.packages = lib.mkIf config.my.development.embedded-tools.enable config.my.development.embedded-tools.packages;
|
||||
config.home.packages = mkIf toolsConfig.enable toolsConfig.packages;
|
||||
}
|
||||
|
|
31
modules/workstation/home-manager/development/networking.nix
Normal file
31
modules/workstation/home-manager/development/networking.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
toolsConfig = config.my.development.tools.networking;
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
options.my.development.tools.networking = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Enable network analysis tools.
|
||||
'';
|
||||
};
|
||||
|
||||
packages = mkOption {
|
||||
type = types.listOf types.package;
|
||||
default = with pkgs; [ wireshark ];
|
||||
description = ''
|
||||
Network analysis tools to install.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config.home.packages = mkIf toolsConfig.enable toolsConfig.packages;
|
||||
}
|
25
modules/workstation/wireshark.nix
Normal file
25
modules/workstation/wireshark.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
machineProps,
|
||||
...
|
||||
}:
|
||||
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
|
||||
{
|
||||
config = {
|
||||
programs.wireshark.enable = anyWiresharkUser;
|
||||
|
||||
users.users = builtins.mapAttrs (name: value: {
|
||||
extraGroups = if (userUseWireshark value) then [ "wireshark" ] else [ ];
|
||||
}) config.home-manager.users;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue