Skip to content

Commit

Permalink
Merge pull request #1369 from Mic92/joerg-ci
Browse files Browse the repository at this point in the history
homebrew: remove casks no longer defined in nix
  • Loading branch information
Mic92 authored Oct 20, 2024
2 parents da5d292 + dc102e5 commit b2310c4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion darwin/modules/homebrew.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
{ config, lib, ... }:
{
config,
lib,
...
}:
let
configuredCasks = builtins.toFile "new-casks" (
lib.concatMapStringsSep "\n" (cask: cask.name) config.homebrew.casks
);
in
{
homebrew.enable = true;
system.activationScripts.homebrew.text = lib.mkIf config.homebrew.enable (
lib.mkBefore ''
if [[ ! -f "${config.homebrew.brewPrefix}/brew" ]]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
comm -23 \
<(/opt/homebrew/bin/brew list --casks -q -1 | sort -u) \
<(sort -u ${configuredCasks}) | xargs --no-run-if-empty -I {} /opt/homebrew/bin/brew uninstall --cask {}
''
);
homebrew.casks = [
Expand Down

0 comments on commit b2310c4

Please sign in to comment.