diff --git a/modules/home/rsydn/shell/nushell.nix b/modules/home/rsydn/shell/nushell.nix index 5fd07cb..b87b68f 100644 --- a/modules/home/rsydn/shell/nushell.nix +++ b/modules/home/rsydn/shell/nushell.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, pkgs, lib, ... }: let themeName = "capr4n.omp.json"; themeSource = ./oh-my-posh/capr4n.omp.json; @@ -6,20 +6,33 @@ let profileBin = "${config.home.profileDirectory}/bin"; systemBin = "/run/current-system/sw/bin"; defaultBin = "/nix/var/nix/profiles/default/bin"; + darwinHomebrewDir = if pkgs.stdenv.hostPlatform.isAarch64 then + "/opt/homebrew" + else + "/usr/local"; + homebrewBin = "${darwinHomebrewDir}/bin"; + homebrewSbin = "${darwinHomebrewDir}/sbin"; + homebrewPaths = if pkgs.stdenv.hostPlatform.isDarwin then + lib.unique [ homebrewBin homebrewSbin ] + else + [ ]; + formatPathList = paths: lib.concatMapStrings (path: " \"${path}\"\n") paths; in { programs.nushell.enable = lib.mkDefault true; programs.nushell.envFile.text = '' let nix_paths = [ - "${profileBin}" - "${systemBin}" - "${defaultBin}" - ] +${formatPathList [ profileBin systemBin defaultBin ]} ] + + let homebrew_paths = [ +${formatPathList homebrewPaths} ] + + let path_candidates = ($nix_paths | append $homebrew_paths | flatten) if ($env.PATH? == null) { - $env.PATH = $nix_paths + $env.PATH = $path_candidates } else { - for path in $nix_paths { + for path in $path_candidates { if not ($env.PATH | any {|it| $it == $path}) { $env.PATH = ($env.PATH | append $path) }