diff --git a/home/default.nix b/home/default.nix index 053e898..6c7bf69 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,64 +1,21 @@ { config, lib, pkgs, ... }: let - # Handly shell command to view the dependency tree of Nix packages - depends = pkgs.writeScriptBin "depends" '' - dep=$1 - nix-store --query --requisites $(which $dep) - ''; - - run = pkgs.writeScriptBin "run" '' - nix-shell --pure --run "$@" - ''; - - # Collect garbage, optimize store, repair paths - nix-cleanup-store = pkgs.writeShellScriptBin "nix-cleanup-store" '' - nix-collect-garbage -d - nix optimise-store 2>&1 | sed -E 's/.*'\'''(\/nix\/store\/[^\/]*).*'\'''/\1/g' | uniq | sudo -E ${pkgs.parallel}/bin/parallel 'nix-store --repair-path {}' - ''; - # Symlink macOS apps installed via Nix into ~/Applications nix-symlink-apps-macos = pkgs.writeShellScriptBin "nix-symlink-apps-macos" '' for app in $(find ~/Applications -name '*.app') do - if test -L $app && [[ $(readlink -f $app) == /nix/store/* ]]; then + if test -L $app && [[ $(greadlink -f $app) == /nix/store/* ]]; then rm $app fi done - for app in $(find ~/.nix-profile/Applications/ -name '*.app' -exec readlink -f '{}' \;) + for app in $(find ~/.nix-profile/Applications/ -name '*.app' -exec greadlink -f '{}' \;) do + echo "symlinking $(basename $app) into ~/Applications" ln -s $app ~/Applications/$(basename $app) done ''; - - # Update Homebrew pagkages/apps - brew-bundle-update = pkgs.writeShellScriptBin "brew-bundle-update" '' - brew update - brew bundle --file=~/.config/nixpkgs/Brewfile - ''; - - # Remove Homebrew pakages/apps not in Brewfile - brew-bundle-cleanup = pkgs.writeShellScriptBin "brew-bundle-cleanup" '' - brew bundle cleanup --zap --force --file=~/.config/nixpkgs/Brewfile - ''; - - # change kitty themes - lightk = pkgs.writeShellScriptBin "lightk" '' - kitty @ set-colors -a -c "$HOME/.config/kitty/modus-operandi.conf" - ''; - - darkk = pkgs.writeShellScriptBin "darkk" '' - kitty @ set-colors -a -c "$HOME/.config/kitty/modus-vivendi.conf" - ''; - scripts = [ - depends - run - nix-cleanup-store nix-symlink-apps-macos - brew-bundle-update - brew-bundle-cleanup - lightk - darkk ]; customPython = pkgs.python37.buildEnv.override { @@ -89,9 +46,6 @@ in news.display = "silent"; home = { - # only need these if not managed by nix-darwin - # username = "luca"; - # homeDirectory = "/Users/luca"; stateVersion = "20.09"; packages = with pkgs; [ adoptopenjdk-bin # Java @@ -101,15 +55,13 @@ in bat # cat replacement written in Rust cachix cantarell-fonts - # calibre clojure cocoapods stable.clojure-lsp cmake # clang conftest - curl # An old classic - direnv # Per-directory environment variables + curl docker # World's #1 container tool # docker-machine # Docker daemon for macOS emacs-all-the-icons-fonts @@ -118,31 +70,12 @@ in # font-awesome_5 font-awesome_4 fira-code - fzf # Fuzzy finder - # gcc - git-lfs gitAndTools.gh gitAndTools.git-crypt - graphviz # dot gnupg # gpg - # gtk3 - httpie # Like curl but more user friendly - jansson - # jetbrains.pycharm-community - jq # JSON parsing for the CLI - just # Intriguing new make replacement - # libgccjit - kind # Easy Kubernetes installation kubectl # Kubernetes CLI tool # kubectx # kubectl context switching - kustomize - lorri # Easy Nix shell - # libtool - # libvterm-neovim - leiningen - less - # mdcat # Markdown converter/reader for the CLI - # mono + # lorri # Easy Nix shell mosh niv # Nix dependency management nixpkgs-fmt @@ -152,7 +85,6 @@ in nodePackages.prettier # nodePackages.vega-lite # nodePackages.vega-cli - # nuget # nyxt pandoc pinentry_mac # Necessary for GPG @@ -166,24 +98,15 @@ in roboto-mono ripgrep # grep replacement written in Rust rsync - spotify-tui # Spotify interface for the CLI sqlite - # texlive - # texlive.combined.scheme-medium - # imagemagick - # thefuck - tectonic + tectonic # latex tree # Should be included in macOS but it's not tmux - vscode # My fav text editor if I'm being honest watch # webkitgtk wget - xsv # CSV file parsing utility yarn # Node.js package manager youtube-dl # Download videos - zlib - # zsh-powerlevel10k ] ++ scripts; }; } diff --git a/home/programs.nix b/home/programs.nix index 8efaf6e..c8e65e6 100644 --- a/home/programs.nix +++ b/home/programs.nix @@ -93,32 +93,17 @@ ]; # Replaces aliases in ~/.gitconfig aliases = { - ba = "branch -a"; - bd = "branch -D"; - br = "branch"; - cam = "commit -am"; co = "checkout"; - cob = "checkout -b"; - ci = "commit"; - cm = "commit -m"; - cp = "commit -p"; d = "diff"; - dco = "commit -S --amend"; s = "status"; pr = "pull --rebase"; st = "status"; l = "log --graph --pretty='%Cred%h%Creset - %C(bold blue)<%an>%Creset %s%C(yellow)%d%Creset %Cgreen(%cr)' --abbrev-commit --date=relative"; - whoops = "reset --hard"; - wipe = "commit -s"; - fix = "rebase --exec 'git commit --amend --no-edit -S' -i origin/develop"; }; # Global Git config extraConfig = { core = { - # editor = "emacsclient"; - # pager = "delta --dark"; whitespace = "trailing-space,space-before-tab"; - # fileMode = false; }; # commit.gpgsign = "true"; # gpg.program = "gpg2"; @@ -126,11 +111,10 @@ github.user = "lccambiaghi"; protocol.keybase.allow = "always"; credential.helper = "osxkeychain"; - pull.rebase = "false"; + pull.rebase = "true"; }; }; - # gpgconf --kill gpg-agent to restart agent - gpg.enable = true; + gpg.enable = true; # gpgconf --kill gpg-agent to restart agent htop = { enable = true; showProgramPath = true; diff --git a/home/shells/fish.nix b/home/shells/fish.nix index 9db2920..eeaa673 100644 --- a/home/shells/fish.nix +++ b/home/shells/fish.nix @@ -42,16 +42,13 @@ let pipde = "poetry run pip install debugpy"; pipdt = "poetry run pip install dtale"; - # Reload zsh - szsh = "source ~/.zshrc"; - # Reload home manager and zsh - reload = "cd ~/git/nixpkgs && darwin-rebuild switch --flake . && cd -"; + reload = "cd ~/git/nixpkgs && darwin-rebuild switch --flake .#luca-macbookpro && cd -"; # Nix garbage collection garbage = "sudo nix-collect-garbage -d && docker image prune --all --force"; - # See which Nix packages are installed + # See which Nix packages are installed with nix-env installed = "nix-env --query --installed"; # emacs