Skip to content

Commit

Permalink
feat: enable option for home manager module
Browse files Browse the repository at this point in the history
  • Loading branch information
hraban committed Sep 27, 2024
1 parent 63f269f commit 75d1ec1
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,29 @@

outputs = { self, nixpkgs, flake-utils, cl-nix-lite, ... }:
{
homeManagerModules.default = { pkgs, lib, ... }: {
assertions = [ {
assertion = builtins.hasAttr pkgs.stdenv.system self.packages;
message = "mac-app-util home manager module: Unsupported architecture ${pkgs.stdenv.system}. Supported: ${builtins.toString (builtins.attrNames self.packages)}";
} ];
home.activation = {
trampolineApps = let
mac-app-util = self.packages.${pkgs.stdenv.system}.default;
in lib.hm.dag.entryAfter [ "writeBoundary" ] ''
fromDir="$HOME/Applications/Home Manager Apps"
toDir="$HOME/Applications/Home Manager Trampolines"
${mac-app-util}/bin/mac-app-util sync-trampolines "$fromDir" "$toDir"
'';
homeManagerModules.default = { pkgs, lib, config, ... }: {
options = with lib; {
targets.darwin.mac-app-util.enable = mkOption {
type = types.bool;
default = builtins.hasAttr pkgs.stdenv.system self.packages;
example = true;
description = "Whether to enable mac-app-util home manager integration";
};
};
config = lib.mkIf config.targets.darwin.mac-app-util.enable {
assertions = [ {
default = builtins.hasAttr pkgs.stdenv.system self.packages;
message = "mac-app-util home manager module: Unsupported architecture ${pkgs.stdenv.system}. Supported: ${builtins.toString (builtins.attrNames self.packages)}";
} ];
home.activation = {
trampolineApps = let
mac-app-util = self.packages.${pkgs.stdenv.system}.default;
in lib.hm.dag.entryAfter [ "writeBoundary" ] ''
fromDir="$HOME/Applications/Home Manager Apps"
toDir="$HOME/Applications/Home Manager Trampolines"
${mac-app-util}/bin/mac-app-util sync-trampolines "$fromDir" "$toDir"
'';
};
};
};
darwinModules.default = { pkgs, ... }: {
Expand Down

0 comments on commit 75d1ec1

Please sign in to comment.