fix: nushell homebrew path
This commit is contained in:
parent
3b89f0610c
commit
995555050c
1 changed files with 20 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
themeName = "capr4n.omp.json";
|
themeName = "capr4n.omp.json";
|
||||||
themeSource = ./oh-my-posh/capr4n.omp.json;
|
themeSource = ./oh-my-posh/capr4n.omp.json;
|
||||||
|
|
@ -6,20 +6,33 @@ let
|
||||||
profileBin = "${config.home.profileDirectory}/bin";
|
profileBin = "${config.home.profileDirectory}/bin";
|
||||||
systemBin = "/run/current-system/sw/bin";
|
systemBin = "/run/current-system/sw/bin";
|
||||||
defaultBin = "/nix/var/nix/profiles/default/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 {
|
in {
|
||||||
programs.nushell.enable = lib.mkDefault true;
|
programs.nushell.enable = lib.mkDefault true;
|
||||||
|
|
||||||
programs.nushell.envFile.text = ''
|
programs.nushell.envFile.text = ''
|
||||||
let nix_paths = [
|
let nix_paths = [
|
||||||
"${profileBin}"
|
${formatPathList [ profileBin systemBin defaultBin ]} ]
|
||||||
"${systemBin}"
|
|
||||||
"${defaultBin}"
|
let homebrew_paths = [
|
||||||
]
|
${formatPathList homebrewPaths} ]
|
||||||
|
|
||||||
|
let path_candidates = ($nix_paths | append $homebrew_paths | flatten)
|
||||||
|
|
||||||
if ($env.PATH? == null) {
|
if ($env.PATH? == null) {
|
||||||
$env.PATH = $nix_paths
|
$env.PATH = $path_candidates
|
||||||
} else {
|
} else {
|
||||||
for path in $nix_paths {
|
for path in $path_candidates {
|
||||||
if not ($env.PATH | any {|it| $it == $path}) {
|
if not ($env.PATH | any {|it| $it == $path}) {
|
||||||
$env.PATH = ($env.PATH | append $path)
|
$env.PATH = ($env.PATH | append $path)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue