Closed Tarow closed 1 month ago
Fair I never thought of that. Having a .enable
property like the other nixos modules would solve this, right?
I always wondered why they do that but now I know :D
That would be one way, though, since on Linux it does not make any sense to enable this module (nor would it work), you might as well hardcode it.
So personally it would help me, if the assertion was removed and just turned into a condition such as
homeManagerModules.default = { pkgs, lib, ... }: lib.mkIf (builtins.hasAttr pkgs.stdenv.system 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"
'';
};
};
An additional enable
option could be useful on Darwin systems to conditionally disable this module without changing the imports.
Philosophical question : what are assertions good for , then?
POC in github:hraban/mac-app-util/enable -- give it a spin.
I have left in the asserts in favor of a .enable because I think now they do make sense.
Thanks a lot, works just fine with the feature branch:
Thanks for the module, it works great!
On my hosts (Linux/Darwin) i use Home Manager as a standalone installation and reuse the same
home.nix
file and HM modules. Since conditional module imports such asare not possible, it would be great if this module could simply be imported on Linux systems aswell and be a noop module in that case. Alternatively an enable option would be great.
Currently the assertions prevent an import on linux systems, which requires me to define separate "entrypoint"
home.nix
files on my darwin based systems.