System/home-manager/darwin/default.nix

62 lines
1.7 KiB
Nix

{ config, lib, pkgs, inputs, ... }:
let
inherit (import ../../modules/lib.nix {
inherit lib;
inherit pkgs;
})
nLib;
in with lib;
with nLib; {
imports = [
../options.nix
../common/programs/core.nix
../common/programs/devel.nix
../common/programs/terminal.nix
../common/programs/git.nix
../common/programs/ssh.nix
../common/programs/fish.nix
./programs/core.nix
./programs/emacs.nix
./programs/devel.nix
];
options = {
nathan = {
programs = {
# Alacrity, on by default on mac
alacritty = mkDefaultOption "alacritty" config.nathan.config.isDesktop;
};
};
};
config = {
# Link applications in spotlight/launchpad
home.activation = mkIf pkgs.stdenv.isDarwin {
copyApplications = let
apps = pkgs.buildEnv {
name = "home-manager-applications";
paths = config.home.packages;
pathsToLink = "/Applications";
};
in lib.hm.dag.entryAfter [ "writeBoundary" ] ''
baseDir="$HOME/Applications/Home Manager Apps"
if [ -d "$baseDir" ]; then
rm -rf "$baseDir"
fi
mkdir -p "$baseDir"
for appFile in ${apps}/Applications/*; do
target="$baseDir/$(basename "$appFile")"
$DRY_RUN_CMD cp ''${VERBOSE_ARG:+-v} -fHRL "$appFile" "$baseDir"
$DRY_RUN_CMD chmod ''${VERBOSE_ARG:+-v} -R +w "$target"
done
'';
};
home.stateVersion = "22.05";
programs.home-manager.enable = true;
nathan.programs.emacs.package = pkgs.emacs;
# lib.mkDefault inputs.emacs.packages."${pkgs.system}".emacsPgtk;
# Allow management of launchd agents
launchd.enable = true;
};
}