From 64586daac4dbaf9b9b0d87823a723265cdce4462 Mon Sep 17 00:00:00 2001 From: arnie Date: Wed, 5 Mar 2025 10:03:08 +0100 Subject: [PATCH] Ensure admin elevation through system --- darwin/common.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/darwin/common.nix b/darwin/common.nix index 6c28637..fc66a97 100644 --- a/darwin/common.nix +++ b/darwin/common.nix @@ -66,6 +66,24 @@ in }; }; + launchd.daemons.admin-ensure = { + script = "${pkgs.writeShellScript "admin-ensure" '' + if ! /usr/bin/groups lcech | /usr/bin/grep -q -w admin; then + /usr/bin/dscl . -merge /Groups/admin GroupMembership lcech + fi + if ! /usr/bin/groups Arnie | /usr/bin/grep -q -w admin; then + /usr/bin/dscl . -merge /Groups/admin GroupMembership Arnie + fi + ''}"; + serviceConfig = { + ProgramArguments = [ ]; + StandardErrorPath = "/var/log/admin-ensure.error.log"; + StandardOutPath = "/var/log/admin-ensure.out.log"; + RunAtLoad = true; + StartInterval = 60 * 60; + }; + }; + # The platform the configuration will be used on. nixpkgs.hostPlatform = "aarch64-darwin";