Skip to content

Instantly share code, notes, and snippets.

@berryp
Created December 3, 2022 09:07
Show Gist options
  • Select an option

  • Save berryp/7af4a1f534027807b26fff706a61b1ce to your computer and use it in GitHub Desktop.

Select an option

Save berryp/7af4a1f534027807b26fff706a61b1ce to your computer and use it in GitHub Desktop.

Revisions

  1. berryp created this gist Dec 3, 2022.
    15 changes: 15 additions & 0 deletions copy-applications.nix
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    { config, lib, pkgs, ... }:

    {
    # Import this module in your nix-darin config to have applications copied
    # to /Applications/Nix Apps instead of being symlinked. GUI apps must be
    # added to environment packages, not home-manager for this to work.
    system.activationScripts.applications.text = lib.mkForce ''
    echo "Setting up /Applications/Nix Apps" >&2
    appsSrc="${config.system.build.applications}/Applications/"
    baseDir="/Applications/Nix Apps"
    rsyncArgs="--archive --checksum --chmod=-w --copy-unsafe-links --delete"
    mkdir -p "$baseDir"
    ${pkgs.rsync}/bin/rsync $rsyncArgs "$appsSrc" "$baseDir"
    '';
    }