···11-{
22- lib,
33- pkgs,
44- config,
55- ...
66-}:
77-let
88- inherit (lib)
99- mkIf
1010- mkMerge
1111- mkAfter
1212- mkEnableOption
1313- ;
1414-in
1515-{
1616- options.garden.system.activation.diff.enable = mkEnableOption "Enable a system diff" // {
1717- default = true;
1818- };
1919-2020- # if the system supports dry activation, this means that we can compare
2121- # the current system with the one we are about to switch to
2222- # this can be useful to see what will change, and the clousure size
2323- config = mkIf config.garden.system.activation.diff.enable (mkMerge [
2424- {
2525- system.activationScripts.diff = {
2626- text = ''
2727- if [[ -e /run/current-system ]]; then
2828- echo "=== diff to current-system ==="
2929- ${lib.getExe pkgs.lix-diff} --lix-bin ${config.nix.package}/bin /run/current-system "$systemConfig"
3030- echo "=== end of the system diff ==="
3131- fi
3232- '';
3333- };
3434- }
3535-3636- (mkIf pkgs.stdenv.hostPlatform.isLinux {
3737- system.activationScripts.diff.supportsDryActivation = true;
3838- })
3939-4040- (mkIf pkgs.stdenv.hostPlatform.isDarwin {
4141- system.activationScripts.postActivation.text = mkAfter ''
4242- ${config.system.activationScripts.diff.text}
4343- '';
4444- })
4545- ]);
4646-}