Merge branch 'main' of codeberg.org:dnscio/nix-config

This commit is contained in:
Dennis Schoepf 2025-05-28 23:18:21 +02:00
commit 1d584074b0
8 changed files with 185 additions and 82 deletions

View file

@ -0,0 +1,73 @@
{
services.aerospace = {
enable = true;
settings = {
accordion-padding = 25;
gaps = {
inner.horizontal = 6;
inner.vertical = 6;
outer.left = 6;
outer.bottom = 6;
outer.top = 6;
outer.right = 6;
};
workspace-to-monitor-force-assignment = {
"1" = "main";
"2" = "main";
"3" = "main";
"4" = "main";
"5" = "secondary";
"6" = "secondary";
};
mode.main.binding = {
alt-h = "focus left";
alt-j = "focus down";
alt-k = "focus up";
alt-l = "focus right";
alt-shift-h = "move left";
alt-shift-j = "move down";
alt-shift-k = "move up";
alt-shift-l = "move right";
alt-comma = "layout tiles horizontal vertical";
alt-period = "layout accordion horizontal vertical";
alt-f = "fullscreen";
alt-1 = "workspace 1";
alt-2 = "workspace 2";
alt-3 = "workspace 3";
alt-4 = "workspace 4";
alt-5 = "workspace 5";
alt-6 = "workspace 6";
alt-shift-1 = [ "move-node-to-workspace 1" "workspace 1" ];
alt-shift-2 = [ "move-node-to-workspace 2" "workspace 2" ];
alt-shift-3 = [ "move-node-to-workspace 3" "workspace 3" ];
alt-shift-4 = [ "move-node-to-workspace 4" "workspace 4" ];
alt-shift-5 = [ "move-node-to-workspace 5" "workspace 5" ];
alt-shift-6 = [ "move-node-to-workspace 6" "workspace 6" ];
alt-tab = "workspace-back-and-forth";
alt-shift-tab = "move-workspace-to-monitor --wrap-around next";
};
on-window-detected = [
{
"if".app-id = "company.thebrowser.Browser";
run = "move-node-to-workspace 1";
}
{
"if".app-id = "com.github.wez.wezterm";
run = "move-node-to-workspace 2";
}
{
"if".app-id = "com.postmanlabs.mac";
run = "move-node-to-workspace 3";
}
{
"if".app-id = "com.apple.dt.Xcode";
run = "move-node-to-workspace 3";
}
{
"if".app-id = "com.microsoft.teams2";
run = "move-node-to-workspace 5";
}
];
};
};
}

View file

@ -2,5 +2,9 @@
programs.atuin = { programs.atuin = {
enable = true; enable = true;
enableFishIntegration = true; enableFishIntegration = true;
settings = {
style = "compact";
inline_height = 20;
};
}; };
} }

View file

