nixos/liboping: add module
This creates setcap wrappers for oping and noping to allow unprivileged users to use those as well.
This commit is contained in:
parent
404d9529e1
commit
d77b68e487
@ -127,6 +127,7 @@
|
||||
./programs/java.nix
|
||||
./programs/kbdlight.nix
|
||||
./programs/less.nix
|
||||
./programs/liboping.nix
|
||||
./programs/light.nix
|
||||
./programs/mosh.nix
|
||||
./programs/mininet.nix
|
||||
|
22
nixos/modules/programs/liboping.nix
Normal file
22
nixos/modules/programs/liboping.nix
Normal file
@ -0,0 +1,22 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.programs.liboping;
|
||||
in {
|
||||
options.programs.liboping = {
|
||||
enable = mkEnableOption "liboping";
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [ liboping ];
|
||||
security.wrappers = mkMerge (map (
|
||||
exec: {
|
||||
"${exec}" = {
|
||||
source = "${pkgs.liboping}/bin/${exec}";
|
||||
capabilities = "cap_net_raw+p";
|
||||
};
|
||||
}
|
||||
) [ "oping" "noping" ]);
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user