fix: fix shellll

This commit is contained in:
Rasyidan Akbar F. 2025-10-27 16:59:38 +07:00
commit d80bbce9da
6 changed files with 57 additions and 149 deletions

View file

@ -1,6 +1,7 @@
{ config, pkgs, lib, ... }:
let
profileBin = "${config.home.profileDirectory}/bin";
# System binaries path - same on both NixOS and Darwin
systemBin = "/run/current-system/sw/bin";
defaultBin = "/nix/var/nix/profiles/default/bin";
darwinHomebrewDir = if pkgs.stdenv.hostPlatform.isAarch64 then
@ -25,50 +26,53 @@ let
formatPathList = paths:
lib.concatMapStrings (path: " \"${path}\"\n") paths;
in {
imports = [ ./oh-my-posh ];
programs.nushell.enable = lib.mkDefault true;
programs.nushell.extraConfig = ''
# Dotfiles QA validation command
def dotfiles-qa [] {
let dotfiles_dir = "${config.home.homeDirectory}/Development/dotfiles"
def dotfiles-qa [] {
let dotfiles_dir = "${config.home.homeDirectory}/Development/dotfiles"
print $"(ansi green_bold)Running dotfiles QA validation...(ansi reset)\n"
print $"(ansi green_bold)Running dotfiles QA validation...(ansi reset)\n"
# Step 1: Format check
print $"(ansi blue)1. Formatting nix files...(ansi reset)"
cd $dotfiles_dir
nix fmt .
if $env.LAST_EXIT_CODE != 0 {
print $"(ansi red_bold) Formatting failed(ansi reset)"
return
# Step 1: Format check
print $"(ansi blue)1. Formatting nix files...(ansi reset)"
cd $dotfiles_dir
nix fmt .
if $env.LAST_EXIT_CODE != 0 {
print $"(ansi red_bold) Formatting failed(ansi reset)"
return
}
print $"(ansi green) Formatting complete(ansi reset)\n"
# Step 2: Flake check
print $"(ansi blue)2. Running flake check...(ansi reset)"
nix flake check
if $env.LAST_EXIT_CODE != 0 {
print $"(ansi red_bold) Flake check failed(ansi reset)"
return
}
print $"(ansi green) Flake check passed(ansi reset)\n"
# Step 3: Build (without activation)
print $"(ansi blue)3. Building darwin configuration (no activation)...(ansi reset)"
darwin-rebuild build --flake $"($dotfiles_dir)#macbook-pro"
if $env.LAST_EXIT_CODE != 0 {
print $"(ansi yellow) Build had warnings, but may still work(ansi reset)\n"
} else {
print $"(ansi green) Build successful(ansi reset)\n"
}
print $"(ansi green_bold) Core QA checks passed!(ansi reset)"
}
print $"(ansi green) Formatting complete(ansi reset)\n"
# Step 2: Flake check
print $"(ansi blue)2. Running flake check...(ansi reset)"
nix flake check
if $env.LAST_EXIT_CODE != 0 {
print $"(ansi red_bold) Flake check failed(ansi reset)"
return
}
print $"(ansi green) Flake check passed(ansi reset)\n"
# Step 3: Build (without activation)
print $"(ansi blue)3. Building darwin configuration (no activation)...(ansi reset)"
darwin-rebuild build --flake $"($dotfiles_dir)#macbook-pro"
if $env.LAST_EXIT_CODE != 0 {
print $"(ansi yellow) Build had warnings, but may still work(ansi reset)\n"
} else {
print $"(ansi green) Build successful(ansi reset)\n"
}
print $"(ansi green_bold) Core QA checks passed!(ansi reset)"
}
'';
programs.nushell.envFile.text = ''
# Set XDG Base Directory environment variables
$env.XDG_CONFIG_HOME = "${config.xdg.configHome}"
$env.XDG_DATA_HOME = "${config.xdg.dataHome}"
$env.XDG_CACHE_HOME = "${config.xdg.cacheHome}"
let nix_paths = [
${formatPathList [ profileBin systemBin defaultBin ]} ]
@ -113,6 +117,4 @@ in {
load-secret "groq-api-key" "GROQ_API_KEY"
load-secret "firecrawl-api-key" "FIRECRAWL_API_KEY"
'';
programs.oh-my-posh.enableNushellIntegration = lib.mkDefault true;
}