@ -1,98 +1,106 @@
{ config, pkgs, ... }:
{ programs.fish = { { programs.fish = {
enable = true; enable = true;
functions = { functions = {
cdr = '' cdr = ''
set folder (begin set folder (begin
fd . ~/dev/ride/apps/backend/edge-services -t d -d 1; fd . ~/dev/ride/apps/backend/edge-services -t d -d 1;
fd . ~/dev/ride/apps/backend/backend-services -t d -d 1; fd . ~/dev/ride/apps/backend/backend-services -t d -d 1;
fd . ~/dev/ride/apps/backend/backend-services/tariff-service -t d -d 1; fd . ~/dev/ride/apps/frontend/projects -t d -d 1;
fd . ~/dev/ride/apps/backend/backend-services/wallet-service -t d -d 1; fd . ~/dev/ride/apps/native -t d -d 1;
fd . ~/dev/ride/apps/frontend/projects -t d -d 1; # fd . ~/dev/ride/packages -t d -d 1;
fd . ~/dev/ride/apps/native -t d -d 1; echo "$HOME/dev/ride/apps/frontend";
fd . ~/dev/ride/packages -t d -d 1; echo "$HOME/dev/ride/apps/lib";
echo "$HOME/dev/ride/apps/frontend"; echo "$HOME/dev/ride";
echo "$HOME/dev/ride/apps/lib"; end | fzf);
echo "$HOME/dev/ride"; set service (basename $folder)
end | fzf);
set service (basename $folder)
cd $folder cd $folder
''; '';
rr = '' rr = ''
set folder (begin set folder (begin
fd . ~/dev/ride/apps/backend/edge-services -t d -d 1; fd . ~/dev/ride/apps/backend/edge-services -t d -d 1;
fd . ~/dev/ride/apps/backend/backend-services -t d -d 1; fd . ~/dev/ride/apps/backend/backend-services -t d -d 1;
fd . ~/dev/ride/apps/backend/backend-services/tariff-service -t d -d 1; fd . ~/dev/ride/apps/frontend/projects -t d -d 1;
fd . ~/dev/ride/apps/backend/backend-services/wallet-service -t d -d 1; fd . ~/dev/ride/apps/native -t d -d 1;
fd . ~/dev/ride/apps/frontend/projects -t d -d 1; echo "$HOME/dev/ride/apps/frontend";
fd . ~/dev/ride/apps/native -t d -d 1; echo "$HOME/dev/ride/apps/lib";
echo "$HOME/dev/ride/apps/frontend"; echo "$HOME/dev/ride";
echo "$HOME/dev/ride/apps/lib"; end | fzf);
echo "$HOME/dev/ride";
end | fzf); if test -n "$folder"
set service (basename $folder)
if test -n "$folder" cd $folder
set service (basename $folder)
cd $folder # Check if package.json exists
if test -f "package.json"
# Check if package.json exists # Extract and format npm scripts for fzf
if test -f "package.json" set script_cmd (jq -r '.scripts | to_entries | .[] | "\(.key): \(.value)"' package.json | fzf)
# Extract and format npm scripts for fzf
set script_cmd (jq -r '.scripts | to_entries | .[] | "\(.key): \(.value)"' package.json | fzf) if test -n "$script_cmd"
# Extract just the script name before the colon
if test -n "$script_cmd" set script_name (string split ": " $script_cmd)[1]
# Extract just the script name before the colon if test -n "$script_name"
set script_name (string split ": " $script_cmd)[1] echo "Running: npm run $script_name"
if test -n "$script_name" npm run $script_name
echo "Running: npm run $script_name" end
npm run $script_name end
end end
end end
end
end
''; '';
ff = '' ff = ''
set RG_PREFIX "rg --column --line-number --no-heading --color=always --smart-case " set RG_PREFIX "rg --column --line-number --no-heading --color=always --smart-case "
set INITIAL_QUERY "$argv" set INITIAL_QUERY "$argv"
fzf --ansi --disabled --query "$INITIAL_QUERY" \ fzf --ansi --disabled --query "$INITIAL_QUERY" \
--bind "start:reload:$RG_PREFIX {q}" \ --bind "start:reload:$RG_PREFIX {q}" \
--bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \ --bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \
--delimiter : \ --delimiter : \
--preview 'bat --color=always {1} --highlight-line {2}' \ --preview 'bat --color=always {1} --highlight-line {2}' \
--preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \ --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \
--bind 'enter:become(nvim {1} +{2})' --bind 'enter:become(nvim {1} +{2})'
''; '';
envsource = '' envsource = ''
for line in (cat $argv | grep -v '^#') for line in (cat $argv | grep -v '^#')
set item (string split -m 1 '=' $line) set item (string split -m 1 '=' $line)
set -gx $item[1] $item[2] set -gx $item[1] $item[2]
end end
''; '';
fish_greeting = "fortune -a"; fish_greeting = "fortune -a";
resize_images = '' resize_images = ''
# Resize all JPG images in the current directory and its subdirectories # Resize all JPG images in the current directory and its subdirectories
# Usage: resize_images [percentage] # Usage: resize_images [percentage]
# Example: resize_images 20 - resizes all images to 20% of original size # Example: resize_images 20 - resizes all images to 20% of original size
# If no percentage is provided, defaults to 40% # If no percentage is provided, defaults to 40%
set -l percentage $argv[1] set -l percentage $argv[1]
if test -z "$percentage" if test -z "$percentage"
set percentage 40 set percentage 40
end end
for img in (find . -type f -name "*.JPG") for img in (find . -type f -name "*.JPG")
set original_size (stat -f %z "$img") set original_size (stat -f %z "$img")
magick convert "$img" -resize "$percentage%" "$img" magick convert "$img" -resize "$percentage%" "$img"
set new_size (stat -f %z "$img") set new_size (stat -f %z "$img")
echo "Processed $img" echo "Processed $img"
echo "Original size: $original_size bytes" echo "Original size: $original_size bytes"
echo "New size: $new_size bytes" echo "New size: $new_size bytes"
echo "---" echo "---"
end end
''; '';
localip = "ifconfig | grep \"inet \" | grep -v 127.0.0.1 | awk '{print $2}' | head -n 1"; localip = "ifconfig | grep \"inet \" | grep -v 127.0.0.1 | awk '{print $2}' | head -n 1";
publicip = "curl -4 ifconfig.me"; publicip = "curl -4 ifconfig.me";
fzf = ''
set -Ux FZF_DEFAULT_OPTS "
--color=fg:#908caa,bg:#191724,hl:#ebbcba
--color=fg+:#e0def4,bg+:#26233a,hl+:#ebbcba
--color=border:#403d52,header:#31748f,gutter:#191724
--color=spinner:#f6c177,info:#9ccfd8
--color=pointer:#c4a7e7,marker:#eb6f92,prompt:#908caa"
command fzf
'';
}; };
interactiveShellInit = '' interactiveShellInit = ''
@ -110,11 +118,13 @@
fish_add_path /opt/homebrew/bin fish_add_path /opt/homebrew/bin
fish_add_path $ANDROID_HOME/emulator fish_add_path $ANDROID_HOME/emulator
fish_add_path $ANDROID_HOME/platform-tools fish_add_path $ANDROID_HOME/platform-tools
fish_add_path $HOME/.config/fish/plugins
envsource ~/.env envsource ~/.env
zoxide init fish | source zoxide init fish | source
fnm env --use-on-cd --shell fish | source fnm env --use-on-cd --shell fish | source
rbenv init - | source
''; '';
shellAbbrs = { shellAbbrs = {

View file

@ -0,0 +1,7 @@
au BufNewFile,BufRead Appfile set ft=ruby
au BufNewFile,BufRead Deliverfile set ft=ruby
au BufNewFile,BufRead Fastfile set ft=ruby
au BufNewFile,BufRead Gymfile set ft=ruby
au BufNewFile,BufRead Matchfile set ft=ruby
au BufNewFile,BufRead Snapfile set ft=ruby
au BufNewFile,BufRead Scanfile set ft=ruby

View file

@ -6,7 +6,8 @@ local M = {}
function M.apply_to_config(config) function M.apply_to_config(config)
if hn == "dnsc-work" then if hn == "dnsc-work" then
config.window_background_opacity = 0.9 config.window_background_opacity = 0.975
config.font_size = 19
end end
if hn == "dnsc-desktop" then if hn == "dnsc-desktop" then

View file

@ -57,6 +57,7 @@
extraGroups = [ "wheel" "networkmanager" ]; extraGroups = [ "wheel" "networkmanager" ];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILvXWZOPOJJDAoF+Sx/ZLoAVu6G/7/MAWoknBgMAzjul dennis@dnsc-mac" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILvXWZOPOJJDAoF+Sx/ZLoAVu6G/7/MAWoknBgMAzjul dennis@dnsc-mac"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKnmuxDkpDIku5t1Tykz21u78xoQ7LJR8JEcfth32LGu dennis@dnsc-work"
]; ];
}; };

View file

@ -72,6 +72,7 @@
extraGroups = [ "wheel" "networkmanager" ]; extraGroups = [ "wheel" "networkmanager" ];
openssh.authorizedKeys.keys = [ openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILvXWZOPOJJDAoF+Sx/ZLoAVu6G/7/MAWoknBgMAzjul dennis@dnsc-mac" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILvXWZOPOJJDAoF+Sx/ZLoAVu6G/7/MAWoknBgMAzjul dennis@dnsc-mac"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKnmuxDkpDIku5t1Tykz21u78xoQ7LJR8JEcfth32LGu dennis@dnsc-work"
]; ];
}; };

