dotfiles.nix/home/copyApplications.nix

22 lines
800 B
Nix
Raw Normal View History

2022-04-21 01:26:30 +00:00
# adapted from
# https://github.com/reckenrode/nixos-configs/blob/2acd7b0699fd57628deb7b8855b4d5f0ea8f8cb1/common/darwin/home-manager/copyApplications.nix
2022-07-17 19:40:37 +00:00
# workaround for
# https://github.com/nix-community/home-manager/issues/1341
2022-04-21 01:26:30 +00:00
{ config, pkgs, lib, ... }:
2022-04-20 23:44:53 +00:00
{
2022-04-21 01:26:30 +00:00
home.activation = lib.optionalAttrs pkgs.stdenv.isDarwin {
2022-04-20 23:44:53 +00:00
copyApplications = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
2022-04-21 01:26:30 +00:00
appsSrc="${config.home.homeDirectory}/Applications/Nix Apps/"
2022-04-20 23:44:53 +00:00
if [ -d "$appsSrc" ]; then
baseDir="$HOME/Applications/Home Manager Apps"
rsyncArgs="--archive --checksum --chmod=-w --copy-unsafe-links --delete"
$DRY_RUN_CMD mkdir -p "$baseDir"
2022-05-24 03:03:29 +00:00
$DRY_RUN_CMD sudo ${pkgs.rsync}/bin/rsync ''${VERBOSE_ARG:+-v} $rsyncArgs "$appsSrc" "$baseDir"
2022-04-20 23:44:53 +00:00
fi
'';
};
}