summaryrefslogtreecommitdiffstats
path: root/tests/homebrew-cleanup-check.nix
blob: 6ccdff048c64f9e3440a8427922f69c8785c6b6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{ config, ... }:

let
  brewBundleInstallCmd = config.homebrew.onActivation.brewBundleCmd { onlyCheck = false; };
in

{
  homebrew.enable = true;
  homebrew.user = "test-homebrew-user";
  homebrew.onActivation.cleanup = "check";

  test = ''
    echo "checking that cleanup check is present in system checks" >&2
    grep "brew bundle --file='.*-Brewfile' cleanup" ${config.out}/activate

    echo "checking that brew bundle [install] command does not have --cleanup flag" >&2
    if echo "${brewBundleInstallCmd}" | grep -F -- '--cleanup' > /dev/null; then
      echo "Expected no --cleanup flag in brewBundleInstallCmd"
      echo "Actual: ${brewBundleInstallCmd}"
      exit 1
    fi
  '';
}