View file

@ -8,7 +8,7 @@
}: { }: {
imports = [ imports = [
inputs.home-manager.darwinModules.home-manager inputs.home-manager.darwinModules.home-manager
../../home/modules/aerospace ../../home/modules/aerospace/work.nix
]; ];
# Setting the user # Setting the user
@ -44,6 +44,7 @@
prettierd prettierd
atuin atuin
nil nil
nurl
]; ];
# Homebrew # Homebrew
@ -51,7 +52,7 @@
enable = true; enable = true;
onActivation = { onActivation = {
autoUpdate = false; autoUpdate = true;
cleanup = "zap"; cleanup = "zap";
}; };
@ -68,7 +69,7 @@
"yt-dlp" "yt-dlp"
"zoxide" "zoxide"
"sqlite" "sqlite"
"rsync" # "rsync" -> Can't install due to: https://github.com/fastlane/fastlane/discussions/27962
"fnm" "fnm"
"imagemagick" "imagemagick"
"todo-txt" "todo-txt"
@ -83,12 +84,13 @@
"librsvg" "librsvg"
"pixman" "pixman"
"python-setuptools" "python-setuptools"
"rbenv"
]; ];
casks = [ casks = [
"arc" "arc"
"microsoft-teams" "microsoft-teams"
"tailscale" # "tailscale"
"font-victor-mono" "font-victor-mono"
"font-victor-mono-nerd-font" "font-victor-mono-nerd-font"
"vlc" "vlc"
@ -102,6 +104,8 @@
"1password" "1password"
"android-studio" "android-studio"
"zulu@17" "zulu@17"
"postman"
"docker"
]; ];
}; };
@ -130,6 +134,7 @@
persistent-apps = [ persistent-apps = [
"/Applications/Arc.app" "/Applications/Arc.app"
"/Applications/WezTerm.app" "/Applications/WezTerm.app"
"/Applications/Microsoft Teams.app"
"/System/Applications/System Settings.app/" "/System/Applications/System Settings.app/"
]; ];
persistent-others = [ persistent-others = [
@ -171,6 +176,7 @@
home-manager = { home-manager = {
extraSpecialArgs = { inherit inputs outputs; }; extraSpecialArgs = { inherit inputs outputs; };
useGlobalPkgs = true; useGlobalPkgs = true;
backupFileExtension = "backup";
users = { users = {
dennis = import ../../home/darwin-work.nix; dennis = import ../../home/darwin-work.nix;
}; };