Skip to content

Commit

Permalink
Simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
lccambiaghi committed May 19, 2021
1 parent e2c660e commit e57af41
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 106 deletions.
89 changes: 6 additions & 83 deletions home/default.nix
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -152,7 +85,6 @@ in
nodePackages.prettier
# nodePackages.vega-lite
# nodePackages.vega-cli
# nuget
# nyxt
pandoc
pinentry_mac # Necessary for GPG
Expand All @@ -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;
};
}
20 changes: 2 additions & 18 deletions home/programs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,44 +93,28 @@
];
# 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";
ui.color = "always";
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;
Expand Down
7 changes: 2 additions & 5 deletions home/shells/fish.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e57af41

Please sign in to comment.