diff --git a/.luarc.json b/.luarc.json deleted file mode 100644 index 18eefe7..0000000 --- a/.luarc.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "workspace.checkThirdParty": false, - "workspace.library": ["${3rd}/luassert/library", "${3rd}/luv/library"] -} diff --git a/LICENSE b/LICENSE index b76ad1c..570135f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,374 @@ -MIT License +Mozilla Public License Version 2.0 +================================== -Copyright (c) 2021 Keanu Timmermans +1. Definitions +-------------- -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/common/Brewfile b/common/Brewfile new file mode 100644 index 0000000..d24acbc --- /dev/null +++ b/common/Brewfile @@ -0,0 +1,143 @@ +# Utils {{{ +def flatten_brews(brews) + brews.flat_map do |category, brew_list| + brew_list.map do |brew| + if brew.is_a?(Hash) + brew.to_a.first # Extract the package name and options from the hash + else + [brew, {}] # No options, so use an empty hash + end + end + end +end + +def liftoff(root) + root[:taps].each do |name| + tap name + end + + flatten_brews(root[:brews]).each do |pkg, opts| + brew(pkg, opts) + end + + root[:casks].each do |name| + cask name + end +end +# }}} + +packages = { + taps: [ + "ddev/ddev", + "the-wineskin-project/wineskin", + "isen-ng/dotnet-sdk-versions" + ], + brews: { # {{{ + services: [ + { "syncthing" => { restart_service: :changed } }, + ], + system: [ + "cmark", + "cmark-gfm", + "gcc@12", + "mkcert", + "nss", + "pinentry-mac", + "pkg-config", + "sdl2" + ], + languages: [ + "bash-language-server", + "composer", + "dhall", + "dhall-json", + "dhall-lsp-server", + "go", + "gradle", + "kotlin", + "lua-language-server", + "node", + "openjdk", + "php", + "poetry", + "ruby", + "stylua", + "uv", + "yaml-language-server" + ], + tools: [ + "act", + "bat", + "bear", + "coder", + "croc", + "ddev", + "dua-cli", + "eza", + "ffmpeg", + "fzf", + "gawk", + "gh", + "git-crypt", + "git-delta", + "gitui", + "gnupg", + "ijq", + "imagemagick", + "kubernetes-cli", + "neovim", + "pandoc", + "ripgrep", + "shellcheck", + "shfmt", + "sops", + "tealdeer", + "wget" + ] + }, # }}} + casks: [ # {{{ + "1password", + "1password-cli", + "alt-tab", + "android-studio", + "browserstacklocal", + "crossover", + "dotnet-sdk9", + "dotnet-sdk8", + "db-browser-for-sqlite", + "discord", + "discord@ptb", + "firefox@developer-edition", + "font-ibm-plex", + "font-jetbrains-mono-nerd-font", + "goland", + "google-chrome", + "imhex", + "insomnia", + "intellij-idea", + "iterm2", + "kitty", + "lens", + "obs", + "obsidian", + "orbstack", + "phpstorm", + "prismlauncher", + "qbittorrent", + "raycast", + "rectangle", + "rider", + "rubymine", + "sequel-ace", + "shottr", + "slack", + "spotify", + # "steam", + "tailscale-app", + "thunderbird", + "transmit", + "visual-studio-code" + ] # }}} +} + +liftoff packages diff --git a/dmitmel-dotfiles b/dmitmel-dotfiles index 6676f24..7b2b39e 160000 --- a/dmitmel-dotfiles +++ b/dmitmel-dotfiles @@ -1 +1 @@ -Subproject commit 6676f249fb50421a457da1cddd2682c80b8669ab +Subproject commit 7b2b39e8fa5a00a990c683fb69bae88462defb83 diff --git a/kitty/kitty.conf b/kitty/kitty.conf index c9b2d05..944c79b 100644 --- a/kitty/kitty.conf +++ b/kitty/kitty.conf @@ -1,14 +1,10 @@ -# Include Dima's config. include ../dmitmel-dotfiles/misc/kitty.conf -# I sure do love ligatures. -font_family Fira Code +font_family JetBrainsMonoNFM-Regular -# Remember previous window size. (which will probably always be maximized) remember_window_size yes - -# Disable the stupid bell. enable_audio_bell no - -# The block confuses me, shush. cursor_shape beam + +# Mac bindings +map cmd+t launch --type=tab diff --git a/nix/darwin-configuration.nix.bak b/nix/darwin-configuration.nix.bak deleted file mode 100644 index c73922e..0000000 --- a/nix/darwin-configuration.nix.bak +++ /dev/null @@ -1,220 +0,0 @@ -{ config, pkgs, ... }: - -{ - networking = { - hostName = "alymac"; - }; - - # List packages installed in system profile. To search by name, run: - # $ nix-env -qaP | grep wget - environment.systemPackages = with pkgs; [ - # System tools - libtool - pcre - pkg-config - patchelf - gnutls - gsasl - - # CLI tools - act - bat - bitwarden-cli - cloudflared - delta - exa - ffmpeg - fzf - gh - git - git-crypt - gitui - gnupg - jq - kubectl - kubelogin-oidc - mosh - neovim - nixpkgs-fmt - ripgrep - sops - vim - wget - - # Charm tools - skate - soft-serve - - # Programs - jetbrains.idea-ultimate - jetbrains.phpstorm - jetbrains.rider - rectangle - slack - tailscale - - # Programming languages - crystal - deno - dotnet-sdk - go - jdk - nil - nodejs_20 - ruby_3_1 - sbcl - shards - zig - - # Libraries - nodePackages.http-server - nodePackages.pnpm - nodePackages.prettier - nodePackages.yarn - openssl - - # Fyra vala crap - glib - glib-networking - gobject-introspection - gtk4 - libgee - meson - ninja - vala - ]; - - homebrew = { - enable = true; - # If only this didn't break. - onActivation.cleanup = "zap"; - - taps = [ - "drud/ddev" - "homebrew/cask" - "homebrew/cask-versions" - ]; - - # Please do not the brew. - brews = [ - "composer" - "ddev" - "mkcert" - "pkg-config" - "sdl2" - ]; - - casks = [ - "1password" - "1password-cli" - "alt-tab" - "amethyst" - "android-studio" - "audacity" - "background-music" - "db-browser-for-sqlite" - "discord" - "discord-ptb" - "docker" - "emacs" - "fig" - "firefox" - "google-chrome" - "itch" - "iterm2" - "obs" - "raycast" - "sequel-ace" - "shortcat" - "shottr" - "spotify" - "thunderbird" - "visual-studio-code" - ]; - }; - - # Auto upgrade nix package and the daemon service. - services.nix-daemon.enable = true; - - # Configuration for nix itself. - nix = { - package = pkgs.nix; - settings = { - experimental-features = [ "nix-command" "flakes" ]; - build-users-group = "nixbld"; - }; - gc = { - automatic = true; - options = "--delete-older-than 8d"; - }; - }; - - # Create /etc/zshrc that loads the nix-darwin environment. - # I wish I had access to inputs. - programs.zsh = { - enable = true; - promptInit = " - source ~/.dotfiles/zsh/zshrc - "; - }; - - # Used for backwards compatibility, please read the changelog before changing. - # $ darwin-rebuild changelog - system.stateVersion = 4; - - # Absolutely proprietary. - nixpkgs.config.allowUnfree = true; -} - - -# services.yabai = { -# enable = true; -# enableScriptingAddition = true; -# config = { -# layout = "bsp"; -# window_placement = "first_child"; -# auto_balance = "on"; -# -# focus_follows_mouse = "autoraise"; -# -# window_topmost = "on"; -# -# window_opacity = "on"; -# active_window_opacity = "1.0"; -# normal_window_opacity = "0.9"; -# }; -# -# extraConfig = " -# yabai -m signal --add event=dock_did_restart action=\"sudo yabai --load-sa\" -# sudo yabai --load-sa -# "; -# }; -# -# services.skhd = { -# enable = true; -# skhdConfig = " -# # Toggle split -# shift + cmd - enter : /run/current-system/sw/bin/yabai -m window --toggle split -# -# # Focus window -# ctrl + cmd - up : /run/current-system/sw/bin/yabai -m window --focus north -# ctrl + cmd - right : /run/current-system/sw/bin/yabai -m window --focus east -# ctrl + cmd - down : /run/current-system/sw/bin/yabai -m window --focus south -# ctrl + cmd - left : /run/current-system/sw/bin/yabai -m window --focus west -# -# # Move windows -# shift + cmd - left : /run/current-system/sw/bin/yabai -m window --warp west -# shift + cmd - right : /run/current-system/sw/bin/yabai -m window --warp east -# -# # Focus monitor -# ctrl + alt - z : /run/current-system/sw/bin/yabai -m display --focus prev -# -# # Increase window size -# shift + alt - a : /run/current-system/sw/bin/yabai -m window --resize left:-20:0 -# shift + alt - w : /run/current-system/sw/bin/yabai -m window --resize top:0:-20 -# -# # Decrease window size -# shift + cmd - s : /run/current-system/sw/bin/yabai -m window --resize bottom:0:-20 -# shift + cmd - w : /run/current-system/sw/bin/yabai -m window --resize top:0:20 -# "; -# }; diff --git a/nix/flake.lock b/nix/flake.lock index 0b74a57..81f346d 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -7,15 +7,16 @@ ] }, "locked": { - "lastModified": 1720469887, - "narHash": "sha256-BwPsGQ/EMqCreUc5j9Efj+wx13AjREtuHhbyHZygcE4=", + "lastModified": 1743127615, + "narHash": "sha256-+sMGqywrSr50BGMLMeY789mSrzjkoxZiu61eWjYS/8o=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "fabc653517106127e2ed435fb52e7e8854354428", + "rev": "fc843893cecc1838a59713ee3e50e9e7edc6207c", "type": "github" }, "original": { "owner": "lnl7", + "ref": "nix-darwin-24.11", "repo": "nix-darwin", "type": "github" } @@ -23,11 +24,11 @@ "dotfiles": { "flake": false, "locked": { - "lastModified": 1717202661, - "narHash": "sha256-yRqcINrAjRhW7JGE2qoAvQv1hirZLGZwmxayAMdtCU0=", + "lastModified": 1737381808, + "narHash": "sha256-8iX9gv7R/bpmwr5aedF8Dl6tgKo+bKNyXV2MLp8AyGE=", "ref": "refs/heads/master", - "rev": "66b760491c829609e016688beaa121d3aa1d2188", - "revCount": 473, + "rev": "8a22bbd9fdeb3fe2bad5583fc7f8af8ac1899877", + "revCount": 494, "submodules": true, "type": "git", "url": "https://github.com/lexisother/dotfiles" @@ -38,39 +39,6 @@ "url": "https://github.com/lexisother/dotfiles" } }, - "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" - } - }, - "flakey-profile": { - "locked": { - "lastModified": 1712898590, - "narHash": "sha256-FhGIEU93VHAChKEXx905TSiPZKga69bWl1VB37FK//I=", - "owner": "lf-", - "repo": "flakey-profile", - "rev": "243c903fd8eadc0f63d205665a92d4df91d42d9d", - "type": "github" - }, - "original": { - "owner": "lf-", - "repo": "flakey-profile", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -78,69 +46,32 @@ ] }, "locked": { - "lastModified": 1720042825, - "narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=", + "lastModified": 1744743431, + "narHash": "sha256-iyn/WBYDc7OtjSawbegINDe/gIkok888kQxk3aVnkgg=", "owner": "nix-community", "repo": "home-manager", - "rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073", + "rev": "c61bfe3ae692f42ce688b5865fac9e0de58e1387", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-24.05", + "ref": "release-24.11", "repo": "home-manager", "type": "github" } }, - "lix": { - "inputs": { - "flake-utils": "flake-utils", - "flakey-profile": "flakey-profile", - "lix": "lix_2", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1719353937, - "narHash": "sha256-86NBqDxAP20ET/UoKX0WvSItblNQ97czXb2q7lkMrwk=", - "ref": "refs/heads/main", - "rev": "5d9d94089fb1ca96222a34bfe245ef5c5ebefd37", - "revCount": 92, - "type": "git", - "url": "https://git.lix.systems/lix-project/nixos-module" - }, - "original": { - "type": "git", - "url": "https://git.lix.systems/lix-project/nixos-module" - } - }, - "lix_2": { - "flake": false, - "locked": { - "lastModified": 1718767907, - "narHash": "sha256-gpd+mGQxqVHw2kO6rSPQel8TkChHh9UpqxjsmQi0QJM=", - "rev": "85f282ef572577899b3d80ba8def1b920a386218", - "type": "tarball", - "url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/85f282ef572577899b3d80ba8def1b920a386218.tar.gz" - }, - "original": { - "type": "tarball", - "url": "https://git.lix.systems/lix-project/lix/archive/main.tar.gz" - } - }, "nixpkgs": { "locked": { - "lastModified": 1720492477, - "narHash": "sha256-PV6LKJpj43tuKAMEfmXiKZjlOW1IqZORUJ8WYcdLtGE=", + "lastModified": 1744492897, + "narHash": "sha256-qqKO4FOo/vPmNIaRPcLqwfudUlQ29iNdI1IbCZfjmxs=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "64f145f456b7a3953f191cad9e257cd88412044e", + "rev": "86484f6076aac9141df2bfcddbf7dcfce5e0c6bb", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-24.05-darwin", + "ref": "nixpkgs-24.11-darwin", "repo": "nixpkgs", "type": "github" } @@ -150,24 +81,8 @@ "darwin": "darwin", "dotfiles": "dotfiles", "home-manager": "home-manager", - "lix": "lix", "nixpkgs": "nixpkgs" } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/nix/flake.nix b/nix/flake.nix index cf246b6..a656bc2 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -2,55 +2,49 @@ description = "flake of the lyxer..."; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-24.05-darwin"; - home-manager.url = "github:nix-community/home-manager/release-24.05"; - darwin.url = "github:lnl7/nix-darwin"; - lix.url = "git+https://git.lix.systems/lix-project/nixos-module"; - dotfiles = { - url = "https://github.com/lexisother/dotfiles"; - type = "git"; - submodules = true; - flake = false; - }; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-24.11-darwin"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; - darwin.inputs.nixpkgs.follows = "nixpkgs"; - lix.inputs.nixpkgs.follows = "nixpkgs"; + home-manager = { + url = "github:nix-community/home-manager/release-24.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + darwin = { + url = "github:lnl7/nix-darwin/nix-darwin-24.11"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + dotfiles = { + url = "https://github.com/lexisother/dotfiles"; + type = "git"; + submodules = true; + flake = false; + }; }; # add the inputs declared above to the argument attribute set - outputs = { self, nixpkgs, lix, home-manager, dotfiles, darwin }: let - system = "x86_64-darwin"; - importAll = path: map - (p: import (path + ("/" + p))) - (builtins.attrNames (builtins.readDir path)); - pkgs = import nixpkgs { - inherit system; - overlays = importAll ./overlays; + outputs = + { + self, + darwin, + ... + }@inputs: + let + lib = import ./lib { inherit inputs; }; + in + { + inherit lib; + + darwinConfigurations.alymac = darwin.lib.darwinSystem { + specialArgs = { inherit lib self inputs; }; + modules = [ + ./modules/common + ./modules/darwin + + ./home + + ./hosts/alymac + ]; + }; }; - libs = with builtins; listToAttrs (map - (path: { - name = replaceStrings [".nix"] [""] path; - value = (import (pkgs.lib.path.append ./lib path)) { inherit pkgs; }; - }) - (attrNames (readDir ./lib))); - in { - darwinConfigurations."alymac" = darwin.lib.darwinSystem { - inherit system; - specialArgs = libs; - modules = [ - ./system - lix.nixosModules.default - home-manager.darwinModules.home-manager - { - home-manager = { - extraSpecialArgs = { inherit self; inherit dotfiles; } // libs; - useGlobalPkgs = true; - useUserPackages = true; - users.alyxia.imports = [ ./home ]; - }; - } - ]; - }; - }; } diff --git a/nix/home/alyxia/default.nix b/nix/home/alyxia/default.nix new file mode 100644 index 0000000..5dea2d8 --- /dev/null +++ b/nix/home/alyxia/default.nix @@ -0,0 +1,7 @@ +{ lib, ... }: + +{ + imports = lib.importAll [ ] ./.; + + home.stateVersion = "24.05"; +} diff --git a/nix/home/alyxia/docs.nix b/nix/home/alyxia/docs.nix new file mode 100644 index 0000000..22c8c7f --- /dev/null +++ b/nix/home/alyxia/docs.nix @@ -0,0 +1,8 @@ +{ lib, ... }: +{ + manual = lib.mapAttrs (_: lib.mkForce) { + html.enable = false; + json.enable = false; + manpages.enable = false; + }; +} diff --git a/nix/home/alyxia/git.nix b/nix/home/alyxia/git.nix new file mode 100644 index 0000000..f69e8f6 --- /dev/null +++ b/nix/home/alyxia/git.nix @@ -0,0 +1,51 @@ +{ pkgs, ... }: + +{ + programs = { + git = { + enable = true; + package = pkgs.gitAndTools.gitFull; # contains git send-email et al + + userName = "Alyxia Sother"; + userEmail = "alyxia@riseup.net"; + signing = { + key = "01E16C4E775A37E4"; + signByDefault = true; + }; + + ignores = [ + ".DS_Store" + ]; + + delta = { + enable = true; + options = { + navigate = true; + line-numbers = true; + features = "decorations"; + + decorations = { + commit-decoration-style = "bold yellow box ul"; + file-style = "bold yellow ul"; + file-decoration-style = "none"; + hunk-header-decoration-style = "yellow box"; + }; + }; + }; + + extraConfig = { + init.defaultBranch = "master"; + }; + }; + + gh = { + enable = true; + # Why the *fuck* are these packages as opposed to GitHub links??? + extensions = with pkgs; [ + gh-actions-cache + ]; + }; + + gitui.enable = true; + }; +} diff --git a/nix/home/nvim.nix b/nix/home/alyxia/nvim.nix similarity index 89% rename from nix/home/nvim.nix rename to nix/home/alyxia/nvim.nix index efbb5b5..e051cdc 100644 --- a/nix/home/nvim.nix +++ b/nix/home/alyxia/nvim.nix @@ -1,5 +1,4 @@ { self, pkgs, ... }: - { programs.neovim = { enable = true; @@ -29,7 +28,10 @@ command = "rescript-language-server"; args = [ "--node-ipc" ]; filetypes = [ "rescript" ]; - rootPatterns = [ "rescript.json" "bsconfig.json" ]; + rootPatterns = [ + "rescript.json" + "bsconfig.json" + ]; }; }; }; diff --git a/nix/home/packages.nix b/nix/home/alyxia/packages.nix similarity index 81% rename from nix/home/packages.nix rename to nix/home/alyxia/packages.nix index 3563604..07f15c1 100644 --- a/nix/home/packages.nix +++ b/nix/home/alyxia/packages.nix @@ -1,8 +1,17 @@ { pkgs, ... }: let + phpEnv = pkgs.php.buildEnv { + extensions = + { enabled, all }: + enabled + ++ (with all; [ + imagick + ]); + }; + packageSets = with pkgs; { - system = [ + system = [ gnutls gsasl libtool @@ -14,7 +23,6 @@ let base = [ act bat - bitwarden-cli cachix cloudflared delta @@ -25,10 +33,11 @@ let git-crypt gitui gnupg - jq + imagemagick kubectl kubelogin-oidc mosh + nix-init nixd nixpkgs-fmt pandoc @@ -53,13 +62,16 @@ let dhall dhall-json dhall-lsp-server + ghostscript go jdk kotlin kotlin-language-server lua-language-server nil - nodejs_20 + nodejs_22 + phpEnv + phpEnv.packages.composer python2 ruby_3_1 sbcl @@ -87,8 +99,8 @@ let distro ]; }; - everything = builtins.concatLists (builtins.attrValues packageSets); + everything = builtins.concatLists (builtins.attrValues packageSets); in { home.packages = everything; diff --git a/nix/home/alyxia/syncthing.nix b/nix/home/alyxia/syncthing.nix new file mode 100644 index 0000000..9c5cae9 --- /dev/null +++ b/nix/home/alyxia/syncthing.nix @@ -0,0 +1,9 @@ +{ ... }: + +{ + services = { + syncthing = { + enable = true; + }; + }; +} diff --git a/nix/home/zsh.nix b/nix/home/alyxia/zsh.nix similarity index 95% rename from nix/home/zsh.nix rename to nix/home/alyxia/zsh.nix index 777c0a6..8dd4a48 100644 --- a/nix/home/zsh.nix +++ b/nix/home/alyxia/zsh.nix @@ -1,5 +1,4 @@ { self, ... }: - { programs.zsh = { enable = true; @@ -18,6 +17,7 @@ export FRENYARD_SCALE=2.40 export RETHINK_API="https://rethink.alyxia.dev" export KUBECONFIG="$HOME/.kube/config.yaml" + export SDKROOT="$(xcrun --show-sdk-path)" function violent-update() { # diff --git a/nix/home/default.nix b/nix/home/default.nix index 14146e1..170bacc 100644 --- a/nix/home/default.nix +++ b/nix/home/default.nix @@ -1,7 +1,17 @@ -{ importAll, ... }: - +{ inputs, self, ... }: { - imports = importAll [] ./.; + imports = [ inputs.home-manager.darwinModules.home-manager ]; - home.stateVersion = "24.05"; + config = { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + + extraSpecialArgs = { + inherit self inputs; + }; + + users.alyxia = ./alyxia; + }; + }; } diff --git a/nix/home/git.nix b/nix/home/git.nix deleted file mode 100644 index a429f70..0000000 --- a/nix/home/git.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ pkgs, ... }: - -{ - programs.git = { - enable = true; - package = pkgs.gitAndTools.gitFull; # contains git send-email et al - - userName = "Alyxia Sother"; - userEmail = "alyxia@riseup.net"; - signing = { - key = "01E16C4E775A37E4"; - signByDefault = true; - }; - - ignores = [ - ".DS_Store" - ]; - - delta = { - enable = true; - options = { - line-numbers = true; - features = "decorations"; - syntax-theme = "ansi"; - }; - }; - - extraConfig = { - init.defaultBranch = "master"; - }; - }; - - programs.gh = { - enable = true; - # Why the *fuck* are these packages as opposed to GitHub links??? - extensions = with pkgs; [ - gh-actions-cache - ]; - }; - - programs.gitui.enable = true; -} diff --git a/nix/system/default.nix b/nix/hosts/alymac/default.nix similarity index 79% rename from nix/system/default.nix rename to nix/hosts/alymac/default.nix index 018abe3..dab5f82 100644 --- a/nix/system/default.nix +++ b/nix/hosts/alymac/default.nix @@ -1,7 +1,5 @@ -{ importAll, ... }: - { - imports = importAll [] ./.; + system.stateVersion = 5; networking = { computerName = "Alyxia's MacBook Pro"; @@ -9,11 +7,6 @@ localHostName = "alymac"; }; - users.users.alyxia = { - name = "alyxia"; - home = "/Users/alyxia"; - }; - # enable the gpg agent by default programs.gnupg.agent.enable = true; @@ -23,4 +16,7 @@ # tailscaled isn't automatically registered as a service that should run on installation. services.tailscale.enable = true; + + # set nixpkgs system + nixpkgs.hostPlatform = "x86_64-darwin"; } diff --git a/nix/lib/default.nix b/nix/lib/default.nix new file mode 100644 index 0000000..58d9962 --- /dev/null +++ b/nix/lib/default.nix @@ -0,0 +1,17 @@ +{ inputs }: +let + lib0 = inputs.nixpkgs.lib; + + myLib = lib0.makeExtensible ( + self: + let + callLib = file: import file { lib = self; }; + in + { + importAll = callLib ./importAll.nix; + } + ); + + lib = myLib.extend (_: _: lib0); +in +lib diff --git a/nix/lib/importAll.nix b/nix/lib/importAll.nix index 2db75b0..770bbe6 100644 --- a/nix/lib/importAll.nix +++ b/nix/lib/importAll.nix @@ -1,15 +1,31 @@ -{ pkgs, ... }: +{ lib }: +let + inherit (lib) + map + filter + path + attrNames + filterAttrs + pathExists + elem + match + ; -exclude: cwd: with builtins; with pkgs.lib; filter - (e: !elem e exclude) - (map - (p: path.append cwd p) - (attrNames (attrsets.filterAttrs - (p: t: + inherit (builtins) readDir baseNameOf; +in +exclude: cwd: +filter (e: !elem e exclude) ( + map (p: path.append cwd p) ( + attrNames ( + filterAttrs ( + p: t: let d = t == "directory"; b = baseNameOf p; in - d && pathExists (path.append cwd (p + "/default.nix")) || - !d && match ''.*\.nix'' b != null && b != "default.nix") - (readDir cwd)))) + d && pathExists (path.append cwd (p + "/default.nix")) + || !d && match ''.*\.nix'' b != null && b != "default.nix" + ) (readDir cwd) + ) + ) +) diff --git a/nix/modules/common/default.nix b/nix/modules/common/default.nix new file mode 100644 index 0000000..8bdc9b3 --- /dev/null +++ b/nix/modules/common/default.nix @@ -0,0 +1,4 @@ +{ lib, ... }: +{ + imports = lib.importAll [ ] ./.; +} diff --git a/nix/system/nix.nix b/nix/modules/common/nix.nix similarity index 91% rename from nix/system/nix.nix rename to nix/modules/common/nix.nix index 43f97f2..fe3bce3 100644 --- a/nix/system/nix.nix +++ b/nix/modules/common/nix.nix @@ -1,12 +1,16 @@ { pkgs, ... }: - { services.nix-daemon.enable = true; nix = { + # package = inputs.nixpkgs-old.legacyPackages.${pkgs.system}.lix; + settings = { # enable flakes and the `nix` command - experimental-features = [ "nix-command" "flakes" ]; + experimental-features = [ + "nix-command" + "flakes" + ]; # disable the flake registry since it worsens perf flake-registry = pkgs.writers.writeJSON "flakes-empty.json" { @@ -15,9 +19,9 @@ }; # "apply the free optimisations" - auto-optimise-store = true; + # auto-optimise-store = true; - # we need to create some trusted and allwed users so that we can use + # we need to create some trusted and allwed users so that we can use # some features like substituters allowed-users = [ "@wheel" # allow sudo users to mark the following values as trusted @@ -64,6 +68,7 @@ "lexisother.cachix.org-1:/JtVjLzEue9SHlXK0O4ogtZpRpzeLqTwfZpfTIN/N2s=" ]; }; + gc = { automatic = true; options = "--delete-older-than 3d"; diff --git a/nix/modules/common/users.nix b/nix/modules/common/users.nix new file mode 100644 index 0000000..cf7317b --- /dev/null +++ b/nix/modules/common/users.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: +{ + users.users.alyxia = { + name = "alyxia"; + home = if pkgs.stdenv.hostPlatform.isDarwin then "/Users/alyxia" else "/home/alyxia"; + }; +} diff --git a/nix/modules/darwin/default.nix b/nix/modules/darwin/default.nix new file mode 100644 index 0000000..8bdc9b3 --- /dev/null +++ b/nix/modules/darwin/default.nix @@ -0,0 +1,4 @@ +{ lib, ... }: +{ + imports = lib.importAll [ ] ./.; +} diff --git a/nix/system/homebrew.nix b/nix/modules/darwin/homebrew.nix similarity index 77% rename from nix/system/homebrew.nix rename to nix/modules/darwin/homebrew.nix index 99b0fd4..beb98d9 100644 --- a/nix/system/homebrew.nix +++ b/nix/modules/darwin/homebrew.nix @@ -1,5 +1,3 @@ -{ ... }: - { homebrew = { enable = true; @@ -13,19 +11,21 @@ "drud/ddev" "homebrew/cask-versions" "int128/kubelogin" + "the-wineskin-project/wineskin" ]; # Please do not the brew. brews = [ "bear" "coder" - "composer" "croc" "ddev" "deno" "dotnet" "ferium" + "gcc@12" "gradle" + "ijq" "kubelogin" "mkcert" "nss" @@ -37,13 +37,13 @@ # Fyra crap, but from Homebrew because someone doesn't know how to # package libraries in nixpkgs - "appstream-glib" - "glib" - "gobject-introspection" - "gsettings-desktop-schemas" - "gtk4" - "gtksourceview5" - "libgee" + # "appstream-glib" + # "glib" + # "gobject-introspection" + # "gsettings-desktop-schemas" + # "gtk4" + # "gtksourceview5" + # "libgee" ]; casks = [ @@ -51,27 +51,31 @@ "1password-cli" "alt-tab" "android-studio" + "anydesk" "audacity" "background-music" "browserstacklocal" + "clion" "db-browser-for-sqlite" "discord" - "discord-ptb" + "discord@ptb" "docker" - "dolphin@dev" "firefox" - "firefox-developer-edition" + "firefox@developer-edition" + "fleet" "goland" "google-chrome" + "imhex" + "insomnia" "intellij-idea" "itch" "iterm2" "lens" "minecraft" "obs" + "obsidian" "orbstack" "phpstorm" - "plexamp" "qbittorrent" "raycast" "readdle-spark" @@ -88,6 +92,7 @@ "typora" "visual-studio-code" "wine-stable" + "wineskin" ]; }; } diff --git a/nix/system/preferences.nix b/nix/modules/darwin/preferences.nix similarity index 95% rename from nix/system/preferences.nix rename to nix/modules/darwin/preferences.nix index 7d52f4c..c56c187 100644 --- a/nix/system/preferences.nix +++ b/nix/modules/darwin/preferences.nix @@ -1,5 +1,3 @@ -{ ... }: - { system.defaults = { ActivityMonitor = { @@ -14,8 +12,8 @@ NSNavPanelExpandedStateForSaveMode = true; NSNavPanelExpandedStateForSaveMode2 = true; - KeyRepeat = 1; - InitialKeyRepeat = 10; + KeyRepeat = 6; + InitialKeyRepeat = 25; }; LaunchServices.LSQuarantine = false; diff --git a/nix/overlays/lix.nix b/nix/overlays/lix.nix deleted file mode 100644 index f44f23b..0000000 --- a/nix/overlays/lix.nix +++ /dev/null @@ -1,12 +0,0 @@ -(final: prev: { - lix = prev.lix.overrideAttrs (oldAttrs: { - postPatch = (oldAttrs.postPatch or "") + '' - substituteInPlace src/libmain/shared.cc \ - --replace-fail "(Lix, like Nix)" "but for lesbians" - ''; - - # WARNING: This greatly assumes that lix will never merge a CL that breaks - # the tests. But I choose to disable them anyway because the build time is faster - doCheck = false; - }); -}) diff --git a/nvim/.luarc.json b/nvim/.luarc.json new file mode 100644 index 0000000..8c8dd32 --- /dev/null +++ b/nvim/.luarc.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", + "runtime.version": "LuaJIT", + "diagnostics.globals": ["vim"], + "diagnostics.disable": ["empty-block", "duplicate-set-field", "inject-field"], + "diagnostics.unusedLocalExclude": ["_*"] +} diff --git a/nvim/.stylua.toml b/nvim/.stylua.toml new file mode 100644 index 0000000..4573b87 --- /dev/null +++ b/nvim/.stylua.toml @@ -0,0 +1,9 @@ +syntax = "LuaJIT" +column_width = 100 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferSingle" +call_parentheses = "Always" +space_after_function_names = "Never" +collapse_simple_statement = "Always" diff --git a/nvim/.vintrc.yml b/nvim/.vintrc.yml new file mode 100644 index 0000000..64f8063 --- /dev/null +++ b/nvim/.vintrc.yml @@ -0,0 +1,7 @@ +cmdargs: + severity: style_problem + env: + neovim: true +policies: + ProhibitSetNoCompatible: + enabled: false diff --git a/nvim/after/ftplugin/dream.vim b/nvim/after/ftplugin/dream.vim index 50703e1..51638a8 100644 --- a/nvim/after/ftplugin/dream.vim +++ b/nvim/after/ftplugin/dream.vim @@ -1 +1 @@ -execute 'source' fnameescape(g:k_dotfiles_dir) . '/dmitmel-dotfiles/nvim/after/ftplugin/text.vim' +execute 'source' fnameescape(g:a_dotfiles_dir) . '/dmitmel-dotfiles/nvim/after/ftplugin/text.vim' diff --git a/nvim/after/lsp/bashls.lua b/nvim/after/lsp/bashls.lua new file mode 100644 index 0000000..e9bc27d --- /dev/null +++ b/nvim/after/lsp/bashls.lua @@ -0,0 +1,16 @@ +-- + +---@type dotfiles.lsp.Config +return { + cmd = { 'bash-language-server', 'start' }, + filetypes = { 'bash', 'sh' }, + root_markers = { '.git' }, + + settings = { + bashIde = { + globPattern = '*@(.sh|.bash)', + }, + }, + + build_settings = function(ctx) ctx.settings:merge(ctx.new_settings:pick({ 'bashIde' })) end, +} diff --git a/nvim/after/lsp/biome.lua b/nvim/after/lsp/biome.lua new file mode 100644 index 0000000..a1ccc0e --- /dev/null +++ b/nvim/after/lsp/biome.lua @@ -0,0 +1,5 @@ +---@type dotfiles.lsp.Config +return { + -- why aren't they configuring this??? + root_markers = { 'biome.json', 'biome.jsonc' }, +} diff --git a/nvim/after/lsp/php.lua b/nvim/after/lsp/php.lua new file mode 100644 index 0000000..f85e3c5 --- /dev/null +++ b/nvim/after/lsp/php.lua @@ -0,0 +1,9 @@ +-- + +---@type dotfiles.lsp.Config +return { + cmd = { 'phpactor', 'language-server' }, + filetypes = { 'php' }, + root_markers = { '.git', 'composer.json', '.phpactor.json', '.phpactor.yml' }, + workspace_required = true, +} diff --git a/nvim/after/plugin/keybinds.vim b/nvim/after/plugin/keybinds.vim deleted file mode 100644 index 46efcf3..0000000 --- a/nvim/after/plugin/keybinds.vim +++ /dev/null @@ -1,4 +0,0 @@ -nnoremap ff Telescope find_files -nnoremap fg Telescope live_grep -nnoremap fb Telescope buffers -nnoremap fh Telescope help_tags diff --git a/nvim/coc-languages/go.vim b/nvim/coc-languages/go.vim deleted file mode 100644 index d838559..0000000 --- a/nvim/coc-languages/go.vim +++ /dev/null @@ -1,2 +0,0 @@ -call extend(g:dotfiles_coc_extensions, {'coc-go': 1}) -call extend(g:dotfiles_coc_filetypes, {'go': 1}) diff --git a/nvim/coc-languages/javascript.vim b/nvim/coc-languages/javascript.vim deleted file mode 100644 index 6996f0d..0000000 --- a/nvim/coc-languages/javascript.vim +++ /dev/null @@ -1 +0,0 @@ -let g:coc_user_config['prettier']['printWidth'] = 80 diff --git a/nvim/coc-languages/lisp.vim b/nvim/coc-languages/lisp.vim deleted file mode 100644 index bb594d3..0000000 --- a/nvim/coc-languages/lisp.vim +++ /dev/null @@ -1,2 +0,0 @@ -call extend(g:dotfiles_coc_extensions, {'coc-cl': 1}) -call extend(g:dotfiles_coc_filetypes, {'lisp': 1}) diff --git a/nvim/coc-languages/lua.vim b/nvim/coc-languages/lua.vim deleted file mode 100644 index c8c8489..0000000 --- a/nvim/coc-languages/lua.vim +++ /dev/null @@ -1,10 +0,0 @@ -if !has('nvim-0.2.1') | finish | endif -call extend(g:dotfiles_coc_extensions, {'coc-stylua': 1}) -let g:coc_user_config['coc.preferences.formatOnSaveFiletypes'] = ['lua'] - -" We're using Nix here, so point to the right path... -if has('macunix') - let g:coc_user_config['stylua.styluaPath'] = "/etc/profiles/per-user/alyxia/bin/stylua" -else - let g:coc_user_config['stylua.styluaPath'] = "/usr/bin/stylua" -endif diff --git a/nvim/coc-languages/php.vim b/nvim/coc-languages/php.vim deleted file mode 100644 index ad91d65..0000000 --- a/nvim/coc-languages/php.vim +++ /dev/null @@ -1,2 +0,0 @@ -call extend(g:dotfiles_coc_extensions, {'coc-phpls': 1, 'coc-blade': 1, 'coc-tighten-lint': 1}) -call extend(g:dotfiles_coc_filetypes, {'php': 1, 'blade': 1}) diff --git a/nvim/coc-languages/sh.vim b/nvim/coc-languages/sh.vim deleted file mode 100644 index c85456d..0000000 --- a/nvim/coc-languages/sh.vim +++ /dev/null @@ -1,2 +0,0 @@ -call extend(g:dotfiles_coc_extensions, {'coc-sh': 1}) -call extend(g:dotfiles_coc_filetypes, {'sh': 1, 'zsh': 1}) diff --git a/nvim/coc-languages/tex.vim b/nvim/coc-languages/tex.vim deleted file mode 100644 index a64c73e..0000000 --- a/nvim/coc-languages/tex.vim +++ /dev/null @@ -1,2 +0,0 @@ -call extend(g:dotfiles_coc_extensions, {'coc-vimtex': 1}) -call extend(g:dotfiles_coc_filetypes, {'tex': 1, 'cls': 1}) diff --git a/nvim/dotfiles/lspconfigs/dart.lua b/nvim/dotfiles/lspconfigs/dart.lua deleted file mode 100644 index d7674ef..0000000 --- a/nvim/dotfiles/lspconfigs/dart.lua +++ /dev/null @@ -1,4 +0,0 @@ -local ignition = require("dotfiles.lsp.ignition") -local dartls_config = require("lspconfig.server_configurations.dartls").default_config - -ignition.setup_config("dartls", dartls_config) diff --git a/nvim/dotfiles/lspconfigs/php.lua b/nvim/dotfiles/lspconfigs/php.lua deleted file mode 100644 index 2effbad..0000000 --- a/nvim/dotfiles/lspconfigs/php.lua +++ /dev/null @@ -1,4 +0,0 @@ -local ignition = require("dotfiles.lsp.ignition") -local phpactor_config = require("lspconfig.server_configurations.phpactor").default_config - -ignition.setup_config("phpactor", phpactor_config) diff --git a/nvim/dotfiles/plugins-list.lua b/nvim/dotfiles/plugins-list.lua new file mode 100644 index 0000000..56cb46a --- /dev/null +++ b/nvim/dotfiles/plugins-list.lua @@ -0,0 +1,5 @@ +-- Not really part of the "plugins list" per-se, for the actual plugin list see `plugins-list.vim`. + +dotplug.plug({ + { import = 'adotfiles.plugins' }, +}) diff --git a/nvim/dotfiles/plugins-list.vim b/nvim/dotfiles/plugins-list.vim index 259f3e4..d36523c 100644 --- a/nvim/dotfiles/plugins-list.vim +++ b/nvim/dotfiles/plugins-list.vim @@ -1,71 +1,40 @@ -let s:plug = funcref('dotfiles#plugman#register') +exe dotplug#define_plug_here() " UI {{{ if has('nvim') - call s:plug('romgrk/barbar.nvim') - call s:plug('hoob3rt/lualine.nvim') + Plug 'romgrk/barbar.nvim' + Plug 'hoob3rt/lualine.nvim' endif " }}} " Navigation {{{ if has('nvim') - call s:plug('nvim-telescope/telescope.nvim') " dependencies {{{ - call s:plug('nvim-lua/plenary.nvim') - " }}} + Plug 'nvim-telescope/telescope.nvim', { +\ 'requires': [ +\ 'nvim-lua/plenary.nvim' +\ ] +\ } endif " }}} " Files {{{ if has('nvim') - call s:plug('kyazdani42/nvim-web-devicons') - call s:plug('akinsho/nvim-toggleterm.lua') + Plug 'kyazdani42/nvim-web-devicons' + Plug 'akinsho/nvim-toggleterm.lua' endif - call s:plug('preservim/nerdtree') - call s:plug('antoyo/vim-licenses') + Plug 'preservim/nerdtree' + Plug 'antoyo/vim-licenses' " }}} " Language specific {{{ - if has('nvim') - call s:plug('xiyaowong/coc-nvim-lua') - call s:plug('alaviss/nim.nvim') - if has('unix') - call s:plug('nvim-neorg/neorg') " dependencies {{{ - call s:plug('nvim-treesitter/nvim-treesitter', { 'do': ':TSUpdate' }) - " }}} - endif - endif - call s:plug('lervag/vimtex') - call s:plug('stevearc/vim-arduino') - call s:plug('luke-gru/vim-riml') - call s:plug('guns/vim-sexp') - call s:plug('vim-scripts/newlisp') - call s:plug('m-pilia/vim-mediawiki') - call s:plug('aquach/vim-mediawiki-editor') - call s:plug('noahfrederick/vim-laravel') " dependencies {{{ - call s:plug('noahfrederick/vim-composer') - call s:plug('tpope/vim-projectionist') - call s:plug('tpope/vim-dispatch') - " }}} - call s:plug('rescript-lang/vim-rescript') -" }}} - -" coc {{{ - if g:dotfiles_build_coc_from_source - call s:plug('https://github.com/UltiRequiem/coc-cl', { 'do': 'yarn install --frozen-lockfile && yarn build' }) - endif -" }}} - -" mini.nvim {{{ - call s:plug('echasnovski/mini.pairs') + Plug 'lervag/vimtex' + Plug 'm-pilia/vim-mediawiki' + Plug 'aquach/vim-mediawiki-editor' + Plug 'davidmh/mdx.nvim' " }}} " Misc {{{ - if has('nvim') - call s:plug('andweeb/presence.nvim') - if has('nvim-0.6.0') - call s:plug('github/copilot.vim') - endif - endif - call s:plug('junegunn/vader.vim') - call s:plug('wakatime/vim-wakatime') + Plug 'wakatime/vim-wakatime' " }}} + +delcommand Plug diff --git a/nvim/ftdetect/dotfiles.lua b/nvim/ftdetect/dotfiles.lua new file mode 100644 index 0000000..08ee3e3 --- /dev/null +++ b/nvim/ftdetect/dotfiles.lua @@ -0,0 +1,5 @@ +vim.filetype.add({ + extension = { + mdx = 'mdx' + } +}) diff --git a/nvim/ftdetect/dotfiles.vim b/nvim/ftdetect/dotfiles.vim index c120a2d..b6b5926 100644 --- a/nvim/ftdetect/dotfiles.vim +++ b/nvim/ftdetect/dotfiles.vim @@ -1,10 +1,2 @@ -function! s:genSrcInfo() - :call system('rm -rf .SRCINFO; makepkg --printsrcinfo > .SRCINFO') -endfunction - -augroup dotfilesftdetect - autocmd BufWritePost PKGBUILD :call s:genSrcInfo() - - autocmd BufNewFile,BufRead *.dream setf dream - autocmd BufNewFile,BufRead *.newlisp setf newlisp -augroup END +autocmd BufNewFile,BufRead *.dream setf dream +autocmd BufNewFile,BufRead *.newlisp setf newlisp diff --git a/nvim/ftplugin/PKGBUILD.vim b/nvim/ftplugin/PKGBUILD.vim new file mode 100644 index 0000000..6f28e47 --- /dev/null +++ b/nvim/ftplugin/PKGBUILD.vim @@ -0,0 +1,5 @@ +function! s:genSrcInfo() + :call system('rm -rf .SRCINFO; makepkg --printsrcinfo > .SRCINFO') +endfunction + +autocmd BufWritePost PKGBUILD :call s:genSrcInfo() diff --git a/nvim/ftplugin/mdx.vim b/nvim/ftplugin/mdx.vim new file mode 100644 index 0000000..4249185 --- /dev/null +++ b/nvim/ftplugin/mdx.vim @@ -0,0 +1,8 @@ +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +" Taken from $VIMRUNTIME/ftplugin/javascript.vim +exe dotfiles#ft#setlocal('comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://') +exe dotfiles#ft#setlocal('commentstring=//\ %s') diff --git a/nvim/ideavimrc b/nvim/ideavimrc new file mode 100644 index 0000000..433f430 --- /dev/null +++ b/nvim/ideavimrc @@ -0,0 +1,48 @@ +" vim:ft=vim +" .ideavimrc is a configuration file for IdeaVim plugin. It uses +" the same commands as the original .vimrc configuration. +" You can find a list of commands here: https://jb.gg/h38q75 +" Find more examples here: https://jb.gg/share-ideavimrc + + +" Show a few lines of context around the cursor. Note that this makes the +" text scroll if you mouse-click near the start or end of the window. +set scrolloff=5 + +" Do incremental searching. +set incsearch + +set number " show current line number +set relativenumber " show relative line numbers + +" Don't use Ex mode, use Q for formatting. +map Q gq + +" --- Enable IdeaVim plugins https://jb.gg/ideavim-plugins +" Highlight copied text +Plug 'machakann/vim-highlightedyank' +" Commentary plugin +Plug 'tpope/vim-commentary' + +Plug 'terryma/vim-multiple-cursors' +" vim-multiple-cursors default mappings {{{ +" Remap multiple-cursors shortcuts to match terryma/vim-multiple-cursors +nmap NextWholeOccurrence +xmap NextWholeOccurrence +nmap g NextOccurrence +xmap g NextOccurrence +xmap SkipOccurrence +xmap RemoveOccurrence + +" Note that the default and g shortcuts don't work on Mac due to dead keys. +" is used to enter accented text e.g. ñ +" Feel free to pick your own mappings that are not affected. I like to use +nmap AllWholeOccurrences +xmap AllWholeOccurrences +nmap g AllOccurrences +xmap g AllOccurrences +" }}} + + +"" -- Map IDE actions to IdeaVim -- https://jb.gg/abva4t +map \r (ReformatCode) diff --git a/nvim/init.lua b/nvim/init.lua deleted file mode 100644 index a9decd1..0000000 --- a/nvim/init.lua +++ /dev/null @@ -1,14 +0,0 @@ --- Disable airline to use barbar -vim.g.loaded_airline = 1 - --- TODO: Refactor to Lua --- This has stopped working...? --- let g:dotfiles_plugin_manager_inhibited_plugins = { --- \ 'vim-airline': 1, --- \ } - --- Small plugin configs -vim.g.dashboard_default_executive ='fzf' - --- Styling -vim.o.termguicolors = true diff --git a/nvim/init.vim b/nvim/init.vim index d16d87e..ab06f72 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,26 +1,20 @@ -let g:k_nvim_dotfiles_dir = expand(':p:h') -let g:k_dotfiles_dir = expand(':p:h:h') -let &runtimepath = g:k_nvim_dotfiles_dir.','.&runtimepath.','.g:k_nvim_dotfiles_dir.'/after' +" Add my paths to the rtp +let g:a_nvim_dotfiles_dir = expand(':p:h') +let g:a_dotfiles_dir = expand(':p:h:h') +let &runtimepath = g:a_nvim_dotfiles_dir.','.&runtimepath.','.g:a_nvim_dotfiles_dir.'/after' -let g:vim_ide = 1 +" dotfiles configuration +let g:vim_ide = 2 let g:dotfiles_rainbow_indent_opacity = 0.5 - -" Inhibited plugins {{{ - " I'd love to use dotfiles#plugman#inhibit in my plugins-list.vim but by that - " point it is already too late. - let g:dotfiles#plugman#inhibited_plugins = {} - - " Does not do its job properly anymore, I'm afraid. - let g:dotfiles#plugman#inhibited_plugins["delimitMate"] = 1 -" }}} +let g:dotfiles_treesitter_highlighting = v:true +let g:dotfiles_highlight_url_under_cursor = v:true source :p:h/../dmitmel-dotfiles/nvim/init.vim -if has('nvim') - luafile :p:h/init.lua -else - set termguicolors -endif +let g:loaded_airline = 1 + +" Doesn't hurt to try and set again. +set termguicolors " Arrow key fix kanged from {{{ if exists("g:HELP_MY_ARROW_KEYS_ARE_BROKEN") diff --git a/nvim/lua/adotfiles/plugins/blink.lua b/nvim/lua/adotfiles/plugins/blink.lua new file mode 100644 index 0000000..5eaae79 --- /dev/null +++ b/nvim/lua/adotfiles/plugins/blink.lua @@ -0,0 +1,18 @@ +---@type LazySpec +return { + 'blink.cmp', + ---@type blink.cmp.Config + opts = { + keymap = { + [''] = { + 'select_next', + 'fallback', + }, + + [''] = { + 'select_prev', + 'fallback', + }, + }, + }, +} diff --git a/nvim/lua/kdotfiles/utils.lua b/nvim/lua/kdotfiles/utils.lua deleted file mode 100644 index 17e4ef7..0000000 --- a/nvim/lua/kdotfiles/utils.lua +++ /dev/null @@ -1,28 +0,0 @@ -local M = require('dotfiles.autoload')('kdotfiles.utils') - -function M.file_exists(file) - local f = io.open(file, "rb") - if f then f:close() end - return f ~= nil -end - -function M.lines_from(file) - if not M.file_exists(file) then return {} end - lines = {} - for line in io.lines(file) do - lines[#lines + 1] = line - end - return lines -end - -function M.get_os(lines) - os_name = "Unknown" - for k,v in pairs(lines) do - if string.match(v, "^ID=") then - os_name = string.sub(v, 4) - end - end - return os_name -end - -return M diff --git a/nvim/plugin/barbar.lua b/nvim/plugin/barbar.lua index cbaa758..e1b5f5b 100644 --- a/nvim/plugin/barbar.lua +++ b/nvim/plugin/barbar.lua @@ -1,18 +1,23 @@ local ok, barbar = pcall(require, 'barbar') -if not ok then return end; +if not ok then return end -barbar.setup { +---@diagnostic disable: missing-fields + +barbar.setup({ icons = { buffer_index = true, filetype = { - enabled = true - } - } -} + enabled = true, + }, + }, +}) --[[@as barbar.config.options]] local map = vim.api.nvim_set_keymap local opts = { noremap = true, silent = true } +map('n', '', 'BufferNext', opts) +map('n', '', 'BufferPrevious', opts) + -- Navigating buffers map('n', '', 'BufferPrevious', opts) map('n', '', 'BufferNext', opts) diff --git a/nvim/plugin/commands.vim b/nvim/plugin/commands.vim index 7842ea6..f38449c 100644 --- a/nvim/plugin/commands.vim +++ b/nvim/plugin/commands.vim @@ -1 +1,3 @@ -command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') +if !(dotplug#has('coc.nvim') && g:vim_ide == 1) + command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport') +endif diff --git a/nvim/plugin/completion.vim b/nvim/plugin/completion.vim new file mode 100644 index 0000000..824849f --- /dev/null +++ b/nvim/plugin/completion.vim @@ -0,0 +1,23 @@ +if !(dotplug#has('coc.nvim') && g:vim_ide == 1) | finish | endif + +" Additional extensions {{{ +" Go +call dotutils#add_unique(g:coc_global_extensions, 'coc-go') +" Common Lisp +call dotutils#add_unique(g:coc_global_extensions, 'coc-cl') +" PHP +call dotutils#add_unique(g:coc_global_extensions, 'coc-phpls') +call dotutils#add_unique(g:coc_global_extensions, 'coc-blade') +call dotutils#add_unique(g:coc_global_extensions, 'coc-tighten-lint') +" Shell +call dotutils#add_unique(g:coc_global_extensions, 'coc-sh') +" TeX +call dotutils#add_unique(g:coc_global_extensions, 'coc-vimtex') +" Vue +call dotutils#add_unique(g:coc_global_extensions, '@yaegassy/coc-volar') +" }}} + +" Config {{{ +let g:coc_user_config['prettier'] = {} +let g:coc_user_config['prettier']['printWidth'] = 80 +" }}} diff --git a/nvim/plugin/keybinds.vim b/nvim/plugin/keybinds.vim index d6dbc8d..cc331dd 100644 --- a/nvim/plugin/keybinds.vim +++ b/nvim/plugin/keybinds.vim @@ -1,23 +1,33 @@ nnoremap :NERDTreeToggle +inoremap db + " Completion {{{ - function! s:check_back_space() abort - let col = col('.') - 1 - return !col || getline('.')[col - 1] =~ '\s' - endfunction + if (dotplug#has('coc.nvim') && g:vim_ide == 1) + function! s:check_back_space() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' + endfunction - nmap (coc-codeaction-line) - xmap (coc-codeaction-selected) + nmap (coc-codeaction-line) + xmap (coc-codeaction-selected) - inoremap coc#pum#visible() ? coc#pum#confirm() : "\" + inoremap coc#pum#visible() ? coc#pum#confirm() + \: "\u\\=coc#on_enter()\" - inoremap - \ coc#pum#visible() ? coc#pum#next(1): - \ check_back_space() ? "\" : - \ coc#refresh() - inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" + inoremap + \ coc#pum#visible() ? coc#pum#next(1) : + \ check_back_space() ? "\" : + \ coc#refresh() + inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" + endif " }}} +nnoremap ff Telescope find_files +nnoremap fg Telescope live_grep +nnoremap fb Telescope buffers +nnoremap fh Telescope help_tags + " Copy to clipboard register and paste from clipboard register {{{ " Taken from https://unix.stackexchange.com/a/23437 nnoremap "+y diff --git a/nvim/plugin/lualine.lua b/nvim/plugin/lualine.lua index d281582..70ad855 100644 --- a/nvim/plugin/lualine.lua +++ b/nvim/plugin/lualine.lua @@ -1,12 +1,14 @@ +local ok, lualine = pcall(require, 'lualine') +if not ok then return end; + local dotfiles_gruv = require'lualine.themes.gruvbox' local theme = require'dotfiles.colorscheme' -- https://github.com/dmitmel/dotfiles/commit/bf96e553764e3a166286f5a6a8017e01dadcf6f9 -- https://ptb.discord.com/channels/382339402338402315/382339402338402317/885864846892077086 -function get_color(index) +local function get_color(index) local color = theme.base16_colors[index] - local r, g, b = unpack(color, 1, 3) - return string.format('#%02x%02x%02x', r, g, b) + return string.format('%06x', color.gui) end -- Structure of themes is as follows: @@ -14,21 +16,21 @@ end -- b: secondary components, such git branch info -- c: Middle components, basically everything in the middle -dotfiles_gruv.normal.a.bg = get_color(12) +dotfiles_gruv.normal.a.bg = get_color(11) -dotfiles_gruv.insert.a.bg = get_color(14) -dotfiles_gruv.insert.c.bg = get_color(2) +dotfiles_gruv.insert.a.bg = get_color(13) +dotfiles_gruv.insert.c.bg = get_color(1) -dotfiles_gruv.visual.a.bg = get_color(15) -dotfiles_gruv.visual.c.bg = get_color(2) -dotfiles_gruv.visual.c.fg = get_color(7) +dotfiles_gruv.visual.a.bg = get_color(14) +dotfiles_gruv.visual.c.bg = get_color(1) +dotfiles_gruv.visual.c.fg = get_color(6) -dotfiles_gruv.command.a.bg = get_color(16) +dotfiles_gruv.command.a.bg = get_color(15) dotfiles_gruv.command.c.bg = get_color(2) -dotfiles_gruv.command.c.fg = get_color(7) +dotfiles_gruv.command.c.fg = get_color(6) -dotfiles_gruv.replace.a.bg = get_color(9) -dotfiles_gruv.replace.c.bg = get_color(2) +dotfiles_gruv.replace.a.bg = get_color(8) +dotfiles_gruv.replace.c.bg = get_color(1) -- Displays the currently selected Arduino board local function showBoard() @@ -37,7 +39,7 @@ local function showBoard() end end -require('lualine').setup{ +lualine.setup{ options = { theme = dotfiles_gruv } diff --git a/nvim/plugin/neorg.lua b/nvim/plugin/neorg.lua deleted file mode 100644 index e655840..0000000 --- a/nvim/plugin/neorg.lua +++ /dev/null @@ -1,21 +0,0 @@ -local ok, neorg = pcall(require, 'neorg') -if not ok then return end; - -local ok, cmp = pcall(require, 'cmp') -if not ok then return end; - -local cmp_config = cmp.get_config() -table.insert(cmp_config.sources, { name = "neorg" }) -cmp.setup(cmp_config) - -require('neorg').setup { - load = { - ["core.defaults"] = {}, - ["core.norg.concealer"] = {}, - ["core.norg.completion"] = { - config = { - engine = "nvim-cmp" - } - } - } -} diff --git a/nvim/plugin/nlsp.lua b/nvim/plugin/nlsp.lua new file mode 100644 index 0000000..bb7e3c7 --- /dev/null +++ b/nvim/plugin/nlsp.lua @@ -0,0 +1,10 @@ +local has_lsp, lsp = pcall(require, 'vim.lsp') +if not (has_lsp and lsp.config ~= nil and vim.g.vim_ide == 2) then return end + +require('dotfiles.lsp_ignition').enable({ + 'php', + 'biome', + 'vimls', + 'bashls', + 'mdx_analyzer' +}) diff --git a/nvim/plugin/treesitter.lua b/nvim/plugin/treesitter.lua deleted file mode 100644 index bcdfe6f..0000000 --- a/nvim/plugin/treesitter.lua +++ /dev/null @@ -1,37 +0,0 @@ -local ok, parser_configs = pcall(require, 'nvim-treesitter.parsers') -if not ok then return end - --- Should only really run on my Macbook, as it is my only macOS device. --- Apple's C compilers seem to not want to compile any of Treesitter's --- dialects. --- That is, `cc`, `gcc`, `g++`, andsoforth. Funnily enough, they are all --- aliases to the same program. --- So, the nix-darwin configuration specifies the installation of zig as a --- replacement compiler solely so the Treesitter dialects compile. Very --- intuitive. --- Sadly, the solution only works on my old MacBook pro, which is a 13 inch --- model. So my only option is to lock it down to that device. -if vim.loop.os_uname().sysname == 'Darwin' then - local meta = vim.fn.system({"system_profiler", "SPHardwareDataType"}); - if not string.match(meta, "MacBookPro13,1") then - return - end - - local opts = require('nvim-treesitter.install') - opts.compilers = { "zig" } - opts.command_extra_args = { "--help" } -end - -local parser_configs = parser_configs.get_parser_configs() - -parser_configs.norg = { - install_info = { - url = "https://github.com/nvim-neorg/tree-sitter-norg", - files = { "src/parser.c", "src/scanner.cc" }, - branch = "main" - }, -} - -require('nvim-treesitter.configs').setup { - ensure_installed = { "norg" } -} diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh index f765f91..a575520 100644 --- a/zsh/aliases.zsh +++ b/zsh/aliases.zsh @@ -1,8 +1,14 @@ -alias welcome="welcome --extra-logos-dir $K_ZSH_DOTFILES/../script-resources/welcome/logos" -alias markdown2htmldoc="$K_ZSH_DOTFILES/../scripts/markdown2htmldoc" -alias mediawiki-preview="$K_ZSH_DOTFILES/../scripts/mediawiki-preview" +alias welcome="welcome --extra-logos-dir $A_ZSH_DOTFILES/../script-resources/welcome/logos" +alias markdown2htmldoc="$A_ZSH_DOTFILES/../scripts/markdown2htmldoc" +alias mediawiki-preview="$A_ZSH_DOTFILES/../scripts/mediawiki-preview" alias sail='[ -f sail ] && sh sail || sh vendor/bin/sail' +if command_exists ddev; then + function craft() { + [ -f craft ] && ddev craft $@ || return 1 + } +fi + if (( _is_macos )); then if command_exists exa; then alias ls="exa --classify --group-directories-first" diff --git a/zsh/functions.zsh b/zsh/functions.zsh index c47c5e6..84d653c 100644 --- a/zsh/functions.zsh +++ b/zsh/functions.zsh @@ -1,3 +1,52 @@ #!/usr/bin/env zsh -# + silence() { $1 &>/dev/null } + +# Utility for recovering environment variable files when moving devices, +# provided they are in a central backup dir +function recover-env() { + local PWD="$(pwd)" + local backup_dir="$HOME/Documents/envs" + + if ! [ -d "$backup_dir" ]; then + echo "No backup dir found. Bailing." + return 1 + fi + + local project="$1" + if [ "$#" -eq 0 ] || [ -z "$1" ]; then + echo "No arguments specified, using current folder as project name." + local project="$(basename "$PWD")" + fi + + if ! [ -f "$backup_dir/$project.env" ]; then + echo "No .env file for this project found. Bailing." + return 1 + fi + + cp "$backup_dir/$project.env" "$PWD/.env" + echo "$project.env restored to .env" +} + +# https://github.com/dmitmel/dotfiles/blob/a174ef1556c440ca8cb7ee23bf1731290b9d22ce/zsh/functions.zsh#L114-L134 +SYNC_WORKING_DIR_STORAGE="${ZSH_CACHE_DIR}/last-working-dir" + +autoload -Uz add-zsh-hook +add-zsh-hook chpwd sync_working_dir_chpwd_hook +sync_working_dir_chpwd_hook() { + if [[ "$ZSH_SUBSHELL" == 0 ]]; then + sync_working_dir_save + fi +} + +sync_working_dir_save() { + pwd >| "$SYNC_WORKING_DIR_STORAGE" +} + +sync_working_dir_load() { + local dir + if dir="$(<"$SYNC_WORKING_DIR_STORAGE")" 2>/dev/null && [[ -n "$dir" ]]; then + cd -- "$dir" + fi +} +alias cds="sync_working_dir_load" diff --git a/zsh/zle.zsh b/zsh/zle.zsh new file mode 100644 index 0000000..b5b8268 --- /dev/null +++ b/zsh/zle.zsh @@ -0,0 +1,3 @@ +_fzf_history_list() { + fc -lr 1 | sed "s/^[[:space:]]*[0-9][0-9]*/${${${fg[blue]//\\/\\\\}//\//\\\/}//&/\\&}&${${${reset_color//\\/\\\\}//\//\\\/}//&/\\&}/" +} diff --git a/zsh/zshrc b/zsh/zshrc index 4a43f8a..6461e5f 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -1,23 +1,27 @@ #!/usr/bin/env zsh -# Options for Dima's config -DOTFILES_DISABLE_WELCOME=1 -DOTFILES_SYNC_LAST_WORKING_DIR=1 +# enable KSH globbing, which gives access to things such as !(1|2|3) +setopt ksh_glob # Get this file's current directory and source Dima's zshrc from there -K_ZSH_DOTFILES="$( dirname "$( readlink -f "$0" )" )" -source $K_ZSH_DOTFILES/../dmitmel-dotfiles/zsh/zshrc +A_ZSH_DOTFILES="$( dirname "$( readlink -f "$0" )" )" -for script in functions plugins aliases; do - source "$K_ZSH_DOTFILES/$script.zsh" -done +DOTFILES_SYNC_LAST_WORKING_DIR=1 -if [[ -d "$K_ZSH_DOTFILES/custom" ]]; then - for script in $K_ZSH_DOTFILES/custom/*.zsh; do - source "$script" +_dotfiles_customizations() { + for script in functions plugins aliases zle; do + source "$A_ZSH_DOTFILES/$script.zsh" done -fi -if [[ -z "$KDOTFILES_DISABLE_WELCOME" && -z "$POETRY_ACTIVE" ]]; then - welcome -fi + if [[ -d "$A_ZSH_DOTFILES/custom" ]]; then + for script in $A_ZSH_DOTFILES/custom/*.zsh; do + source "$script" + done + fi + + if [[ -n "$DOTFILES_SYNC_LAST_WORKING_DIR" ]]; then + sync_working_dir_load + fi +} + +source $A_ZSH_DOTFILES/../dmitmel-dotfiles/zsh/zshrc