Separate a few zsh config
This commit is contained in:
parent
14cfaaf056
commit
bd99a04f19
4 changed files with 48 additions and 39 deletions
|
|
@ -28,6 +28,43 @@
|
||||||
|
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
|
|
||||||
|
# darwin-specific alias
|
||||||
|
programs.zsh.shellAliases = {
|
||||||
|
oss = "sudo darwin-rebuild switch --flake ~/.config/nix#$(hostname)";
|
||||||
|
|
||||||
|
preview = "open -a Preview";
|
||||||
|
slide = "open -a SlidePilot";
|
||||||
|
pixel = "open -a 'Pixelmator Pro'";
|
||||||
|
inkscape = "open -a Inkscape";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Darwin-specific zsh functions
|
||||||
|
programs.zsh.initExtra = ''
|
||||||
|
# Function to search and open all macOS applications
|
||||||
|
function app() {
|
||||||
|
local app_path
|
||||||
|
local file_to_open="$1"
|
||||||
|
|
||||||
|
app_path=$( (find -L /Applications -name "*.app" -maxdepth 2 2>/dev/null; \
|
||||||
|
find -L ~/Applications -name "*.app" -maxdepth 3 2>/dev/null; \
|
||||||
|
find /System/Applications -name "*.app" -maxdepth 2 2>/dev/null; \
|
||||||
|
find /System/Applications/Utilities -name "*.app" -maxdepth 1 2>/dev/null) |
|
||||||
|
sort | uniq |
|
||||||
|
fzf --header="Select app to open''${file_to_open:+ file: $file_to_open}" \
|
||||||
|
--preview 'basename {} .app' \
|
||||||
|
--preview-window=up:1 \
|
||||||
|
--height=40%)
|
||||||
|
|
||||||
|
if [[ -n "$app_path" ]]; then
|
||||||
|
if [[ -n "$file_to_open" ]]; then
|
||||||
|
open -a "$app_path" "$file_to_open"
|
||||||
|
else
|
||||||
|
open "$app_path"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
# Network and file transfer
|
# Network and file transfer
|
||||||
lftp
|
lftp
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,11 @@
|
||||||
|
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
|
|
||||||
|
# nixOS-specific alias
|
||||||
|
programs.zsh.shellAliases = {
|
||||||
|
oss = "sudo nixos-rebuild switch --flake ~/.config/nix#$(hostname)";
|
||||||
|
};
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
# Network and file transfer
|
# Network and file transfer
|
||||||
lftp
|
lftp
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
# hs-specific home configuration
|
# hs-specific home configuration
|
||||||
# Example: Server-specific tools, monitoring utilities, etc.
|
programs.zsh.shellAliases = {
|
||||||
|
# Disk health monitoring
|
||||||
|
smart-report = "sudo /home/yanlin/.config/nix/scripts/daily-smart-report.sh";
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, pkgs, lib, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
projectsConfig = import ../config/projects.nix { homeDirectory = config.home.homeDirectory; };
|
projectsConfig = import ../config/projects.nix { homeDirectory = config.home.homeDirectory; };
|
||||||
|
|
@ -27,17 +27,6 @@ in
|
||||||
hm = "home-manager";
|
hm = "home-manager";
|
||||||
hms = "home-manager switch --flake ~/.config/nix#$(whoami)@$(hostname)";
|
hms = "home-manager switch --flake ~/.config/nix#$(whoami)@$(hostname)";
|
||||||
hms-offline = "home-manager switch --flake ~/.config/nix#$(whoami)@$(hostname) --option substitute false";
|
hms-offline = "home-manager switch --flake ~/.config/nix#$(whoami)@$(hostname) --option substitute false";
|
||||||
doss = "sudo darwin-rebuild switch --flake ~/.config/nix#$(hostname)";
|
|
||||||
noss = "sudo nixos-rebuild switch --flake ~/.config/nix#$(hostname)";
|
|
||||||
# Disk health monitoring
|
|
||||||
smart-report = "sudo /home/yanlin/.config/nix/scripts/daily-smart-report.sh";
|
|
||||||
|
|
||||||
} // lib.optionalAttrs pkgs.stdenv.isDarwin {
|
|
||||||
# macOS-specific app aliases
|
|
||||||
preview = "open -a Preview";
|
|
||||||
slide = "open -a SlidePilot";
|
|
||||||
pixel = "open -a 'Pixelmator Pro'";
|
|
||||||
inkscape = "open -a Inkscape";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
initContent = ''
|
initContent = ''
|
||||||
|
|
@ -122,31 +111,6 @@ in
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to search and open all macOS applications (macOS only)
|
|
||||||
${lib.optionalString pkgs.stdenv.isDarwin ''
|
|
||||||
function app() {
|
|
||||||
local app_path
|
|
||||||
local file_to_open="$1"
|
|
||||||
|
|
||||||
app_path=$( (find -L /Applications -name "*.app" -maxdepth 2 2>/dev/null; \
|
|
||||||
find -L ~/Applications -name "*.app" -maxdepth 3 2>/dev/null; \
|
|
||||||
find /System/Applications -name "*.app" -maxdepth 2 2>/dev/null; \
|
|
||||||
find /System/Applications/Utilities -name "*.app" -maxdepth 1 2>/dev/null) |
|
|
||||||
sort | uniq |
|
|
||||||
fzf --header="Select app to open''${file_to_open:+ file: $file_to_open}" \
|
|
||||||
--preview 'basename {} .app' \
|
|
||||||
--preview-window=up:1 \
|
|
||||||
--height=40%)
|
|
||||||
|
|
||||||
if [[ -n "$app_path" ]]; then
|
|
||||||
if [[ -n "$file_to_open" ]]; then
|
|
||||||
open -a "$app_path" "$file_to_open"
|
|
||||||
else
|
|
||||||
open "$app_path"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
''}
|
|
||||||
|
|
||||||
# Interactive project launcher with fzf
|
# Interactive project launcher with fzf
|
||||||
function proj() {
|
function proj() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue