From 8d745c6aa741bd306c961fef751bf19fe2356f84 Mon Sep 17 00:00:00 2001 From: Felix Schneider <99918022+trueberryless@users.noreply.github.com> Date: Mon, 20 Oct 2025 07:50:49 +0200 Subject: [PATCH] refactor: clean up Co-authored-by: Clemens Schlipfinger --- README.md | 8 +++++++- dotfiles/.alias | 16 ++++++++++++++++ dotfiles/.gitconfig | 2 +- dotfiles/.zprofile | 1 + dotfiles/.zshrc | 13 +++++++++---- flake.lock | 18 +++++++++--------- flake.nix | 8 +++----- modules/apps.nix | 8 +++++++- modules/fonts.nix | 6 ++++++ modules/home-manager.nix | 4 +++- modules/homebrew.nix | 5 +---- modules/nix-core.nix | 1 - modules/sudo-alias.nix | 10 ---------- 13 files changed, 63 insertions(+), 37 deletions(-) create mode 100644 dotfiles/.alias create mode 100644 dotfiles/.zprofile create mode 100644 modules/fonts.nix delete mode 100644 modules/sudo-alias.nix diff --git a/README.md b/README.md index 8e85d82..c716cfb 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,16 @@ Download Nix with Determinate Systems and decline the `--determinate` option wit curl -fsSL https://install.determinate.systems/nix | sh -s -- install ``` +Install homebrew separately with this command: + +```bash +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +``` + Since git is configured with this repo, I recommend that you just download the ZIP of the repo and unpack locally, save it to `~/.config/nix/` and execute: ```bash -nix run nix-darwin --extra-experimental-features nix-command --extra-experimental-features flakes -- switch --flake ~/.config/nix +sudo nix run nix-darwin --extra-experimental-features nix-command --extra-experimental-features flakes -- switch --flake ~/.config/nix#tbl-macbook ``` After that command, `nix-darwin` is installed and you can run this command to rebuild your config: diff --git a/dotfiles/.alias b/dotfiles/.alias new file mode 100644 index 0000000..fb32a3d --- /dev/null +++ b/dotfiles/.alias @@ -0,0 +1,16 @@ +alias nix-switch='sudo darwin-rebuild switch --flake "$NIX_CONFIG_PATH#$(hostname -s)"' +alias nix-update='nix flake update --flake $NIX_CONFIG_PATH' +alias nix-gc='nix-collect-garbage --delete-old' + +alias rm="rm -i" +alias cp="cp -i" +alias mv="mv -i" + +alias ls="eza" +alias l="eza --icons" +alias ll="eza -l --icons" +alias la="eza -laa --icons" + +alias tree="eza -T" +alias psg="ps -ef | grep -i" +alias envg="env | grep -i" diff --git a/dotfiles/.gitconfig b/dotfiles/.gitconfig index 306f6e7..cbbfd23 100644 --- a/dotfiles/.gitconfig +++ b/dotfiles/.gitconfig @@ -12,4 +12,4 @@ rebase = true [core] - excludesFile = /Users/trueberryless/.gitignore + excludesFile = ~/.gitignore diff --git a/dotfiles/.zprofile b/dotfiles/.zprofile new file mode 100644 index 0000000..6b27a6c --- /dev/null +++ b/dotfiles/.zprofile @@ -0,0 +1 @@ +eval "$(/opt/homebrew/bin/brew shellenv)" diff --git a/dotfiles/.zshrc b/dotfiles/.zshrc index 78ed772..515a67f 100644 --- a/dotfiles/.zshrc +++ b/dotfiles/.zshrc @@ -1,7 +1,12 @@ export LANG='en_US.UTF-8' export EDITOR=vim export VISUAL="$EDITOR" -if [ "$TERM_PROGRAM" != "Apple_Terminal" ]; then - eval "$(oh-my-posh init zsh --config '/Users/trueberryless/oh-my-posh.omp.json')" - eval "$(zoxide init zsh --cmd cd)" -fi + +export NIX_CONFIG_PATH=~/.config/nix + +. ~/.alias + +eval "$(oh-my-posh init zsh --config '~/oh-my-posh.omp.json')" +eval "$(zoxide init zsh --cmd cd)" + +eval "$(bw completion --shell zsh); compdef _bw bw;" diff --git a/flake.lock b/flake.lock index 17f77e1..281cb9b 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1756679287, - "narHash": "sha256-Xd1vOeY9ccDf5VtVK12yM0FS6qqvfUop8UQlxEB+gTQ=", + "lastModified": 1758463745, + "narHash": "sha256-uhzsV0Q0I9j2y/rfweWeGif5AWe0MGrgZ/3TjpDYdGA=", "owner": "nix-community", "repo": "home-manager", - "rev": "07fc025fe10487dd80f2ec694f1cd790e752d0e8", + "rev": "3b955f5f0a942f9f60cdc9cacb7844335d0f21c3", "type": "github" }, "original": { @@ -28,11 +28,11 @@ ] }, "locked": { - "lastModified": 1757432263, - "narHash": "sha256-qHn+/0+IOz5cG68BZUwL9BV3EO/e9eNKCjH3+N7wMdI=", + "lastModified": 1759509947, + "narHash": "sha256-4XifSIHfpJKcCf5bZZRhj8C4aCpjNBaE3kXr02s4rHU=", "owner": "nix-darwin", "repo": "nix-darwin", - "rev": "1fef4404de4d1596aa5ab2bd68078370e1b9dcdb", + "rev": "000eadb231812ad6ea6aebd7526974aaf4e79355", "type": "github" }, "original": { @@ -44,11 +44,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1757590060, - "narHash": "sha256-EWwwdKLMZALkgHFyKW7rmyhxECO74+N+ZO5xTDnY/5c=", + "lastModified": 1760912464, + "narHash": "sha256-+iIFNo47ea60KO9RP8yi8mPpb76AjXm5mtIWJSdVZuU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0ef228213045d2cdb5a169a95d63ded38670b293", + "rev": "ca8238eea4e13422e041c20fd798c5e0de5f749c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 8db5e36..e72c207 100644 --- a/flake.nix +++ b/flake.nix @@ -26,17 +26,15 @@ }; in { - # Apply darwin flake using: - # $ darwin-rebuild switch --flake ~/.config/nix#tbl-macbook darwinConfigurations.${hostname} = nix-darwin.lib.darwinSystem { inherit system specialArgs; modules = [ + ./modules/apps.nix + ./modules/fonts.nix + ./modules/homebrew.nix ./modules/host-users.nix ./modules/nix-core.nix ./modules/system.nix - ./modules/sudo-alias.nix - ./modules/apps.nix - ./modules/homebrew.nix home-manager.darwinModules.home-manager { home-manager.useGlobalPkgs = true; diff --git a/modules/apps.nix b/modules/apps.nix index 9b625cf..376047a 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, ... }: let devShellPaths = [ ./shells/node20.nix @@ -10,18 +10,24 @@ in { environment.systemPackages = (with pkgs; [ aldente + bitwarden-desktop + code-cursor discord docker + eza git google-chrome iterm2 jetbrains.idea-ultimate jetbrains.rider neofetch + nixd + oh-my-posh postman raycast tmux tree + zed-editor zoxide ]) ++ devShells; diff --git a/modules/fonts.nix b/modules/fonts.nix new file mode 100644 index 0000000..f0926fd --- /dev/null +++ b/modules/fonts.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + fonts.packages = with pkgs; [ + nerd-fonts.fira-code + ]; +} diff --git a/modules/home-manager.nix b/modules/home-manager.nix index 66354da..e3eb2e9 100644 --- a/modules/home-manager.nix +++ b/modules/home-manager.nix @@ -11,9 +11,11 @@ ]; home.file = { + ".alias".source = ../dotfiles/.alias; ".gitconfig".source = ../dotfiles/.gitconfig; ".gitignore".source = ../dotfiles/.gitignore; + ".zprofile".source = ../dotfiles/.zprofile; ".zshrc".source = ../dotfiles/.zshrc; "oh-my-posh.omp.json".source = ../dotfiles/oh-my-posh.omp.json; }; -} \ No newline at end of file +} diff --git a/modules/homebrew.nix b/modules/homebrew.nix index 5326257..3b9173e 100644 --- a/modules/homebrew.nix +++ b/modules/homebrew.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ ... }: { # To make this work, homebrew need to be installed manually, see https://brew.sh # @@ -16,7 +16,6 @@ # `brew install` brews = [ "gh" - "oh-my-posh" ]; # `brew install --cask` @@ -24,8 +23,6 @@ "beeper" "clipbook" "firefox" - "font-fira-code-nerd-font" - "processing" "spotify" "visual-studio-code" "zen" diff --git a/modules/nix-core.nix b/modules/nix-core.nix index 961cb31..55d8c1d 100644 --- a/modules/nix-core.nix +++ b/modules/nix-core.nix @@ -12,7 +12,6 @@ # substituers that will be considered before the official ones(https://cache.nixos.org) substituters = [ - "https://mirror.sjtu.edu.cn/nix-channels/store" "https://nix-community.cachix.org" ]; trusted-public-keys = [ diff --git a/modules/sudo-alias.nix b/modules/sudo-alias.nix deleted file mode 100644 index 204d952..0000000 --- a/modules/sudo-alias.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs, ... }: -let - nixSwitch = pkgs.writeShellScriptBin "nix-switch" '' - exec darwin-rebuild switch --flake "$(eval echo "/Users/$SUDO_USER")/.config/nix#$(hostname -s)" - ''; -in { - environment.systemPackages = [ - nixSwitch - ]; -} \ No newline at end of file -- 2.51.2