commit 01b26805d59e3b481c8e54004c9b411e34386e44 Author: Niccolo Borgioli Date: Mon Mar 10 10:03:51 2025 +0100 clean repo diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1a512a4 --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +# export SOPS_AGE_KEY_FILE=${HOME}/.config/sops/age/keys.txt +export SOPS_AGE_KEY_FILE=$(pwd)/.keys.txt diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..45b5ca3 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +secrets/** filter=git-crypt diff=git-crypt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6d56ec7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.key* diff --git a/.sops.yaml b/.sops.yaml new file mode 100644 index 0000000..45ea201 --- /dev/null +++ b/.sops.yaml @@ -0,0 +1,4 @@ +creation_rules: + - path_regex: secrets/[^/]+\.(yaml|json|env|ini)$ + age: >- + age1fwwfdh3np846pcwlsre2d8py3a8z5gfltx3jcyghdfx9esn6a40sm60mdj diff --git a/README.md b/README.md new file mode 100644 index 0000000..b5b2f36 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# Dotfiles with Nix on macOS + +## Installation + +```bash +# Install nix [without the --determinate flag] +curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install + +# Install brew [for casks] +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + +# Get repo +git clone https://github.com/cupcakearmy/nix-macos ~/.config/nix-darwin + +# Installation +nix run nix-darwin -- switch --flake ~/.config/nix-darwin#mbp +``` + +## Crypt + +Files under `secrets` are encrypted using `git-crypt`. + +```bash +# Save the key, when the repo is unlocked +git-crypt export-key - | base64 > .key.b64 + +# Decode (Given the base64 key is written to .key.b64) +cat .key.b64 | base64 --decode > .key +git-crypt unlock .key +``` diff --git a/cask.nix b/cask.nix new file mode 100644 index 0000000..426ca10 --- /dev/null +++ b/cask.nix @@ -0,0 +1,40 @@ +[ + "knockknock" + "lulu" + "oversight" + + "aldente" + "alt-tab" + "keka" + "jordanbaird-ice" + "keycastr" + "raycast" + "ghostty" + "lihaoyun6/tap/quickrecorder" + + # Dev + "docker" + "sloth" + "vscodium" + "hoppscotch" + "utm" + "balenaetcher" + + # Apps + "figma" + "arc" + "firefox" + "bitwarden" + "spotify" + "vlc" + "slack" + "yubico-authenticator" + "suspicious-package" + "mediahuman-audio-converter" + "imageoptim" + "appcleaner" + "daisydisk" + "discord" + "signal" + "vlc" +] diff --git a/darwin.nix b/darwin.nix new file mode 100644 index 0000000..97ff748 --- /dev/null +++ b/darwin.nix @@ -0,0 +1,72 @@ +{ + pkgs, + host, + flake, + lib, + ... +}: +{ + nix.settings.experimental-features = "nix-command flakes"; + + # Set Git commit hash for darwin-version. + system.configurationRevision = flake.rev or flake.dirtyRev or null; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 5; + nixpkgs.hostPlatform = host.platform; + nixpkgs.config.allowUnfree = true; + + # Nix Darwin + # https://daiderd.com/nix-darwin/manual/index.html + + # Security + system.defaults.screensaver.askForPassword = true; + system.defaults.screensaver.askForPasswordDelay = 0; + system.defaults.loginwindow.GuestEnabled = false; + + # Dock + system.defaults.dock.autohide = true; + system.defaults.dock.orientation = "left"; + system.defaults.dock.show-recents = false; + system.defaults.dock.persistent-apps = [ + "/Applications/Arc.app" + "/Applications/Ghostty.app" + "/Applications/VSCodium.app" + "/Applications/Spotify.app" + "/System/Applications/System Settings.app" + ]; + system.defaults.dock.persistent-others = [ ]; + + # Input devices + system.keyboard.enableKeyMapping = true; + system.keyboard.remapCapsLockToEscape = true; + system.defaults.NSGlobalDomain.InitialKeyRepeat = 25; + system.defaults.NSGlobalDomain.KeyRepeat = 2; + system.defaults.NSGlobalDomain."com.apple.mouse.tapBehavior" = 1; + system.defaults.NSGlobalDomain."com.apple.trackpad.scaling" = 0.875; + system.defaults.trackpad.Dragging = true; + + # Finder + system.defaults.finder.AppleShowAllExtensions = true; + system.defaults.finder.ShowPathbar = true; + + # Other + system.startup.chime = false; + + users.users.${host.username} = { + home = "/Users/${host.username}"; + shell = pkgs.fish; + }; + programs.fish.enable = true; + + homebrew = { + enable = true; + casks = (import ./cask.nix) ++ (lib.attrByPath [ "extras" "casks" ] [ ] host); + taps = [ "lihaoyun6/tap" ]; + onActivation = { + autoUpdate = true; + cleanup = "zap"; + }; + }; +} diff --git a/files/ghostty/config b/files/ghostty/config new file mode 100644 index 0000000..46a8e2d --- /dev/null +++ b/files/ghostty/config @@ -0,0 +1,4 @@ +font-family = "JetBrainsMono Nerd Font" +quit-after-last-window-closed=true +theme = "rose-pine" +window-save-state = "always" diff --git a/files/git/config.personal b/files/git/config.personal new file mode 100644 index 0000000..fd1a420 --- /dev/null +++ b/files/git/config.personal @@ -0,0 +1,4 @@ +[user] + name = cupcakearmy + email = hi@nicco.io + signingkey = 3235314B4D31232F diff --git a/files/git/config.work b/files/git/config.work new file mode 100644 index 0000000..d24756e --- /dev/null +++ b/files/git/config.work @@ -0,0 +1,4 @@ +[user] + name = Niccolo Borgioli + email = hi@nicco.io + signingkey = 4897ACD13A65977C diff --git a/files/git/gitconfig b/files/git/gitconfig new file mode 100644 index 0000000..069cccb --- /dev/null +++ b/files/git/gitconfig @@ -0,0 +1,24 @@ +[filter "lfs"] + clean = git-lfs clean -- %f + smudge = git-lfs smudge -- %f + process = git-lfs filter-process + required = true +[core] + excludesfile = ~/.gitignore_global + autocrlf = input + ignorecase=false +[commit] + gpgsign = false + +[pull] + rebase = false + +[push] + autoSetupRemote = true +[branch] + sort = -committerdate +[alias] + fpush = push --force-with-lease + +[include] + path = ~/.gitconfig.local diff --git a/files/git/gitignore_global b/files/git/gitignore_global new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/files/git/gitignore_global @@ -0,0 +1 @@ +.DS_Store diff --git a/files/nvim/.gitignore b/files/nvim/.gitignore new file mode 100644 index 0000000..cc5457a --- /dev/null +++ b/files/nvim/.gitignore @@ -0,0 +1,8 @@ +tt.* +.tests +doc/tags +debug +.repro +foo.* +*.log +data diff --git a/files/nvim/.neoconf.json b/files/nvim/.neoconf.json new file mode 100644 index 0000000..7c48087 --- /dev/null +++ b/files/nvim/.neoconf.json @@ -0,0 +1,15 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + } +} diff --git a/files/nvim/LICENSE b/files/nvim/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/files/nvim/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/files/nvim/README.md b/files/nvim/README.md new file mode 100644 index 0000000..185280b --- /dev/null +++ b/files/nvim/README.md @@ -0,0 +1,4 @@ +# 💤 LazyVim + +A starter template for [LazyVim](https://github.com/LazyVim/LazyVim). +Refer to the [documentation](https://lazyvim.github.io/installation) to get started. diff --git a/files/nvim/init.lua b/files/nvim/init.lua new file mode 100644 index 0000000..2514f9e --- /dev/null +++ b/files/nvim/init.lua @@ -0,0 +1,2 @@ +-- bootstrap lazy.nvim, LazyVim and your plugins +require("config.lazy") diff --git a/files/nvim/lazy-lock.json b/files/nvim/lazy-lock.json new file mode 100644 index 0000000..66029df --- /dev/null +++ b/files/nvim/lazy-lock.json @@ -0,0 +1,57 @@ +{ + "LazyVim": { "branch": "main", "commit": "4d596cf4b4dcb369b2aef7e4d09635416b6c5a3f" }, + "SchemaStore.nvim": { "branch": "main", "commit": "291b15c6a03d8f859da8d83f46ed41ae6bb0ea8d" }, + "auto-session": { "branch": "main", "commit": "8d2eddb14ef66ed1019c92251e2d31bb7a2a2f87" }, + "bg.nvim": { "branch": "main", "commit": "18b4161e22decab29fa8705c174bb29b5b39be36" }, + "bufferline.nvim": { "branch": "main", "commit": "5cc447cb2b463cb499c82eaeabbed4f5fa6a0a44" }, + "catppuccin": { "branch": "main", "commit": "637d99e638bc6f1efedac582f6ccab08badac0c6" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-git": { "branch": "main", "commit": "ec049036e354ed8ed0215f2427112882e1ea7051" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "conform.nvim": { "branch": "master", "commit": "62d5accad8b29d6ba9b58d3dff90c43a55621c60" }, + "crates.nvim": { "branch": "main", "commit": "8bf8358ee326d5d8c11dcd7ac0bcc9ff97dbc785" }, + "flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" }, + "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, + "fzf-lua": { "branch": "main", "commit": "9427dc65afaa7972fb20fc52280cd1449f691928" }, + "gitsigns.nvim": { "branch": "main", "commit": "ac5aba6dce8c06ea22bea2c9016f51a2dbf90dc7" }, + "grug-far.nvim": { "branch": "main", "commit": "9a2f78219390b47d67795ab09390d7f092e23976" }, + "hop.nvim": { "branch": "master", "commit": "08ddca799089ab96a6d1763db0b8adc5320bf050" }, + "indent-blankline.nvim": { "branch": "master", "commit": "7871a88056f7144defca9c931e311a3134c5d509" }, + "lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" }, + "lazydev.nvim": { "branch": "main", "commit": "d5800897d9180cea800023f2429bce0a94ed6064" }, + "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, + "luvit-meta": { "branch": "main", "commit": "57d464c4acb5c2e66bd4145060f5dc9e96a7bbb7" }, + "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "43894adcf10bb1190c2184bd7c1750e8ea2b3dce" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "mini.ai": { "branch": "main", "commit": "31c149067d38b97720d2a179619f7745a0006ecc" }, + "mini.animate": { "branch": "main", "commit": "d33ddf0eefee6338bbd95805c4595c1b34e6bfe2" }, + "mini.comment": { "branch": "main", "commit": "a56581c40c19fa26f2b39da72504398de3173c5a" }, + "mini.icons": { "branch": "main", "commit": "54686be7d58807906cb2c8c2216e0bf9c044f19a" }, + "mini.pairs": { "branch": "main", "commit": "7e834c5937d95364cc1740e20d673afe2d034cdb" }, + "mini.surround": { "branch": "main", "commit": "48a9795c9d352c771e1ab5dedab6063c0a2df037" }, + "neo-tree.nvim": { "branch": "main", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" }, + "noice.nvim": { "branch": "main", "commit": "203f74adaae11d47440a667555b4af9156be807b" }, + "nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" }, + "nvim-cmp": { "branch": "main", "commit": "40a03dc225383c4f6256596c2cdf27e03b8119b5" }, + "nvim-lint": { "branch": "master", "commit": "8e9562de7261e5b862c631958df616e1a65552cd" }, + "nvim-lspconfig": { "branch": "master", "commit": "291a8f1a319dc712db85bcc174b0cf406f0a5b69" }, + "nvim-snippets": { "branch": "main", "commit": "56b4052f71220144689caaa2e5b66222ba5661eb" }, + "nvim-treesitter": { "branch": "master", "commit": "a3a732107f8b529f97bf4921b3e1af5dcc756bb6" }, + "nvim-treesitter-textobjects": { "branch": "master", "commit": "3e450cd85243da99dc23ebbf14f9c70e9a0c26a4" }, + "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, + "nvim-ts-context-commentstring": { "branch": "main", "commit": "9c74db656c3d0b1c4392fc89a016b1910539e7c0" }, + "persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "render-markdown.nvim": { "branch": "main", "commit": "d6a82d70765aa238b7ea48d257a1d57a92501423" }, + "rustaceanvim": { "branch": "master", "commit": "6e742b9fc6a37e46181879f6c32cecfa8cd2cebf" }, + "snacks.nvim": { "branch": "main", "commit": "a365d3e854641ad9a5b362d35cc13e0fb8032e88" }, + "tailwindcss-colorizer-cmp.nvim": { "branch": "main", "commit": "3d3cd95e4a4135c250faf83dd5ed61b8e5502b86" }, + "todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" }, + "tokyonight.nvim": { "branch": "main", "commit": "c2725eb6d086c8c9624456d734bd365194660017" }, + "trouble.nvim": { "branch": "main", "commit": "3dc00c0447c016cd43e03054c3d49436a1f2076d" }, + "ts-comments.nvim": { "branch": "main", "commit": "2002692ad1d3f6518d016550c20c2a890f0cbf0e" }, + "vim-startuptime": { "branch": "master", "commit": "ac2cccb5be617672add1f4f3c0a55ce99ba34e01" }, + "which-key.nvim": { "branch": "main", "commit": "68e37e12913a66b60073906f5d3f14dee0de19f2" } +} diff --git a/files/nvim/lazyvim.json b/files/nvim/lazyvim.json new file mode 100644 index 0000000..622c66b --- /dev/null +++ b/files/nvim/lazyvim.json @@ -0,0 +1,31 @@ +{ + "extras": [ + "lazyvim.plugins.extras.coding.mini-comment", + "lazyvim.plugins.extras.coding.mini-surround", + "lazyvim.plugins.extras.editor.fzf", + "lazyvim.plugins.extras.lang.docker", + "lazyvim.plugins.extras.lang.git", + "lazyvim.plugins.extras.lang.go", + "lazyvim.plugins.extras.lang.json", + "lazyvim.plugins.extras.lang.markdown", + "lazyvim.plugins.extras.lang.php", + "lazyvim.plugins.extras.lang.prisma", + "lazyvim.plugins.extras.lang.rust", + "lazyvim.plugins.extras.lang.svelte", + "lazyvim.plugins.extras.lang.tailwind", + "lazyvim.plugins.extras.lang.nix", + "lazyvim.plugins.extras.lang.toml", + "lazyvim.plugins.extras.lang.typescript", + "lazyvim.plugins.extras.lang.vue", + "lazyvim.plugins.extras.lang.yaml", + "lazyvim.plugins.extras.formatting.prettier", + "lazyvim.plugins.extras.formatting.biome", + "lazyvim.plugins.extras.ui.mini-animate", + "lazyvim.plugins.extras.util.dot", + "lazyvim.plugins.extras.util.startuptime" + ], + "news": { + "NEWS.md": "7429" + }, + "version": 7 +} \ No newline at end of file diff --git a/files/nvim/lua/config/autocmds.lua b/files/nvim/lua/config/autocmds.lua new file mode 100644 index 0000000..27e9e06 --- /dev/null +++ b/files/nvim/lua/config/autocmds.lua @@ -0,0 +1,3 @@ +-- Autocmds are automatically loaded on the VeryLazy event +-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua +-- Add any additional autocmds here diff --git a/files/nvim/lua/config/keymaps.lua b/files/nvim/lua/config/keymaps.lua new file mode 100644 index 0000000..b3d9fd8 --- /dev/null +++ b/files/nvim/lua/config/keymaps.lua @@ -0,0 +1,5 @@ +-- Keymaps are automatically loaded on the VeryLazy event +-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua +-- Add any additional keymaps here + +vim.keymap.set("n", "", "HopWord", { desc = "Hop to any word" }) diff --git a/files/nvim/lua/config/lazy.lua b/files/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..cc889fc --- /dev/null +++ b/files/nvim/lua/config/lazy.lua @@ -0,0 +1,43 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" + +if not (vim.uv or vim.loop).fs_stat(lazypath) then + -- bootstrap lazy.nvim + -- stylua: ignore + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) +end +vim.opt.rtp:prepend(lazypath) + +require("lazy").setup({ + spec = { + -- add LazyVim and import its plugins + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + -- import/override with your plugins + { import = "plugins" }, + }, + defaults = { + -- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup. + -- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default. + lazy = false, + -- It's recommended to leave version=false for now, since a lot the plugin that support versioning, + -- have outdated releases, which may break your Neovim install. + version = false, -- always use the latest git commit + -- version = "*", -- try installing the latest stable version for plugins that support semver + }, + -- install = { colorscheme = { "tokyonight", "habamax" } }, + checker = { enabled = true }, -- automatically check for plugin updates + performance = { + rtp = { + -- disable some rtp plugins + disabled_plugins = { + "gzip", + -- "matchit", + -- "matchparen", + -- "netrwPlugin", + "tarPlugin", + "tohtml", + "tutor", + "zipPlugin", + }, + }, + }, +}) diff --git a/files/nvim/lua/config/options.lua b/files/nvim/lua/config/options.lua new file mode 100644 index 0000000..3ea1454 --- /dev/null +++ b/files/nvim/lua/config/options.lua @@ -0,0 +1,3 @@ +-- Options are automatically loaded before lazy.nvim startup +-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua +-- Add any additional options here diff --git a/files/nvim/lua/plugins/auto-session.lua b/files/nvim/lua/plugins/auto-session.lua new file mode 100644 index 0000000..9ee3f14 --- /dev/null +++ b/files/nvim/lua/plugins/auto-session.lua @@ -0,0 +1,13 @@ +return { + { + "rmagatti/auto-session", + lazy = false, + + ---enables autocomplete for opts + ---@module "auto-session" + ---@type AutoSession.Config + opts = { + suppressed_dirs = { "~/", "~/Desktop", "~/Downloads", "/" }, + }, + }, +} diff --git a/files/nvim/lua/plugins/bg.lua b/files/nvim/lua/plugins/bg.lua new file mode 100644 index 0000000..720f087 --- /dev/null +++ b/files/nvim/lua/plugins/bg.lua @@ -0,0 +1,3 @@ +return { + { "typicode/bg.nvim", lazy = false }, +} diff --git a/files/nvim/lua/plugins/hop.lua b/files/nvim/lua/plugins/hop.lua new file mode 100644 index 0000000..fd2b9ab --- /dev/null +++ b/files/nvim/lua/plugins/hop.lua @@ -0,0 +1,12 @@ +return { + { + "smoka7/hop.nvim", + version = "*", + opts = { + keys = "etovxqpdygfblzhckisuran", + }, + keys = { + { "", "HopWord", desc = "Hop to any word" }, + }, + }, +} diff --git a/files/nvim/lua/plugins/onedark.lua b/files/nvim/lua/plugins/onedark.lua new file mode 100644 index 0000000..21c7ce1 --- /dev/null +++ b/files/nvim/lua/plugins/onedark.lua @@ -0,0 +1,10 @@ +return { + -- { "navarasu/onedark.nvim", opts = { style = "darker" } }, + -- { "LazyVim/LazyVim", opts = { + -- colorscheme = "onedark", + -- } }, + { "catppuccin/nvim", name = "catppuccin" }, + { "LazyVim/LazyVim", opts = { + colorscheme = "catppuccin", + } }, +} diff --git a/files/nvim/stylua.toml b/files/nvim/stylua.toml new file mode 100644 index 0000000..5d6c50d --- /dev/null +++ b/files/nvim/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120 \ No newline at end of file diff --git a/files/omp/colors/.gitignore b/files/omp/colors/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/files/omp/colors/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/files/omp/colors/bun.lockb b/files/omp/colors/bun.lockb new file mode 100755 index 0000000..528a96a Binary files /dev/null and b/files/omp/colors/bun.lockb differ diff --git a/files/omp/colors/colors.json b/files/omp/colors/colors.json new file mode 100644 index 0000000..183e4aa --- /dev/null +++ b/files/omp/colors/colors.json @@ -0,0 +1,106 @@ +[ + { + "properties": { + "steps": 8, + "hue": { + "start": 209, + "end": 259, + "curve": "easeOutQuad" + }, + "saturation": { + "start": 0.03, + "end": 1, + "rate": 1, + "curve": "easeOutQuad" + }, + "brightness": { + "start": 1, + "end": 0.03, + "curve": "easeInQuart" + } + }, + "options": { + "minorSteps": [0, 1], + "name": "Main", + "rotation": "clockwise" + } + }, + { + "properties": { + "steps": 8, + "hue": { + "start": 0, + "end": 15, + "curve": "easeOutQuad" + }, + "saturation": { + "start": 0.75, + "end": 1, + "rate": 1, + "curve": "easeOutQuad" + }, + "brightness": { + "start": 1, + "end": 0.2, + "curve": "linear" + } + }, + "options": { + "minorSteps": [0, 1], + "name": "Error", + "rotation": "clockwise" + } + }, + { + "properties": { + "steps": 8, + "hue": { + "start": 60, + "end": 70, + "curve": "easeOutQuad" + }, + "saturation": { + "start": 0.75, + "end": 1, + "rate": 1, + "curve": "easeOutQuad" + }, + "brightness": { + "start": 1, + "end": 0.2, + "curve": "linear" + } + }, + "options": { + "minorSteps": [0, 1], + "name": "Warning", + "rotation": "clockwise" + } + }, + { + "properties": { + "steps": 8, + "hue": { + "start": 122, + "end": 146, + "curve": "easeOutQuad" + }, + "saturation": { + "start": 0.75, + "end": 1, + "rate": 1, + "curve": "easeOutQuad" + }, + "brightness": { + "start": 1, + "end": 0.2, + "curve": "linear" + } + }, + "options": { + "minorSteps": [0, 1], + "name": "Success", + "rotation": "clockwise" + } + } +] diff --git a/files/omp/colors/index.js b/files/omp/colors/index.js new file mode 100644 index 0000000..4c42678 --- /dev/null +++ b/files/omp/colors/index.js @@ -0,0 +1,21 @@ +import color from '@k-vyn/coloralgorithm' +import colors from './colors.json' assert { type: 'json' } +import fs from 'fs' +import yaml from 'yaml' + +const offset = 10 +const palette = {} +for (const { properties, options } of colors) { + const result = color.generate(properties, options) + const name = result[0].name + for (const color of result[0].colors) { + palette[`${name.toLowerCase()}-${color.step * offset}`] = color.hex + } +} + +const configFile = '../main.omp.yaml' +const config = fs.readFileSync(configFile, 'utf8') +// config.palette = palette +const output = yaml.stringify({ palette }) + +fs.writeFileSync(configFile, config.replace(/palette:(.|\s)*$/, output)) diff --git a/files/omp/colors/package.json b/files/omp/colors/package.json new file mode 100644 index 0000000..d9c68fd --- /dev/null +++ b/files/omp/colors/package.json @@ -0,0 +1,8 @@ +{ + "type": "module", + "main": "index.js", + "dependencies": { + "@k-vyn/coloralgorithm": "^1.0.0", + "yaml": "^2.2.1" + } +} diff --git a/files/omp/config.yaml b/files/omp/config.yaml new file mode 100644 index 0000000..0f5296b --- /dev/null +++ b/files/omp/config.yaml @@ -0,0 +1,159 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json + +palette: + error-0: '#ff4040' + error-10: '#e23629' + error-15: '#d33220' + error-20: '#c52e18' + error-30: '#a8280d' + error-40: '#8a2106' + error-5: '#f03a34' + error-50: '#6d1b02' + error-60: '#501401' + error-70: '#330d00' + main-0: '#f7fbff' + main-10: '#b4cafd' + main-15: '#95a9fc' + main-20: '#7783fa' + main-30: '#5348f4' + main-40: '#4826e8' + main-5: '#d6e6fe' + main-50: '#3e10ca' + main-60: '#22036e' + main-70: '#020008' + success-0: '#40ff46' + success-10: '#29e243' + success-15: '#20d342' + success-20: '#18c541' + success-30: '#0da83d' + success-40: '#068a36' + success-5: '#34f044' + success-50: '#026d2d' + success-60: '#015022' + success-70: '#003316' + warning-0: '#ffff40' + warning-10: '#dae229' + warning-15: '#c8d320' + warning-20: '#b6c518' + warning-30: '#96a80d' + warning-40: '#788a06' + warning-5: '#ecf034' + warning-50: '#5d6d02' + warning-60: '#435001' + warning-70: '#2a3300' +blocks: + - type: prompt + alignment: left + segments: + - leading_diamond:  + foreground: p:main-70 + background: p:main-5 + type: os + style: diamond + - properties: + style: full + template: " \uf0e7 " + foreground: p:main-70 + powerline_symbol:  + background: p:error-15 + type: root + style: powerline + - properties: + style: full + template: ' {{ .Path }} ' + foreground: p:main-0 + powerline_symbol:  + background: p:main-40 + type: path + style: powerline + - template: ' {{ .HEAD }} ' + foreground: p:main-70 + powerline_symbol:  + background: p:warning-10 + type: git + style: powerline + - type: prompt + alignment: right + segments: + - leading_diamond:  + trailing_diamond:  + foreground: p:main-70 + background: p:main-10 + type: python + style: dynamic + - leading_diamond:  + trailing_diamond:  + foreground: p:main-70 + background: p:main-10 + type: go + style: dynamic + - leading_diamond:  + trailing_diamond:  + foreground: p:main-70 + background: p:main-10 + type: node + style: dynamic + - leading_diamond:  + trailing_diamond:  + template: '{{ .Context }}{{ if .Namespace }}::{{ .Namespace }}{{ end }}' + foreground: p:main-70 + background: p:main-10 + type: kubectl + style: dynamic + - leading_diamond:  + trailing_diamond:  + template: '{{ .Icon }} {{ .Server }}' + foreground: p:main-70 + background: p:main-10 + type: docker + style: dynamic + - leading_diamond:  + trailing_diamond:  + foreground: p:main-70 + background: p:main-10 + type: rust + style: dynamic + - leading_diamond:  + trailing_diamond:  + foreground: p:main-70 + background: p:main-10 + type: battery + style: dynamic + - properties: + always_enabled: true + leading_diamond:  + template: "{{ if gt .Code 0 }}\uf00d {{ .Code }} {{ .Meaning }}{{ else }}\uf42e{{ end }}" + foreground: p:main-70 + type: status + style: diamond + background_templates: + - '{{ if gt .Code 0 }}p:error-0{{ else }}p:main-10{{ end }}' + - properties: + always_enabled: true + style: round + foreground: p:main-70 + powerline_symbol:  + background: p:main-5 + type: executiontime + style: powerline + - properties: + time_format: '15:04:05' + template: ' {{ .CurrentDate | date .Format }} ' + foreground: p:main-70 + powerline_symbol:  + background: p:main-0 + type: time + style: powerline + - type: prompt + alignment: left + segments: + - properties: + always_enabled: true + template: '❯ ' + foreground: p:main-15 + type: status + style: plain + foreground_templates: + - '{{ if gt .Code 0 }}p:error-15{{ end }}' + newline: true +version: 3 diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..2683891 --- /dev/null +++ b/flake.lock @@ -0,0 +1,69 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1741543064, + "narHash": "sha256-AjXyS3ACxWAd+h3NSkrflN+uC0Tq1XFqox472RF6yh0=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "db4386d686fb0b2788e7422e6a2299deace9c4b1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1741229100, + "narHash": "sha256-0HwrTDXp9buEwal/1ymK9uQmzUD5ozIA7CJGqnT/gLs=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "adf5c88ba1fe21af5c083b4d655004431f20c5ab", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1741402956, + "narHash": "sha256-y2hByvBM03s9T2fpeLjW6iprbxnhV9mJMmSwCHc41ZQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ed0b1881565c1ffef490c10d663d4f542031dad3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ea95ce8 --- /dev/null +++ b/flake.nix @@ -0,0 +1,48 @@ +{ + description = "Personal Nix configuration"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + + nix-darwin.url = "github:LnL7/nix-darwin"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; + + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = + { + self, + nix-darwin, + nixpkgs, + home-manager, + }: + let + hosts = import ./hosts; + inherit (builtins) listToAttrs; + in + { + darwinConfigurations = listToAttrs ( + map (host: { + name = host.hostName; + value = nix-darwin.lib.darwinSystem { + specialArgs = { + inherit host; + flake = self; + }; + modules = [ + (import ./darwin.nix) + home-manager.darwinModules.home-manager + { + home-manager.backupFileExtension = "backup"; + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.${host.username} = import ./home/home.nix { inherit host; }; + } + ]; + }; + }) hosts + ); + }; +} diff --git a/home/home.nix b/home/home.nix new file mode 100644 index 0000000..b62a896 --- /dev/null +++ b/home/home.nix @@ -0,0 +1,91 @@ +{ host }: +{ + pkgs, + lib, + config, + sops-nix, + ... +}: +{ + # https://nix-community.github.io/home-manager + home.stateVersion = "25.05"; + programs.home-manager.enable = true; + + home.username = host.username; + home.homeDirectory = "/Users/${host.username}"; + + home.packages = + (import ./pkgs.nix { inherit pkgs; }) + ++ ((lib.attrByPath [ "extras" "pkgs" ] (pkgs: [ ]) host) pkgs); + + fonts.fontconfig.enable = true; + + home = { + sessionVariables = { + EDITOR = "nvim"; + }; + + file = { + ".config/omp/config.yaml".source = ../files/omp/config.yaml; + ".config/ghostty/config".source = ../files/ghostty/config; + ".gitconfig".source = ../files/git/gitconfig; + ".gitignore_global".source = ../files/git/gitignore_global; + ".gitconfig.local".source = ../files/git/config.work; + ".config/nvim".source = ../files/nvim; + + # Secrets + ".ssh/config".source = ../secrets/ssh/config; + }; + + shellAliases = { + l = "ls -hal"; + dc = "docker compose"; + rsync = "rsync -az --info=progress2"; + t = "tmux new-session -A -s main"; + e = "nvim"; + g = "lazygit"; + d = "lazydocker"; + vai = "darwin-rebuild switch --flake ~/.config/nix-darwin#${host.hostName}"; + }; + }; + + programs = { + direnv.enable = true; + zoxide.enable = true; + + fish = { + enable = true; + interactiveShellInit = '' + if type -q oh-my-posh + oh-my-posh init fish --config ~/.config/omp/config.yaml | source + end + if type -q fnm + fnm env --use-on-cd | source + end + ''; + }; + bash = { + enable = true; + }; + tmux = { + enable = true; + clock24 = true; + mouse = true; + extraConfig = '' + # switch panes using Alt-arrow without prefix + bind -n M-Left select-pane -L + bind -n M-Right select-pane -R + bind -n M-Up select-pane -U + bind -n M-Down select-pane -D + + # switch panes using jkhl + bind h select-pane -L + bind l select-pane -R + bind j select-pane -U + bind k select-pane -D + ''; + shell = "${pkgs.fish}/bin/fish"; + terminal = "tmux-256color"; + }; + }; +} diff --git a/home/pkgs.nix b/home/pkgs.nix new file mode 100644 index 0000000..bcede05 --- /dev/null +++ b/home/pkgs.nix @@ -0,0 +1,61 @@ +{ pkgs }: +with pkgs; +[ + # Base + tmux + oh-my-posh + git + git-lfs + git-crypt + gh + bfg-repo-cleaner + gnutar + gnupg + htop + btop + rclone + rename + tmux + tree + wget + woff2 + bat + rsync + sops + + # Dev + devenv + nixpacks + ollama + colima + lazydocker + exercism + + # Editor + neovim + fzf + lazygit + lua + luajitPackages.luarocks + ast-grep + ripgrep + + # Language specific + nixfmt-rfc-style + fnm + bun + deno + zig + uv + ruff + tectonic + tex-fmt + rustup + shfmt + ruby + ruby-lsp + rubyPackages.prism + + # Fonts + nerd-fonts.jetbrains-mono +] diff --git a/hosts/default.nix b/hosts/default.nix new file mode 100644 index 0000000..90f15c4 --- /dev/null +++ b/hosts/default.nix @@ -0,0 +1,4 @@ +[ + (import ./mac14.nix) + (import ./mac16.nix) +] diff --git a/hosts/mac14.nix b/hosts/mac14.nix new file mode 100644 index 0000000..c19b3ec --- /dev/null +++ b/hosts/mac14.nix @@ -0,0 +1,5 @@ +{ + username = "cupcakearmy"; + hostName = "mac14"; + platform = "aarch64-darwin"; +} diff --git a/hosts/mac16.nix b/hosts/mac16.nix new file mode 100644 index 0000000..c2b660f --- /dev/null +++ b/hosts/mac16.nix @@ -0,0 +1,27 @@ +{ + username = "niccoloborgioli"; + hostName = "mac16"; + platform = "aarch64-darwin"; + + extras = { + casks = [ + "phpstorm" + "datagrip" + "tailscale" + "android-studio" + ]; + pkgs = + pkgs: with pkgs; [ + vault + cocoapods + phrase-cli + boundary + awscli2 + fastlane + jdk + android-tools + sdkmanager + _1password-cli + ]; + }; +} diff --git a/secrets/ssh/config b/secrets/ssh/config new file mode 100644 index 0000000..e8e3d09 Binary files /dev/null and b/secrets/ssh/config differ