diff --git a/flake.nix b/flake.nix index b82adc8..6daf2c1 100644 --- a/flake.nix +++ b/flake.nix @@ -93,7 +93,6 @@ inputs.homebrew.homeManagerModules.default ]; lumpiastyHome.macos = true; - lumpiastyHome.brew = true; }; nixpkgs.overlays = [ inputs.claude-code.overlays.default diff --git a/home-modules/brew.nix b/home-modules/brew.nix deleted file mode 100644 index 80eb22c..0000000 --- a/home-modules/brew.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ config, lib, pkgs, ... }: - -let - brewPath = config.homebrew.brewPath; -in { - options.lumpiastyHome.brew = lib.mkEnableOption "Homebrew integration via home-manager-brew"; - - config = lib.mkMerge [ - (lib.mkIf config.lumpiastyHome.brew { - homebrew = { - enable = true; - brewInstall = true; - update = true; - upgrade = true; - cleanup = true; - casks = [ - "steam" - ]; - }; - - home.activation.homebrewInstall = lib.mkForce ( - lib.hm.dag.entryAfter ["installPackages" "linkGeneration" "createGpgHomedir"] ( - if config.homebrew.brewInstall then '' - if [ ! -f "${brewPath}" ]; then - echo "Homebrew not found (${brewPath}), installing..." - export PATH="${pkgs.curl}/bin:${pkgs.bash}/bin:${pkgs.coreutils}/bin:${pkgs.gnugrep}/bin:${pkgs.gnused}/bin:$PATH" - ${pkgs.bash}/bin/bash -c "$(${pkgs.curl}/bin/curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - fi - '' else "" - ) - ); - }) - (lib.mkIf (!config.lumpiastyHome.brew) { - homebrew.enable = lib.mkForce false; - }) - ]; -} diff --git a/home-modules/default.nix b/home-modules/default.nix index 897d8e0..9078689 100644 --- a/home-modules/default.nix +++ b/home-modules/default.nix @@ -1,6 +1,8 @@ { flake, pkgs, lib, osConfig ? null, ... }: { + options.lumpiastyHome.macos = lib.mkEnableOption "Macos specific things"; + imports = [ ./gpg.nix ./pc.nix @@ -8,9 +10,11 @@ ./gaming.nix ./fhsBash.nix ./linux.nix + ] ++ lib.optionals (osConfig ? system.defaults) [ + # Can't use config.lumpiastyHome.macos here — imports are evaluated before config, + # causing infinite recursion. osConfig ? system.defaults detects nix-darwin. ./macos.nix - ./brew.nix ] ++ lib.optionals (osConfig.lumpiasty.enablePlasma) [ ./plasma.nix ]; -} \ No newline at end of file +} diff --git a/home-modules/macos.nix b/home-modules/macos.nix index edea98f..4512bac 100644 --- a/home-modules/macos.nix +++ b/home-modules/macos.nix @@ -1,10 +1,33 @@ { config, lib, pkgs, osConfig, ... }: -{ - options.lumpiastyHome.macos = lib.mkEnableOption "Macos specific things"; - +let + brewPath = config.homebrew.brewPath; +in { config = lib.mkIf config.lumpiastyHome.macos { targets.darwin.copyApps.enable = true; targets.darwin.linkApps.enable = false; + + homebrew = { + enable = true; + brewInstall = true; + update = true; + upgrade = true; + cleanup = true; + casks = [ + "steam" + ]; + }; + + home.activation.homebrewInstall = lib.mkForce ( + lib.hm.dag.entryAfter ["installPackages" "linkGeneration" "createGpgHomedir"] ( + if config.homebrew.brewInstall then '' + if [ ! -f "${brewPath}" ]; then + echo "Homebrew not found (${brewPath}), installing..." + export PATH="${pkgs.curl}/bin:${pkgs.bash}/bin:${pkgs.coreutils}/bin:${pkgs.gnugrep}/bin:${pkgs.gnused}/bin:$PATH" + ${pkgs.bash}/bin/bash -c "$(${pkgs.curl}/bin/curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + fi + '' else "" + ) + ); }; -} \ No newline at end of file +}