From 5848a4813d135d8bf146fb2c323bfa29632ec353 Mon Sep 17 00:00:00 2001 From: vancycles-knak Date: Thu, 12 Jun 2025 16:38:57 -0700 Subject: [PATCH 1/6] added missing package --- nix-darwin/home-modules/programs/spacemacs.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-darwin/home-modules/programs/spacemacs.nix b/nix-darwin/home-modules/programs/spacemacs.nix index 4d28401f..b9986cbd 100644 --- a/nix-darwin/home-modules/programs/spacemacs.nix +++ b/nix-darwin/home-modules/programs/spacemacs.nix @@ -30,6 +30,7 @@ gcc libgccjit editorconfig-core-c + ispell proton-pass protonmail-bridge # for email ]; From efaae77c090a45d20cefcf4815f2d2820142ab92 Mon Sep 17 00:00:00 2001 From: vancycles-knak Date: Tue, 17 Jun 2025 14:49:23 -0700 Subject: [PATCH 2/6] ipdate --- nix-darwin/flake.nix | 2 +- nix-darwin/flakes/monolith/configuration.nix | 1 + nix-darwin/users/henri.vandersleyen/configuration.nix | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/nix-darwin/flake.nix b/nix-darwin/flake.nix index d46a489e..9c602818 100644 --- a/nix-darwin/flake.nix +++ b/nix-darwin/flake.nix @@ -112,7 +112,7 @@ quadlet-nix.nixosModules.quadlet home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; + # home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.extraSpecialArgs = { inherit inputs; diff --git a/nix-darwin/flakes/monolith/configuration.nix b/nix-darwin/flakes/monolith/configuration.nix index b262080f..e0254dd3 100644 --- a/nix-darwin/flakes/monolith/configuration.nix +++ b/nix-darwin/flakes/monolith/configuration.nix @@ -88,6 +88,7 @@ ]; # secrets + # if you change the secret strucutre you must first create the new secret and then rebuild and then change its reference in the config sops = { defaultSopsFile = ./secrets/secrets.yaml; defaultSopsFormat = "yaml"; diff --git a/nix-darwin/users/henri.vandersleyen/configuration.nix b/nix-darwin/users/henri.vandersleyen/configuration.nix index 79e57e02..73142ded 100644 --- a/nix-darwin/users/henri.vandersleyen/configuration.nix +++ b/nix-darwin/users/henri.vandersleyen/configuration.nix @@ -28,10 +28,10 @@ }; nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; # for nix.nix }; - nixpkgs = { hostPlatform = "aarch64-darwin"; config.allowUnfree = true; + config.allowBroken = true; # temporary config.allowUnsupportedSystem = true; }; @@ -62,6 +62,7 @@ ''; # Homebrew needs to be installed on its own! + system.primaryUser = username; homebrew = { enable = true; casks = [ From 55ef000eda21f86be749a24a9b0848c75165cb12 Mon Sep 17 00:00:00 2001 From: vancycles-knak Date: Tue, 17 Jun 2025 14:50:39 -0700 Subject: [PATCH 3/6] updated spacemacs --- .config/spacemacs/.spacemacs | 143 ++++++++++++++--------------------- 1 file changed, 57 insertions(+), 86 deletions(-) diff --git a/.config/spacemacs/.spacemacs b/.config/spacemacs/.spacemacs index 161e404f..409c4785 100644 --- a/.config/spacemacs/.spacemacs +++ b/.config/spacemacs/.spacemacs @@ -76,6 +76,7 @@ This function should only modify configuration layer settings." typescript-linter 'eslint typescript-fmt-on-save t ) ;; js but like better? + (php :variables php-backend 'lsp) ;; personal home programming says what? (python :variables python-format-on-save t python-formatter 'black @@ -106,8 +107,8 @@ This function should only modify configuration layer settings." yaml-enable-lsp t) ;; evil clearly fomatted toml ;; what if we tried yet another std (json :variables - json-fmt-on-save t - json-fmt-tool 'prettier) ;; the prefered backend/frontend love letter format + json-fmt-tool 'prettier + json-fmt-on-save t) ;; the prefered backend/frontend love letter format multiple-cursors (shell :variables shell-default-height 30 @@ -146,24 +147,14 @@ This function should only modify configuration layer settings." (nix-ts-mode :mode "\\.nix\\'" :config - ;; (setq lsp-nix-nixd-server-path "/home/henri/.nix-profile/bin/nixd") - (let ((system-name (if (eq system-type 'darwin) - "henri-MacBook-Pro" - "desktop")) - (config-type (if (eq system-type 'darwin) - "darwinConfigurations" - "nixosConfigurations"))) + (let ((home-dir (if (eq system-type 'gnu/linux) + "/home/henri/Documents" + "/Users/henri.vandersleyen/Documents"))) (setq lsp-nix-nixd-home-manager-options-expr - (format "(builtins.getFlake \"%s/Documents/dotFiles/nix-darwin\").%s.\"%s\".options.home-manager" - (getenv "HOME") - config-type - system-name)) + (format "(builtins.getFlake \"%s/dotFiles/nix-darwin\").darwinConfigurations.\"henri-MacBook-Pro\".options.home-manager" home-dir)) (setq lsp-nix-nixd-nixos-options-expr - (format "(builtins.getFlake \"%s/Documents/dotFiles/nix-darwin\").%s.\"%s\".options" - (getenv "HOME") - config-type - system-name))) - (setq lsp-nix-nixd-nixpkgs-expr "import { }")) + (format "(builtins.getFlake \"%s/dotFiles/nix-darwin\").darwinConfigurations.\"henri-MacBook-Pro\".options" home-dir)) + (setq lsp-nix-nixd-nixpkgs-expr "import { }"))) (sops :recipe (:type git :host github :repo "djgoku/sops")) catppuccin-theme @@ -703,11 +694,38 @@ before packages are loaded." ;;INFO: in macos, you can increase the repeat rate of keys ;; M-x nerd-icons-install-fonts to fix doom-emacs status line (add-to-list 'exec-path "/etc/profiles/per-user/henri.vandersleyen/bin") + ;; --- elisp --- + (defun mp-elisp-mode-eval-buffer () + (interactive) + (message "--- Evaluated buffer ---\n") + (eval-buffer)) + + (define-key emacs-lisp-mode-map (kbd "C-c C-c") #'mp-elisp-mode-eval-buffer) + (define-key lisp-interaction-mode-map (kbd "C-c C-c") #'mp-elisp-mode-eval-buffer) + + (defun run-elisp-in-vterm () + "Run the current elisp buffer and display the output in a vterm terminal." + (interactive) + (save-buffer) + (let ((file-path (buffer-file-name)) + (vterm-buffer-name "*elisp-vterm*")) + (if (not file-path) + (message "Buffer is not visiting a file") + (if (fboundp 'vterm) + (progn + (if (get-buffer vterm-buffer-name) + (switch-to-buffer-other-window vterm-buffer-name) + (vterm vterm-buffer-name)) + (vterm-send-string + (format "emacs --batch -l %s && echo \"\\nElisP execution completed.\"\n" + (shell-quote-argument file-path)))) + (message "vterm is not available. Make sure vterm is installed."))))) + ;; --- shell --- + (spacemacs/set-leader-keys "obs" 'vterm) ;; --- misc problems --- (when (fboundp 'electric-indent-mode) (electric-indent-mode -1)) ;; disables auto indent on new lines (setq-default spacemacs-yank-indent-threshold 0) ;; disables auto indent on pasting (setq-default word-wrap t) - (spacemacs/set-leader-keys "obs" 'scratch-buffer) ;; --- popper --- (spacemacs/set-leader-keys "opt" 'popper-toggle) (spacemacs/set-leader-keys "opc" 'popper-cycle) @@ -775,9 +793,12 @@ _p_rev _u_pper _=_: upper/lower _r_esolve web-mode-code-indent-offset 2 web-mode-attr-indent-offset 2) ;; --- llm/ai --- - (gptel-make-deepseek "DeepSeek" - :stream t - :key "your-api-key") + ;; (gptel-make-deepseek "DeepSeek" + ;; :stream t + ;; :key "your-api-key") + (gptel-make-gh-copilot "Copilot") + (setq gptel-model 'claude-3.7-sonnet + gptel-backend (gptel-make-gh-copilot "Copilot")) ;; --- projectile --- (setq projectile-project-search-path '("~/knak/packages/" "~/Documents/")) (spacemacs/set-leader-keys "ps" 'projectile-discover-projects-in-search-path) @@ -792,7 +813,9 @@ _p_rev _u_pper _=_: upper/lower _r_esolve ;; --- hl-todo --- (with-eval-after-load 'hl-todo - (add-to-list 'hl-todo-keyword-faces '("WARN" . "#FFA500"))) + (add-to-list 'hl-todo-keyword-faces '("WARN" . "#FAB387")) ;; Catppuccin Peach + (add-to-list 'hl-todo-keyword-faces '("FIX" . "#F38BA8")) ;; Catppuccin Red + (add-to-list 'hl-todo-keyword-faces '("INFO" . "#89DCEB"))) ;; Catppuccin Sky ;; --- org-general --- (setq user-mail-address "henri-vandersleyen@protonmail.com") (add-hook 'org-mode-hook @@ -818,7 +841,7 @@ _p_rev _u_pper _=_: upper/lower _r_esolve ;; --- org-todo --- (setq org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!)") - (sequence "BACKLOG(b)" "PLAN(p)" "READY(r)" "ACTIVE(a)" "REVIEW(v)" "WAIT(w@/!)" "HOLD(h)" "|" "COMPLETED(c)" "CANC(k@)"))) + (sequence "BACKLOG(b)" "PLAN(p)" "READY(r)" "ACTIVE(a)" "REVIEW(v)" "WAIT(w@/!)" "HOLD(h)" "|" "CANC(k@)"))) (setq org-todo-keyword-faces '(("TODO" :inherit (org-todo region) :foreground "#A6E3A1" :weight bold) ; Green @@ -831,7 +854,6 @@ _p_rev _u_pper _=_: upper/lower _r_esolve ("BACKLOG" :inherit (org-todo region) :foreground "#B4BEFE" :weight bold) ; Lavender ("HOLD" :inherit (org-todo region) :foreground "#CBA6F7" :weight bold) ; Mauve ("DONE" :inherit (org-todo region) :foreground "#6C7086" :weight bold) ; Gray (Subtext0) - ("COMPLETED" :inherit (org-todo region) :foreground "#6C7086" :weight bold) ; Gray (same as DONE) ("CANC" :inherit (org-todo region) :foreground "#FAB387" :weight bold) ; Peach )) ;; --- org-priority @@ -920,20 +942,25 @@ _p_rev _u_pper _=_: upper/lower _r_esolve :hidefiles nil :formula nil :timestamp nil :level nil :tcolumns nil :formatter nil)) ;; --- org-templates --- + ;; TODO: (setq org-capture-templates '( ("j" "Work Log Entry" - entry (file+datetree "~/Documents/zettelkasten/org-roam/org/work-log.org") - "* %?" + entry (file+datetree "~/Documents/zettelkasten/org-roam/org/work/work-log.org") + "* %^{Task} \n:PROPERTIES:\n:END:\n" :empty-lines 0) ("c" "Code To-Do" entry (file+headline "~/Documents/zettelkasten/org-roam/org/work/todo.org" "Code Related Tasks") - "* TODO [#C] %?\nDEADLINE: %^T\n:Created: %T\n%i\n%a\nShortcut Ticket: \nProposed Solution: \n" + "* TODO [#C] %?\n:PROPERTIES:\n:Effort: $^{Effort}\n:Weight: $^{Weight}\n:END:\nDEADLINE: %^T\n:Created: %T\n%i\n%a\nShortcut Ticket: \nProposed Solution: \n" :empty-lines 0) ("g" "General To-Do" entry (file+headline "~/Documents/zettelkasten/org-roam/org/home/todo.org" "General TODOS") "* TODO [#E] %?\n:Created: %T\n " :empty-lines 0) + ("l" "Learning note" + entry (file+headline "~/Documents/zettelkasten/org-roam/org/home/learning.org" "Learning Notes") + "* %^{Subject} \n:PROPERTIES:\n:END:\n** %?" + :empty-lines 0) ("m" "Meeting" entry (file+datetree "~/Documents/zettelkasten/org-roam/org/work/meetings.org") "* %? :meeting:%^g \n:Created: %T\n** Attendees\n*** \n** Notes\n** Action Items\n*** TODO [#A] " @@ -978,6 +1005,7 @@ _p_rev _u_pper _=_: upper/lower _r_esolve :if-new (file+head "projects/%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: Project") :unnarrowed t) )) + ;; --- date prettier (svg)--- ;; --- lsp --- (add-hook 'python-mode-hook #'lsp) (add-hook 'typescript-mode-hook #'lsp) @@ -1030,64 +1058,7 @@ This function is called at the very end of Spacemacs initialization." ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(package-selected-packages - '(a ace-jump-helm-line ace-link ace-pinyin add-node-modules-path - aggressive-indent aio alert all-the-icons anaconda-mode auctex - auto-compile auto-dictionary auto-highlight-symbol auto-yasnippet blacken - browse-at-remote bui catppuccin-theme centered-cursor-mode chinese-conv - chinese-word-at-point clean-aindent-mode closql code-cells code-review - color-identifiers-mode column-enforce-mode company company-anaconda - company-auctex company-emoji company-math company-nixos-options - company-reftex company-shell concurrent consult ctable cython-mode - dap-mode deferred define-word devdocs diff-hl diminish dired-quick-sort - disable-mouse docker dockerfile-mode doom-modeline doom-themes - dotenv-mode drag-stuff dumb-jump eat editorconfig elisp-def elisp-demos - elisp-slime-nav ellama emacsql emoji-cheat-sheet-plus emojify emr epc - esh-help eshell-prompt-extras eshell-z eval-sexp-fu evil-anzu evil-args - evil-cleverparens evil-collection evil-easymotion evil-escape - evil-evilified-state evil-exchange evil-goggles evil-iedit-state - evil-indent-plus evil-lion evil-lisp-state evil-matchit evil-mc - evil-nerd-commenter evil-numbers evil-org evil-surround evil-tex - evil-textobj-line evil-tutor evil-unimpaired evil-visual-mark-mode - evil-visualstar exec-path-from-shell expand-region eyebrowse - fancy-battery fcitx fic-mode find-by-pinyin-dired fish-mode flx-ido - flycheck-bashate flycheck-elsa flycheck-package flycheck-pos-tip - flyspell-correct flyspell-correct-helm flyspell-popup font-utils forge - gh-md ghub git-link git-messenger git-modes git-timemachine - gitignore-templates gntp gnuplot golden-ratio google-translate gptel - helm-ag helm-c-yasnippet helm-comint helm-company helm-descbinds - helm-git-grep helm-ls-git helm-lsp helm-make helm-mode-manager helm-mu - helm-nixos-options helm-org helm-org-rifle helm-projectile helm-purpose - helm-pydoc helm-spotify-plus helm-swoop helm-themes helm-xref hide-comnt - highlight-indentation highlight-numbers highlight-parentheses hl-todo - holy-mode htmlize hungry-delete hybrid-mode importmagic indent-guide - info+ insert-shebang inspector js-doc js2-mode js2-refactor json-mode - json-navigator json-reformat json-snatcher ligature link-hint - live-py-mode livid-mode llm load-env-vars log4e lorem-ipsum lsp-docker - lsp-latex lsp-mode lsp-origami lsp-pyright lsp-tailwindcss lsp-treemacs - lsp-ui macrostep magit magit-section markdown-mode markdown-toc - math-symbol-lists multi multi-line multi-term multi-vterm - multiple-cursors nameless names nerd-icons nix-mode nix-ts-mode - nixos-options nodejs-repl npm-mode nyan-mode ob-typescript open-junk-file - org org-category-capture org-cliplink org-contrib org-download org-mime - org-pomodoro org-present org-project-capture org-projectile org-rich-yank - org-roam org-roam-ui org-superstar orgit orgit-forge origami overseer - pangu-spacing paradox password-generator pcache pcre2el persistent-soft - pinyinlib pip-requirements pipenv pippel plz plz-event-source - plz-media-type poetry pomm popper popwin pos-tip prettier-js py-isort - pydoc pyenv-mode pyim pyim-basedict pylookup pytest pythonic pyvenv - quickrun rainbow-delimiters rainbow-identifiers rainbow-mode reformatter - request restart-emacs shell-pop shfmt shrink-path simple-httpd - skewer-mode smeargle sops space-doc spaceline spacemacs-purpose-popwin - spacemacs-whitespace-cleanup sphinx-doc spotify sqlite3 - string-edit-at-point string-inflection symbol-overlay symon term-cursor - terminal-here toc-org toml-mode transient treemacs-all-the-icons - treemacs-evil treemacs-icons-dired treemacs-magit treemacs-persp - treemacs-projectile treepy typescript-mode ucs-utils undo-fu - undo-fu-session unicode-fonts uuidgen valign vi-tilde-fringe - vim-powerline vmd-mode volatile-highlights vterm vundo web-beautify - web-mode websocket which-key winum with-editor writeroom-mode ws-butler - xkcd xr xref yaml yaml-mode yapfify yasnippet yasnippet-snippets - youdao-dictionary))) + '(svg-tag-mode svg-lib drupal-mode php-auto-yasnippets php-mode phpunit a ace-jump-helm-line ace-link ace-pinyin add-node-modules-path aggressive-indent aio alert all-the-icons anaconda-mode auctex auto-compile auto-dictionary auto-highlight-symbol auto-yasnippet blacken browse-at-remote bui catppuccin-theme centered-cursor-mode chinese-conv chinese-word-at-point clean-aindent-mode closql code-cells code-review color-identifiers-mode column-enforce-mode company company-anaconda company-auctex company-emoji company-math company-nixos-options company-reftex company-shell concurrent consult ctable cython-mode dap-mode deferred define-word devdocs diff-hl diminish dired-quick-sort disable-mouse docker dockerfile-mode doom-modeline doom-themes dotenv-mode drag-stuff dumb-jump eat editorconfig elisp-def elisp-demos elisp-slime-nav ellama emacsql emoji-cheat-sheet-plus emojify emr epc esh-help eshell-prompt-extras eshell-z eval-sexp-fu evil-anzu evil-args evil-cleverparens evil-collection evil-easymotion evil-escape evil-evilified-state evil-exchange evil-goggles evil-iedit-state evil-indent-plus evil-lion evil-lisp-state evil-matchit evil-mc evil-nerd-commenter evil-numbers evil-org evil-surround evil-tex evil-textobj-line evil-tutor evil-unimpaired evil-visual-mark-mode evil-visualstar exec-path-from-shell expand-region eyebrowse fancy-battery fcitx fic-mode find-by-pinyin-dired fish-mode flx-ido flycheck-bashate flycheck-elsa flycheck-package flycheck-pos-tip flyspell-correct flyspell-correct-helm flyspell-popup font-utils forge gh-md ghub git-link git-messenger git-modes git-timemachine gitignore-templates gntp gnuplot golden-ratio google-translate gptel helm-ag helm-c-yasnippet helm-comint helm-company helm-descbinds helm-git-grep helm-ls-git helm-lsp helm-make helm-mode-manager helm-mu helm-nixos-options helm-org helm-org-rifle helm-projectile helm-purpose helm-pydoc helm-spotify-plus helm-swoop helm-themes helm-xref hide-comnt highlight-indentation highlight-numbers highlight-parentheses hl-todo holy-mode htmlize hungry-delete hybrid-mode importmagic indent-guide info+ insert-shebang inspector js-doc js2-mode js2-refactor json-mode json-navigator json-reformat json-snatcher ligature link-hint live-py-mode livid-mode llm load-env-vars log4e lorem-ipsum lsp-docker lsp-latex lsp-mode lsp-origami lsp-pyright lsp-tailwindcss lsp-treemacs lsp-ui macrostep magit magit-section markdown-mode markdown-toc math-symbol-lists multi multi-line multi-term multi-vterm multiple-cursors nameless names nerd-icons nix-mode nix-ts-mode nixos-options nodejs-repl npm-mode nyan-mode ob-typescript open-junk-file org org-category-capture org-cliplink org-contrib org-download org-mime org-pomodoro org-present org-project-capture org-projectile org-rich-yank org-roam org-roam-ui org-superstar orgit orgit-forge origami overseer pangu-spacing paradox password-generator pcache pcre2el persistent-soft pinyinlib pip-requirements pipenv pippel plz plz-event-source plz-media-type poetry pomm popper popwin pos-tip prettier-js py-isort pydoc pyenv-mode pyim pyim-basedict pylookup pytest pythonic pyvenv quickrun rainbow-delimiters rainbow-identifiers rainbow-mode reformatter request restart-emacs shell-pop shfmt shrink-path simple-httpd skewer-mode smeargle sops space-doc spaceline spacemacs-purpose-popwin spacemacs-whitespace-cleanup sphinx-doc spotify sqlite3 string-edit-at-point string-inflection symbol-overlay symon term-cursor terminal-here toc-org toml-mode transient treemacs-all-the-icons treemacs-evil treemacs-icons-dired treemacs-magit treemacs-persp treemacs-projectile treepy typescript-mode ucs-utils undo-fu undo-fu-session unicode-fonts uuidgen valign vi-tilde-fringe vim-powerline vmd-mode volatile-highlights vterm vundo web-beautify web-mode websocket which-key winum with-editor writeroom-mode ws-butler xkcd xr xref yaml yaml-mode yapfify yasnippet yasnippet-snippets youdao-dictionary))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. From ede2495bf76b3a125079391234c79b1761af684a Mon Sep 17 00:00:00 2001 From: vancycles-knak Date: Tue, 17 Jun 2025 16:14:51 -0700 Subject: [PATCH 4/6] some tinkering --- nix-darwin/users/henri/home.nix | 5 ++++ nix-learning/macos/.sops.yaml | 10 ++++++++ nix-learning/macos/flake.nix | 24 ++++++++++-------- nix-learning/macos/secrets/secrets.yaml | 33 +++++++++++++++++++++++++ nix-learning/macos/shell.nix | 4 +-- nix-learning/macos/sops.nix | 27 ++++++++++++++++++++ 6 files changed, 91 insertions(+), 12 deletions(-) create mode 100644 nix-learning/macos/.sops.yaml create mode 100644 nix-learning/macos/secrets/secrets.yaml create mode 100644 nix-learning/macos/sops.nix diff --git a/nix-darwin/users/henri/home.nix b/nix-darwin/users/henri/home.nix index bad15c92..7efec20e 100644 --- a/nix-darwin/users/henri/home.nix +++ b/nix-darwin/users/henri/home.nix @@ -52,6 +52,11 @@ hostname = "192.168.4.129"; user = "henri"; }; + macos = { + # ssh macos + hostname = "192.168.4.245"; + user = "macos"; + }; factorio = { # ssh factorio hostname = "192.168.4.129"; diff --git a/nix-learning/macos/.sops.yaml b/nix-learning/macos/.sops.yaml new file mode 100644 index 00000000..4414a822 --- /dev/null +++ b/nix-learning/macos/.sops.yaml @@ -0,0 +1,10 @@ +# careful when changing keys +keys: + - &primary age1df2u7xvze6rq5utz74ckx059wr3z97j484wc04063437h6hn4v6s9auec3 + - &work age17jgvjp9u4wa6799e3utfqxfrq9mgkfhxxed02cpp642tm6cna9gqg4yafw +creation_rules: + - path_regex: secrets/.*\.yaml$ + key_groups: + - age: + - *primary + - *work diff --git a/nix-learning/macos/flake.nix b/nix-learning/macos/flake.nix index 520ee536..d2f548d3 100644 --- a/nix-learning/macos/flake.nix +++ b/nix-learning/macos/flake.nix @@ -10,6 +10,11 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + # my own packages + # nix-scripts = { + # url = "github:Vanderscycle/nixScripts"; + # inputs.nixpkgs.follows = "nixpkgs"; + # }; }; outputs = @@ -17,10 +22,12 @@ self, nix-darwin, nixpkgs, + # nix-scripts, home-manager, }: let - system = "x86_64-darwin"; + # system = "x86_64-darwin"; + system = "aarch64-darwin"; pkgs = import nixpkgs { system = system; config.allowUnfree = true; @@ -74,19 +81,16 @@ # nix develop .#anotherEnv anotherEnv = pkgs.mkShell { name = "localhost-shell"; - # desired packages + # desired packages, notice how lolcat/neofetch isn't present nativeBuildInputs = with pkgs; [ - kubernetes + sl ]; shellHook = '' - ${pkgs.neofetch}/bin/neofetch - echo -e "localhost shell activated" | ${pkgs.lolcat}/bin/lolcat - echo "Available commands:" - echo " setup_cluster - Create local Kubernetes cluster" - echo " generate_secrets - Generate Kubernetes secrets" - echo " deploy_tilt - Start Tilt development environment" - echo " all - Run all previous commands" + ${pkgs.neofetch}/bin/neofetch + echo -e "localhost shell activated" | ${pkgs.lolcat}/bin/lolcat + echo "Available commands:" + echo "sl - choo choo" ''; }; }; diff --git a/nix-learning/macos/secrets/secrets.yaml b/nix-learning/macos/secrets/secrets.yaml new file mode 100644 index 00000000..288f5d70 --- /dev/null +++ b/nix-learning/macos/secrets/secrets.yaml @@ -0,0 +1,33 @@ +hello: ENC[AES256_GCM,data:gPlJB/trn0w3Gzyo+AZp8JWM04qtgrYBfqtNh5jzQ4wjXo5QvmamjYhsSrs5sQ==,iv:cGGrUyNoElsOsfTICFTYOYXXRYRDnZ4YuuBh5/Yqn9s=,tag:bx9tX/aEnATYdDQmbiYUQg==,type:str] +example_key: ENC[AES256_GCM,data:eSeGtuLslX2Yaf8LkA==,iv:PPfZK/VfmnBZY3jzD+NyZCD8h70IWfx0Q8fad6uac8Q=,tag:VpbtRFuZI1SDa4NMRjHhAQ==,type:str] +example_array: + - ENC[AES256_GCM,data:3/Bs4xOHL4PTDXEu57I=,iv:p7Cke4Jxu4HyUmssuSLPq91rke44KxCr99YLgEMTzqQ=,tag:KSp5hU2LvK5yx02mlXp6eA==,type:str] + - ENC[AES256_GCM,data:XqGo6yXzqR/lj6vKR00=,iv:qtjX3tmDLdJRNVuzzQ1RXdYOC3R1gShhzPhQLFYJ1/k=,tag:E+cMYyGiwevcEHrdtPOtfQ==,type:str] +example_number: ENC[AES256_GCM,data:xACsiokhrc/aIw==,iv:+mZeAPMpwx62gK7XhAH288tlQFAxNF3xV+PO04po2a0=,tag:eH9wiKytoORvZBOOri6NRQ==,type:float] +example_booleans: + - ENC[AES256_GCM,data:KjSuFg==,iv:U8zI1hrKUe3SYuBlvwrYIMnrDFAy6KmkwPmmSMQuQvY=,tag:8WF3twFWFjrOkMoWRQvtXw==,type:bool] + - ENC[AES256_GCM,data:zAP8JBM=,iv:kpggIsMk5FvylM37DNKmBTRZwqXZMSUfQ29Rky91DgM=,tag:RJ4U5aheSa/qY/9Qd2CQ2g==,type:bool] +sops: + age: + - recipient: age1df2u7xvze6rq5utz74ckx059wr3z97j484wc04063437h6hn4v6s9auec3 + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAwSHhFZGlTVjlOU0ZNOVZw + Z0h2ZXJhMzBHdU11Tzl0QjZ3U2JMaWc4RUZzCld2NHFRZmtoaTQ4K0VhcVFqaFBJ + YWtYcDhaTUQ4WlN3ZCtRUStIYnNwVmsKLS0tIGF3ZmliL2s1ODI2WWlVZENnV0lp + RmZMUTZLTDRVaE4rWEpFK1Z3cGYyTm8KnAMDNdONcndCMh5PqRdzzFX2CbblV1Q2 + qfgN5gTDxgj9vjtFQRyg6F74xt8Aiu5/iqGiUPtPrHly30Cgpq3HlQ== + -----END AGE ENCRYPTED FILE----- + - recipient: age17jgvjp9u4wa6799e3utfqxfrq9mgkfhxxed02cpp642tm6cna9gqg4yafw + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBlaTlybnpvTkZIUmtPNjFT + ZmRnelZaSUIybDVKK3FCM3J3aC84dHAxRkFNClpGNitZUXRCNnhjTlhGM041TWpS + VDVBRlpjdnoxQ0xVS2hmaklFcjcyRXcKLS0tIC80c2xweFZmUER3elRrVC9ZZU1I + OXFWRTl3V1pjZHQ5a0RSRVFmRkU4dXMKe2yEU40PwfTz9TtQBpc+miTSBWKJrrIc + opE96yKGSraZYRFpiqA5abLJD/sXlAsM0ycTAZ/x3DFSkhXlz17dhg== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2025-06-17T22:58:29Z" + mac: ENC[AES256_GCM,data:+bUErZGcusObTmKaY6p+1gY5txslQqKb/f5zkPcoRfgl+VDF+XYtMJaGnX/W1E7/5B8DNL7r4NZyYUrko6mrV9+oGsgQRCPQM8fZVQRTnjLo4qa7vWZrOq3s5OHO4Csi18tVhEPX1d+geTHcgjgIy+b1xFbBgDPd+YnQ/w0/PVg=,iv:ODXQ3gYbgOOpEFVZY1kOTz0Vq9vhK3ohuwI+84ycedc=,tag:feuBJXNEX0gq5gInH1oxgg==,type:str] + unencrypted_suffix: _unencrypted + version: 3.10.2 diff --git a/nix-learning/macos/shell.nix b/nix-learning/macos/shell.nix index 9986b995..5c0435af 100644 --- a/nix-learning/macos/shell.nix +++ b/nix-learning/macos/shell.nix @@ -1,5 +1,4 @@ { - inputs, pkgs ? import { }, ... }: @@ -7,11 +6,12 @@ pkgs.mkShell { name = "local dev shell"; # desired packages nativeBuildInputs = with pkgs; [ - nodejs_16 + nodejs_20 # a pain point would be finding nodejs_16/18 as they aren't in the nixos packages list ]; shellHook = '' ${pkgs.neofetch}/bin/neofetch echo -e "You are now in a dev shell in $(pwd)" | ${pkgs.lolcat}/bin/lolcat + node -v ''; } diff --git a/nix-learning/macos/sops.nix b/nix-learning/macos/sops.nix new file mode 100644 index 00000000..7eebc1fe --- /dev/null +++ b/nix-learning/macos/sops.nix @@ -0,0 +1,27 @@ +{ + pkgs, + inputs, + config, + ... +}: +{ + imports = [ + inputs.sops-nix.nixosModules.sops + ]; + + environment.systemPackages = with pkgs; [ + sops + ]; + + sops = { + defaultSopsFile = ./secrets/secrets.yaml; + defaultSopsFormat = "yaml"; + + age.keyFile = "/home/${meta.username}/.config/sops/age/keys.txt"; + secrets = { + "nextcloud/admin/password" = { + owner = "root"; + }; + }; + }; +} From 877ca81dc378e91e3e26bf253711c64e5c7480d7 Mon Sep 17 00:00:00 2001 From: vancycles-knak Date: Tue, 17 Jun 2025 16:15:12 -0700 Subject: [PATCH 5/6] udpated emacs --- .config/spacemacs/.spacemacs | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/.config/spacemacs/.spacemacs b/.config/spacemacs/.spacemacs index 409c4785..485a2949 100644 --- a/.config/spacemacs/.spacemacs +++ b/.config/spacemacs/.spacemacs @@ -1018,11 +1018,35 @@ _p_rev _u_pper _=_: upper/lower _r_esolve ;; --- perspective --- (spacemacs/set-leader-keys "olk" 'spacemacs/helm-persp-kill) ;; --- tramp/ssh --- - ;; --- make it a hydra to select which one to connect to - (defun connect-factorio () + (defun connect-monolith () "Open a remote folder using TRAMP in Dired." (interactive) (dired "/ssh:monolith@192.168.4.129:/")) + + (defun connect-macos() + "Open a remote folder using TRAMP in Dired." + (interactive) + (dired "/ssh:macos@192.168.4.245:/")) + + (defun connect-pi () + "Open a remote folder using TRAMP in Dired." + (interactive) + (dired "/ssh:admin@192.168.1.100:/")) + + (defhydra hydra/diredssh (:hint nil :color blue) + " +SSH Connections +-------------------------- +_f_: factorio/monolith +_p_: Pi +_m_: Macos +_q_: Cancel +" + ("f" connect-factorio :color yellow) + ("p" connect-pi :color yellow) + ("m" connect-macos :color yellow) + ("q" nil "cancel" :color blue)) + (spacemacs/set-leader-keys "ods" 'hydra/diredssh/body) ;; --- sops -- ;; https://github.com/djgoku/sops (which-key-add-key-based-replacements "os" "+sops") @@ -1030,6 +1054,12 @@ _p_rev _u_pper _=_: upper/lower _r_esolve (spacemacs/set-leader-keys "oss" 'sops-save-file) (spacemacs/set-leader-keys "osc" 'sops-cancel) (global-sops-mode 1) + ;; --- which-key -- + (which-key-add-key-based-replacements + "SPC o a" "git" + "SPC o s" "sops" + "SPC o d" "dired" + "SPC o l" "persp") ;; --- treemacs --- (custom-set-faces '(treemacs-hl-line-face ((t (:background "#e64553"))))) From 7af00ed7f2a061171b9f459b9119b5928b4e8268 Mon Sep 17 00:00:00 2001 From: vancycles-knak Date: Thu, 19 Jun 2025 13:17:57 -0700 Subject: [PATCH 6/6] udpate --- .config/spacemacs/.spacemacs | 30 ++- nix-darwin/containers/default.nix | 1 + nix-darwin/containers/nginx.nix | 42 +++++ nix-darwin/flakes/monolith/configuration.nix | 85 ++++++++- nix-darwin/flakes/monolith/fstab.nix | 13 ++ .../home-modules/programs/spacemacs.nix | 1 + nix-learning/README.org | 71 ++----- nix-learning/macos/flake.lock | 175 +++++++++++++++++- nix-learning/macos/flake.nix | 20 +- nix-learning/macos/home.nix | 4 +- nix-learning/macos/programs/default.nix | 1 + nix-learning/macos/programs/matrix.nix | 21 +++ nix-learning/macos/secrets/secrets.yaml | 38 ++-- nix-learning/macos/shell.nix | 1 + nix-learning/macos/sops.nix | 10 +- 15 files changed, 419 insertions(+), 94 deletions(-) create mode 100644 nix-darwin/containers/nginx.nix create mode 100644 nix-learning/macos/programs/matrix.nix diff --git a/.config/spacemacs/.spacemacs b/.config/spacemacs/.spacemacs index 485a2949..9a98440a 100644 --- a/.config/spacemacs/.spacemacs +++ b/.config/spacemacs/.spacemacs @@ -1033,18 +1033,36 @@ _p_rev _u_pper _=_: upper/lower _r_esolve (interactive) (dired "/ssh:admin@192.168.1.100:/")) + (defun connect-kube-node1 () + "Open a remote folder using TRAMP in Dired." + (interactive) + (dired "/ssh:proxmox@192.168.2.10:/")) + + (defun connect-kube-node2 () + "Open a remote folder using TRAMP in Dired." + (interactive) + (dired "/ssh:proxmox@192.168.2.12:/")) + + (defun connect-kube-node3 () + "Open a remote folder using TRAMP in Dired." + (interactive) + (dired "/ssh:proxmox@192.168.2.13:/")) + (defhydra hydra/diredssh (:hint nil :color blue) " -SSH Connections --------------------------- -_f_: factorio/monolith -_p_: Pi -_m_: Macos +SSH Connections Kubernetes Nodes +-------------------------- -------------------------- +_f_: factorio/monolith _1_: kube-node1 +_p_: Pi _2_: kube-node2 +_m_: Macos _3_: kube-node3 _q_: Cancel " - ("f" connect-factorio :color yellow) + ("f" connect-monolith :color yellow) ("p" connect-pi :color yellow) ("m" connect-macos :color yellow) + ("1" connect-kube-node1 :color yellow) + ("2" connect-kube-node2 :color yellow) + ("3" connect-kube-node3 :color yellow) ("q" nil "cancel" :color blue)) (spacemacs/set-leader-keys "ods" 'hydra/diredssh/body) ;; --- sops -- diff --git a/nix-darwin/containers/default.nix b/nix-darwin/containers/default.nix index 575d92e5..0c28afcb 100644 --- a/nix-darwin/containers/default.nix +++ b/nix-darwin/containers/default.nix @@ -1,6 +1,7 @@ { imports = [ ./n8n.nix + ./nginx.nix ./postgres.nix ./protonmail-bridge.nix ./redis.nix diff --git a/nix-darwin/containers/nginx.nix b/nix-darwin/containers/nginx.nix new file mode 100644 index 00000000..656288be --- /dev/null +++ b/nix-darwin/containers/nginx.nix @@ -0,0 +1,42 @@ +{ lib, config, ... }: + +let + cfg = config.container.nginx; +in +{ + options = { + container.nginx = { + enable = lib.mkEnableOption "nginx container"; + name = lib.mkOption { + type = lib.types.str; + default = "nginx"; + }; + mountPoint = lib.mkOption { + type = lib.types.str; + default = "/tmp/nginx"; + }; + ports = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ "8080:80" ]; + }; + }; + }; + + config = lib.mkIf cfg.enable { + virtualisation = { + oci-containers = { + backend = "docker"; + containers = { + nginx = { + image = "nginx:latest"; + volumes = [ + "${cfg.mountPoint}/html:/usr/share/nginx/html" + "${cfg.mountPoint}/conf:/etc/nginx/conf.d" + ]; + ports = cfg.ports; + }; + }; + }; + }; + }; +} diff --git a/nix-darwin/flakes/monolith/configuration.nix b/nix-darwin/flakes/monolith/configuration.nix index e0254dd3..768ebf13 100644 --- a/nix-darwin/flakes/monolith/configuration.nix +++ b/nix-darwin/flakes/monolith/configuration.nix @@ -61,6 +61,10 @@ isNormalUser = false; extraGroups = [ "smbaccess" ]; }; + users.users.paperless = { + isNormalUser = false; + extraGroups = [ "smbaccess" ]; + }; users.users.${meta.username} = { isNormalUser = true; extraGroups = [ @@ -250,6 +254,26 @@ entryPoints = [ "web" ]; middlewares = [ "strip-nextcloud-prefix" ]; }; + + paperless-router = { + rule = "PathPrefix(`/paperless`)"; + service = "paperless-service"; + entryPoints = [ "web" ]; + middlewares = [ "strip-paperless-prefix" ]; + }; + + transmission-router = { + rule = "PathPrefix(`/transmission`)"; + service = "transmission-service"; + entryPoints = [ "web" ]; + middlewares = [ "strip-transmission-prefix" ]; + }; + homepage-router = { + rule = "PathPrefix(`/homepage`)"; + service = "homepage-service"; + entryPoints = [ "web" ]; + middlewares = [ "strip-homepage-prefix" ]; + }; }; services = { @@ -276,6 +300,24 @@ { url = "http://0.0.0.0:9999"; } ]; }; + + paperless-service = { + loadBalancer.servers = [ + { url = "http://0.0.0.0:28981"; } + ]; + }; + + transmission-service = { + loadBalancer.servers = [ + { url = "http://0.0.0.0:9091"; } + ]; + }; + + homepage-service = { + loadBalancer.servers = [ + { url = "http://0.0.0.0:8082"; } + ]; + }; }; middlewares = { strip-n8n-prefix = { @@ -293,6 +335,19 @@ strip-nextcloud-prefix = { stripPrefix.prefixes = [ "/nextcloud" ]; }; + + strip-paperless-prefix = { + stripPrefix.prefixes = [ "/paperless" ]; + }; + + strip-transmission-prefix = { + stripPrefix.prefixes = [ "/torrent" ]; + }; + + # not working + strip-homepage-prefix = { + stripPrefix.prefixes = [ "/homepage" ]; + }; }; }; }; @@ -305,8 +360,6 @@ enable = true; openFirewall = true; settings = { - # N8N_LISTEN_ADDRESS= "0.0.0.0"; - # N8N_SECURE_COOKIE = false; }; }; #INFO: a way to set env vars for services @@ -356,13 +409,37 @@ }; services.paperless = { enable = true; + port = 28981; + address = "0.0.0.0"; + settings = { + # https://docs.paperless-ngx.com/configuration/ + PAPERLESS_FORCE_SCRIPT_NAME = "/paperless"; + PAPERLESS_STATIC_URL = "/paperless"; + PAPERLESS_CONSUMPTION_DIR = "/mnt/rice/paperless/consume"; + PAPERLESS_DATA_DIR = "/mnt/rice/paperless/data"; + PAPERLESS_MEDIA_ROOT = "/mnt/rice/paperless/media"; + PAPERLESS_STATICDIR = "/mnt/rice/paperless/static"; + # PAPERLESS_ADMIN_USER= + # PAPERLESS_ADMIN_MAIL= + # PAPERLESS_ADMIN_PASSWORD= + }; + }; + services.homepage-dashboard = { + enable = true; + listenPort = 8082; + openFirewall = true; + settings = { + "base" = "http://0.0.0.0/homepage"; + }; }; - services.transmission = { enable = true; openFirewall = true; + openPeerPorts = true; settings = { - "download-dir" = "/mnt/rice/famjam/transmission"; + download-dir = "/mnt/rice/transmission"; + rpc-port = 9091; + rpc-url = "/torrent/"; }; }; diff --git a/nix-darwin/flakes/monolith/fstab.nix b/nix-darwin/flakes/monolith/fstab.nix index 36f45c63..cdbf6398 100644 --- a/nix-darwin/flakes/monolith/fstab.nix +++ b/nix-darwin/flakes/monolith/fstab.nix @@ -14,6 +14,19 @@ "defaults" ]; }; + fileSystems."/mnt/rice/paperless" = { + device = "//192.168.4.223/rice/paperless"; + fsType = "cifs"; + options = [ + "credentials=/root/smbcreds_fam" + "dir_mode=0770" + "file_mode=0770" + "uid=paperless" # Set paperless as the owner + "gid=smbaccess" + "rw" + "nofail" # Don't fail boot if mount fails + ]; + }; # create user for read only/ # for nextcloud (and folder specific) } diff --git a/nix-darwin/home-modules/programs/spacemacs.nix b/nix-darwin/home-modules/programs/spacemacs.nix index b9986cbd..fddf59b1 100644 --- a/nix-darwin/home-modules/programs/spacemacs.nix +++ b/nix-darwin/home-modules/programs/spacemacs.nix @@ -33,6 +33,7 @@ ispell proton-pass protonmail-bridge # for email + devcontainer ]; }; diff --git a/nix-learning/README.org b/nix-learning/README.org index 3d5712a6..96e56225 100644 --- a/nix-learning/README.org +++ b/nix-learning/README.org @@ -23,7 +23,6 @@ From that point on, nix is on your system and you can already use it (if you ope nix shell nixpkgs#cowsay #+end_src - ***** Configuring system We will be using flakes as they are the nix equivalent of a ~Dockerfile~ and can provide multiple outputs. @@ -55,71 +54,41 @@ nix run nix-darwin -- switch --flake . darwin-rebuild switch --flake . # --dry-run #+end_src +One more quick demo of the on the fly pattern +#+begin_src zsh +nix shell nixpkgs#fzf nixpkgs#neovim +nvim "$(fzf)" +#+end_src + +You can use nix like a devcontainer +#+begin_src zsh +nix develop +nix develop .#anotherEnv +#+end_src + To rollback #+begin_src zsh nix profile history --profile /nix/var/nix/profiles/system # or - darwin-rebuild switch --list-generations # to undo latest darwin-rebuild switch --rollback # or revert to a specific version darwin-rebuild switch --switch-generation 1 #+end_src -***** Video references -[[https://www.youtube.com/watch?v=Z8BL8mdzWHI][Nix is my favorite package manager to use on macOS - YouTube]] -[[https://www.youtube.com/watch?v=iU7B76NTr2I][Nix Darwin Turned My Mac into a Fully Automated Machine - YouTube]] + ***** Update #+begin_src bash nix flake update #+end_src -**** Linux (non-NixOS) -Very similar to Macos except the template is different -#+begin_src zsh -curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | \ - sh -s -- install --determinate -#+end_src - -#+begin_src zsh -nix flake init # creates a basic flake (hello world) -#+end_src - - -***** Configuring system -We can only use home-manager to configure our computer. To do so we can must install it. -[[https://nix-community.github.io/home-manager/#sec-install-standalone][Home Manager Manual]] - -If the nix bug infected you, I can only recommend that you move to Nix-OS - -That being said we will be using the following flake [[file:rocky-linux/flake.nix][rocky-nix flake]] - -In the aforementioned file we will -#+begin_src zsh -sudo nix run .#create-user-script -sudo passwd rocky # Set password interactively -home-manager switch --flake .#rocky -#+end_src - -***** Demo - - #+begin_src zsh - ssh rocky@192.168.4.245 - # ensure that it has rsync on the machine - rsync -avz ~/Documents/dotFiles/nix-learning/rocky-linux/ rocky@192.168.4.215:~/Documents/ +*** limitation +- not able to declare containers using ~virtualisation~ like nixos +- not all packages are compatibles with x86_64-darwin or aarch_64-darwin +- no systemd which is a big bummer - # applying the config - home-manager switch --flake .#rocky - - # rollback - home-manager generations # list all generations - # I actually don't know how to do this - #+end_src - -One more quick demo of the on the fly pattern -#+begin_src zsh -nix shell nixpkgs#fzf nixpkgs#neovim -nvim "$(fzf)" -#+end_src +**** Video references +[[https://www.youtube.com/watch?v=Z8BL8mdzWHI][Nix is my favorite package manager to use on macOS - YouTube]] +[[https://www.youtube.com/watch?v=iU7B76NTr2I][Nix Darwin Turned My Mac into a Fully Automated Machine - YouTube]] *** Searching/using packages Nixos has an extensive package manager repository diff --git a/nix-learning/macos/flake.lock b/nix-learning/macos/flake.lock index e0451dc9..9fa3dbf9 100644 --- a/nix-learning/macos/flake.lock +++ b/nix-learning/macos/flake.lock @@ -1,5 +1,86 @@ { "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nix-scripts", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gomod2nix": { + "inputs": { + "flake-utils": [ + "nix-scripts", + "flake-utils" + ], + "nixpkgs": [ + "nix-scripts", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717050755, + "narHash": "sha256-C9IEHABulv2zEDFA+Bf0E1nmfN4y6MIUe5eM2RCrDC0=", + "owner": "nix-community", + "repo": "gomod2nix", + "rev": "31b6d2e40b36456e792cd6cf50d5a8ddd2fa59a1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "gomod2nix", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -41,7 +122,62 @@ "type": "github" } }, + "nix-scripts": { + "inputs": { + "flake-utils": "flake-utils", + "gomod2nix": "gomod2nix", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1750268646, + "narHash": "sha256-NQmEc07EQHDeEls22GKamEDHMPUNUzx+E8M18N9/DbQ=", + "owner": "vancycles-knak", + "repo": "nixScripts", + "rev": "5f7e4973caad7d38bbea2df9e2ca949b9895c77c", + "type": "github" + }, + "original": { + "owner": "vancycles-knak", + "repo": "nixScripts", + "type": "github" + } + }, "nixpkgs": { + "locked": { + "lastModified": 1719082008, + "narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9693852a2070b398ee123a329e68f0dab5526681", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1720386169, + "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1747467164, "narHash": "sha256-JBXbjJ0t6T6BbVc9iPVquQI9XSXCGQJD8c8SgnUquus=", @@ -57,11 +193,48 @@ "type": "github" } }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1720524665, + "narHash": "sha256-ni/87oHPZm6Gv0ECYxr1f6uxB0UKBWJ6HvS7lwLU6oY=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "8d6a17d0cdf411c55f12602624df6368ad86fac1", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "home-manager": "home-manager", "nix-darwin": "nix-darwin", - "nixpkgs": "nixpkgs" + "nix-scripts": "nix-scripts", + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/nix-learning/macos/flake.nix b/nix-learning/macos/flake.nix index d2f548d3..ff74025e 100644 --- a/nix-learning/macos/flake.nix +++ b/nix-learning/macos/flake.nix @@ -3,18 +3,21 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - nix-darwin.url = "github:nix-darwin/nix-darwin/master"; - nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; + nix-darwin = { + url = "github:nix-darwin/nix-darwin/master"; + inputs.nixpkgs.follows = "nixpkgs"; + }; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + # my own packages - # nix-scripts = { - # url = "github:Vanderscycle/nixScripts"; - # inputs.nixpkgs.follows = "nixpkgs"; - # }; + nix-scripts = { + url = "github:vancycles-knak/nixScripts"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = @@ -22,7 +25,7 @@ self, nix-darwin, nixpkgs, - # nix-scripts, + nix-scripts, home-manager, }: let @@ -78,12 +81,14 @@ inherit inputs; } ); + # nix develop .#anotherEnv anotherEnv = pkgs.mkShell { name = "localhost-shell"; # desired packages, notice how lolcat/neofetch isn't present nativeBuildInputs = with pkgs; [ sl + nix-scripts.packages.${system}.output2 ]; shellHook = '' @@ -91,6 +96,7 @@ echo -e "localhost shell activated" | ${pkgs.lolcat}/bin/lolcat echo "Available commands:" echo "sl - choo choo" + echo "myscript2 - a small bash script packaged with nix" ''; }; }; diff --git a/nix-learning/macos/home.nix b/nix-learning/macos/home.nix index 5a38f6d9..fee58d94 100644 --- a/nix-learning/macos/home.nix +++ b/nix-learning/macos/home.nix @@ -9,18 +9,20 @@ ./kitty.nix # you can separate your programs in separate folders ./programs + ]; # INFO: how to structure your code # https://www.youtube.com/watch?v=vYc6IzKvAJQ cowsay.enable = false; + home = { username = username; homeDirectory = "/Users/${username}"; stateVersion = "25.05"; # Please read the comment before changing. packages = with pkgs; [ - # cowsay + asciiquarium ]; file = { }; diff --git a/nix-learning/macos/programs/default.nix b/nix-learning/macos/programs/default.nix index 765eda98..a046309e 100644 --- a/nix-learning/macos/programs/default.nix +++ b/nix-learning/macos/programs/default.nix @@ -2,5 +2,6 @@ # INFO: think of default.nix as index.ts imports = [ ./cowsay.nix + ./matrix.nix ]; } diff --git a/nix-learning/macos/programs/matrix.nix b/nix-learning/macos/programs/matrix.nix new file mode 100644 index 00000000..c2ad87d9 --- /dev/null +++ b/nix-learning/macos/programs/matrix.nix @@ -0,0 +1,21 @@ +{ + pkgs, + lib, + config, + ... +}: +{ + options = { + steam-loco.enable = lib.mkOption { + type = lib.types.bool; + description = "welcome neo"; + default = false; + }; + }; + + config = lib.mkIf config.steam-loco.enable { + home.packages = with pkgs; [ + sl + ]; + }; +} diff --git a/nix-learning/macos/secrets/secrets.yaml b/nix-learning/macos/secrets/secrets.yaml index 288f5d70..5d11caf1 100644 --- a/nix-learning/macos/secrets/secrets.yaml +++ b/nix-learning/macos/secrets/secrets.yaml @@ -1,33 +1,29 @@ -hello: ENC[AES256_GCM,data:gPlJB/trn0w3Gzyo+AZp8JWM04qtgrYBfqtNh5jzQ4wjXo5QvmamjYhsSrs5sQ==,iv:cGGrUyNoElsOsfTICFTYOYXXRYRDnZ4YuuBh5/Yqn9s=,tag:bx9tX/aEnATYdDQmbiYUQg==,type:str] -example_key: ENC[AES256_GCM,data:eSeGtuLslX2Yaf8LkA==,iv:PPfZK/VfmnBZY3jzD+NyZCD8h70IWfx0Q8fad6uac8Q=,tag:VpbtRFuZI1SDa4NMRjHhAQ==,type:str] -example_array: - - ENC[AES256_GCM,data:3/Bs4xOHL4PTDXEu57I=,iv:p7Cke4Jxu4HyUmssuSLPq91rke44KxCr99YLgEMTzqQ=,tag:KSp5hU2LvK5yx02mlXp6eA==,type:str] - - ENC[AES256_GCM,data:XqGo6yXzqR/lj6vKR00=,iv:qtjX3tmDLdJRNVuzzQ1RXdYOC3R1gShhzPhQLFYJ1/k=,tag:E+cMYyGiwevcEHrdtPOtfQ==,type:str] -example_number: ENC[AES256_GCM,data:xACsiokhrc/aIw==,iv:+mZeAPMpwx62gK7XhAH288tlQFAxNF3xV+PO04po2a0=,tag:eH9wiKytoORvZBOOri6NRQ==,type:float] -example_booleans: - - ENC[AES256_GCM,data:KjSuFg==,iv:U8zI1hrKUe3SYuBlvwrYIMnrDFAy6KmkwPmmSMQuQvY=,tag:8WF3twFWFjrOkMoWRQvtXw==,type:bool] - - ENC[AES256_GCM,data:zAP8JBM=,iv:kpggIsMk5FvylM37DNKmBTRZwqXZMSUfQ29Rky91DgM=,tag:RJ4U5aheSa/qY/9Qd2CQ2g==,type:bool] +hello: ENC[AES256_GCM,data:r+q8YYbJCIQu/i35ZRRCvgWygAk0I8VzhfOoQXfgRFPrkdehHgzv44F+e+QSzw==,iv:yXwaNkwBej2Jd7HovlJ86RlqPK2JQ566NVbUqe6FCdo=,tag:weCQhjdzOvxZhMIY0hk5/w==,type:str] +program1: + category1: + password: ENC[AES256_GCM,data:SqdEa/r95YH8VcJn,iv:5n9BZBf3yYa1sh/0vNPvH6pIU0aZTjF6QhlzNM5Y7eE=,tag:KPA/XcaWqKl+eb9BLT/zZQ==,type:str] + username: ENC[AES256_GCM,data:7q6rYgrB,iv:86sXDPtVoKDks08r0dYXpP57r5ITbg9dqtJaah7DzJc=,tag:dCxbYRgjqAJvUeLzrsSiOg==,type:str] sops: age: - recipient: age1df2u7xvze6rq5utz74ckx059wr3z97j484wc04063437h6hn4v6s9auec3 enc: | -----BEGIN AGE ENCRYPTED FILE----- - YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAwSHhFZGlTVjlOU0ZNOVZw - Z0h2ZXJhMzBHdU11Tzl0QjZ3U2JMaWc4RUZzCld2NHFRZmtoaTQ4K0VhcVFqaFBJ - YWtYcDhaTUQ4WlN3ZCtRUStIYnNwVmsKLS0tIGF3ZmliL2s1ODI2WWlVZENnV0lp - RmZMUTZLTDRVaE4rWEpFK1Z3cGYyTm8KnAMDNdONcndCMh5PqRdzzFX2CbblV1Q2 - qfgN5gTDxgj9vjtFQRyg6F74xt8Aiu5/iqGiUPtPrHly30Cgpq3HlQ== + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBpLzEvbisxd1IwRlBKMWlk + KzhNVDVRbWNpdHRqOHFiODdra0IvdS90VVFvCjdpZSsxaGNUT25aZUtpbWhwNDFF + bDYwMVpCZ0Y2anQ1RjFtd3AvSlNmOWsKLS0tIEFseExITkl2bEF5bUtIK00yMFZN + Mmdtb2t0d3pjeEJBUkpEOUkzZ29wREUKwZTP+GDr55VsvFaI8pFZE8LhF+u+tRRx + 6ds17CySHfR/z8mEFhvCFhlxCjAJDUtji/Y45+d3+blZGCSNSSWXjg== -----END AGE ENCRYPTED FILE----- - recipient: age17jgvjp9u4wa6799e3utfqxfrq9mgkfhxxed02cpp642tm6cna9gqg4yafw enc: | -----BEGIN AGE ENCRYPTED FILE----- - YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBlaTlybnpvTkZIUmtPNjFT - ZmRnelZaSUIybDVKK3FCM3J3aC84dHAxRkFNClpGNitZUXRCNnhjTlhGM041TWpS - VDVBRlpjdnoxQ0xVS2hmaklFcjcyRXcKLS0tIC80c2xweFZmUER3elRrVC9ZZU1I - OXFWRTl3V1pjZHQ5a0RSRVFmRkU4dXMKe2yEU40PwfTz9TtQBpc+miTSBWKJrrIc - opE96yKGSraZYRFpiqA5abLJD/sXlAsM0ycTAZ/x3DFSkhXlz17dhg== + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSArT0JvZ3ZOUndBaThoSGMv + TzJ0M1hRM01xdkkrMUU3MTNMdXdsb0Z2TUdnCm5tMEFScDRKcTh0NjlrTW9nZ1h1 + R3NUazVTTWNiS1RoOHo0a2J1c3hqQkUKLS0tIHJBVE5KYUZwanMrSC8xRDF4emVr + U1RzRHdHWGgyQ3FHK3VIemxzZmJhV2sKzlIW6ro6Vmzun8/L/RcWWycyTSSdNcug + DbGH/sLAf/TqJehzDNUdcljeOYLvh3e3h07yc3q8jFm71ZUxz5I8Hg== -----END AGE ENCRYPTED FILE----- - lastmodified: "2025-06-17T22:58:29Z" - mac: ENC[AES256_GCM,data:+bUErZGcusObTmKaY6p+1gY5txslQqKb/f5zkPcoRfgl+VDF+XYtMJaGnX/W1E7/5B8DNL7r4NZyYUrko6mrV9+oGsgQRCPQM8fZVQRTnjLo4qa7vWZrOq3s5OHO4Csi18tVhEPX1d+geTHcgjgIy+b1xFbBgDPd+YnQ/w0/PVg=,iv:ODXQ3gYbgOOpEFVZY1kOTz0Vq9vhK3ohuwI+84ycedc=,tag:feuBJXNEX0gq5gInH1oxgg==,type:str] + lastmodified: "2025-06-18T19:38:56Z" + mac: ENC[AES256_GCM,data:qbC9pXp6t91NtHnVMlJK8s9GOWD1zcVycWxxAxySijPSgzUyRE7M/2OSlBjZKDKDV89yCIcCae7MOhzMn34enUA1Ng1AVO7A6GqrFqIyRgOccmEVaJ/df6xrv9mEwucOkD+wppoIIEuNnDIZcCZt4jbrZKIQdtzRCG1pBJtUCds=,iv:agGXa5NnlYKNxeoy1s3+LQ7p2sTezZGklJ1aMFfua4c=,tag:OK+OUbjY/fZK7WERQkuFPQ==,type:str] unencrypted_suffix: _unencrypted version: 3.10.2 diff --git a/nix-learning/macos/shell.nix b/nix-learning/macos/shell.nix index 5c0435af..cc52aa24 100644 --- a/nix-learning/macos/shell.nix +++ b/nix-learning/macos/shell.nix @@ -12,6 +12,7 @@ pkgs.mkShell { shellHook = '' ${pkgs.neofetch}/bin/neofetch echo -e "You are now in a dev shell in $(pwd)" | ${pkgs.lolcat}/bin/lolcat + ${pkgs.figlet}/bin/figlet "node version:" node -v ''; } diff --git a/nix-learning/macos/sops.nix b/nix-learning/macos/sops.nix index 7eebc1fe..3a34b09c 100644 --- a/nix-learning/macos/sops.nix +++ b/nix-learning/macos/sops.nix @@ -2,6 +2,7 @@ pkgs, inputs, config, + username, ... }: { @@ -17,10 +18,13 @@ defaultSopsFile = ./secrets/secrets.yaml; defaultSopsFormat = "yaml"; - age.keyFile = "/home/${meta.username}/.config/sops/age/keys.txt"; + age.keyFile = "/home/${username}/.config/sops/age/keys.txt"; secrets = { - "nextcloud/admin/password" = { - owner = "root"; + "program1/category1/password" = { + owner = username; + }; + "program1/category1/username" = { + owner = username; }; }; };