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:
Maximilian Bosch 2020-01-16 18:06:35 +01:00
parent 404d9529e1
commit d77b68e487
No known key found for this signature in database
GPG Key ID: 091DBF4D1FC46B8E
2 changed files with 23 additions and 0 deletions

View File

@ -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

View 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" ]);
};
}