From bf1726257864b7772e56467abfddf89540cbeb30 Mon Sep 17 00:00:00 2001 From: Oleksii Filonenko Date: Mon, 30 Dec 2019 13:58:58 +0200 Subject: [PATCH] nixos/what: init --- nixos/modules/module-list.nix | 1 + nixos/modules/programs/what.nix | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 nixos/modules/programs/what.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 914f9a878b0..2dc3378bf00 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -159,6 +159,7 @@ ./programs/wavemon.nix ./programs/way-cooler.nix ./programs/waybar.nix + ./programs/what.nix ./programs/wireshark.nix ./programs/x2goserver.nix ./programs/xfs_quota.nix diff --git a/nixos/modules/programs/what.nix b/nixos/modules/programs/what.nix new file mode 100644 index 00000000000..02e4eaba723 --- /dev/null +++ b/nixos/modules/programs/what.nix @@ -0,0 +1,29 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let cfg = config.programs.what; +in { + meta.maintainers = with maintainers; [ filalex77 ]; + + options = { + programs.what = { + enable = mkOption { + type = types.bool; + default = false; + description = '' + Whether to add what to the global environment and configure a + setcap wrapper for it. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ what ]; + security.wrappers.what = { + source = "${pkgs.what}/bin/what"; + capabilities = "cap_net_raw,cap_net_admin+ep"; + }; + }; +}