summary refs log tree commit diff
path: root/nixos/modules/programs/what.nix
diff options
context:
space:
mode:
authorOleksii Filonenko <brightone@protonmail.com>2019-12-30 13:58:58 +0200
committerOleksii Filonenko <brightone@protonmail.com>2019-12-30 13:59:52 +0200
commitbf1726257864b7772e56467abfddf89540cbeb30 (patch)
tree6d9042a8fb7c08cf219c00662f9b210cc1b9ed85 /nixos/modules/programs/what.nix
parent014ffad4086e44f2317361d748cdca34a31bd2f5 (diff)
downloadnixpkgs-bf1726257864b7772e56467abfddf89540cbeb30.tar
nixpkgs-bf1726257864b7772e56467abfddf89540cbeb30.tar.gz
nixpkgs-bf1726257864b7772e56467abfddf89540cbeb30.tar.bz2
nixpkgs-bf1726257864b7772e56467abfddf89540cbeb30.tar.lz
nixpkgs-bf1726257864b7772e56467abfddf89540cbeb30.tar.xz
nixpkgs-bf1726257864b7772e56467abfddf89540cbeb30.tar.zst
nixpkgs-bf1726257864b7772e56467abfddf89540cbeb30.zip
nixos/what: init
Diffstat (limited to 'nixos/modules/programs/what.nix')
-rw-r--r--nixos/modules/programs/what.nix29
1 files changed, 29 insertions, 0 deletions
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";
+    };
+  };
+}