diff --git a/home/darwin-work.nix b/home/darwin-work.nix new file mode 100644 index 0000000..96b56cf --- /dev/null +++ b/home/darwin-work.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: + +{ + home.username = "dennis"; + home.homeDirectory = "/Users/dennis"; + home.stateVersion = "24.11"; + + home.sessionVariables = { + EDITOR = "nvim"; + GOPATH = "$HOME/go"; + }; + + xdg.enable = true; + + imports = [ + ./modules/git + ./modules/fish/work + ./modules/atuin + ./modules/wezterm + ./modules/nvim + ./modules/lazygit + ]; + + programs.home-manager.enable = true; +} diff --git a/home/modules/fish/default.nix b/home/modules/fish/default.nix index 47386c8..dea3819 100644 --- a/home/modules/fish/default.nix +++ b/home/modules/fish/default.nix @@ -42,7 +42,7 @@ echo "---" 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"; }; diff --git a/home/modules/fish/work.nix b/home/modules/fish/work.nix new file mode 100644 index 0000000..4692a0f --- /dev/null +++ b/home/modules/fish/work.nix @@ -0,0 +1,83 @@ +{ + programs.fish = { + enable = true; + + functions = { + ff = '' + set RG_PREFIX "rg --column --line-number --no-heading --color=always --smart-case " + set INITIAL_QUERY "$argv" + fzf --ansi --disabled --query "$INITIAL_QUERY" \ + --bind "start:reload:$RG_PREFIX {q}" \ + --bind "change:reload:sleep 0.1; $RG_PREFIX {q} || true" \ + --delimiter : \ + --preview 'bat --color=always {1} --highlight-line {2}' \ + --preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \ + --bind 'enter:become(nvim {1} +{2})' + ''; + envsource = '' + for line in (cat $argv | grep -v '^#') + set item (string split -m 1 '=' $line) + set -gx $item[1] $item[2] + end + ''; + fish_greeting = "fortune -a"; + resize_images = '' + # Resize all JPG images in the current directory and its subdirectories + # Usage: resize_images [percentage] + # Example: resize_images 20 - resizes all images to 20% of original size + # If no percentage is provided, defaults to 40% + + set -l percentage $argv[1] + if test -z "$percentage" + set percentage 40 + end + + for img in (find . -type f -name "*.JPG") + set original_size (stat -f %z "$img") + magick convert "$img" -resize "$percentage%" "$img" + set new_size (stat -f %z "$img") + echo "Processed $img" + echo "Original size: $original_size bytes" + echo "New size: $new_size bytes" + echo "---" + end + ''; + localip = "ifconfig | grep \"inet \" | grep -v 127.0.0.1 | awk '{print $2}' | head -n 1"; + publicip = "curl -4 ifconfig.me"; + }; + + interactiveShellInit = '' + fish_config theme choose "Rosé Pine" + + set -gx JAVA_HOME /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home + set -gx ANDROID_HOME /Users/dennis/Library/Android/sdk + + set hn (prompt_hostname) + set fish_cursor_default block blink + set fish_cursor_insert line blink + set fish_cursor_replace_one underscore blink + set fish_cursor_visual block + set fish_vi_force_cursor 1 + fish_vi_key_bindings + + fish_add_path /run/current-system/sw/bin + fish_add_path /opt/homebrew/bin + fish_add_path $ANDROID_HOME/emulator + fish_add_path $ANDROID_HOME/platform-tools + + envsource ~/.env + + zoxide init fish | source + fnm env --use-on-cd --shell fish | source + ''; + + shellAbbrs = { + lg = "lazygit"; + g = "git"; + frc = "source ~/.config/fish/**/*.fish"; + t = "todo.sh"; + }; + }; + + home.file.".config/fish/themes".source = ./themes; +} diff --git a/hosts/dnsc-work/default.nix b/hosts/dnsc-work/default.nix new file mode 100644 index 0000000..bf682d7 --- /dev/null +++ b/hosts/dnsc-work/default.nix @@ -0,0 +1,184 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + imports = [ + inputs.home-manager.darwinModules.home-manager + ../../home/modules/aerospace + ]; + + # Setting the user + networking.hostName = "dnsc-work"; + networking.computerName = "dnsc-work"; + + users.users."dennis"= { + home = "/Users/dennis"; + description = "Dennis Schoepf"; + }; + + nix.settings.trusted-users = [ "dennis" ]; + + nixpkgs.config.allowUnfree = true; + + # System Packages + environment.systemPackages = with pkgs; [ + git + btop + fish + ripgrep + fzf + fd + sd + bat + neovim + just + tldr + fortune + neofetch + stylua + typescript-language-server + vscode-langservers-extracted + lua-language-server + prettierd + atuin + nil + ]; + + # Homebrew + homebrew = { + enable = true; + + onActivation = { + autoUpdate = false; + cleanup = "zap"; + }; + + taps = [ + "homebrew/services" + ]; + + masApps = { + Bitwarden = 1352778147; + XCode = 497799835; + }; + + brews = [ + "mas" + "lazygit" + "ffmpeg" + "tree-sitter" + "yt-dlp" + "zoxide" + "sqlite" + "rsync" + "fnm" + "imagemagick" + "todo-txt" + "watchman" + ]; + + casks = [ + "arc" + "microsoft-teams" + "zen-browser" + "font-victor-mono" + "font-victor-mono-nerd-font" + "vlc" + "alfred" + "wezterm" + "hiddenbar" + "syncthing" + "eurkey" + "karabiner-elements" + "wezterm" + "1password" + "android-studio" + "zulu@17" + ]; + }; + + # Shells + environment.shells = [ pkgs.fish ]; + + # System settings + system = { + stateVersion = 5; + activationScripts.postUserActivation.text = '' + /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u + ''; + + defaults = { + smb.NetBIOSName = "dnsc-work"; + + dock = { + autohide = true; + autohide-delay = 0.01; + autohide-time-modifier = 0.01; + expose-group-apps = true; + launchanim = false; + minimize-to-application = true; + orientation = "right"; + show-recents = false; + persistent-apps = [ + "/Applications/Arc.app" + "/Applications/WezTerm.app" + "/System/Applications/System Settings.app/" + ]; + persistent-others = [ + "/Users/dennis/Downloads" + ]; + }; + + finder = { + AppleShowAllExtensions = true; + CreateDesktop = false; + FXEnableExtensionChangeWarning = false; + FXPreferredViewStyle = "clmv"; + ShowPathbar = true; + ShowStatusBar = true; + }; + + loginwindow = { + LoginwindowText = "\\U03bb dnsc-work (powered by Nix)"; + }; + + menuExtraClock = { + Show24Hour = true; + ShowDate = 0; + }; + + screencapture = { + location = "/Users/dennis/Downloads"; + target = "file"; + }; + + spaces.spans-displays = false; + }; + }; + + # Add ability to used TouchID for sudo authentication + security.pam.services.sudo_local.touchIdAuth = true; + + # Home Manager Setup + home-manager = { + extraSpecialArgs = { inherit inputs outputs; }; + useGlobalPkgs = true; + users = { + dennis = import ../../home/darwin-work.nix; + }; + }; + + # Nix settings + # Enable new Nix CLI and flakes + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + nix.package = pkgs.nix; + nix.gc = { + automatic = true; + options = "--delete-older-than 1w"; + }; +}