Skip to content

Commit

Permalink
services/yabai: Remove IFD
Browse files Browse the repository at this point in the history
enableScriptingAddition no longer triggers IFD
by using runCommand to generate sudoers.d/yabai,
instead of builtins.hashFile and interpolating the string in nix.
  • Loading branch information
nrabulinski committed Feb 1, 2024
1 parent 91b9daf commit 602f274
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions modules/services/yabai/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ in
serviceConfig.KeepAlive.SuccessfulExit = false;
};

environment.etc."sudoers.d/yabai".text =
let
sha = builtins.hashFile "sha256" "${cfg.package}/bin/yabai";
in
"%admin ALL=(root) NOPASSWD: sha256:${sha} ${cfg.package}/bin/yabai --load-sa";
environment.etc."sudoers.d/yabai".source = pkgs.runCommand "sudoers-yabai" {} ''
YABAI_BIN="${config.services.yabai.package}/bin/yabai"
SHASUM=$(sha256sum "$YABAI_BIN" | cut -d' ' -f1)
cat <<EOF >"$out"
%admin ALL=(root) NOPASSWD: sha256:$SHASUM $YABAI_BIN --load-sa
EOF
'';
})
];
}

0 comments on commit 602f274

Please sign in to comment.