mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 22:36:23 +01:00
d77b68e487
This creates setcap wrappers for oping and noping to allow unprivileged users to use those as well.
22 lines
470 B
Nix
22 lines
470 B
Nix
{ 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" ]);
|
|
};
|
|
}
|