diff --git a/nix-darwin/flake.lock b/nix-darwin/flake.lock index 55184950..f373e06d 100644 --- a/nix-darwin/flake.lock +++ b/nix-darwin/flake.lock @@ -33,6 +33,23 @@ "type": "github" } }, + "brew-src": { + "flake": false, + "locked": { + "lastModified": 1761551821, + "narHash": "sha256-N3Zj73TAxclhLGgADbPVwcVrhYIBKUgAxjfQuOXre6s=", + "owner": "Homebrew", + "repo": "brew", + "rev": "8f6719274133c5bcc24c058c5a6bcbb3b0cd48b3", + "type": "github" + }, + "original": { + "owner": "Homebrew", + "ref": "4.6.19", + "repo": "brew", + "type": "github" + } + }, "catppuccin": { "inputs": { "nixpkgs": "nixpkgs" @@ -551,6 +568,24 @@ "type": "github" } }, + "nix-homebrew": { + "inputs": { + "brew-src": "brew-src" + }, + "locked": { + "lastModified": 1761927470, + "narHash": "sha256-KsFDGRGD8j1R6TvJ4HkebKsh3HXLY0XazanLrhO3wqE=", + "owner": "zhaofengli", + "repo": "nix-homebrew", + "rev": "3cae36b3a17b09a66435291619dce8cf2c4728ca", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "repo": "nix-homebrew", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1762111121, @@ -660,6 +695,7 @@ "home-manager": "home-manager", "hosts": "hosts", "hyprland": "hyprland", + "nix-homebrew": "nix-homebrew", "nixpkgs": "nixpkgs_2", "nixvim": "nixvim", "rose-pine-hyprcursor": "rose-pine-hyprcursor", diff --git a/nix-darwin/flake.nix b/nix-darwin/flake.nix index a3120009..9e84b3f8 100644 --- a/nix-darwin/flake.nix +++ b/nix-darwin/flake.nix @@ -15,6 +15,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + nix-homebrew = { + url = "github:zhaofengli/nix-homebrew"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + hosts = { url = "github:StevenBlack/hosts"; inputs.nixpkgs.follows = "nixpkgs"; @@ -58,6 +63,7 @@ darwin, catppuccin, nixvim, + nix-homebrew, ... }: let diff --git a/nix-darwin/home-modules/programs/nnn.nix b/nix-darwin/home-modules/programs/nnn.nix index 2cb9747f..6380ee59 100644 --- a/nix-darwin/home-modules/programs/nnn.nix +++ b/nix-darwin/home-modules/programs/nnn.nix @@ -44,7 +44,6 @@ home = { packages = with pkgs; [ dragon-drop - sxiv ]; sessionVariables = { # NNN_PLUG = "f:finder;o:fzopen;p:preview-tui;t:preview-tabbed"; # tabbed is x only diff --git a/nix-darwin/home-modules/programs/zsh.nix b/nix-darwin/home-modules/programs/zsh.nix index 2203f93b..d1147672 100644 --- a/nix-darwin/home-modules/programs/zsh.nix +++ b/nix-darwin/home-modules/programs/zsh.nix @@ -17,9 +17,14 @@ programs.zsh = { enable = true; initContent = '' - export ENTERPRISE_REPO_PATH=~/knak - if [[ -f $ENTERPRISE_REPO_PATH/scripts/mfa-token-loader.sh ]]; then source $ENTERPRISE_REPO_PATH/scripts/mfa-token-loader.sh; fi - [[ -f $ENTERPRISE_REPO_PATH/scripts/aliases ]] && source $ENTERPRISE_REPO_PATH/scripts/aliases + export ENTERPRISE_REPO_PATH=~/knak + if [[ -f $ENTERPRISE_REPO_PATH/scripts/mfa-token-loader.sh ]]; then source $ENTERPRISE_REPO_PATH/scripts/mfa-token-loader.sh; fi + [[ -f $ENTERPRISE_REPO_PATH/scripts/aliases ]] && source $ENTERPRISE_REPO_PATH/scripts/aliases + + # added because of homebrew + export NVM_DIR="$HOME/.nvm" + [ -s "$HOMEBREW_PREFIX/opt/nvm/nvm.sh" ] && \. "$HOMEBREW_PREFIX/opt/nvm/nvm.sh" # This loads nvm + [ -s "$HOMEBREW_PREFIX/opt/nvm/etc/bash_completion.d/nvm" ] && \. "$HOMEBREW_PREFIX/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion ''; autosuggestion.enable = true; syntaxHighlighting.enable = true; diff --git a/nix-darwin/users/henri.vandersleyen/configuration.nix b/nix-darwin/users/henri.vandersleyen/configuration.nix index 15d3a17c..bfc8fe9f 100644 --- a/nix-darwin/users/henri.vandersleyen/configuration.nix +++ b/nix-darwin/users/henri.vandersleyen/configuration.nix @@ -7,6 +7,7 @@ # https://daiderd.com/nix-darwin/manual/index.html { imports = [ + inputs.nix-homebrew.darwinModules.nix-homebrew # ./modules/services/appleTouchId.nix ]; @@ -166,6 +167,12 @@ # Homebrew needs to be installed on its own! system.primaryUser = meta.username; + nix-homebrew = { + enable = true; + enableRosetta = true; # Only for Apple Silicon (M1/M2) + user = meta.username; + autoMigrate = true; + }; homebrew = { enable = true; casks = [ @@ -174,7 +181,7 @@ "postman" "arc" "spotify" - "docker" + "docker-desktop" "fellow" "font-jetbrains-mono" ]; @@ -183,6 +190,7 @@ "nvm" "dive" "aws-sam-cli" + "awscli" ]; }; } diff --git a/nix-darwin/users/henri.vandersleyen/home.nix b/nix-darwin/users/henri.vandersleyen/home.nix index ad9707d3..d7259860 100644 --- a/nix-darwin/users/henri.vandersleyen/home.nix +++ b/nix-darwin/users/henri.vandersleyen/home.nix @@ -72,15 +72,15 @@ # programs program = { - awscli.enable = true; - arc-browser.enable = false; # INFO unmaintained (use brew) + awscli.enable = false; # brew + arc-browser.enable = false; # beew codium.enable = true; - fish.enable = true; + fish.enable = false; zsh.enable = true; nh.flakeLocation = "/Users/${meta.username}/Documents/dotFiles/nix-darwin"; keychain = { enable = true; - # keys = [ "/home/${meta.username}/.ssh/knak" ]; + keys = [ "/home/${meta.username}/.ssh/knak" ]; }; git = { # userEmail = config.sops.secrets."knak/email".path; diff --git a/test.el b/test.el new file mode 100644 index 00000000..706eaa48 --- /dev/null +++ b/test.el @@ -0,0 +1,78 @@ +(require 'eieio) +;; Elisp programs are made of symbolic expressions ("sexps"): +;; SPC m e b (evaluate buffer) +(setq max-front-squat 315) +(setq max-deadlift 315) +(setq max-ovh-press 155) +;; "%s" string +;; "%d" digit +;; essentially console.log +;; (message "%d" max-front-squat) +;; (message "%d" (/ max-ovh-press .7)) +;; (message "%d" (+ 2 2 )) + +;; I can only train 3-4 times a week +;; I want progressive overloads for the heavy lifts. which allows for spare work (if I feel good) +;; kb exervises clean/jerk, snatch, loaded carry. +;;(setq table '((set exercise weight))) + +(defclass workout () + ((exercise :initarg :exercise + :initform "" + :type string + :custom string + :documentation "The big lift name.") + (weight :initarg :weight + :initform 0 + :type integer + :custom integer + :documentation "The weight of the lift."))) + +(cl-defmethod data ((wkout workout)) + (message "exercise: %s weight: %d" + (slot-value wkout 'exercise) + (slot-value wkout 'weight))) + +;; let*: Variables are bound in sequence, so later ones can use earlier ones +(cl-defmethod month ((wkout workout) &optional (sets 1)) + "Generate org table rows for N sets of a workout." + (let* ((exercise (slot-value wkout 'exercise)) ;; defines a list of vars + (weight (round (* (slot-value wkout 'weight) 0.7))) + (rows (mapcar (lambda (i) (list i exercise weight)) + (number-sequence 1 sets)))) + rows)) ;; rows contains the returned data + +(cl-defmethod to-org ((tables list)) + "Render multiple workout tables into a temporary Org-mode buffer." + (let ((buf (get-buffer-create "*Workout Tables*"))) + (with-current-buffer buf + (erase-buffer) + (org-mode) + (dolist (table tables) + (insert "\n") ;; Add a blank line between tables + ;; Optionally: Add a heading + (let ((exercise-name (nth 1 (car table)))) ;; Get exercise name from row 1 + (insert (format "* %s\n" exercise-name))) + ;; Insert the table rows + (dolist (row table) + (insert (mapconcat (lambda (cell) + (format "| %s " cell)) + row + "") + "|\n")) + (insert "\n")) ;; Another newline for spacing + (goto-char (point-min)) + (org-table-map-tables 'org-table-align)) + (switch-to-buffer buf))) + +;; --- +(setq squats (workout :exercise "Squat" :weight max-front-squat)) +(setq deadlift (workout :exercise "Deadlift" :weight max-deadlift)) + +(data squats) +;; Call month to add to table +;;(month squats) + +;; Check contents of table +(to-org (list (month squats 7) + (month deadlift 5)))