diff --git a/configuration.nix b/configuration.nix index b974d4f..1939e33 100644 --- a/configuration.nix +++ b/configuration.nix @@ -3,8 +3,10 @@ self: { pkgs, ... }: { # List packages installed in system profile. To search by name, run: # $ nix-env -qaP | grep wget - environment.systemPackages = - [ pkgs.vim + environment.systemPackages = with pkgs; [ + vim + curl + git ]; # Necessary for using flakes on this system. diff --git a/home-modules/brew.nix b/home-modules/brew.nix index 64f092f..80eb22c 100644 --- a/home-modules/brew.nix +++ b/home-modules/brew.nix @@ -1,6 +1,8 @@ { config, lib, pkgs, ... }: -{ +let + brewPath = config.homebrew.brewPath; +in { options.lumpiastyHome.brew = lib.mkEnableOption "Homebrew integration via home-manager-brew"; config = lib.mkMerge [ @@ -15,6 +17,18 @@ "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;