aboutsummaryrefslogtreecommitdiff
path: root/system/sysops.nix
diff options
context:
space:
mode:
Diffstat (limited to 'system/sysops.nix')
-rw-r--r--system/sysops.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/system/sysops.nix b/system/sysops.nix
new file mode 100644
index 0000000..ccf6d0b
--- /dev/null
+++ b/system/sysops.nix
@@ -0,0 +1,35 @@
+{ config, lib, ...}:
+let
+
+ inherit (lib) concatMapStringsSep concatStringsSep mkOption types;
+ inherit (types) str listOf;
+
+ bindir = "/run/current-system/sw/bin";
+
+ commands = concatStringsSep ", " (
+ [
+ "${bindir}/du *"
+ "${bindir}/iftop"
+ "${bindir}/iotop"
+ "${bindir}/ip6tables -L*"
+ "${bindir}/ipsec *"
+ "${bindir}/iptables -L*"
+ "${bindir}/journalctl *"
+ "${bindir}/lsof *"
+ "${bindir}/mtr *"
+ "${bindir}/nix-collect-garbage *"
+ "${bindir}/nmap *"
+ "${bindir}/tcpdump *"
+ "${bindir}/traceroute *"
+ ] ++ map (c: "${bindir}/systemctl ${c} *")
+ [ "kill" "reload" "restart" "start" "status" "stop" ]
+ );
+
+in {
+
+ config = {
+ security.sudo.extraConfig = ''
+ %wheel ALL=(ALL) NOPASSWD: ${commands}
+ '';
+ };
+}