Compare commits
No commits in common. "efdbd949b895b43014ff119cbd507343a17b3ef7" and "ca860d410f071b09cc53fae98da5b61eac9184d8" have entirely different histories.
efdbd949b8
...
ca860d410f
116 changed files with 5241 additions and 2053 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
result
|
||||||
12
.sops.yaml
12
.sops.yaml
|
|
@ -1,12 +0,0 @@
|
||||||
keys:
|
|
||||||
- &users:
|
|
||||||
- &prunebutt age1r26dvz9zd2ds87clnqd9kxln6hyp9dtyvcfsmp9k894lkws9c49qy3yyrv
|
|
||||||
- &hosts:
|
|
||||||
- &remus age12p2494hhhjcw28w4kg5q3rv3xtv7gmpyxags9s9ta8c3rc0g4qrst20cvw
|
|
||||||
|
|
||||||
creation_rules:
|
|
||||||
- path_regex: secrets/secrets.json$
|
|
||||||
key_groups:
|
|
||||||
- age:
|
|
||||||
- *prunebutt
|
|
||||||
- *remus
|
|
||||||
252
LICENSE
252
LICENSE
|
|
@ -1,232 +1,20 @@
|
||||||
GNU GENERAL PUBLIC LICENSE
|
Copyright (c) 2024 Nicolas Goudry
|
||||||
Version 3, 29 June 2007
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
Preamble
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
The GNU General Public License is a free, copyleft license for software and other kinds of works.
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
|
|
||||||
|
|
||||||
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
|
|
||||||
|
|
||||||
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
|
|
||||||
|
|
||||||
The precise terms and conditions for copying, distribution and modification follow.
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
0. Definitions.
|
|
||||||
|
|
||||||
“This License” refers to version 3 of the GNU General Public License.
|
|
||||||
|
|
||||||
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
|
|
||||||
|
|
||||||
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
|
|
||||||
|
|
||||||
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
|
|
||||||
|
|
||||||
A “covered work” means either the unmodified Program or a work based on the Program.
|
|
||||||
|
|
||||||
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
|
|
||||||
|
|
||||||
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
|
|
||||||
|
|
||||||
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
|
|
||||||
|
|
||||||
1. Source Code.
|
|
||||||
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
|
|
||||||
|
|
||||||
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
|
|
||||||
|
|
||||||
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
|
|
||||||
|
|
||||||
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
|
|
||||||
|
|
||||||
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
|
|
||||||
|
|
||||||
The Corresponding Source for a work in source code form is that same work.
|
|
||||||
|
|
||||||
2. Basic Permissions.
|
|
||||||
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
|
|
||||||
|
|
||||||
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
|
|
||||||
|
|
||||||
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
|
|
||||||
|
|
||||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
|
||||||
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
|
|
||||||
|
|
||||||
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
|
|
||||||
|
|
||||||
4. Conveying Verbatim Copies.
|
|
||||||
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
|
|
||||||
|
|
||||||
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
|
|
||||||
|
|
||||||
5. Conveying Modified Source Versions.
|
|
||||||
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
|
|
||||||
|
|
||||||
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
|
|
||||||
|
|
||||||
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
|
|
||||||
|
|
||||||
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
|
|
||||||
|
|
||||||
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
|
|
||||||
|
|
||||||
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
|
|
||||||
|
|
||||||
6. Conveying Non-Source Forms.
|
|
||||||
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
|
|
||||||
|
|
||||||
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
|
|
||||||
|
|
||||||
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
|
|
||||||
|
|
||||||
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
|
|
||||||
|
|
||||||
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
|
|
||||||
|
|
||||||
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
|
|
||||||
|
|
||||||
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
|
|
||||||
|
|
||||||
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
|
|
||||||
|
|
||||||
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
|
|
||||||
|
|
||||||
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
|
|
||||||
|
|
||||||
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
|
|
||||||
|
|
||||||
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
|
|
||||||
|
|
||||||
7. Additional Terms.
|
|
||||||
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
|
|
||||||
|
|
||||||
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
|
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
|
|
||||||
|
|
||||||
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
|
|
||||||
|
|
||||||
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
|
|
||||||
|
|
||||||
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
|
|
||||||
|
|
||||||
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
|
|
||||||
|
|
||||||
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
|
|
||||||
|
|
||||||
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
|
|
||||||
|
|
||||||
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
|
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
|
|
||||||
|
|
||||||
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
|
|
||||||
|
|
||||||
8. Termination.
|
|
||||||
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
|
|
||||||
|
|
||||||
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
|
|
||||||
|
|
||||||
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
|
|
||||||
|
|
||||||
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
|
|
||||||
|
|
||||||
9. Acceptance Not Required for Having Copies.
|
|
||||||
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
|
|
||||||
|
|
||||||
10. Automatic Licensing of Downstream Recipients.
|
|
||||||
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
|
|
||||||
|
|
||||||
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
|
|
||||||
|
|
||||||
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
|
|
||||||
|
|
||||||
11. Patents.
|
|
||||||
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
|
|
||||||
|
|
||||||
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
|
|
||||||
|
|
||||||
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
|
|
||||||
|
|
||||||
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
|
|
||||||
|
|
||||||
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
|
|
||||||
|
|
||||||
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
|
|
||||||
|
|
||||||
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
|
|
||||||
|
|
||||||
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
|
|
||||||
|
|
||||||
12. No Surrender of Others' Freedom.
|
|
||||||
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
|
|
||||||
|
|
||||||
13. Use with the GNU Affero General Public License.
|
|
||||||
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
|
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
|
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
|
|
||||||
|
|
||||||
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
|
|
||||||
|
|
||||||
15. Disclaimer of Warranty.
|
|
||||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
|
||||||
|
|
||||||
16. Limitation of Liability.
|
|
||||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
||||||
|
|
||||||
17. Interpretation of Sections 15 and 16.
|
|
||||||
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
|
|
||||||
|
|
||||||
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
|
|
||||||
|
|
||||||
nixConfig
|
|
||||||
Copyright (C) 2024 prunebutt
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
|
||||||
|
|
||||||
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
|
|
||||||
|
|
||||||
nixConfig Copyright (C) 2024 prunebutt
|
|
||||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
||||||
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
|
|
||||||
|
|
||||||
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
|
|
||||||
|
|
||||||
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
|
|
||||||
|
|
|
||||||
60
README.md
60
README.md
|
|
@ -1,3 +1,59 @@
|
||||||
# nixConfig
|
# NixVim config
|
||||||
|
|
||||||
My nix config
|
**PERSONAL** configuration for [Neovim](https://neovim.io/) using [Nixvim](https://nix-community.github.io/nixvim/). Heavily inspired by [AstroNvim](https://astronvim.com/).
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> This project uses the [flake system](https://nixos.wiki/wiki/Flakes) and is not intended to be used without Flakes.
|
||||||
|
|
||||||
|
The [flake](./flake.nix) exports two packages:
|
||||||
|
|
||||||
|
* `default`: Nixvim package built from the configuration files
|
||||||
|
* `lite`: Same as above, without the LSP stuff
|
||||||
|
|
||||||
|
> [!WARNING]
|
||||||
|
> 🚧 **This is a work in progress** 🚧
|
||||||
|
|
||||||
|
## 📥 Installation
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
inputs.nixvim-config.url = "github:nicolas-goudry/nixvim-config";
|
||||||
|
|
||||||
|
outputs = { nixvim-config, ... }: {
|
||||||
|
overlays.additions = final: _prev: {
|
||||||
|
nixvim = nixvim-config.packages.${_prev.system}.default;
|
||||||
|
|
||||||
|
# Or use the lite version
|
||||||
|
# nixvim = nixvim-config.packages.${_prev.system}.lite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🍱 Structure
|
||||||
|
|
||||||
|
The config is mainly split in two directories:
|
||||||
|
|
||||||
|
* [plugins](./plugins): Nixvim plugins configuration, using a custom load mechanism
|
||||||
|
* [config](./config): nvim configuration (like options, global keymaps, etc)
|
||||||
|
|
||||||
|
Other configuration attributes may be found in [`default.nix`](./default.nix) if they don’t justify being in a separate file.
|
||||||
|
|
||||||
|
### 🥣 Configuration
|
||||||
|
|
||||||
|
The configuration is split in multiple files organized by “topic” in the [config](./config) directory. These are auto-`import`ed in the main [`default.nix`](./default.nix) file.
|
||||||
|
|
||||||
|
### 🥢 Plugins
|
||||||
|
|
||||||
|
The plugins are not explicitly declared as Nixvim `plugins.<plugin>` attributes. Instead, they are looked up in and loaded from the [plugins](./plugins) directory.
|
||||||
|
|
||||||
|
In short, a lambda will read the files in the directory and use the filename to assign a plugin to the right attribute. Example: `telescope.nix` will be loaded in `config.plugins.telescope`. Custom plugins are also supported, read further.
|
||||||
|
|
||||||
|
Each plugin file must export a lambda, which is called with an attribute set containing the `nixpkgs`'s library as `lib`. Plugins may or may not use it. It must return an attribute set which can contain the following attributes:
|
||||||
|
|
||||||
|
* `opts`: plugin options as expected by Nixvim
|
||||||
|
* `rootOpts`: extra options for the root Nixvim `config` attribute
|
||||||
|
* this allows to further configure the plugin if it doesn’t expose a given option
|
||||||
|
* `extra`: custom plugin not supported by Nixvim
|
||||||
|
* `extra.packages`: list of packages to be added as `extraPlugins` (ie. `vimPlugins.<plugin>`)
|
||||||
|
* `extra.config`: plugin configuration in lua
|
||||||
|
|
|
||||||
380
config/autocmds.nix
Normal file
380
config/autocmds.nix
Normal file
|
|
@ -0,0 +1,380 @@
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua
|
||||||
|
{
|
||||||
|
autoGroups = {
|
||||||
|
auto_quit.clear = true;
|
||||||
|
autoview.clear = true;
|
||||||
|
bufferline.clear = true;
|
||||||
|
checktime.clear = true;
|
||||||
|
create_dir.clear = true;
|
||||||
|
editorconfig_filetype.clear = true;
|
||||||
|
file_user_events.clear = true;
|
||||||
|
highlighturl.clear = true;
|
||||||
|
highlightyank.clear = true;
|
||||||
|
large_buf_settings.clear = true;
|
||||||
|
q_close_windows.clear = true;
|
||||||
|
terminal_settings.clear = true;
|
||||||
|
unlist_quickfix.clear = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
autoCmd = [
|
||||||
|
# auto_quit
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua#L18-L46
|
||||||
|
{
|
||||||
|
desc = "Quit neovim if more than one window is open and only sidebar windows are list";
|
||||||
|
event = "BufEnter";
|
||||||
|
group = "auto_quit";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function()
|
||||||
|
local wins = vim.api.nvim_tabpage_list_wins(0)
|
||||||
|
-- Both neo-tree and aerial will auto-quit if there is only a single window left
|
||||||
|
if #wins <= 1 then return end
|
||||||
|
local sidebar_fts = { aerial = true, ["neo-tree"] = true }
|
||||||
|
for _, winid in ipairs(wins) do
|
||||||
|
if vim.api.nvim_win_is_valid(winid) then
|
||||||
|
local bufnr = vim.api.nvim_win_get_buf(winid)
|
||||||
|
local filetype = vim.bo[bufnr].filetype
|
||||||
|
-- If any visible windows are not sidebars, early return
|
||||||
|
if not sidebar_fts[filetype] then
|
||||||
|
return
|
||||||
|
-- If the visible window is a sidebar
|
||||||
|
else
|
||||||
|
-- only count filetypes once, so remove a found sidebar from the detection
|
||||||
|
sidebar_fts[filetype] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #vim.api.nvim_list_tabpages() > 1 then
|
||||||
|
vim.cmd.tabclose()
|
||||||
|
else
|
||||||
|
vim.cmd.qall()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
# autoview
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua#L49-L70
|
||||||
|
{
|
||||||
|
desc = "Save view with mkview for real files";
|
||||||
|
event = [ "BufWinLeave" "BufWritePost" "WinLeave" ];
|
||||||
|
group = "autoview";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(event)
|
||||||
|
if vim.b[event.buf].view_activated then vim.cmd.mkview { mods = { emsg_silent = true } } end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Try to load file view if available and enable view saving for real files";
|
||||||
|
event = "BufWinEnter";
|
||||||
|
group = "autoview";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(event)
|
||||||
|
if not vim.b[event.buf].view_activated then
|
||||||
|
local filetype = vim.bo[event.buf].filetype
|
||||||
|
local buftype = vim.bo[event.buf].buftype
|
||||||
|
local ignore_filetypes = { "gitcommit", "gitrebase", "svg", "hgcommit" }
|
||||||
|
if buftype == "" and filetype and filetype ~= "" and not vim.tbl_contains(ignore_filetypes, filetype) then
|
||||||
|
vim.b[event.buf].view_activated = true
|
||||||
|
vim.cmd.loadview { mods = { emsg_silent = true } }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
# bufferline
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua#L73-L115
|
||||||
|
{
|
||||||
|
desc = "Update buffers when adding new buffers";
|
||||||
|
event = [ "BufAdd" "BufEnter" "TabNewEntered" ];
|
||||||
|
group = "bufferline";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(args)
|
||||||
|
local buf_utils = require "astrocore.buffer"
|
||||||
|
if not vim.t.bufs then vim.t.bufs = {} end
|
||||||
|
if not buf_utils.is_valid(args.buf) then return end
|
||||||
|
if args.buf ~= buf_utils.current_buf then
|
||||||
|
buf_utils.last_buf = buf_utils.is_valid(buf_utils.current_buf) and buf_utils.current_buf or nil
|
||||||
|
buf_utils.current_buf = args.buf
|
||||||
|
end
|
||||||
|
local bufs = vim.t.bufs
|
||||||
|
if not vim.tbl_contains(bufs, args.buf) then
|
||||||
|
table.insert(bufs, args.buf)
|
||||||
|
vim.t.bufs = bufs
|
||||||
|
end
|
||||||
|
vim.t.bufs = vim.tbl_filter(buf_utils.is_valid, vim.t.bufs)
|
||||||
|
require("astrocore").event "BufsUpdated"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Update buffers when deleting buffers";
|
||||||
|
event = [ "BufDelete" "TermClose" ];
|
||||||
|
group = "bufferline";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(args)
|
||||||
|
local removed
|
||||||
|
for _, tab in ipairs(vim.api.nvim_list_tabpages()) do
|
||||||
|
local bufs = vim.t[tab].bufs
|
||||||
|
if bufs then
|
||||||
|
for i, bufnr in ipairs(bufs) do
|
||||||
|
if bufnr == args.buf then
|
||||||
|
removed = true
|
||||||
|
table.remove(bufs, i)
|
||||||
|
vim.t[tab].bufs = bufs
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.t.bufs = vim.tbl_filter(require("astrocore.buffer").is_valid, vim.t.bufs)
|
||||||
|
if removed then require("astrocore").event "BufsUpdated" end
|
||||||
|
vim.cmd.redrawtabline()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
# checktime
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua#L118-L122
|
||||||
|
{
|
||||||
|
desc = "Check if buffers changed on editor focus";
|
||||||
|
event = [ "FocusGained" "TermClose" "TermLeave" ];
|
||||||
|
group = "checktime";
|
||||||
|
command = "checktime";
|
||||||
|
}
|
||||||
|
|
||||||
|
# create_dir
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua#L125-L132
|
||||||
|
{
|
||||||
|
desc = "Automatically create parent directories if they don't exist when saving a file";
|
||||||
|
event = "BufWritePre";
|
||||||
|
group = "create_dir";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(args)
|
||||||
|
if not require("astrocore.buffer").is_valid(args.buf) then return end
|
||||||
|
vim.fn.mkdir(vim.fn.fnamemodify(vim.loop.fs_realpath(args.match) or args.match, ":p:h"), "p")
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
# editorconfig_filetype
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua#L135-L144
|
||||||
|
{
|
||||||
|
desc = "Configure editorconfig after filetype detection to override `ftplugin`s";
|
||||||
|
event = "FileType";
|
||||||
|
group = "editorconfig_filetype";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(args)
|
||||||
|
if vim.F.if_nil(vim.b.editorconfig, vim.g.editorconfig, true) then
|
||||||
|
local editorconfig_avail, editorconfig = pcall(require, "editorconfig")
|
||||||
|
if editorconfig_avail then editorconfig.config(args.buf) end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
# file_user_events
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua#L147-L177
|
||||||
|
{
|
||||||
|
desc = "Astro user events for file detection (AstroFile and AstroGitFile)";
|
||||||
|
event = [ "BufReadPost" "BufNewFile" "BufWritePost" ];
|
||||||
|
group = "file_user_events";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(args)
|
||||||
|
if vim.b[args.buf].astrofile_checked then return end
|
||||||
|
vim.b[args.buf].astrofile_checked = true
|
||||||
|
vim.schedule(function()
|
||||||
|
if not vim.api.nvim_buf_is_valid(args.buf) then return end
|
||||||
|
local astro = require "astrocore"
|
||||||
|
local current_file = vim.api.nvim_buf_get_name(args.buf)
|
||||||
|
if vim.g.vscode or not (current_file == "" or vim.bo[args.buf].buftype == "nofile") then
|
||||||
|
astro.event "File"
|
||||||
|
local folder = vim.fn.fnamemodify(current_file, ":p:h")
|
||||||
|
if vim.fn.has "win32" == 1 then folder = ('"%s"'):format(folder) end
|
||||||
|
if vim.fn.executable "git" == 1 then
|
||||||
|
if astro.cmd({ "git", "-C", folder, "rev-parse" }, false) or astro.file_worktree() then
|
||||||
|
astro.event "GitFile"
|
||||||
|
pcall(vim.api.nvim_del_augroup_by_name, "file_user_events")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
pcall(vim.api.nvim_del_augroup_by_name, "file_user_events")
|
||||||
|
end
|
||||||
|
vim.schedule(function()
|
||||||
|
if require("astrocore.buffer").is_valid(args.buf) then
|
||||||
|
vim.api.nvim_exec_autocmds(args.event, { buffer = args.buf, data = args.data })
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
# highlighturl
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua#L180-L203
|
||||||
|
{
|
||||||
|
desc = "URL Highlighting";
|
||||||
|
event = [ "VimEnter" "FileType" "BufEnter" "WinEnter" ];
|
||||||
|
group = "highlighturl";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(args)
|
||||||
|
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||||
|
if
|
||||||
|
vim.api.nvim_win_get_buf(win) == args.buf
|
||||||
|
and vim.tbl_get(require "astrocore", "config", "features", "highlighturl")
|
||||||
|
and not vim.w[win].highlighturl_enabled
|
||||||
|
then
|
||||||
|
require("astrocore").set_url_match(win)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Set up the default HighlightURL highlight group";
|
||||||
|
event = [ "VimEnter" "User" ];
|
||||||
|
group = "highlighturl";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(args)
|
||||||
|
if args.event == "VimEnter" or args.match == "AstroColorScheme" then
|
||||||
|
vim.api.nvim_set_hl(0, "HighlightURL", { default = true, underline = true })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
# highlightyank
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua#L206-L211
|
||||||
|
{
|
||||||
|
desc = "Highlight yanked text";
|
||||||
|
event = "TextYankPost";
|
||||||
|
group = "highlightyank";
|
||||||
|
pattern = "*";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.highlight.on_yank()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
# large_buf_settings
|
||||||
|
# https://github.com/AstroNvim/astrocore/blob/v1.5.0/lua/astrocore/init.lua#L473-L486
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua#L214-L239
|
||||||
|
# https://www.reddit.com/r/neovim/comments/z85s1l/comment/iyfrgvb/
|
||||||
|
{
|
||||||
|
desc = "Disable certain functionality on very large files";
|
||||||
|
event = "User";
|
||||||
|
group = "large_buf_settings";
|
||||||
|
pattern = "AstroLargeBuf";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(args)
|
||||||
|
vim.opt_local.wrap = true -- enable wrap, long lines in vim are slow
|
||||||
|
vim.opt_local.list = false -- disable list chars
|
||||||
|
|
||||||
|
vim.b[args.buf].autoformat = false -- disable autoformat on save
|
||||||
|
vim.b[args.buf].cmp_enabled = false -- disable completion
|
||||||
|
vim.b[args.buf].miniindentscope_disable = true -- disable indent scope
|
||||||
|
vim.b[args.buf].matchup_matchparen_enabled = 0 -- disable vim-matchup
|
||||||
|
|
||||||
|
local astrocore = require "astrocore"
|
||||||
|
if vim.tbl_get(astrocore.config, "features", "highlighturl") then
|
||||||
|
astrocore.config.features.highlighturl = false
|
||||||
|
vim.tbl_map(function(win)
|
||||||
|
if vim.w[win].highlighturl_enabled then astrocore.delete_url_match(win) end
|
||||||
|
end, vim.api.nvim_list_wins())
|
||||||
|
end
|
||||||
|
|
||||||
|
local ibl_avail, ibl = pcall(require, "ibl") -- disable indent-blankline
|
||||||
|
if ibl_avail then ibl.setup_buffer(args.buf, { enabled = false }) end
|
||||||
|
|
||||||
|
local illuminate_avail, illuminate = pcall(require, "illuminate.engine") -- disable vim-illuminate
|
||||||
|
if illuminate_avail then illuminate.stop_buf(args.buf) end
|
||||||
|
|
||||||
|
local rainbow_avail, rainbow = pcall(require, "rainbow-delimiters") -- disable rainbow-delimiters
|
||||||
|
if rainbow_avail then rainbow.disable(args.buf) end
|
||||||
|
|
||||||
|
--[[
|
||||||
|
Custom additions
|
||||||
|
]]--
|
||||||
|
local ts_avail, ts = pcall(require, "nvim-treesitter.configs") -- disable treesitter
|
||||||
|
if ts_avail then
|
||||||
|
for _, module in ipairs(ts.available_modules()) do
|
||||||
|
vim.cmd(("TSBufDisable %s"):format(module))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.opt_local.foldmethod = "manual"
|
||||||
|
vim.opt_local.spell = false
|
||||||
|
vim.cmd("syntax off")
|
||||||
|
vim.cmd("LspStop")
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
# q_close_windows
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua#L242-L255
|
||||||
|
{
|
||||||
|
desc = "Make q close help, man, quickfix, dap floats";
|
||||||
|
event = "BufWinEnter";
|
||||||
|
group = "q_close_windows";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(event)
|
||||||
|
if vim.tbl_contains({ "help", "nofile", "quickfix" }, vim.bo[event.buf].buftype) then
|
||||||
|
vim.keymap.set("n", "q", "<Cmd>close<CR>", {
|
||||||
|
desc = "Close window",
|
||||||
|
buffer = event.buf,
|
||||||
|
silent = true,
|
||||||
|
nowait = true,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
# terminal_settings
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua#L258-L266
|
||||||
|
{
|
||||||
|
desc = "Disable line number/fold column/sign column for terminals";
|
||||||
|
event = "TermOpen";
|
||||||
|
group = "terminal_settings";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.opt_local.number = false
|
||||||
|
vim.opt_local.relativenumber = false
|
||||||
|
vim.opt_local.foldcolumn = "0"
|
||||||
|
vim.opt_local.signcolumn = "no"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
|
# unlist_quickfix
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_autocmds.lua#L270-L275
|
||||||
|
{
|
||||||
|
desc = "Unlist quickfix buffers";
|
||||||
|
event = "FileType";
|
||||||
|
group = "unlist_quickfix";
|
||||||
|
pattern = "qf";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.opt_local.buflisted = false
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
40
config/colorscheme.nix
Normal file
40
config/colorscheme.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
{lib, ...}:{
|
||||||
|
# TODO: Make colorscheme configurable
|
||||||
|
colorscheme = lib.mkOverride 500 "everforest";
|
||||||
|
|
||||||
|
colorschemes = {
|
||||||
|
kanagawa.enable = true;
|
||||||
|
nord.enable = true;
|
||||||
|
tokyonight = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
style = "storm";
|
||||||
|
light_style = "day";
|
||||||
|
transparent = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
everforest = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
enable_italic = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
catppuccin = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
flavour = "mocha";
|
||||||
|
|
||||||
|
# Needed to keep terminal transparency, if any
|
||||||
|
transparent_background = false;
|
||||||
|
|
||||||
|
styles = {
|
||||||
|
keywords = [ "italic" ];
|
||||||
|
conditionals = [ "italic" ];
|
||||||
|
functions = [ "italic" ];
|
||||||
|
loops = [ "italic" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
14
config/default.nix
Normal file
14
config/default.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
{ lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
definitions = lib.attrNames (
|
||||||
|
lib.filterAttrs
|
||||||
|
(filename: kind:
|
||||||
|
filename != "default.nix"
|
||||||
|
&& (kind == "regular" || kind == "directory")
|
||||||
|
)
|
||||||
|
(builtins.readDir ./.)
|
||||||
|
);
|
||||||
|
in {
|
||||||
|
imports = map (file: import ./${file}) definitions;
|
||||||
|
}
|
||||||
180
config/keymaps/buffers.nix
Normal file
180
config/keymaps/buffers.nix
Normal file
|
|
@ -0,0 +1,180 @@
|
||||||
|
# Manage buffers
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L56-L89
|
||||||
|
[
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>c";
|
||||||
|
options.desc = "Close buffer";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").close()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>C";
|
||||||
|
options.desc = "Force close buffer";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").close(0, true)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "]b";
|
||||||
|
options.desc = "Next buffer in tabline";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").nav(vim.v.count1)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "[b";
|
||||||
|
options.desc = "Previous buffer in tabline";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").nav(-vim.v.count1)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = ">b";
|
||||||
|
options.desc = "Move buffer tab right";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").move(vim.v.count1)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<b";
|
||||||
|
options.desc = "Move buffer tab left";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").move(-vim.v.count1)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>bc";
|
||||||
|
options.desc = "Close all buffers except current";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").close_all(true)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>bC";
|
||||||
|
options.desc = "Close all buffers";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").close_all()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>bl";
|
||||||
|
options.desc = "Close all buffers to the left";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").close_left()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>bp";
|
||||||
|
options.desc = "Previous buffer";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").prev()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>br";
|
||||||
|
options.desc = "Close all buffers to the right";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").close_right()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>bse";
|
||||||
|
options.desc = "By extension";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").sort "extension"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>bsr";
|
||||||
|
options.desc = "By relative path";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").sort "unique_path"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>bsp";
|
||||||
|
options.desc = "By full path";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").sort "full_path"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>bsi";
|
||||||
|
options.desc = "By buffer number";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").sort "bufnr"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>bsm";
|
||||||
|
options.desc = "By modification";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.buffer").sort "modified"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
]
|
||||||
10
config/keymaps/default.nix
Normal file
10
config/keymaps/default.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
_: {
|
||||||
|
keymaps =
|
||||||
|
(import ./buffers.nix)
|
||||||
|
++ (import ./diagnostics.nix)
|
||||||
|
++ (import ./splits.nix)
|
||||||
|
++ (import ./standard.nix)
|
||||||
|
++ (import ./tabs.nix)
|
||||||
|
++ (import ./terminal.nix)
|
||||||
|
++ (import ./toggles.nix);
|
||||||
|
}
|
||||||
48
config/keymaps/diagnostics.nix
Normal file
48
config/keymaps/diagnostics.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
||||||
|
# Diagnostics
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L92-L100
|
||||||
|
[
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>ld";
|
||||||
|
options.desc = "Hover diagnostics";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.diagnostic.open_float()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "[d";
|
||||||
|
options.desc = "Previous diagnostic";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.diagnostic.goto_prev()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "]d";
|
||||||
|
options.desc = "Next diagnostic";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.diagnostic.goto_next()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "gl";
|
||||||
|
options.desc = "Hover diagnostics";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.diagnostic.open_float()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
]
|
||||||
52
config/keymaps/splits.nix
Normal file
52
config/keymaps/splits.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
# Split navigation
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L107-L114
|
||||||
|
[
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-H>";
|
||||||
|
action = "<C-w>h";
|
||||||
|
options.desc = "Move to left split";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-J>";
|
||||||
|
action = "<C-w>j";
|
||||||
|
options.desc = "Move to below split";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-K>";
|
||||||
|
action = "<C-w>k";
|
||||||
|
options.desc = "Move to above split";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-L>";
|
||||||
|
action = "<C-w>l";
|
||||||
|
options.desc = "Move to right split";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-Up>";
|
||||||
|
action = "<Cmd>resize -2<CR>";
|
||||||
|
options.desc = "Resize split up";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-Down>";
|
||||||
|
action = "<Cmd>resize +2<CR>";
|
||||||
|
options.desc = "Resize split down";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-Left>";
|
||||||
|
action = "<Cmd>vertical resize -2<CR>";
|
||||||
|
options.desc = "Resize split left";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<C-Right>";
|
||||||
|
action = "<Cmd>vertical resize +2<CR>";
|
||||||
|
options.desc = "Resize split right";
|
||||||
|
}
|
||||||
|
]
|
||||||
106
config/keymaps/standard.nix
Normal file
106
config/keymaps/standard.nix
Normal file
|
|
@ -0,0 +1,106 @@
|
||||||
|
let
|
||||||
|
forceWrite = {
|
||||||
|
action = "<cmd>silent! update! | redraw<cr>";
|
||||||
|
options.desc = "Force write";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
[
|
||||||
|
# Standard operations
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L27-L44
|
||||||
|
{
|
||||||
|
mode = [ "n" "x" ];
|
||||||
|
key = "j";
|
||||||
|
action = "v:count == 0 ? 'gj' : 'j'";
|
||||||
|
|
||||||
|
options = {
|
||||||
|
desc = "Move cursor down";
|
||||||
|
expr = true;
|
||||||
|
silent = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = [ "n" "x" ];
|
||||||
|
key = "k";
|
||||||
|
action = "v:count == 0 ? 'gk' : 'k'";
|
||||||
|
|
||||||
|
options = {
|
||||||
|
desc = "Move cursor up";
|
||||||
|
expr = true;
|
||||||
|
silent = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>w";
|
||||||
|
action = "<cmd>w<cr>";
|
||||||
|
options.desc = "Save";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>q";
|
||||||
|
action = "<cmd>confirm q<cr>";
|
||||||
|
options.desc = "Quit window";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>Q";
|
||||||
|
action = "<cmd>confirm qall<cr>";
|
||||||
|
options.desc = "Exit neovim";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>n";
|
||||||
|
action = "<cmd>enew<cr>";
|
||||||
|
options.desc = "New file";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
inherit (forceWrite) action options;
|
||||||
|
mode = "n";
|
||||||
|
key = "<c-s>";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
inherit (forceWrite) options;
|
||||||
|
mode = [ "i" "x" ];
|
||||||
|
key = "<c-s>";
|
||||||
|
action = "<esc>" + forceWrite.action;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<c-q>";
|
||||||
|
action = "<cmd>q!<cr>";
|
||||||
|
options.desc = "Force quit";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "|";
|
||||||
|
action = "<cmd>vsplit<cr>";
|
||||||
|
options.desc = "Vertical split";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "\\";
|
||||||
|
action = "<cmd>split<cr>";
|
||||||
|
options.desc = "Horizontal split";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "gx";
|
||||||
|
action.__raw = "require('astrocore').system_open";
|
||||||
|
options.desc = "Open the file under cursor with system app";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Stay in indent mode
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L117-L118
|
||||||
|
{
|
||||||
|
mode = "v";
|
||||||
|
key = "<S-Tab>";
|
||||||
|
action = "<gv";
|
||||||
|
options.desc = "Unindent line";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "v";
|
||||||
|
key = "<Tab>";
|
||||||
|
action = ">gv";
|
||||||
|
options.desc = "Indent line";
|
||||||
|
}
|
||||||
|
]
|
||||||
26
config/keymaps/tabs.nix
Normal file
26
config/keymaps/tabs.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
# Navigate tabs
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L103-L104
|
||||||
|
[
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "]t";
|
||||||
|
options.desc = "Next tab";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.cmd.tabnext()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "[t";
|
||||||
|
options.desc = "Previous tab";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.cmd.tabprevious()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
]
|
||||||
28
config/keymaps/terminal.nix
Normal file
28
config/keymaps/terminal.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Improved terminal navigation
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L121-L124
|
||||||
|
[
|
||||||
|
{
|
||||||
|
mode = "t";
|
||||||
|
key = "<C-H>";
|
||||||
|
action = "<Cmd>wincmd h<CR>";
|
||||||
|
options.desc = "Terminal left window navigation";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "t";
|
||||||
|
key = "<C-J>";
|
||||||
|
action = "<Cmd>wincmd j<CR>";
|
||||||
|
options.desc = "Terminal down window navigation";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "t";
|
||||||
|
key = "<C-K>";
|
||||||
|
action = "<Cmd>wincmd k<CR>";
|
||||||
|
options.desc = "Terminal up window navigation";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "t";
|
||||||
|
key = "<C-L>";
|
||||||
|
action = "<Cmd>wincmd l<CR>";
|
||||||
|
options.desc = "Terminal right window navigation";
|
||||||
|
}
|
||||||
|
]
|
||||||
180
config/keymaps/toggles.nix
Normal file
180
config/keymaps/toggles.nix
Normal file
|
|
@ -0,0 +1,180 @@
|
||||||
|
# UI/UX toggles
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_mappings.lua#L128-L145
|
||||||
|
[
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>uA";
|
||||||
|
options.desc = "Toggle rooter autochdir";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").autochdir()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>ub";
|
||||||
|
options.desc = "Toggle background";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").background()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>ud";
|
||||||
|
options.desc = "Toggle diagnostics";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").diagnostics()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>ug";
|
||||||
|
options.desc = "Toggle signcolumn";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").signcolumn()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>u>";
|
||||||
|
options.desc = "Toggle foldcolumn";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").foldcolumn()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>ui";
|
||||||
|
options.desc = "Change indent setting";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").indent()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>ul";
|
||||||
|
options.desc = "Toggle statusline";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").statusline()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>un";
|
||||||
|
options.desc = "Change line numbering";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").number()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>uN";
|
||||||
|
options.desc = "Toggle Notifications";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").notifications()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>up";
|
||||||
|
options.desc = "Toggle paste mode";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").paste()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>us";
|
||||||
|
options.desc = "Toggle spellcheck";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").spell()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>uS";
|
||||||
|
options.desc = "Toggle conceal";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").conceal()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>ut";
|
||||||
|
options.desc = "Toggle tabline";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").tabline()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>uu";
|
||||||
|
options.desc = "Toggle URL highlight";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").url_match()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>uw";
|
||||||
|
options.desc = "Toggle wrap";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").wrap()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>uy";
|
||||||
|
options.desc = "Toggle syntax highlight";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astrocore.toggles").buffer_syntax()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
]
|
||||||
148
config/options.nix
Normal file
148
config/options.nix
Normal file
|
|
@ -0,0 +1,148 @@
|
||||||
|
# Neovim options
|
||||||
|
# Use :options to get the list of all options
|
||||||
|
# Use :h <option> to load help for given <option>
|
||||||
|
_:{
|
||||||
|
opts = {
|
||||||
|
# Don't stop backspace at insert
|
||||||
|
backspace.__raw = ''
|
||||||
|
vim.list_extend(vim.opt.backspace:get(), { "nostop" })
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Keep visual indentation on wrapped lines
|
||||||
|
breakindent = true;
|
||||||
|
|
||||||
|
# Hide command line unless needed
|
||||||
|
cmdheight = 0;
|
||||||
|
|
||||||
|
# Insert mode completion options
|
||||||
|
completeopt = [ "menu" "menuone" "noselect" ];
|
||||||
|
|
||||||
|
# Raise a dialog asking if you wish to save the current file(s)
|
||||||
|
confirm = true;
|
||||||
|
|
||||||
|
# Copy previous indentation on autoindenting
|
||||||
|
copyindent = true;
|
||||||
|
|
||||||
|
# Highlight current line
|
||||||
|
cursorline = true;
|
||||||
|
|
||||||
|
# Enable linematch diff algorithm
|
||||||
|
diffopt.__raw = ''
|
||||||
|
vim.list_extend(vim.opt.diffopt:get(), { "algorithm:histogram", "linematch:60" })
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Expand <Tab> to spaces
|
||||||
|
expandtab = true;
|
||||||
|
|
||||||
|
# Disable `~` on nonexistent lines
|
||||||
|
fillchars = { eob = " "; };
|
||||||
|
|
||||||
|
# Enable fold with all code unfolded
|
||||||
|
foldcolumn = "1";
|
||||||
|
foldenable = true;
|
||||||
|
foldlevel = 99;
|
||||||
|
foldlevelstart = 99;
|
||||||
|
|
||||||
|
# Ignore case in search patterns
|
||||||
|
ignorecase = true;
|
||||||
|
|
||||||
|
# Show substitution preview in split window
|
||||||
|
inccommand = "split";
|
||||||
|
|
||||||
|
# Infer casing on word completion
|
||||||
|
infercase = true;
|
||||||
|
|
||||||
|
# Global statusline
|
||||||
|
laststatus = 3;
|
||||||
|
|
||||||
|
# Wrap lines at 'breakat'
|
||||||
|
linebreak = true;
|
||||||
|
|
||||||
|
# Enable list mode
|
||||||
|
list = true;
|
||||||
|
|
||||||
|
# Set custom strings for list mode
|
||||||
|
# - tabulations are shown as ‒▶
|
||||||
|
# - trailing spaces are shown as ·
|
||||||
|
# - multiple non-leading consecutive spaces are shown as bullets (·)
|
||||||
|
# - non-breakable spaces are shown as ⎕
|
||||||
|
listchars = "tab:‒▶,trail:·,multispace:·,lead: ,nbsp:⎕";
|
||||||
|
|
||||||
|
# Enable mouse support
|
||||||
|
mouse = "a";
|
||||||
|
|
||||||
|
# Show line numbers
|
||||||
|
number = true;
|
||||||
|
|
||||||
|
# Preserve indentation as much as possible
|
||||||
|
preserveindent = true;
|
||||||
|
|
||||||
|
# Height of the popup menu
|
||||||
|
pumheight = 10;
|
||||||
|
|
||||||
|
# Display line numbers relative to current line
|
||||||
|
relativenumber = true;
|
||||||
|
|
||||||
|
# Minimal number of lines to keep around the cursor
|
||||||
|
# This has the effect to move the view along with current line
|
||||||
|
#scrolloff = 999;
|
||||||
|
|
||||||
|
# Number of spaces to use for indentation
|
||||||
|
shiftwidth = 2;
|
||||||
|
|
||||||
|
# Disable search count wrap and startup messages
|
||||||
|
shortmess.__raw = ''
|
||||||
|
vim.tbl_deep_extend("force", vim.opt.shortmess:get(), { s = true, I = true })
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Disable showing modes in command line
|
||||||
|
showmode = false;
|
||||||
|
|
||||||
|
# Always show tabline
|
||||||
|
showtabline = 2;
|
||||||
|
|
||||||
|
# Show signs column
|
||||||
|
signcolumn = "yes";
|
||||||
|
|
||||||
|
# Override ignorecase if search pattern contains uppercase characters
|
||||||
|
smartcase = true;
|
||||||
|
|
||||||
|
# Number of spaces input on <Tab>
|
||||||
|
softtabstop = 2;
|
||||||
|
|
||||||
|
# Open horizontal split below (:split)
|
||||||
|
splitbelow = true;
|
||||||
|
|
||||||
|
# Open vertical split to the right (:vsplit)
|
||||||
|
splitright = true;
|
||||||
|
|
||||||
|
# Number of spaces to represent a <Tab>
|
||||||
|
tabstop = 2;
|
||||||
|
|
||||||
|
# Enables 24-bit RGB color
|
||||||
|
termguicolors = true;
|
||||||
|
|
||||||
|
# Shorter timeout duration
|
||||||
|
timeoutlen = 500;
|
||||||
|
|
||||||
|
# Set window title to the filename
|
||||||
|
title = true;
|
||||||
|
|
||||||
|
# Save undo history to undo file (in $XDG_STATE_HOME/nvim/undo)
|
||||||
|
undofile = true;
|
||||||
|
|
||||||
|
viewoptions.__raw = ''
|
||||||
|
vim.tbl_filter(function(val) return val ~= "curdir" end, vim.opt.viewoptions:get())
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Enable virtual edit in visual block mode
|
||||||
|
# This has the effect of selecting empty cells beyond lines boundaries
|
||||||
|
virtualedit = "block";
|
||||||
|
|
||||||
|
# Disable line wrapping
|
||||||
|
wrap = false;
|
||||||
|
|
||||||
|
# Disable making a backup before overwriting a file
|
||||||
|
writebackup = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
27
default.nix
Normal file
27
default.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
_:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./config
|
||||||
|
./plugins
|
||||||
|
./utils
|
||||||
|
];
|
||||||
|
|
||||||
|
config = {
|
||||||
|
# Use <Space> as leader key
|
||||||
|
globals.mapleader = " ";
|
||||||
|
|
||||||
|
# Set 'vi' and 'vim' aliases to nixvim
|
||||||
|
viAlias = true;
|
||||||
|
vimAlias = true;
|
||||||
|
|
||||||
|
# Setup clipboard support
|
||||||
|
clipboard = {
|
||||||
|
# Use xsel as clipboard provider
|
||||||
|
providers.xsel.enable = true;
|
||||||
|
|
||||||
|
# Sync system clipboard
|
||||||
|
register = "unnamedplus";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
179
flake.lock
generated
179
flake.lock
generated
|
|
@ -3,7 +3,6 @@
|
||||||
"devshell": {
|
"devshell": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixvim-config",
|
|
||||||
"nixvim",
|
"nixvim",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
|
|
@ -22,26 +21,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"disko": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1728334376,
|
|
||||||
"narHash": "sha256-CTKEKPzD/j8FK6H4DO3EjyixZd3HHvgAgfnCwpGFP5c=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "disko",
|
|
||||||
"rev": "d39ee334984fcdae6244f5a8e6ab857479cbaefe",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "disko",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-compat": {
|
"flake-compat": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1696426674,
|
"lastModified": 1696426674,
|
||||||
|
|
@ -59,7 +38,6 @@
|
||||||
"flake-parts": {
|
"flake-parts": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs-lib": [
|
"nixpkgs-lib": [
|
||||||
"nixvim-config",
|
|
||||||
"nixvim",
|
"nixvim",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
|
|
@ -99,18 +77,15 @@
|
||||||
"git-hooks": {
|
"git-hooks": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": [
|
"flake-compat": [
|
||||||
"nixvim-config",
|
|
||||||
"nixvim",
|
"nixvim",
|
||||||
"flake-compat"
|
"flake-compat"
|
||||||
],
|
],
|
||||||
"gitignore": "gitignore",
|
"gitignore": "gitignore",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixvim-config",
|
|
||||||
"nixvim",
|
"nixvim",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"nixpkgs-stable": [
|
"nixpkgs-stable": [
|
||||||
"nixvim-config",
|
|
||||||
"nixvim",
|
"nixvim",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
|
|
@ -132,7 +107,6 @@
|
||||||
"gitignore": {
|
"gitignore": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixvim-config",
|
|
||||||
"nixvim",
|
"nixvim",
|
||||||
"git-hooks",
|
"git-hooks",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
|
|
@ -155,27 +129,6 @@
|
||||||
"home-manager": {
|
"home-manager": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1728337164,
|
|
||||||
"narHash": "sha256-VdRTjJFyq4Q9U7Z/UoC2Q5jK8vSo6E86lHc2OanXtvc=",
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "home-manager",
|
|
||||||
"rev": "038630363e7de57c36c417fd2f5d7c14773403e4",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-community",
|
|
||||||
"repo": "home-manager",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"home-manager_2": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixvim-config",
|
|
||||||
"nixvim",
|
"nixvim",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
|
|
@ -197,7 +150,6 @@
|
||||||
"nix-darwin": {
|
"nix-darwin": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixvim-config",
|
|
||||||
"nixvim",
|
"nixvim",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
|
|
@ -219,7 +171,6 @@
|
||||||
"nix-formatter-pack": {
|
"nix-formatter-pack": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixvim-config",
|
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"nmd": "nmd",
|
"nmd": "nmd",
|
||||||
|
|
@ -241,11 +192,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1728241625,
|
"lastModified": 1725432240,
|
||||||
"narHash": "sha256-yumd4fBc/hi8a9QgA9IT8vlQuLZ2oqhkJXHPKxH/tRw=",
|
"narHash": "sha256-+yj+xgsfZaErbfYM3T+QvEE2hU7UuE+Jf0fJCJ8uPS0=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "c31898adf5a8ed202ce5bea9f347b1c6871f32d1",
|
"rev": "ad416d066ca1222956472ab7d0555a6946746a80",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -255,48 +206,15 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs-stable": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1720535198,
|
|
||||||
"narHash": "sha256-zwVvxrdIzralnSbcpghA92tWu2DV2lwv89xZc8MTrbg=",
|
|
||||||
"owner": "nixos",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "205fd4226592cc83fd4c0885a3e4c9c400efabb5",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nixos",
|
|
||||||
"ref": "nixos-23.11",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs-stable_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1728156290,
|
|
||||||
"narHash": "sha256-uogSvuAp+1BYtdu6UWuObjHqSbBohpyARXDWqgI12Ss=",
|
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "17ae88b569bb15590549ff478bab6494dde4a907",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "release-24.05",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixvim": {
|
"nixvim": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"devshell": "devshell",
|
"devshell": "devshell",
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"flake-parts": "flake-parts",
|
"flake-parts": "flake-parts",
|
||||||
"git-hooks": "git-hooks",
|
"git-hooks": "git-hooks",
|
||||||
"home-manager": "home-manager_2",
|
"home-manager": "home-manager",
|
||||||
"nix-darwin": "nix-darwin",
|
"nix-darwin": "nix-darwin",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixvim-config",
|
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"nuschtosSearch": "nuschtosSearch",
|
"nuschtosSearch": "nuschtosSearch",
|
||||||
|
|
@ -316,28 +234,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixvim-config": {
|
|
||||||
"inputs": {
|
|
||||||
"nix-formatter-pack": "nix-formatter-pack",
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
],
|
|
||||||
"nixvim": "nixvim"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1725703566,
|
|
||||||
"narHash": "sha256-EJAUQPyQH2PmgXj3aTmOXQyeQrW1tSiIoR3TE8/DFRk=",
|
|
||||||
"owner": "MFlossmann",
|
|
||||||
"repo": "nixvim_config",
|
|
||||||
"rev": "515bf0662032bb2aa1aeed902ad1c01431506495",
|
|
||||||
"type": "gitlab"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "MFlossmann",
|
|
||||||
"repo": "nixvim_config",
|
|
||||||
"type": "gitlab"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nmd": {
|
"nmd": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
|
@ -374,7 +270,6 @@
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixvim-config",
|
|
||||||
"nixvim",
|
"nixvim",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
|
|
@ -395,55 +290,9 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"disko": "disko",
|
"nix-formatter-pack": "nix-formatter-pack",
|
||||||
"home-manager": "home-manager",
|
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nixpkgs-stable": "nixpkgs-stable",
|
"nixvim": "nixvim"
|
||||||
"nixvim-config": "nixvim-config",
|
|
||||||
"sops-nix": "sops-nix",
|
|
||||||
"suyu": "suyu"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"sops-nix": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
],
|
|
||||||
"nixpkgs-stable": "nixpkgs-stable_2"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1728345710,
|
|
||||||
"narHash": "sha256-lpunY1+bf90ts+sA2/FgxVNIegPDKCpEoWwOPu4ITTQ=",
|
|
||||||
"owner": "mic92",
|
|
||||||
"repo": "sops-nix",
|
|
||||||
"rev": "06535d0e3d0201e6a8080dd32dbfde339b94f01b",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "mic92",
|
|
||||||
"repo": "sops-nix",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"suyu": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
],
|
|
||||||
"systems": "systems_2"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1714727263,
|
|
||||||
"narHash": "sha256-R+x0UZrBedeR6w+h44JaGwuQJrut5VVD2yjNgYNt9f4=",
|
|
||||||
"ref": "refs/heads/master",
|
|
||||||
"rev": "4013bb63ca2217eab5c4a25e266d68d908b96791",
|
|
||||||
"revCount": 15,
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://git.suyu.dev/suyu/nix-flake"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://git.suyu.dev/suyu/nix-flake"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
|
|
@ -461,25 +310,9 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1689347949,
|
|
||||||
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default-linux",
|
|
||||||
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default-linux",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"treefmt-nix": {
|
"treefmt-nix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixvim-config",
|
|
||||||
"nixvim",
|
"nixvim",
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
]
|
]
|
||||||
|
|
|
||||||
100
flake.nix
100
flake.nix
|
|
@ -1,66 +1,70 @@
|
||||||
{
|
{
|
||||||
description = "Nixos config flake";
|
description = "NixVim config heavily inspired by AstroNvim";
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
|
|
||||||
|
|
||||||
home-manager = {
|
# Nix formatting pack
|
||||||
url = "github:nix-community/home-manager";
|
# https://gerschtli.github.io/nix-formatter-pack/nix-formatter-pack-options.html
|
||||||
|
nix-formatter-pack = {
|
||||||
|
url = "github:Gerschtli/nix-formatter-pack";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
# nixvim = {
|
nixvim = {
|
||||||
# url = "github:nix-community/nixvim";
|
url = "github:nix-community/nixvim";
|
||||||
# inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
# };
|
|
||||||
nixvim-config = {
|
|
||||||
type = "gitlab";
|
|
||||||
owner = "MFlossmann";
|
|
||||||
repo = "nixvim_config";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
|
|
||||||
disko = {
|
|
||||||
url = "github:nix-community/disko";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
|
|
||||||
sops-nix = {
|
|
||||||
url = "github:mic92/sops-nix";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = {
|
outputs =
|
||||||
self,
|
{ nixpkgs
|
||||||
nixpkgs,
|
, nixvim
|
||||||
...
|
, nix-formatter-pack
|
||||||
} @ inputs: let
|
, ...
|
||||||
# basic boilerplate-reducing lib with a bunch of functions
|
}:
|
||||||
helperLib = import ./helperLib/default.nix {inherit inputs;};
|
let
|
||||||
nixvim_config = inputs.nixvim_config;
|
forAllSystems = nixpkgs.lib.genAttrs [
|
||||||
in {
|
"aarch64-linux"
|
||||||
packages = helperLib.forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
|
"i686-linux"
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-darwin"
|
||||||
|
"x86_64-darwin"
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
formatter = forAllSystems (system:
|
||||||
|
nix-formatter-pack.lib.mkFormatter {
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
|
||||||
formatter = helperLib.forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
|
config.tools = {
|
||||||
|
deadnix.enable = true;
|
||||||
nixosConfigurations = {
|
nixpkgs-fmt.enable = true;
|
||||||
remus = helperLib.mkSystem ./hosts/remus/configuration.nix;
|
statix.enable = true;
|
||||||
muffinman = helperLib.mkSystem ./hosts/muffinman/configuration.nix;
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
homeConfigurations = {
|
packages = forAllSystems (system:
|
||||||
"prunebutt@remus" = helperLib.mkHome "x86_64-linux" ./hosts/remus/home.nix;
|
let
|
||||||
"prunebutt@muffinman" = helperLib.mkHome "x86_64-linux" ./hosts/muffinman/home.nix;
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
mkNixvim = specialArgs:
|
||||||
|
nixvim.legacyPackages.${system}.makeNixvimWithModule {
|
||||||
|
inherit pkgs;
|
||||||
|
|
||||||
|
module = ./.;
|
||||||
|
|
||||||
|
extraSpecialArgs = specialArgs // {
|
||||||
|
inherit pkgs;
|
||||||
|
|
||||||
|
icons = import ./utils/_icons.nix;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
homeManagerModules.default = ./modules/home;
|
in
|
||||||
nixosModules.default = ./modules/nixOS;
|
{
|
||||||
|
default = mkNixvim { };
|
||||||
# overlays.additions =
|
lite = mkNixvim { withLSP = false; };
|
||||||
# (final: prev: {
|
}
|
||||||
# neovim = nixvim_config.packages.${prev.system}.default;
|
);
|
||||||
# });
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,125 +0,0 @@
|
||||||
{inputs}: let
|
|
||||||
helperLib = (import ./default.nix) {inherit inputs;};
|
|
||||||
outputs = inputs.self.outputs;
|
|
||||||
overlay-stable = final: prev: {
|
|
||||||
stable = inputs.nixpkgs-stable.legacyPackages.${prev.system};
|
|
||||||
};
|
|
||||||
in rec {
|
|
||||||
# imports = [
|
|
||||||
# ./syncthing.nix
|
|
||||||
# ];
|
|
||||||
|
|
||||||
# ================================================================ #
|
|
||||||
# = My Lib = #
|
|
||||||
# ================================================================ #
|
|
||||||
|
|
||||||
# ======================= Package Helpers ======================== #
|
|
||||||
|
|
||||||
pkgsFor = sys: inputs.nixpkgs.legacyPackages.${sys};
|
|
||||||
|
|
||||||
# ========================== Buildables ========================== #
|
|
||||||
|
|
||||||
mkSystem = config:
|
|
||||||
inputs.nixpkgs.lib.nixosSystem {
|
|
||||||
specialArgs = {
|
|
||||||
inherit inputs outputs helperLib;
|
|
||||||
};
|
|
||||||
modules = [
|
|
||||||
({
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {nixpkgs.overlays = [overlay-stable];})
|
|
||||||
config
|
|
||||||
outputs.nixosModules.default
|
|
||||||
|
|
||||||
(import ../overlays)
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
mkHome = sys: config:
|
|
||||||
inputs.home-manager.lib.homeManagerConfiguration {
|
|
||||||
pkgs = pkgsFor sys;
|
|
||||||
extraSpecialArgs = {
|
|
||||||
inherit inputs helperLib outputs;
|
|
||||||
};
|
|
||||||
modules = [
|
|
||||||
({
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {nixpkgs.overlays = [overlay-stable];})
|
|
||||||
config
|
|
||||||
outputs.homeManagerModules.default
|
|
||||||
|
|
||||||
(import ../overlays)
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# =========================== Helpers ============================ #
|
|
||||||
|
|
||||||
filesIn = dir: (map (fname: dir + "/${fname}")
|
|
||||||
(builtins.attrNames (builtins.readDir dir)));
|
|
||||||
|
|
||||||
dirsIn = dir:
|
|
||||||
inputs.nixpkgs.lib.filterAttrs (name: value: value == "directory")
|
|
||||||
(builtins.readDir dir);
|
|
||||||
|
|
||||||
fileNameOf = path: (builtins.head (builtins.split "\\." (baseNameOf path)));
|
|
||||||
|
|
||||||
# ========================== Extenders =========================== #
|
|
||||||
|
|
||||||
# Evaluates nixos/home-manager module and extends it's options / config
|
|
||||||
extendModule = {path, ...} @ args: {pkgs, ...} @ margs: let
|
|
||||||
eval =
|
|
||||||
if (builtins.isString path) || (builtins.isPath path)
|
|
||||||
then import path margs
|
|
||||||
else path margs;
|
|
||||||
evalNoImports = builtins.removeAttrs eval ["imports" "options"];
|
|
||||||
|
|
||||||
extra =
|
|
||||||
if (builtins.hasAttr "extraOptions" args) || (builtins.hasAttr "extraConfig" args)
|
|
||||||
then [
|
|
||||||
({...}: {
|
|
||||||
options = args.extraOptions or {};
|
|
||||||
config = args.extraConfig or {};
|
|
||||||
})
|
|
||||||
]
|
|
||||||
else [];
|
|
||||||
in {
|
|
||||||
imports =
|
|
||||||
(eval.imports or [])
|
|
||||||
++ extra;
|
|
||||||
|
|
||||||
options =
|
|
||||||
if builtins.hasAttr "optionsExtension" args
|
|
||||||
then (args.optionsExtension (eval.options or {}))
|
|
||||||
else (eval.options or {});
|
|
||||||
|
|
||||||
config =
|
|
||||||
if builtins.hasAttr "configExtension" args
|
|
||||||
then (args.configExtension (eval.config or evalNoImports))
|
|
||||||
else (eval.config or evalNoImports);
|
|
||||||
};
|
|
||||||
|
|
||||||
# Applies extendModules to all modules
|
|
||||||
# modules can be defined in the same way
|
|
||||||
# as regular imports, or taken from "filesIn"
|
|
||||||
extendModules = extension: modules:
|
|
||||||
map
|
|
||||||
(f: let
|
|
||||||
name = fileNameOf f;
|
|
||||||
in (extendModule ((extension name) // {path = f;})))
|
|
||||||
modules;
|
|
||||||
|
|
||||||
# ============================ Shell ============================= #
|
|
||||||
forAllSystems =
|
|
||||||
# pkgs:
|
|
||||||
inputs.nixpkgs.lib.genAttrs [
|
|
||||||
"x86_64-linux"
|
|
||||||
"aarch64-linux"
|
|
||||||
"x86_64-darwin"
|
|
||||||
"aarch64-darwin"
|
|
||||||
];
|
|
||||||
# (system: pkgs inputs.nixpkgs.legacyPackages.${system});
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
{}: {
|
|
||||||
getSyncthingDevices = x: trace "foobar" x;
|
|
||||||
}
|
|
||||||
|
|
@ -1,143 +0,0 @@
|
||||||
# Edit this configuration file to define what should be installed on
|
|
||||||
# your system. Help is available in the configuration.nix(5) man page
|
|
||||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
|
||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
# Include the results of the hardware scan.
|
|
||||||
./hardware-configuration.nix
|
|
||||||
inputs.home-manager.nixosModules.default
|
|
||||||
];
|
|
||||||
|
|
||||||
nix.settings.experimental-features = ["nix-command" "flakes"];
|
|
||||||
|
|
||||||
# Bootloader.
|
|
||||||
boot.loader.systemd-boot.enable = true;
|
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
|
||||||
|
|
||||||
networking.hostName = "remus";
|
|
||||||
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
|
||||||
|
|
||||||
# Configure network proxy if necessary
|
|
||||||
# networking.proxy.default = "http://user:password@proxy:port/";
|
|
||||||
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
|
||||||
|
|
||||||
# Enable networking
|
|
||||||
networking.networkmanager.enable = true;
|
|
||||||
|
|
||||||
# Set your time zone.
|
|
||||||
time.timeZone = "Europe/Berlin";
|
|
||||||
|
|
||||||
# Select internationalisation properties.
|
|
||||||
i18n.defaultLocale = "en_US.UTF-8";
|
|
||||||
|
|
||||||
i18n.extraLocaleSettings = {
|
|
||||||
LC_ADDRESS = "de_DE.UTF-8";
|
|
||||||
LC_IDENTIFICATION = "de_DE.UTF-8";
|
|
||||||
LC_MEASUREMENT = "de_DE.UTF-8";
|
|
||||||
LC_MONETARY = "de_DE.UTF-8";
|
|
||||||
LC_NAME = "de_DE.UTF-8";
|
|
||||||
LC_NUMERIC = "de_DE.UTF-8";
|
|
||||||
LC_PAPER = "de_DE.UTF-8";
|
|
||||||
LC_TELEPHONE = "de_DE.UTF-8";
|
|
||||||
LC_TIME = "de_DE.UTF-8";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Enable the X11 windowing system.
|
|
||||||
services.xserver.enable = true;
|
|
||||||
|
|
||||||
# Enable the GNOME Desktop Environment.
|
|
||||||
services.xserver.displayManager.gdm.enable = true;
|
|
||||||
services.xserver.desktopManager.gnome.enable = true;
|
|
||||||
|
|
||||||
# Configure keymap in X11
|
|
||||||
services.xserver.xkb = {
|
|
||||||
layout = "de";
|
|
||||||
variant = "neo";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Configure console keymap
|
|
||||||
console.keyMap = "de";
|
|
||||||
|
|
||||||
# Enable CUPS to print documents.
|
|
||||||
services.printing.enable = true;
|
|
||||||
|
|
||||||
# Enable sound with pipewire.
|
|
||||||
sound.enable = true;
|
|
||||||
hardware.pulseaudio.enable = false;
|
|
||||||
security.rtkit.enable = true;
|
|
||||||
services.pipewire = {
|
|
||||||
enable = true;
|
|
||||||
alsa.enable = true;
|
|
||||||
alsa.support32Bit = true;
|
|
||||||
pulse.enable = true;
|
|
||||||
# If you want to use JACK applications, uncomment this
|
|
||||||
#jack.enable = true;
|
|
||||||
|
|
||||||
# use the example session manager (no others are packaged yet so this is enabled by default,
|
|
||||||
# no need to redefine it in your config for now)
|
|
||||||
#media-session.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Enable touchpad support (enabled default in most desktopManager).
|
|
||||||
# services.xserver.libinput.enable = true;
|
|
||||||
|
|
||||||
users.users.prunebutt = {
|
|
||||||
isNormalUser = true;
|
|
||||||
description = "prunebutt";
|
|
||||||
extraGroups = ["networkmanager" "wheel"];
|
|
||||||
packages = with pkgs; [
|
|
||||||
firefox
|
|
||||||
# thunderbird
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
home-manager = {
|
|
||||||
extraSpecialArgs = {inherit inputs;};
|
|
||||||
users = {
|
|
||||||
"prunebutt" = import ./home.nix;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Allow unfree packages
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
|
||||||
|
|
||||||
# List packages installed in system profile. To search, run:
|
|
||||||
# $ nix search wget
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
|
|
||||||
wget
|
|
||||||
git
|
|
||||||
];
|
|
||||||
|
|
||||||
# Some programs need SUID wrappers, can be configured further or are
|
|
||||||
# started in user sessions.
|
|
||||||
# programs.mtr.enable = true;
|
|
||||||
# programs.gnupg.agent = {
|
|
||||||
# enable = true;
|
|
||||||
# enableSSHSupport = true;
|
|
||||||
# };
|
|
||||||
|
|
||||||
# List services that you want to enable:
|
|
||||||
|
|
||||||
# Enable the OpenSSH daemon.
|
|
||||||
# services.openssh.enable = true;
|
|
||||||
|
|
||||||
# Open ports in the firewall.
|
|
||||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
|
||||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
|
||||||
# Or disable the firewall altogether.
|
|
||||||
# networking.firewall.enable = false;
|
|
||||||
|
|
||||||
# This value determines the NixOS release from which the default
|
|
||||||
# settings for stateful data, like file locations and database versions
|
|
||||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
|
||||||
# this value at the release version of the first install of this system.
|
|
||||||
# Before changing this value read the documentation for this option
|
|
||||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
|
||||||
system.stateVersion = "23.11"; # Did you read the comment?
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
# This is just an example, you should generate yours with nixos-generate-config and put it in here.
|
|
||||||
{
|
|
||||||
fileSystems."/" = {
|
|
||||||
device = "/dev/sda1";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Set your system kind (needed for flakes)
|
|
||||||
nixpkgs.hostPlatform = "x86_64-linux";
|
|
||||||
}
|
|
||||||
|
|
@ -1,83 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
# Home Manager needs a bit of information about you and the paths it should
|
|
||||||
# manage.
|
|
||||||
home.username = "prunebutt";
|
|
||||||
home.homeDirectory = "/home/prunebutt";
|
|
||||||
|
|
||||||
# This value determines the Home Manager release that your configuration is
|
|
||||||
# compatible with. This helps avoid breakage when a new Home Manager release
|
|
||||||
# introduces backwards incompatible changes.
|
|
||||||
#
|
|
||||||
# You should not change this value, even if you update Home Manager. If you do
|
|
||||||
# want to update the value, then make sure to first check the Home Manager
|
|
||||||
# release notes.
|
|
||||||
home.stateVersion = "23.11"; # Please read the comment before changing.
|
|
||||||
|
|
||||||
# The home.packages option allows you to install Nix packages into your
|
|
||||||
# environment.
|
|
||||||
home.packages = [
|
|
||||||
# # Adds the 'hello' command to your environment. It prints a friendly
|
|
||||||
# # "Hello, world!" when run.
|
|
||||||
# pkgs.hello
|
|
||||||
|
|
||||||
pkgs.nerdfonts
|
|
||||||
# # It is sometimes useful to fine-tune packages, for example, by applying
|
|
||||||
# # overrides. You can do that directly here, just don't forget the
|
|
||||||
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
|
|
||||||
# # fonts?
|
|
||||||
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
|
|
||||||
|
|
||||||
# # You can also create simple shell scripts directly inside your
|
|
||||||
# # configuration. For example, this adds a command 'my-hello' to your
|
|
||||||
# # environment:
|
|
||||||
# (pkgs.writeShellScriptBin "my-hello" ''
|
|
||||||
# echo "Hello, ${config.home.username}!"
|
|
||||||
# '')
|
|
||||||
];
|
|
||||||
|
|
||||||
programs.zsh.enable = true;
|
|
||||||
|
|
||||||
programs.neovim.enable = false;
|
|
||||||
programs.neovim.defaultEditor = false;
|
|
||||||
|
|
||||||
# Home Manager is pretty good at managing dotfiles. The primary way to manage
|
|
||||||
# plain files is through 'home.file'.
|
|
||||||
home.file = {
|
|
||||||
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
|
|
||||||
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
|
|
||||||
# # symlink to the Nix store copy.
|
|
||||||
# ".screenrc".source = dotfiles/screenrc;
|
|
||||||
|
|
||||||
# # You can also set the file content immediately.
|
|
||||||
# ".gradle/gradle.properties".text = ''
|
|
||||||
# org.gradle.console=verbose
|
|
||||||
# org.gradle.daemon.idletimeout=3600000
|
|
||||||
# '';
|
|
||||||
};
|
|
||||||
|
|
||||||
# Home Manager can also manage your environment variables through
|
|
||||||
# 'home.sessionVariables'. If you don't want to manage your shell through Home
|
|
||||||
# Manager then you have to manually source 'hm-session-vars.sh' located at
|
|
||||||
# either
|
|
||||||
#
|
|
||||||
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
|
|
||||||
#
|
|
||||||
# or
|
|
||||||
#
|
|
||||||
# ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
|
|
||||||
#
|
|
||||||
# or
|
|
||||||
#
|
|
||||||
# /etc/profiles/per-user/prunebutt/etc/profile.d/hm-session-vars.sh
|
|
||||||
#
|
|
||||||
home.sessionVariables = {
|
|
||||||
EDITOR = "nvim";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
|
||||||
programs.home-manager.enable = true;
|
|
||||||
}
|
|
||||||
|
|
@ -1,151 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
outputs,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
hostName = "muffinman";
|
|
||||||
static_ip = "192.168.178.2";
|
|
||||||
gateway = "192.168.178.1";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./hardware-configuration.nix
|
|
||||||
outputs.nixosModules.default
|
|
||||||
];
|
|
||||||
|
|
||||||
# Bootloader.
|
|
||||||
boot = {
|
|
||||||
loader.grub = {
|
|
||||||
enable = true;
|
|
||||||
device = "nodev";
|
|
||||||
efiSupport = true;
|
|
||||||
};
|
|
||||||
# systemd-boot.enable = true;
|
|
||||||
loader.efi.canTouchEfiVariables = true;
|
|
||||||
|
|
||||||
# TODO: remove my mail address from here
|
|
||||||
swraid.enable = true;
|
|
||||||
swraid.mdadmConf = ''
|
|
||||||
MAILADDR michael.flossmann@posteo.net
|
|
||||||
'';
|
|
||||||
|
|
||||||
kernelParams = builtins.trace "ip=${static_ip}::${gateway}:255.255.255.0:${hostName}:" [ "ip=${static_ip}::${gateway}:255.255.255.0:${hostName}:" ];
|
|
||||||
initrd = {
|
|
||||||
availableKernelModules = [ "igb" ];
|
|
||||||
# systemd.users.root.shell = "/bin/conspy";
|
|
||||||
network = {
|
|
||||||
enable = true;
|
|
||||||
ssh = {
|
|
||||||
enable = true;
|
|
||||||
port = 2222;
|
|
||||||
authorizedKeys = [
|
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJlwh35h9AfYwTJ94V4UNo08o/Nt0qXrg8axNWsw0JlF prunebutt@remus"
|
|
||||||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDEzOPuJcV4KSKrsXUtVXqStpdQbFwJH++cbCf8rdFXcx/dXwfAI/tKw3P5oEkRCE+cg6sFtUD4nvU+htfTO4UrZqfKojOP6DxPl+eDRztELjvenPmRo8/WhlVyMhdj2JNy3if5GK2KtbThLqZSrud9qCxRkUFLd4EK75Tukv4Qv3yer1UYcDtbEjNsrdZK5llyb283fHSnm/P145BK4bCFIrbpi8Hzh5eq/usRhPAsNnuGmYnTpV1Kcf90z2gE1IEoFFzzXeKGNTPDrGr9QFPWDfUsyvrsxv4kej8GWNnAgI3VAvvXTYRy+Vz/QF12vU3Sm1s0/nQc+/liprTLl17H5IrnpGc1Ml/kz6fWRgdbtEEcyTrHnQW9mQqHRGWhhe7KMkQ/GB4EMmGSacC/v86ZSQCQ4X811X3zIk9B/+J6xbtUBqdIXZot5qoBQ8xl3o8UbhKGz+ekVeDdlgmLvICvtbc44vihfW/azFxYJ5PK+WiEN6SpRFaTi5sfwC8b1jQtOCCV7IASepD3/iOG80UQ2AYxwDJEYsHTEg0YwWtGfmmegTxJ33nJIjwoRrVpa61OoMQlxnhkNJUnxrPrV+7WZHeWV5YXl86WRhAi+FHybFeg42gsSPqmFk5MhpE/10cLy7F2EHme+LsdYLxu7PanR68wva0m+6wDCTknIjoDFQ== prunebutt@LittleUmbrella"
|
|
||||||
];
|
|
||||||
hostKeys = [ "/etc/secrets/initrd/ssh_host_rsa_key" ];
|
|
||||||
extraConfig = ''ForceCommand cryptsetup-askpass'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
networking = {
|
|
||||||
hostName = hostName;
|
|
||||||
networkmanager.enable = true;
|
|
||||||
|
|
||||||
useDHCP = false;
|
|
||||||
|
|
||||||
interfaces = {
|
|
||||||
eno2 = {
|
|
||||||
ipv4.addresses = [
|
|
||||||
{
|
|
||||||
address = "${static_ip}";
|
|
||||||
prefixLength = 24;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
defaultGateway = {
|
|
||||||
address = "${gateway}";
|
|
||||||
interface = "eno2";
|
|
||||||
};
|
|
||||||
nameservers = [
|
|
||||||
"${gateway}"
|
|
||||||
"9.9.9.9"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
services.xserver.enable = false;
|
|
||||||
|
|
||||||
console = {
|
|
||||||
font = "ter-powerline-v16b";
|
|
||||||
packages = [
|
|
||||||
pkgs.terminus_font
|
|
||||||
pkgs.powerline-fonts
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
myNixOS = {
|
|
||||||
services.syncthing = {
|
|
||||||
enable = true;
|
|
||||||
remoteGui = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
home-users = {
|
|
||||||
"prunebutt" = {
|
|
||||||
userConfig = ./home.nix;
|
|
||||||
userSettings = {
|
|
||||||
extraGroups = ["networkmanager" "wheel" "libvirtd" "docker"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
# Allow unfree packages
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
|
||||||
|
|
||||||
# List packages installed in system profile. To search, run:
|
|
||||||
# $ nix search wget
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
|
|
||||||
wget
|
|
||||||
git
|
|
||||||
|
|
||||||
# mdadm # shouldn't be needed with boot.swraid.enable = true
|
|
||||||
];
|
|
||||||
|
|
||||||
# Some programs need SUID wrappers, can be configured further or are
|
|
||||||
# started in user sessions.
|
|
||||||
# programs.mtr.enable = true;
|
|
||||||
# programs.gnupg.agent = {
|
|
||||||
# enable = true;
|
|
||||||
# enableSSHSupport = true;
|
|
||||||
# };
|
|
||||||
|
|
||||||
# # auto unlock storage drive
|
|
||||||
# environment.etc.crypttab.text = ''
|
|
||||||
# cryptstorage UUID=74b68945-6edf-4141-93d4-bcccb310f7df /etc/secrets/storage_keyfile.key
|
|
||||||
# '';
|
|
||||||
|
|
||||||
# Enable the OpenSSH daemon.
|
|
||||||
services.openssh.enable = true;
|
|
||||||
|
|
||||||
# Open ports in the firewall.
|
|
||||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
|
||||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
|
||||||
# Or disable the firewall altogether.
|
|
||||||
networking.firewall.enable = false;
|
|
||||||
|
|
||||||
# This value determines the NixOS release from which the default
|
|
||||||
# settings for stateful data, like file locations and database versions
|
|
||||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
|
||||||
# this value at the release version of the first install of this system.
|
|
||||||
# Before changing this value read the documentation for this option
|
|
||||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
|
||||||
system.stateVersion = "24.05"; # Did you read the comment?
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{ config, lib, pkgs, modulesPath, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
imports =
|
|
||||||
[ (modulesPath + "/installer/scan/not-detected.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ];
|
|
||||||
boot.initrd.kernelModules = [ "dm-snapshot" ];
|
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
|
|
||||||
fileSystems."/" =
|
|
||||||
{ device = "/dev/disk/by-uuid/8163a747-43d8-41e1-8514-69c42d37a165";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.initrd.luks.devices."luks-7c776e51-99b0-402e-9254-c5310b5bfa17".device = "/dev/disk/by-uuid/7c776e51-99b0-402e-9254-c5310b5bfa17";
|
|
||||||
|
|
||||||
fileSystems."/boot" =
|
|
||||||
{ device = "/dev/disk/by-uuid/E43C-FE83";
|
|
||||||
fsType = "vfat";
|
|
||||||
options = [ "fmask=0022" "dmask=0022" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
# fileSystems."/data/media" =
|
|
||||||
# { device = "/dev/disk/by-uuid/203764d8-7e5d-4e61-8467-46dab635ceff";
|
|
||||||
# fsType = "ext4";
|
|
||||||
# };
|
|
||||||
#
|
|
||||||
# fileSystems."/data/personal" =
|
|
||||||
# { device = "/dev/disk/by-uuid/4fa1ebd4-eeee-44ab-a77b-df58edcf1813";
|
|
||||||
# fsType = "ext4";
|
|
||||||
# };
|
|
||||||
|
|
||||||
swapDevices = [
|
|
||||||
{ device = "/.swapfile"; size = 30518; }
|
|
||||||
];
|
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.eno2.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
# home.username = "prunebutt";
|
|
||||||
# home.homeDirectory = "/home/prunebutt";
|
|
||||||
home = let
|
|
||||||
user = "prunebutt";
|
|
||||||
in {
|
|
||||||
username = "${user}";
|
|
||||||
homeDirectory = "/home/${user}";
|
|
||||||
# You should not change this value, even if you update Home Manager. If you do
|
|
||||||
# want to update the value, then make sure to first check the Home Manager
|
|
||||||
# release notes.
|
|
||||||
stateVersion = "24.11"; # Please read the comment before changing.
|
|
||||||
|
|
||||||
# The home.packages option allows you to install Nix packages into your
|
|
||||||
# environment.
|
|
||||||
packages = [
|
|
||||||
# # It is sometimes useful to fine-tune packages, for example, by applying
|
|
||||||
# # overrides. You can do that directly here, just don't forget the
|
|
||||||
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
|
|
||||||
# # fonts?
|
|
||||||
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
|
|
||||||
|
|
||||||
# # You can also create simple shell scripts directly inside your
|
|
||||||
# # configuration. For example, this adds a command 'my-hello' to your
|
|
||||||
# # environment:
|
|
||||||
# (pkgs.writeShellScriptBin "my-hello" ''
|
|
||||||
# echo "Hello, ${config.home.username}!"
|
|
||||||
# '')
|
|
||||||
|
|
||||||
## GNOME
|
|
||||||
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# myHomeManager = {
|
|
||||||
# bundles = {
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
|
|
||||||
programs.zsh.enable = true;
|
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
|
||||||
# programs.home-manager.enable = true;
|
|
||||||
}
|
|
||||||
|
|
@ -1,158 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
outputs,
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
# Include the results of the hardware scan.
|
|
||||||
./hardware-configuration.nix
|
|
||||||
outputs.nixosModules.default
|
|
||||||
];
|
|
||||||
|
|
||||||
nix.settings.experimental-features = ["nix-command" "flakes"];
|
|
||||||
|
|
||||||
# Bootloader.
|
|
||||||
boot.loader = {
|
|
||||||
systemd-boot.enable = true;
|
|
||||||
efi.canTouchEfiVariables = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# for virtual webcams
|
|
||||||
boot.kernelModules = [ "v4l2loopback"];
|
|
||||||
boot.extraModulePackages = with config.boot.kernelPackages; [
|
|
||||||
v4l2loopback
|
|
||||||
];
|
|
||||||
boot.extraModprobeConfig = ''
|
|
||||||
options v4l2loopback devices=1 video_nr=0 card_label="My OBS Virt Cam" exclusive_caps=1
|
|
||||||
'';
|
|
||||||
security.polkit.enable = true;
|
|
||||||
|
|
||||||
networking = {
|
|
||||||
hostName = "remus";
|
|
||||||
networkmanager.enable = true;
|
|
||||||
# wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
|
||||||
};
|
|
||||||
|
|
||||||
services.desktopManager.plasma6.enable = true;
|
|
||||||
services.xserver.desktopManager.gnome.enable = true;
|
|
||||||
services.displayManager.defaultSession = "plasma";
|
|
||||||
|
|
||||||
programs.ssh.askPassword = lib.mkForce "${pkgs.kdePackages.ksshaskpass.out}/bin/ksshaskpass";
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
ryujinx
|
|
||||||
v4l-utils
|
|
||||||
wf-recorder
|
|
||||||
obs-studio
|
|
||||||
mitmproxy # for checking what facebook collects
|
|
||||||
linux-wifi-hotspot
|
|
||||||
];
|
|
||||||
|
|
||||||
programs.kdeconnect.enable = true;
|
|
||||||
|
|
||||||
services.flatpak.enable = true;
|
|
||||||
myNixOS = {
|
|
||||||
bundles.general-desktop.enable = true;
|
|
||||||
bundles.gaming = {
|
|
||||||
enable = true;
|
|
||||||
remotePlay = true;
|
|
||||||
alvr = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
services.syncthing.enable = true;
|
|
||||||
|
|
||||||
ausweisapp.enable = true;
|
|
||||||
|
|
||||||
mitmproxy = {
|
|
||||||
enable = true;
|
|
||||||
routeAP = true;
|
|
||||||
accessPoint = "wlp5s0f3u3";
|
|
||||||
mitmPort = 8080;
|
|
||||||
};
|
|
||||||
|
|
||||||
home-users = {
|
|
||||||
"prunebutt" = {
|
|
||||||
userConfig = ./home.nix;
|
|
||||||
userSettings = {
|
|
||||||
extraGroups = ["networkmanager" "wheel" "libvirtd" "docker" "wireshark" "adbusers"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.adb.enable = true;
|
|
||||||
|
|
||||||
programs.wireshark.enable = true;
|
|
||||||
# List packages installed in system profile. To search, run:
|
|
||||||
# $ nix search wget
|
|
||||||
|
|
||||||
# Some programs need SUID wrappers, can be configured further or are
|
|
||||||
# started in user sessions.
|
|
||||||
# programs.mtr.enable = true;
|
|
||||||
# programs.gnupg.agent = {
|
|
||||||
# enable = true;
|
|
||||||
# enableSSHSupport = true;
|
|
||||||
# };
|
|
||||||
|
|
||||||
# List services that you want to enable:
|
|
||||||
|
|
||||||
# Enable the OpenSSH daemon.
|
|
||||||
services.openssh.enable = true;
|
|
||||||
|
|
||||||
# Enable graphics
|
|
||||||
hardware.graphics = {
|
|
||||||
enable = true;
|
|
||||||
enable32Bit = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Load nvidia driver for Xorg and Wayland
|
|
||||||
services.xserver.videoDrivers = ["nvidia"];
|
|
||||||
|
|
||||||
hardware.nvidia = {
|
|
||||||
# Modesetting is required.
|
|
||||||
modesetting.enable = true;
|
|
||||||
|
|
||||||
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
|
|
||||||
# Enable this if you have graphical corruption issues or application crashes after waking
|
|
||||||
# up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead
|
|
||||||
# of just the bare essentials.
|
|
||||||
powerManagement.enable = true;
|
|
||||||
|
|
||||||
# Fine-grained power management. Turns off GPU when not in use.
|
|
||||||
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
|
|
||||||
powerManagement.finegrained = false;
|
|
||||||
|
|
||||||
# Use the NVidia open source kernel module (not to be confused with the
|
|
||||||
# independent third-party "nouveau" open source driver).
|
|
||||||
# Support is limited to the Turing and later architectures. Full list of
|
|
||||||
# supported GPUs is at:
|
|
||||||
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
|
|
||||||
# Only available from driver 515.43.04+
|
|
||||||
# Currently alpha-quality/buggy, so false is currently the recommended setting.
|
|
||||||
open = false;
|
|
||||||
|
|
||||||
# Enable the Nvidia settings menu,
|
|
||||||
# accessible via `nvidia-settings`.
|
|
||||||
nvidiaSettings = true;
|
|
||||||
|
|
||||||
# Optionally, you may need to select the appropriate driver version for your specific GPU.
|
|
||||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Open ports in the firewall.
|
|
||||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
|
||||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
|
||||||
# Or disable the firewall altogether.
|
|
||||||
# networking.firewall.enable = false;
|
|
||||||
|
|
||||||
# This value determines the NixOS release from which the default
|
|
||||||
# settings for stateful data, like file locations and database versions
|
|
||||||
# on your system were taken. It‘s perfectly fine and recommended to leave
|
|
||||||
# this value at the release version of the first install of this system.
|
|
||||||
# Before changing this value read the documentation for this option
|
|
||||||
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
|
||||||
system.stateVersion = "23.11"; # Did you read the comment?
|
|
||||||
}
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
|
||||||
# and may be overwritten by future invocations. Please make changes
|
|
||||||
# to /etc/nixos/configuration.nix instead.
|
|
||||||
{
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
pkgs,
|
|
||||||
modulesPath,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod"];
|
|
||||||
boot.initrd.kernelModules = [];
|
|
||||||
boot.kernelModules = ["kvm-amd"];
|
|
||||||
boot.extraModulePackages = [];
|
|
||||||
|
|
||||||
fileSystems."/" = {
|
|
||||||
device = "/dev/disk/by-uuid/c849b1d0-f6b0-414b-a2f8-15add0b2b637";
|
|
||||||
fsType = "btrfs";
|
|
||||||
options = ["subvol=@"];
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.initrd.luks.devices."luks-2875a668-8d20-46b1-9c37-843c250be560".device = "/dev/disk/by-uuid/2875a668-8d20-46b1-9c37-843c250be560";
|
|
||||||
|
|
||||||
fileSystems."/boot" = {
|
|
||||||
device = "/dev/disk/by-uuid/4D76-7705";
|
|
||||||
fsType = "vfat";
|
|
||||||
};
|
|
||||||
|
|
||||||
swapDevices = [];
|
|
||||||
|
|
||||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
|
||||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
|
||||||
# still possible to use this option, but it's recommended to use it in conjunction
|
|
||||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
|
||||||
networking.useDHCP = lib.mkDefault true;
|
|
||||||
# networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
|
|
||||||
|
|
||||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
|
||||||
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
||||||
}
|
|
||||||
|
|
@ -1,57 +0,0 @@
|
||||||
{
|
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
# home.username = "prunebutt";
|
|
||||||
# home.homeDirectory = "/home/prunebutt";
|
|
||||||
home = let
|
|
||||||
user = "prunebutt";
|
|
||||||
in {
|
|
||||||
username = "${user}";
|
|
||||||
homeDirectory = "/home/${user}";
|
|
||||||
# You should not change this value, even if you update Home Manager. If you do
|
|
||||||
# want to update the value, then make sure to first check the Home Manager
|
|
||||||
# release notes.
|
|
||||||
stateVersion = "23.11"; # Please read the comment before changing.
|
|
||||||
|
|
||||||
# The home.packages option allows you to install Nix packages into your
|
|
||||||
# environment.
|
|
||||||
packages = [
|
|
||||||
# # It is sometimes useful to fine-tune packages, for example, by applying
|
|
||||||
# # overrides. You can do that directly here, just don't forget the
|
|
||||||
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
|
|
||||||
|
|
||||||
# # fonts?
|
|
||||||
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
|
|
||||||
|
|
||||||
# # You can also create simple shell scripts directly inside your
|
|
||||||
# # configuration. For example, this adds a command 'my-hello' to your
|
|
||||||
# # environment:
|
|
||||||
# (pkgs.writeShellScriptBin "my-hello" ''
|
|
||||||
# echo "Hello, ${config.home.username}!"
|
|
||||||
# '')
|
|
||||||
|
|
||||||
## GNOME
|
|
||||||
];
|
|
||||||
|
|
||||||
sessionVariables = {
|
|
||||||
MOZ_ENABLE_WAYLAND = "0";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
myHomeManager = {
|
|
||||||
bundles = {
|
|
||||||
desktop.enable = true;
|
|
||||||
maker.enable = true;
|
|
||||||
graphicDesign.enable = true;
|
|
||||||
};
|
|
||||||
element.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.zsh.enable = true;
|
|
||||||
|
|
||||||
# Let Home Manager install and manage itself.
|
|
||||||
# programs.home-manager.enable = true;
|
|
||||||
}
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
];
|
|
||||||
|
|
||||||
nixpkgs.config = {
|
|
||||||
allowUnfree = true;
|
|
||||||
experimental-features = "nix-command flakes";
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.home-manager.enable = true;
|
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
# nix
|
|
||||||
nil
|
|
||||||
nh
|
|
||||||
|
|
||||||
tldr
|
|
||||||
|
|
||||||
git
|
|
||||||
lazygit
|
|
||||||
|
|
||||||
tree-sitter
|
|
||||||
|
|
||||||
# file-management
|
|
||||||
ranger
|
|
||||||
pistol
|
|
||||||
file
|
|
||||||
p7zip
|
|
||||||
unzip
|
|
||||||
zip
|
|
||||||
|
|
||||||
# tools
|
|
||||||
killall
|
|
||||||
fzf
|
|
||||||
eza # ls-replacement
|
|
||||||
fd
|
|
||||||
zoxide
|
|
||||||
bat
|
|
||||||
dust
|
|
||||||
ripgrep
|
|
||||||
fastfetch
|
|
||||||
wget
|
|
||||||
lsd
|
|
||||||
numbat
|
|
||||||
|
|
||||||
zellij
|
|
||||||
|
|
||||||
inputs.nixvim-config.packages.${pkgs.system}.default
|
|
||||||
];
|
|
||||||
|
|
||||||
home.sessionVariables = {
|
|
||||||
EDITOR = "nvim";
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.zsh = {
|
|
||||||
enable = true;
|
|
||||||
enableCompletion = true;
|
|
||||||
autosuggestion.enable = true;
|
|
||||||
syntaxHighlighting.enable = true;
|
|
||||||
|
|
||||||
shellAliases = {
|
|
||||||
ll = "lsd -l";
|
|
||||||
lg = "lazygit";
|
|
||||||
};
|
|
||||||
|
|
||||||
history = {
|
|
||||||
size = 10000;
|
|
||||||
path = "${config.xdg.dataHome}/zsh/history";
|
|
||||||
};
|
|
||||||
|
|
||||||
oh-my-zsh = {
|
|
||||||
enable = true;
|
|
||||||
plugins = [ "git" "zoxide" ];
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.neovim = {
|
|
||||||
enable = false;
|
|
||||||
defaultEditor = false;
|
|
||||||
# package = inputs.nixvim-config.packages.${pkgs.system}.default;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [];
|
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
thunderbird
|
|
||||||
signal-desktop
|
|
||||||
keepassxc
|
|
||||||
|
|
||||||
ungoogled-chromium
|
|
||||||
# logseq
|
|
||||||
|
|
||||||
devour
|
|
||||||
];
|
|
||||||
|
|
||||||
programs.firefox = {
|
|
||||||
enable = true;
|
|
||||||
package = pkgs.firefox;
|
|
||||||
};
|
|
||||||
|
|
||||||
# TODO: fill this out (and move it in a service, probably)
|
|
||||||
# services.syncthing = {
|
|
||||||
# enable = true
|
|
||||||
# };
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [];
|
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
inkscape-with-extensions
|
|
||||||
gimp
|
|
||||||
krita
|
|
||||||
|
|
||||||
xournalpp
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [];
|
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
freecad
|
|
||||||
prusa-slicer
|
|
||||||
stable.printrun
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,47 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
system,
|
|
||||||
inputs,
|
|
||||||
outputs,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
helperLib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cfg = config.myHomeManager;
|
|
||||||
# # Taking all modules in ./features and adding enables to them
|
|
||||||
features =
|
|
||||||
helperLib.extendModules
|
|
||||||
(name: {
|
|
||||||
extraOptions = {
|
|
||||||
myHomeManager.${name}.enable = lib.mkEnableOption "enable my ${name} configuration";
|
|
||||||
};
|
|
||||||
|
|
||||||
configExtension = config: (lib.mkIf cfg.${name}.enable config);
|
|
||||||
})
|
|
||||||
(helperLib.filesIn ./features);
|
|
||||||
|
|
||||||
# Taking all module bundles in ./bundles and adding bundle.enables to them
|
|
||||||
bundles =
|
|
||||||
helperLib.extendModules
|
|
||||||
(name: {
|
|
||||||
extraOptions = {
|
|
||||||
myHomeManager.bundles.${name}.enable = lib.mkEnableOption "enable ${name} module bundle";
|
|
||||||
};
|
|
||||||
|
|
||||||
configExtension = config: (lib.mkIf cfg.bundles.${name}.enable config);
|
|
||||||
})
|
|
||||||
(helperLib.filesIn ./bundles);
|
|
||||||
in {
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
]
|
|
||||||
++ features
|
|
||||||
++ bundles;
|
|
||||||
|
|
||||||
config = {
|
|
||||||
myHomeManager = {
|
|
||||||
bundles.core.enable = lib.mkDefault true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
{pkgs, ...}:{
|
|
||||||
home.packages = [ pkgs.element-desktop ];
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
imports = [
|
|
||||||
# ./sops.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
console.keyMap = lib.mkDefault "neo";
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
vim
|
|
||||||
wget
|
|
||||||
git
|
|
||||||
libgcc
|
|
||||||
|
|
||||||
tmux
|
|
||||||
|
|
||||||
psmisc # for fuser, killall and pstree
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
secretsFile = "../../../../secrets/secrets.json";
|
|
||||||
secretsSet = builtins.fromJSON (builtins.readFile ./${secretsFile});
|
|
||||||
devices = builtins.attrNames secretsSet.syncthing.devices;
|
|
||||||
in {
|
|
||||||
imports = [
|
|
||||||
inputs.sops-nix.nixosModules.sops
|
|
||||||
];
|
|
||||||
|
|
||||||
sops = {
|
|
||||||
defaultSopsFile = ./${secretsFile};
|
|
||||||
validateSopsFiles = false;
|
|
||||||
|
|
||||||
age = {
|
|
||||||
# automatically import host SSH keys as age keys
|
|
||||||
sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];
|
|
||||||
# this will use an age key that is expected to already be in the filesystem
|
|
||||||
keyFile = "/var/lib/sops-nix/key.txt";
|
|
||||||
# generate a new key if the key specified above does not exist
|
|
||||||
generateKey = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# secrets will be output to /run/secrets
|
|
||||||
secrets = {
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
sops
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
{config, pkgs, lib, ...}:let
|
|
||||||
mainUser = config.myNixOS.sharedSettings.mainUser;
|
|
||||||
localCfg = config.myNixOS.bundles.gaming;
|
|
||||||
in {
|
|
||||||
options = {
|
|
||||||
myNixOS.bundles.gaming = {
|
|
||||||
remotePlay = lib.mkEnableOption { default = true; };
|
|
||||||
alvr = lib.mkEnableOption { default = false; };
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.steam = {
|
|
||||||
enable = true;
|
|
||||||
gamescopeSession.enable = true;
|
|
||||||
remotePlay.openFirewall = localCfg.remotePlay;
|
|
||||||
localNetworkGameTransfers.openFirewall = localCfg.remotePlay;
|
|
||||||
};
|
|
||||||
programs.gamemode.enable = true;
|
|
||||||
|
|
||||||
hardware.steam-hardware.enable = true;
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [protonup];
|
|
||||||
environment.sessionVariables = {
|
|
||||||
STEAM_EXTRA_COMPAT_TOOLS_PATHS = "/home/${mainUser}/.steam/root/compatibilitytools.d";
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.alvr = {
|
|
||||||
enable = localCfg.alvr;
|
|
||||||
openFirewall = localCfg.alvr;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
boot.kernel.sysctl = {
|
|
||||||
"kernel.sysrq" = 502; # enables "REISUB"
|
|
||||||
};
|
|
||||||
|
|
||||||
# console.keyMap = lib.mkDefault "neo";
|
|
||||||
|
|
||||||
services.xserver = {
|
|
||||||
xkb = lib.mkDefault {
|
|
||||||
layout = "de";
|
|
||||||
variant = "neo";
|
|
||||||
};
|
|
||||||
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# TODO: sort better
|
|
||||||
# For touchscreen/pad support (supposedly)
|
|
||||||
services.libinput.enable = true;
|
|
||||||
|
|
||||||
# TODO: sort better
|
|
||||||
services.displayManager.sddm.enable = lib.mkDefault true;
|
|
||||||
services.desktopManager.plasma6.enable = lib.mkDefault true;
|
|
||||||
|
|
||||||
services.printing.enable = true;
|
|
||||||
|
|
||||||
hardware.opentabletdriver.enable = true;
|
|
||||||
|
|
||||||
# sound
|
|
||||||
hardware.pulseaudio.enable = false;
|
|
||||||
security.rtkit.enable = true;
|
|
||||||
services.pipewire = {
|
|
||||||
enable = true;
|
|
||||||
alsa.enable = true;
|
|
||||||
alsa.support32Bit = true;
|
|
||||||
pulse.enable = true;
|
|
||||||
|
|
||||||
jack.enable = lib.mkDefault true;
|
|
||||||
|
|
||||||
# use the example session manager (no others are packaged yet so this is enabled by default,
|
|
||||||
# no need to redefine it in your config for now)
|
|
||||||
#media-session.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
fonts.packages = with pkgs; [
|
|
||||||
nerdfonts
|
|
||||||
(pkgs.nerdfonts.override {fonts = ["JetBrainsMono" "Iosevka" "FiraCode"];})
|
|
||||||
cm_unicode
|
|
||||||
corefonts
|
|
||||||
];
|
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
|
||||||
keepassxc
|
|
||||||
|
|
||||||
# TODO: move to displaymanagers
|
|
||||||
kdePackages.kscreenlocker
|
|
||||||
];
|
|
||||||
|
|
||||||
# TODO: move to displaymanagers
|
|
||||||
programs.partition-manager.enable = true;
|
|
||||||
|
|
||||||
fonts.enableDefaultPackages = true;
|
|
||||||
fonts.fontconfig = {
|
|
||||||
defaultFonts = {
|
|
||||||
monospace = ["JetBrainsMono Nerd Font Mono"];
|
|
||||||
sansSerif = ["JetBrainsMono Nerd Font"];
|
|
||||||
serif = ["JetBrainsMono Nerd Font"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
inputs,
|
|
||||||
outputs,
|
|
||||||
helperLib,
|
|
||||||
pkgs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cfg = config.myNixOS;
|
|
||||||
in {
|
|
||||||
options.myNixOS.home-users = lib.mkOption {
|
|
||||||
type = lib.types.attrsOf (lib.types.submodule {
|
|
||||||
options = {
|
|
||||||
userConfig = lib.mkOption {
|
|
||||||
example = "home.nix";
|
|
||||||
};
|
|
||||||
userSettings = lib.mkOption {
|
|
||||||
default = {};
|
|
||||||
example = "{}";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
default = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
|
||||||
programs.zsh.enable = true;
|
|
||||||
|
|
||||||
home-manager = {
|
|
||||||
useGlobalPkgs = true;
|
|
||||||
useUserPackages = true;
|
|
||||||
|
|
||||||
extraSpecialArgs = {
|
|
||||||
inherit inputs;
|
|
||||||
inherit helperLib;
|
|
||||||
outputs = inputs.self.outputs;
|
|
||||||
};
|
|
||||||
|
|
||||||
users =
|
|
||||||
builtins.mapAttrs (name: user: {...}: {
|
|
||||||
imports = [
|
|
||||||
(import user.userConfig)
|
|
||||||
outputs.homeManagerModules.default
|
|
||||||
];
|
|
||||||
})
|
|
||||||
(config.myNixOS.home-users);
|
|
||||||
};
|
|
||||||
|
|
||||||
users.users = builtins.mapAttrs (
|
|
||||||
name: user:
|
|
||||||
{
|
|
||||||
isNormalUser = true;
|
|
||||||
shell = pkgs.zsh;
|
|
||||||
extraGroups = ["libvirtd" "networkmanager"];
|
|
||||||
}
|
|
||||||
// user.userSettings
|
|
||||||
) (config.myNixOS.home-users);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,101 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
inputs,
|
|
||||||
outputs,
|
|
||||||
helperLib,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
cfg = config.myNixOS;
|
|
||||||
|
|
||||||
# Taking all modules in ./features and adding enables to them
|
|
||||||
features =
|
|
||||||
helperLib.extendModules
|
|
||||||
(name: {
|
|
||||||
extraOptions = {
|
|
||||||
myNixOS.${name}.enable = lib.mkEnableOption "enable my ${name} configuration";
|
|
||||||
};
|
|
||||||
|
|
||||||
configExtension = config: (lib.mkIf cfg.${name}.enable config);
|
|
||||||
})
|
|
||||||
(helperLib.filesIn ./features);
|
|
||||||
|
|
||||||
# taking all module bundles in ./bundles and adding bundle.enables to them
|
|
||||||
bundles =
|
|
||||||
helperLib.extendModules
|
|
||||||
(name: {
|
|
||||||
extraOptions = {
|
|
||||||
myNixOS.bundles.${name}.enable = lib.mkEnableOption "enable ${name} module bundle";
|
|
||||||
};
|
|
||||||
|
|
||||||
configExtension = config: (lib.mkIf cfg.bundles.${name}.enable config);
|
|
||||||
})
|
|
||||||
(helperLib.filesIn ./bundles);
|
|
||||||
|
|
||||||
# taking all module services in ./services and adding service.enables to them
|
|
||||||
services =
|
|
||||||
helperLib.extendModules
|
|
||||||
(name: {
|
|
||||||
extraOptions = {
|
|
||||||
myNixOS.services.${name}.enable = lib.mkEnableOption "enable ${name} module service";
|
|
||||||
};
|
|
||||||
|
|
||||||
configExtension = config: (lib.mkIf cfg.services.${name}.enable config);
|
|
||||||
})
|
|
||||||
(helperLib.filesIn ./services);
|
|
||||||
in {
|
|
||||||
imports =
|
|
||||||
[
|
|
||||||
inputs.home-manager.nixosModules.home-manager
|
|
||||||
]
|
|
||||||
++ features
|
|
||||||
++ bundles
|
|
||||||
++ services;
|
|
||||||
|
|
||||||
options.myNixOS = {
|
|
||||||
sharedSettings = {
|
|
||||||
# put settings here that are shared between homemanager and nixos, e.g.
|
|
||||||
# hyprland.enable = lib.mkEnableOption "enable hyprland";
|
|
||||||
|
|
||||||
mainUser = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "prunebutt";
|
|
||||||
example = "mainUser";
|
|
||||||
description = "The main user that runs the system";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
|
||||||
nix.settings.experimental-features = ["nix-command" "flakes"];
|
|
||||||
programs.nix-ld.enable = true;
|
|
||||||
nixpkgs = {
|
|
||||||
config.allowUnfree = lib.mkDefault true;
|
|
||||||
# overlays = [
|
|
||||||
# outputs.overlays.additions
|
|
||||||
# outputs.overlays.modifications
|
|
||||||
# ];
|
|
||||||
};
|
|
||||||
|
|
||||||
myNixOS = {
|
|
||||||
bundles.core.enable = lib.mkDefault true;
|
|
||||||
bundles.users.enable = lib.mkDefault true;
|
|
||||||
|
|
||||||
defaultLocale.enable = lib.mkDefault true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
# imports = [
|
|
||||||
# ./neo.nix
|
|
||||||
# ./locale.nix
|
|
||||||
# ./pipewire.nix
|
|
||||||
# ];
|
|
||||||
#
|
|
||||||
# locale.enable = lib.mkDefault true;
|
|
||||||
# neo.enable = lib.mkDefault true;
|
|
||||||
#
|
|
||||||
# pipewire.enable = lib.mkDefault true;
|
|
||||||
# pipewire.useJack = lib.mkDefault false;
|
|
||||||
# }
|
|
||||||
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
_:{
|
|
||||||
programs.ausweisapp = {
|
|
||||||
enable = true;
|
|
||||||
openFirewall = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
config,
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
config = {
|
|
||||||
time.timeZone = lib.mkDefault "Europe/Berlin";
|
|
||||||
|
|
||||||
i18n.defaultLocale = lib.mkDefault "en_US.UTF-8";
|
|
||||||
|
|
||||||
i18n.extraLocaleSettings = lib.mkDefault {
|
|
||||||
LC_ADDRESS = "de_DE.UTF-8";
|
|
||||||
LC_IDENTIFICATION = "de_DE.UTF-8";
|
|
||||||
LC_MEASUREMENT = "de_DE.UTF-8";
|
|
||||||
LC_MONETARY = "de_DE.UTF-8";
|
|
||||||
LC_NAME = "de_DE.UTF-8";
|
|
||||||
LC_NUMERIC = "de_DE.UTF-8";
|
|
||||||
LC_PAPER = "de_DE.UTF-8";
|
|
||||||
LC_TELEPHONE = "de_DE.UTF-8";
|
|
||||||
LC_TIME = "de_DE.UTF-8";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
{config, pkgs, lib, ...}: let
|
|
||||||
localCfg = config.myNixOS.mitmproxy;
|
|
||||||
in {
|
|
||||||
options.myNixOS.mitmproxy = {
|
|
||||||
routeAP = lib.mkEnableOption { default = true; };
|
|
||||||
accessPoint = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
};
|
|
||||||
mitmPort = lib.mkOption { default = 8080; };
|
|
||||||
};
|
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.mitmproxy ];
|
|
||||||
|
|
||||||
networking.firewall = lib.mkIf localCfg.routeAP {
|
|
||||||
extraCommands = let
|
|
||||||
accessPoint = localCfg.accessPoint;
|
|
||||||
port = localCfg.mitmPort;
|
|
||||||
in /*bash*/ ''
|
|
||||||
iptables -t nat -A PREROUTING -i ${accessPoint} -p tcp --dport 80 -j REDIRECT --to-port ${builtins.toString port}
|
|
||||||
iptables -t nat -A PREROUTING -i ${accessPoint} -p tcp --dport 443 -j REDIRECT --to-port ${builtins.toString port}
|
|
||||||
'';
|
|
||||||
allowedTCPPorts = [ localCfg.mitmPort ];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
@ -1,60 +0,0 @@
|
||||||
{
|
|
||||||
pkgs,
|
|
||||||
config,
|
|
||||||
lib,
|
|
||||||
inputs,
|
|
||||||
...
|
|
||||||
}: let
|
|
||||||
webGuiPort = [8384];
|
|
||||||
cfg = config;
|
|
||||||
secretsFile = "../../../secrets/secrets.json";
|
|
||||||
secretsSet = builtins.fromJSON (builtins.readFile ./${secretsFile});
|
|
||||||
devices = builtins.attrNames secretsSet.syncthing.devices;
|
|
||||||
in {
|
|
||||||
options.myNixOS.services.syncthing = {
|
|
||||||
rootDir = lib.mkOption {
|
|
||||||
type = lib.types.path;
|
|
||||||
default = "/home/${cfg.myNixOS.sharedSettings.mainUser}/sync";
|
|
||||||
};
|
|
||||||
|
|
||||||
remoteGui = lib.mkEnableOption "Enable port for remote WebGUI";
|
|
||||||
};
|
|
||||||
|
|
||||||
services.syncthing = {
|
|
||||||
enable = true;
|
|
||||||
user = cfg.myNixOS.sharedSettings.mainUser;
|
|
||||||
dataDir = config.rootDir;
|
|
||||||
configDir = "/home/${cfg.myNixOS.sharedSettings.mainUser}/.config/syncthing";
|
|
||||||
overrideDevices = true;
|
|
||||||
overrideFolders = true;
|
|
||||||
settings = {
|
|
||||||
devices = {
|
|
||||||
"saintAlphonso" = {id = "LHASNUO-CXALARH-XI3TU4U-OCULV72-HS3HQ35-P4FECIT-UZ5VMSZ-PMCEPQH";};
|
|
||||||
"littleUmbrella" = {id = "BH3OHYP-TGGOSZO-EM6MXRY-YHSBOUO-CQHE7DL-N2LOUFY-TF3LEJ7-FHTGTQI";};
|
|
||||||
"pixelRoot" = {id = "PO7U5SE-DYKTOM2-TFDS3BM-A25VK7V-MQ3VPFM-EFX3J4D-B3UDCX4-3XQAIAC";};
|
|
||||||
"pixelDefault" = {id = "HC3CKC7-OUZBLU3-JIKTRYG-DPJE6EC-7POCWNS-6VNOPDU-L7OWYWO-PL332AY";};
|
|
||||||
"pixelGooglor" = {id = "OWDM4I2-O6STMIS-H3EXF65-FSM26K3-5FLQXRN-VOK7JGC-T6H76IR-QAVO3QK";};
|
|
||||||
"remus" = {id = "XATHQZF-XO27XG2-65BT5EO-PZQWGMG-BDOYXID-AI5YPDU-ZACUPB4-UTXLPA3";};
|
|
||||||
};
|
|
||||||
|
|
||||||
folders = {
|
|
||||||
"/home/${cfg.myNixOS.sharedSettings.mainUser}/KeepassXC" = {
|
|
||||||
label = "KeepassXC";
|
|
||||||
id = "xd4de-mjfcq";
|
|
||||||
devices = ["littleUmbrella" "pixelRoot" "pixelDefault" "pixelGooglor" "saintAlphonso"];
|
|
||||||
versioning = {
|
|
||||||
type = "simple";
|
|
||||||
params.keep = "5";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Syncthing ports: 8384 for remote access to GUI
|
|
||||||
# 22000 TCP and/or UDP for sync traffic
|
|
||||||
# 21027/UDP for discovery
|
|
||||||
# source: https://docs.syncthing.net/users/firewall.html
|
|
||||||
networking.firewall.allowedTCPPorts = [8384 22000];
|
|
||||||
networking.firewall.allowedUDPPorts = [22000 21027];
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
# This one brings our custom packages from the `pkgs` directory
|
|
||||||
_:{
|
|
||||||
nixpkgs.overlays = final: prev: import ../pkgs final.pkgs;
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
{inputs, ...}: {
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
(final: prev: import ../pkgs final.pkgs)
|
|
||||||
|
|
||||||
# Any custom modifications
|
|
||||||
# https://nixos.wiki/wiki/Overlays
|
|
||||||
(final: prev: {
|
|
||||||
nixvim = builtins.trace "foobarzelidumm" inputs.nixvim-config.packages.${prev.system}.default;
|
|
||||||
})
|
|
||||||
# example = prev.example.overrideAttrs (oldAttrs: rec {
|
|
||||||
# ...
|
|
||||||
# });
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
# Any custom modifications
|
|
||||||
# https://nixos.wiki/wiki/Overlays
|
|
||||||
|
|
||||||
{inputs, ...}: {
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
(final: prev: {
|
|
||||||
nixvim = inputs.nixvim-config.packages.${prev.system}.default;
|
|
||||||
|
|
||||||
testitest = builtins.trace "foobarbaz" "testitest";
|
|
||||||
# example = prev.example.overrideAttrs (oldAttrs: rec {
|
|
||||||
# ...
|
|
||||||
# });
|
|
||||||
})
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
# Custom packages, that can be defined similarly to ones from nixpkgks
|
|
||||||
# Build them using `nix build .#example`
|
|
||||||
pkgs: {
|
|
||||||
# example = pkgs.callPackage ./example { };
|
|
||||||
}
|
|
||||||
73
plugins/aerial/default.nix
Normal file
73
plugins/aerial/default.nix
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
{ lib, pkgs, ...}:
|
||||||
|
{
|
||||||
|
extra = {
|
||||||
|
packages = [
|
||||||
|
(import ./package.nix { inherit lib pkgs; })
|
||||||
|
];
|
||||||
|
|
||||||
|
config = /*lua*/ ''
|
||||||
|
require("aerial").setup({
|
||||||
|
backends = { "lsp", "treesitter", "markdown", "man" },
|
||||||
|
layout = { min_width = 28, placement = "window", default_direction = "prefer_left" },
|
||||||
|
show_guides = true,
|
||||||
|
filter_kind = false,
|
||||||
|
|
||||||
|
guides = {
|
||||||
|
mid_item = "├ ",
|
||||||
|
last_item = "└ ",
|
||||||
|
nested_top = "│ ",
|
||||||
|
whitespace = " ",
|
||||||
|
},
|
||||||
|
autojump = true,
|
||||||
|
keymaps = {
|
||||||
|
["[y"] = "actions.prev",
|
||||||
|
["]y"] = "actions.next",
|
||||||
|
["[Y"] = "actions.prev_up",
|
||||||
|
["]Y"] = "actions.next_up",
|
||||||
|
["|"] = "actions.jump_vsplit",
|
||||||
|
["\\"] = "actions.jump_split",
|
||||||
|
["{"] = false,
|
||||||
|
["}"] = false,
|
||||||
|
["[["] = false,
|
||||||
|
["]]"] = false,
|
||||||
|
["<C-v>"] = false,
|
||||||
|
["<C-s>"] = false,
|
||||||
|
},
|
||||||
|
attach_mode = "global",
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts.keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>lO";
|
||||||
|
action.__raw = ''function() require("aerial").open() end'';
|
||||||
|
options.desc = "Symbols outline (left)";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>lo";
|
||||||
|
action.__raw = ''function() require("aerial").open({direction = "float"}) end'';
|
||||||
|
options.desc = "Symbols outline (floating)";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "]S";
|
||||||
|
action.__raw = ''function() require("aerial").next() end'';
|
||||||
|
options.desc = "Next symbol";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "[S";
|
||||||
|
action.__raw = ''function() require("aerial").prev() end'';
|
||||||
|
options.desc = "Previous symbol";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>fs";
|
||||||
|
action.__raw = ''require("telescope").extensions.aerial.aerial'';
|
||||||
|
options.desc = "Find symbols";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
21
plugins/aerial/package.nix
Normal file
21
plugins/aerial/package.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
{ pkgs, ...}:
|
||||||
|
let
|
||||||
|
version = "2.1.0";
|
||||||
|
in
|
||||||
|
pkgs.vimUtils.buildVimPlugin {
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
name = "aerial";
|
||||||
|
|
||||||
|
# src = pkgs.fetchFromGitHub {
|
||||||
|
# owner = "stevearc";
|
||||||
|
# repo = "aerial.nvim";
|
||||||
|
# rev = "v${version}";
|
||||||
|
# hash = "sha256:0ip8xmncp82svlbkphlas88xjvzrpzyy5b1c9x06dqbm4ifai0va";
|
||||||
|
# };
|
||||||
|
|
||||||
|
src = builtins.fetchTarball {
|
||||||
|
url = "http://github.com/stevearc/aerial.nvim/archive/v${version}.tar.gz";
|
||||||
|
sha256 = "sha256:0ip8xmncp82svlbkphlas88xjvzrpzyy5b1c9x06dqbm4ifai0va";
|
||||||
|
};
|
||||||
|
}
|
||||||
200
plugins/alpha.nix
Normal file
200
plugins/alpha.nix
Normal file
|
|
@ -0,0 +1,200 @@
|
||||||
|
# homepage: https://github.com/goolord/alpha-nvim
|
||||||
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/alpha/index.html
|
||||||
|
{ helpers, icons, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
header = {
|
||||||
|
type = "text";
|
||||||
|
|
||||||
|
# Use color defined by catppuccin
|
||||||
|
opts = {
|
||||||
|
hl = "AlphaHeader";
|
||||||
|
position = "center";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Generated from https://www.asciiart.eu/text-to-ascii-art
|
||||||
|
# Font used: Larry 3D
|
||||||
|
val = [
|
||||||
|
" __ "
|
||||||
|
" /\\ \\__ __ "
|
||||||
|
" __ ____\\ \\ ,_\\ _ __ ___ ___ /\\_\\ __ _ "
|
||||||
|
" /'__`\\ /',__\\\\ \\ \\/ /\\`'__\\/ __`\\ /' _ `\\/\\ \\ /\\ \\/'\\ "
|
||||||
|
"/\\ \\L\\.\\_/\\__, `\\\\ \\ \\_\\ \\ \\//\\ \\L\\ \\/\\ \\/\\ \\ \\ \\\\/> </ "
|
||||||
|
"\\ \\__/.\\_\\/\\____/ \\ \\__\\\\ \\_\\\\ \\____/\\ \\_\\ \\_\\ \\_\\/\\_/\\_\\ "
|
||||||
|
" \\/__/\\/_/\\/___/ \\/__/ \\/_/ \\/___/ \\/_/\\/_/\\/_/\\//\\/_/ "
|
||||||
|
" __ __ /\\_\\ ___ ___ "
|
||||||
|
" /\\ \\/\\ \\\\/\\ \\ /' __` __`\\ "
|
||||||
|
" \\ \\ \\_/ |\\ \\ \\/\\ \\/\\ \\/\\ \\ "
|
||||||
|
" \\ \\___/ \\ \\_\\ \\_\\ \\_\\ \\_\\"
|
||||||
|
" \\/__/ \\/_/\\/_/\\/_/\\/_/"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
buttons = {
|
||||||
|
type = "group";
|
||||||
|
opts.spacing = 1;
|
||||||
|
|
||||||
|
# Use function defined in lua config (see extra.config) to generate buttons
|
||||||
|
val = [
|
||||||
|
{ __raw = "alpha_button('LDR s l', '${icons.Refresh} Last Session')"; }
|
||||||
|
{ __raw = "alpha_button('LDR e ', '${icons.FolderOpen} Explorer')"; }
|
||||||
|
{ __raw = "alpha_button('LDR f o', '${icons.DefaultFile} Recents')"; }
|
||||||
|
{ __raw = "alpha_button('LDR f f', '${icons.Search} Find File')"; }
|
||||||
|
{ __raw = "alpha_button('LDR f g', '${icons.WordFile} Live Grep')"; }
|
||||||
|
{ __raw = "alpha_button('LDR n ', '${icons.FileNew} New File')"; }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Show random fortune as footer
|
||||||
|
footer = {
|
||||||
|
type = "text";
|
||||||
|
|
||||||
|
# Defined by Alpha
|
||||||
|
# https://github.com/goolord/alpha-nvim/blob/main/lua/alpha/fortune.lua
|
||||||
|
val.__raw = "require('alpha.fortune')()";
|
||||||
|
|
||||||
|
# Use color defined by catppuccin
|
||||||
|
opts = {
|
||||||
|
hl = "AlphaFooter";
|
||||||
|
position = "center";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
layout = [
|
||||||
|
# Padding size depending on window height (taken from AstroNvim)
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/alpha.lua#L141
|
||||||
|
{
|
||||||
|
type = "padding";
|
||||||
|
val.__raw = "vim.fn.max { 2, vim.fn.floor(vim.fn.winheight(0) * 0.2) }";
|
||||||
|
}
|
||||||
|
header
|
||||||
|
{ type = "padding"; val = 5; }
|
||||||
|
buttons
|
||||||
|
{ type = "padding"; val = 3; }
|
||||||
|
footer
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
extra = {
|
||||||
|
packages = with pkgs.vimPlugins; [
|
||||||
|
alpha-nvim
|
||||||
|
nvim-web-devicons
|
||||||
|
];
|
||||||
|
|
||||||
|
# Based on Alpha dashboard theme with tweaks from AstroNvim
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/alpha.lua#L86-L112
|
||||||
|
# https://github.com/goolord/alpha-nvim/blob/main/lua/alpha/themes/dashboard.lua#L46-L73
|
||||||
|
config = ''
|
||||||
|
local alpha_leader = "LDR"
|
||||||
|
|
||||||
|
function alpha_button(shortcut, desc, keybind, keybind_opts)
|
||||||
|
local sc = shortcut:gsub("%s", ""):gsub(alpha_leader, "<leader>")
|
||||||
|
|
||||||
|
local real_leader = vim.g.mapleader
|
||||||
|
if real_leader == " " then real_leader = "SPC" end
|
||||||
|
|
||||||
|
local opts = {
|
||||||
|
position = "center",
|
||||||
|
shortcut = shortcut:gsub(alpha_leader, real_leader),
|
||||||
|
cursor = -2,
|
||||||
|
width = 36,
|
||||||
|
align_shortcut = "right",
|
||||||
|
hl = "AlphaButtons",
|
||||||
|
hl_shortcut = "AlphaShortcut",
|
||||||
|
}
|
||||||
|
|
||||||
|
if keybind then
|
||||||
|
keybind_opts = if_nil(keybind_opts, { noremap = true, silent = true, nowait = true, desc = desc })
|
||||||
|
opts.keymap = { "n", sc, keybind, keybind_opts }
|
||||||
|
end
|
||||||
|
|
||||||
|
local function on_press()
|
||||||
|
local key = vim.api.nvim_replace_termcodes(keybind or sc .. "<ignore>", true, false, true)
|
||||||
|
vim.api.nvim_feedkeys(key, "t", false)
|
||||||
|
end
|
||||||
|
|
||||||
|
return {
|
||||||
|
type = "button",
|
||||||
|
val = desc,
|
||||||
|
on_press = on_press,
|
||||||
|
opts = opts,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
require("alpha").setup({
|
||||||
|
layout = ${helpers.toLuaObject layout},
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts = {
|
||||||
|
autoGroups.alpha = { };
|
||||||
|
|
||||||
|
# Custom autocommand (taken from AstroNvim)
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/alpha.lua#L19-L43
|
||||||
|
autoCmd = [
|
||||||
|
{
|
||||||
|
desc = "Disable status, tablines and cmdheight for alpha";
|
||||||
|
event = [ "User" "BufWinEnter" ];
|
||||||
|
group = "alpha";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(event)
|
||||||
|
if
|
||||||
|
(
|
||||||
|
(event.event == "User" and event.file == "AlphaReady")
|
||||||
|
or (event.event == "BufWinEnter" and vim.bo[event.buf].filetype == "alpha")
|
||||||
|
) and not vim.g.before_alpha
|
||||||
|
then
|
||||||
|
vim.g.before_alpha = {
|
||||||
|
showtabline = vim.opt.showtabline:get(),
|
||||||
|
laststatus = vim.opt.laststatus:get(),
|
||||||
|
cmdheight = vim.opt.cmdheight:get(),
|
||||||
|
}
|
||||||
|
vim.opt.showtabline, vim.opt.laststatus, vim.opt.cmdheight = 0, 0, 0
|
||||||
|
elseif vim.g.before_alpha and event.event == "BufWinEnter" and vim.bo[event.buf].buftype ~= "nofile" then
|
||||||
|
vim.opt.laststatus, vim.opt.showtabline, vim.opt.cmdheight =
|
||||||
|
vim.g.before_alpha.laststatus, vim.g.before_alpha.showtabline, vim.g.before_alpha.cmdheight
|
||||||
|
vim.g.before_alpha = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
colorschemes.catppuccin.settings = {
|
||||||
|
# Enable catppuccin colors
|
||||||
|
# https://github.com/catppuccin/nvim/blob/main/lua/catppuccin/groups/integrations/alpha.lua
|
||||||
|
integrations.alpha = true;
|
||||||
|
|
||||||
|
# Override default catppuccin header color
|
||||||
|
custom_highlights = ''
|
||||||
|
function(colors)
|
||||||
|
return {
|
||||||
|
AlphaHeader = { fg = colors.red },
|
||||||
|
}
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>h";
|
||||||
|
options.desc = "Home screen";
|
||||||
|
|
||||||
|
# Open alpha in a non neo-tree window (taken from AstroNvim)
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/alpha.lua#L10-L16
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
local wins = vim.api.nvim_tabpage_list_wins(0)
|
||||||
|
if #wins > 1 and vim.bo[vim.api.nvim_win_get_buf(wins[1])].filetype == "neo-tree" then
|
||||||
|
vim.fn.win_gotoid(wins[2])
|
||||||
|
end
|
||||||
|
require("alpha").start(false)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
23
plugins/arrow.nix
Normal file
23
plugins/arrow.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
{ icons, pkgs, ... }:
|
||||||
|
{
|
||||||
|
opts.enable = true;
|
||||||
|
|
||||||
|
extra = {
|
||||||
|
packages = [ pkgs.vimPlugins.arrow-nvim ];
|
||||||
|
|
||||||
|
config = /*lua*/ ''
|
||||||
|
require('arrow').setup({
|
||||||
|
show_icons = true,
|
||||||
|
leader_key = ';', -- Recommended to be a single key
|
||||||
|
buffer_leader_key = 'm', -- Per Buffer Mappings
|
||||||
|
})
|
||||||
|
|
||||||
|
-- prewritten for later
|
||||||
|
-- require("which-key").add({
|
||||||
|
-- {";", desc = "Arrow buffers"},
|
||||||
|
-- {"m", desc = "Arrow marks"}
|
||||||
|
-- })
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
37
plugins/astrocore/default.nix
Normal file
37
plugins/astrocore/default.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
# homepage: https://github.com/AstroNvim/astrocore
|
||||||
|
{ helpers, icons, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
diagnostics = import ./diagnostics.nix { inherit icons; };
|
||||||
|
features = import ./features.nix;
|
||||||
|
options = import ./options.nix;
|
||||||
|
rooter = import ./rooter.nix;
|
||||||
|
sessions = import ./sessions.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
extra = {
|
||||||
|
packages = [
|
||||||
|
(import ./package { inherit lib pkgs; })
|
||||||
|
];
|
||||||
|
|
||||||
|
config = ''
|
||||||
|
require("astrocore").setup({
|
||||||
|
diagnostics = ${helpers.toLuaObject diagnostics},
|
||||||
|
features = ${helpers.toLuaObject features},
|
||||||
|
options = ${helpers.toLuaObject options},
|
||||||
|
rooter = ${helpers.toLuaObject rooter},
|
||||||
|
sessions = ${helpers.toLuaObject sessions},
|
||||||
|
on_keys = {
|
||||||
|
auto_hlsearch = {
|
||||||
|
function(char)
|
||||||
|
if vim.fn.mode() == "n" then
|
||||||
|
local new_hlsearch = vim.tbl_contains({ "<CR>", "n", "N", "*", "#", "?", "/" }, vim.fn.keytrans(char))
|
||||||
|
if vim.opt.hlsearch:get() ~= new_hlsearch then vim.opt.hlsearch = new_hlsearch end
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
31
plugins/astrocore/diagnostics.nix
Normal file
31
plugins/astrocore/diagnostics.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore.lua#L40-L61
|
||||||
|
{ icons, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
underline = true;
|
||||||
|
update_in_insert = true;
|
||||||
|
severity_sort = true;
|
||||||
|
virtual_text = true;
|
||||||
|
|
||||||
|
float = {
|
||||||
|
focused = false;
|
||||||
|
style = "minimal";
|
||||||
|
border = "rounded";
|
||||||
|
source = "always";
|
||||||
|
header = "";
|
||||||
|
prefix = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
signs = {
|
||||||
|
text = {
|
||||||
|
# vim.diagnostic.severity.ERROR
|
||||||
|
"1" = icons.DiagnosticError;
|
||||||
|
# vim.diagnostic.severity.WARN
|
||||||
|
"2" = icons.DiagnosticWarn;
|
||||||
|
# vim.diagnostic.severity.INFO
|
||||||
|
"3" = icons.DiagnosticInfo;
|
||||||
|
# vim.diagnostic.severity.HINT
|
||||||
|
"4" = icons.DiagnosticHint;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
23
plugins/astrocore/features.nix
Normal file
23
plugins/astrocore/features.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore.lua#L32-L39
|
||||||
|
{
|
||||||
|
# Enable autopairs at start
|
||||||
|
autopairs = true;
|
||||||
|
|
||||||
|
# Enable completion at start
|
||||||
|
cmp = true;
|
||||||
|
|
||||||
|
# Enable diagnostics by default
|
||||||
|
diagnostics_mode = 3;
|
||||||
|
|
||||||
|
# Highlight URLs by default
|
||||||
|
highlighturl = true;
|
||||||
|
|
||||||
|
# Disable notifications
|
||||||
|
notifications = true;
|
||||||
|
|
||||||
|
# Set global limits for large files
|
||||||
|
large_buf = {
|
||||||
|
lines = 10000;
|
||||||
|
size = 1024 * 500;
|
||||||
|
};
|
||||||
|
}
|
||||||
11
plugins/astrocore/options.nix
Normal file
11
plugins/astrocore/options.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore_options.lua#L49-L53
|
||||||
|
g.markdown_recommended_style = 0;
|
||||||
|
|
||||||
|
t.bufs.__raw = ''
|
||||||
|
(function()
|
||||||
|
if not vim.t.bufs then vim.t.bufs = vim.api.nvim_list_bufs() end
|
||||||
|
return vim.t.bufs
|
||||||
|
end)()
|
||||||
|
'';
|
||||||
|
}
|
||||||
22
plugins/astrocore/package/default.nix
Normal file
22
plugins/astrocore/package/default.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
version = "1.5.0";
|
||||||
|
in
|
||||||
|
pkgs.vimUtils.buildVimPlugin {
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
name = "astrocore";
|
||||||
|
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "astronvim";
|
||||||
|
repo = "astrocore";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-KKNglNd3S8E11CMAS6E3vhN4oZoRh0u3rjkgHiIGozI=";
|
||||||
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
./init.lua.patch
|
||||||
|
./mason.lua.patch
|
||||||
|
];
|
||||||
|
}
|
||||||
136
plugins/astrocore/package/init.lua.patch
Normal file
136
plugins/astrocore/package/init.lua.patch
Normal file
|
|
@ -0,0 +1,136 @@
|
||||||
|
diff --git a/lua/astrocore/init.lua b/lua/astrocore/init.lua
|
||||||
|
index b18c5de..91847b4 100644
|
||||||
|
--- a/lua/astrocore/init.lua
|
||||||
|
+++ b/lua/astrocore/init.lua
|
||||||
|
@@ -27,22 +27,6 @@ function M.extend_tbl(default, opts)
|
||||||
|
return default and vim.tbl_deep_extend("force", default, opts) or opts
|
||||||
|
end
|
||||||
|
|
||||||
|
---- Sync Lazy and then update Mason
|
||||||
|
-function M.update_packages()
|
||||||
|
- require("lazy").sync { wait = true }
|
||||||
|
- require("astrocore.mason").update_all()
|
||||||
|
-end
|
||||||
|
-
|
||||||
|
---- Partially reload AstroNvim user settings. Includes core vim options, mappings, and highlights. This is an experimental feature and may lead to instabilities until restart.
|
||||||
|
-function M.reload()
|
||||||
|
- local lazy, was_modifiable = require "lazy", vim.opt.modifiable:get()
|
||||||
|
- if not was_modifiable then vim.opt.modifiable = true end
|
||||||
|
- lazy.reload { plugins = { M.get_plugin "astrocore" } }
|
||||||
|
- if not was_modifiable then vim.opt.modifiable = false end
|
||||||
|
- if M.is_available "astroui" then lazy.reload { plugins = { M.get_plugin "astroui" } } end
|
||||||
|
- vim.cmd.doautocmd "ColorScheme"
|
||||||
|
-end
|
||||||
|
-
|
||||||
|
--- Insert one or more values into a list like table and maintain that you do not insert non-unique values (THIS MODIFIES `dst`)
|
||||||
|
---@param dst any[]|nil The list like table that you want to insert into
|
||||||
|
---@param src any[] Values to be inserted
|
||||||
|
@@ -176,71 +160,52 @@ function M.toggle_term_cmd(opts)
|
||||||
|
terms[opts.cmd][num]:toggle()
|
||||||
|
end
|
||||||
|
|
||||||
|
---- Get a plugin spec from lazy
|
||||||
|
----@param plugin string The plugin to search for
|
||||||
|
----@return LazyPlugin? available # The found plugin spec from Lazy
|
||||||
|
-function M.get_plugin(plugin)
|
||||||
|
- local lazy_config_avail, lazy_config = pcall(require, "lazy.core.config")
|
||||||
|
- return lazy_config_avail and lazy_config.spec.plugins[plugin] or nil
|
||||||
|
-end
|
||||||
|
-
|
||||||
|
---- Check if a plugin is defined in lazy. Useful with lazy loading when a plugin is not necessarily loaded yet
|
||||||
|
+--- Check if a plugin is loaded
|
||||||
|
---@param plugin string The plugin to search for
|
||||||
|
---@return boolean available # Whether the plugin is available
|
||||||
|
-function M.is_available(plugin) return M.get_plugin(plugin) ~= nil end
|
||||||
|
-
|
||||||
|
---- Resolve the options table for a given plugin with lazy
|
||||||
|
----@param plugin string The plugin to search for
|
||||||
|
----@return table opts # The plugin options
|
||||||
|
-function M.plugin_opts(plugin)
|
||||||
|
- local spec = M.get_plugin(plugin)
|
||||||
|
- return spec and require("lazy.core.plugin").values(spec, "opts") or {}
|
||||||
|
-end
|
||||||
|
-
|
||||||
|
---- A helper function to wrap a module function to require a plugin before running
|
||||||
|
----@param plugin string The plugin to call `require("lazy").load` with
|
||||||
|
----@param module table The system module where the functions live (e.g. `vim.ui`)
|
||||||
|
----@param funcs string|string[] The functions to wrap in the given module (e.g. `"ui", "select"`)
|
||||||
|
-function M.load_plugin_with_func(plugin, module, funcs)
|
||||||
|
- if type(funcs) == "string" then funcs = { funcs } end
|
||||||
|
- for _, func in ipairs(funcs) do
|
||||||
|
- local old_func = module[func]
|
||||||
|
- module[func] = function(...)
|
||||||
|
- module[func] = old_func
|
||||||
|
- require("lazy").load { plugins = { plugin } }
|
||||||
|
- module[func](...)
|
||||||
|
- end
|
||||||
|
- end
|
||||||
|
-end
|
||||||
|
+function M.is_available(plugin) return package.loaded[plugin] ~= nil end
|
||||||
|
|
||||||
|
--- Execute a function when a specified plugin is loaded with Lazy.nvim, or immediately if already loaded
|
||||||
|
---@param plugins string|string[] the name of the plugin or a list of plugins to defer the function execution on. If a list is provided, only one needs to be loaded to execute the provided function
|
||||||
|
---@param load_op fun()|string|string[] the function to execute when the plugin is loaded, a plugin name to load, or a list of plugin names to load
|
||||||
|
function M.on_load(plugins, load_op)
|
||||||
|
- local lazy_config_avail, lazy_config = pcall(require, "lazy.core.config")
|
||||||
|
- if lazy_config_avail then
|
||||||
|
- if type(plugins) == "string" then plugins = { plugins } end
|
||||||
|
- if type(load_op) ~= "function" then
|
||||||
|
- local to_load = type(load_op) == "string" and { load_op } or load_op --[=[@as string[]]=]
|
||||||
|
- load_op = function() require("lazy").load { plugins = to_load } end
|
||||||
|
- end
|
||||||
|
+ -- local lazy_config_avail, lazy_config = pcall(require, "lazy.core.config")
|
||||||
|
+ -- if lazy_config_avail then
|
||||||
|
+ -- if type(plugins) == "string" then plugins = { plugins } end
|
||||||
|
+ -- if type(load_op) ~= "function" then
|
||||||
|
+ -- local to_load = type(load_op) == "string" and { load_op } or load_op --[=[@as string[]]=]
|
||||||
|
+ -- load_op = function() require("lazy").load { plugins = to_load } end
|
||||||
|
+ -- end
|
||||||
|
+ --
|
||||||
|
+ -- for _, plugin in ipairs(plugins) do
|
||||||
|
+ -- if vim.tbl_get(lazy_config.plugins, plugin, "_", "loaded") then
|
||||||
|
+ -- vim.schedule(load_op)
|
||||||
|
+ -- return
|
||||||
|
+ -- end
|
||||||
|
+ -- end
|
||||||
|
+ -- vim.api.nvim_create_autocmd("User", {
|
||||||
|
+ -- pattern = "LazyLoad",
|
||||||
|
+ -- desc = ("A function to be ran when one of these plugins runs: %s"):format(vim.inspect(plugins)),
|
||||||
|
+ -- callback = function(args)
|
||||||
|
+ -- if vim.tbl_contains(plugins, args.data) then
|
||||||
|
+ -- load_op()
|
||||||
|
+ -- return true
|
||||||
|
+ -- end
|
||||||
|
+ -- end,
|
||||||
|
+ -- })
|
||||||
|
+ -- end
|
||||||
|
+
|
||||||
|
+ if type(plugins) == "string" then plugins = { plugins } end
|
||||||
|
+ if type(load_op) ~= "function" then
|
||||||
|
+ M.notify "astrocore.on_load cannot load plugins, they must be registered through nixvim"
|
||||||
|
+ load_op = function() end
|
||||||
|
+ end
|
||||||
|
|
||||||
|
- for _, plugin in ipairs(plugins) do
|
||||||
|
- if vim.tbl_get(lazy_config.plugins, plugin, "_", "loaded") then
|
||||||
|
- vim.schedule(load_op)
|
||||||
|
- return
|
||||||
|
- end
|
||||||
|
+ for _, plugin in ipairs(plugins) do
|
||||||
|
+ if M.is_available(plugin) then
|
||||||
|
+ vim.schedule(load_op)
|
||||||
|
+ return
|
||||||
|
end
|
||||||
|
- vim.api.nvim_create_autocmd("User", {
|
||||||
|
- pattern = "LazyLoad",
|
||||||
|
- desc = ("A function to be ran when one of these plugins runs: %s"):format(vim.inspect(plugins)),
|
||||||
|
- callback = function(args)
|
||||||
|
- if vim.tbl_contains(plugins, args.data) then
|
||||||
|
- load_op()
|
||||||
|
- return true
|
||||||
|
- end
|
||||||
|
- end,
|
||||||
|
- })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
113
plugins/astrocore/package/mason.lua.patch
Normal file
113
plugins/astrocore/package/mason.lua.patch
Normal file
|
|
@ -0,0 +1,113 @@
|
||||||
|
diff --git a/lua/astrocore/mason.lua b/lua/astrocore/mason.lua
|
||||||
|
index a286251..7edbeeb 100644
|
||||||
|
--- a/lua/astrocore/mason.lua
|
||||||
|
+++ b/lua/astrocore/mason.lua
|
||||||
|
@@ -12,105 +12,12 @@ local M = {}
|
||||||
|
local astro = require "astrocore"
|
||||||
|
local function mason_notify(msg, type) astro.notify(msg, type, { title = "Mason" }) end
|
||||||
|
|
||||||
|
---- Update specified mason packages, or just update the registries if no packages are listed
|
||||||
|
----@param pkg_names? string|string[] The package names as defined in Mason (Not mason-lspconfig or mason-null-ls) if the value is nil then it will just update the registries
|
||||||
|
----@param auto_install? boolean whether or not to install a package that is not currently installed (default: True)
|
||||||
|
-function M.update(pkg_names, auto_install)
|
||||||
|
- pkg_names = pkg_names or {}
|
||||||
|
- if type(pkg_names) == "string" then pkg_names = { pkg_names } end
|
||||||
|
- if auto_install == nil then auto_install = true end
|
||||||
|
- local registry_avail, registry = pcall(require, "mason-registry")
|
||||||
|
- if not registry_avail then
|
||||||
|
- vim.api.nvim_err_writeln "Unable to access mason registry"
|
||||||
|
- return
|
||||||
|
- end
|
||||||
|
-
|
||||||
|
- registry.update(vim.schedule_wrap(function(success, updated_registries)
|
||||||
|
- if success then
|
||||||
|
- local count = #updated_registries
|
||||||
|
- if vim.tbl_count(pkg_names) == 0 then
|
||||||
|
- mason_notify(("Successfully updated %d %s."):format(count, count == 1 and "registry" or "registries"))
|
||||||
|
- end
|
||||||
|
- for _, pkg_name in ipairs(pkg_names) do
|
||||||
|
- local pkg_avail, pkg = pcall(registry.get_package, pkg_name)
|
||||||
|
- if not pkg_avail then
|
||||||
|
- mason_notify(("`%s` is not available"):format(pkg_name), vim.log.levels.ERROR)
|
||||||
|
- else
|
||||||
|
- if not pkg:is_installed() then
|
||||||
|
- if auto_install then
|
||||||
|
- mason_notify(("Installing `%s`"):format(pkg.name))
|
||||||
|
- pkg:install()
|
||||||
|
- else
|
||||||
|
- mason_notify(("`%s` not installed"):format(pkg.name), vim.log.levels.WARN)
|
||||||
|
- end
|
||||||
|
- else
|
||||||
|
- pkg:check_new_version(function(update_available, version)
|
||||||
|
- if update_available then
|
||||||
|
- mason_notify(("Updating `%s` to %s"):format(pkg.name, version.latest_version))
|
||||||
|
- pkg:install():on("closed", function() mason_notify(("Updated %s"):format(pkg.name)) end)
|
||||||
|
- else
|
||||||
|
- mason_notify(("No updates available for `%s`"):format(pkg.name))
|
||||||
|
- end
|
||||||
|
- end)
|
||||||
|
- end
|
||||||
|
- end
|
||||||
|
- end
|
||||||
|
- else
|
||||||
|
- mason_notify(("Failed to update registries: %s"):format(updated_registries), vim.log.levels.ERROR)
|
||||||
|
- end
|
||||||
|
- end))
|
||||||
|
+function M.update(...)
|
||||||
|
+ mason_notify "Mason is disabled with nixvim"
|
||||||
|
end
|
||||||
|
|
||||||
|
---- Update all packages in Mason
|
||||||
|
function M.update_all()
|
||||||
|
- local registry_avail, registry = pcall(require, "mason-registry")
|
||||||
|
- if not registry_avail then
|
||||||
|
- vim.api.nvim_err_writeln "Unable to access mason registry"
|
||||||
|
- return
|
||||||
|
- end
|
||||||
|
-
|
||||||
|
- mason_notify "Checking for package updates..."
|
||||||
|
- registry.update(vim.schedule_wrap(function(success, updated_registries)
|
||||||
|
- if success then
|
||||||
|
- local installed_pkgs = registry.get_installed_packages()
|
||||||
|
- local running = #installed_pkgs
|
||||||
|
- local no_pkgs = running == 0
|
||||||
|
-
|
||||||
|
- if no_pkgs then
|
||||||
|
- mason_notify "No updates available"
|
||||||
|
- astro.event "MasonUpdateCompleted"
|
||||||
|
- else
|
||||||
|
- local updated = false
|
||||||
|
- for _, pkg in ipairs(installed_pkgs) do
|
||||||
|
- pkg:check_new_version(function(update_available, version)
|
||||||
|
- if update_available then
|
||||||
|
- updated = true
|
||||||
|
- mason_notify(("Updating `%s` to %s"):format(pkg.name, version.latest_version))
|
||||||
|
- pkg:install():on("closed", function()
|
||||||
|
- running = running - 1
|
||||||
|
- if running == 0 then
|
||||||
|
- mason_notify "Update Complete"
|
||||||
|
- astro.event "MasonUpdateCompleted"
|
||||||
|
- end
|
||||||
|
- end)
|
||||||
|
- else
|
||||||
|
- running = running - 1
|
||||||
|
- if running == 0 then
|
||||||
|
- if updated then
|
||||||
|
- mason_notify "Update Complete"
|
||||||
|
- else
|
||||||
|
- mason_notify "No updates available"
|
||||||
|
- end
|
||||||
|
- astro.event "MasonUpdateCompleted"
|
||||||
|
- end
|
||||||
|
- end
|
||||||
|
- end)
|
||||||
|
- end
|
||||||
|
- end
|
||||||
|
- else
|
||||||
|
- mason_notify(("Failed to update registries: %s"):format(updated_registries), vim.log.levels.ERROR)
|
||||||
|
- end
|
||||||
|
- end))
|
||||||
|
+ mason_notify "Mason is disabled with nixvim"
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
28
plugins/astrocore/rooter.nix
Normal file
28
plugins/astrocore/rooter.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore.lua#L62-L72
|
||||||
|
{
|
||||||
|
enabled = true;
|
||||||
|
autochdir = false;
|
||||||
|
notify = false;
|
||||||
|
scope = "global";
|
||||||
|
|
||||||
|
detector = [
|
||||||
|
"lsp"
|
||||||
|
[
|
||||||
|
".git"
|
||||||
|
"_darcs"
|
||||||
|
".hg"
|
||||||
|
".bzr"
|
||||||
|
".svn"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"lua"
|
||||||
|
"MakeFile"
|
||||||
|
"package.json"
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
ignore = {
|
||||||
|
dirs = { };
|
||||||
|
servers = { };
|
||||||
|
};
|
||||||
|
}
|
||||||
13
plugins/astrocore/sessions.nix
Normal file
13
plugins/astrocore/sessions.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astrocore.lua#L73-L80
|
||||||
|
{
|
||||||
|
autosave = {
|
||||||
|
cwd = true;
|
||||||
|
last = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
ignore = {
|
||||||
|
buftypes = { };
|
||||||
|
dirs = { };
|
||||||
|
filetypes = [ "gitcommit" "gitrebase" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
20
plugins/astroui/default.nix
Normal file
20
plugins/astroui/default.nix
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
# homepage: https://github.com/AstroNvim/astroui
|
||||||
|
{ helpers, icons, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
status = import ./status;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
extra = {
|
||||||
|
packages = [
|
||||||
|
(import ./package.nix { inherit lib pkgs; })
|
||||||
|
];
|
||||||
|
|
||||||
|
config = ''
|
||||||
|
require('astroui').setup({
|
||||||
|
icons = ${helpers.toLuaObject icons},
|
||||||
|
status = ${helpers.toLuaObject status},
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
17
plugins/astroui/package.nix
Normal file
17
plugins/astroui/package.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
version = "2.1.4";
|
||||||
|
in
|
||||||
|
pkgs.vimUtils.buildVimPlugin {
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
name = "astroui";
|
||||||
|
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "astronvim";
|
||||||
|
repo = "astroui";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-nmcqJq4L6XFrgrORan5x+WCwSfU3FC4D6Zux45YnIUQ=";
|
||||||
|
};
|
||||||
|
}
|
||||||
9
plugins/astroui/status/attributes.nix
Normal file
9
plugins/astroui/status/attributes.nix
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astroui_status.lua#L103-L110
|
||||||
|
{
|
||||||
|
buffer_active = { bold = true; italic = true; };
|
||||||
|
buffer_picker = { bold = true; };
|
||||||
|
git_branch = { bold = true; };
|
||||||
|
git_diff = { bold = true; };
|
||||||
|
macro_recording = { bold = true; };
|
||||||
|
virtual_env = { bold = true; };
|
||||||
|
}
|
||||||
148
plugins/astroui/status/colors.nix
Normal file
148
plugins/astroui/status/colors.nix
Normal file
|
|
@ -0,0 +1,148 @@
|
||||||
|
{
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astroui_status.lua#L39-L57
|
||||||
|
fallback = {
|
||||||
|
none = "NONE";
|
||||||
|
fg = "#abb2bf";
|
||||||
|
bg = "#1e222a";
|
||||||
|
dark_bg = "#2c323c";
|
||||||
|
blue = "#61afef";
|
||||||
|
green = "#98c379";
|
||||||
|
grey = "#5c6370";
|
||||||
|
bright_grey = "#777d86";
|
||||||
|
dark_grey = "#5c5c5c";
|
||||||
|
orange = "#ff9640";
|
||||||
|
purple = "#c678dd";
|
||||||
|
bright_purple = "#a9a1e1";
|
||||||
|
red = "#e06c75";
|
||||||
|
bright_red = "#ec5f67";
|
||||||
|
white = "#c9c9c9";
|
||||||
|
yellow = "#e5c07b";
|
||||||
|
bright_yellow = "#ebae34";
|
||||||
|
};
|
||||||
|
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astroui_status.lua#L118-L239
|
||||||
|
setup.__raw = ''
|
||||||
|
function()
|
||||||
|
local astroui = require "astroui"
|
||||||
|
---@type AstroUIStatusOpts
|
||||||
|
local status_opts = astroui.config.status
|
||||||
|
local color = assert(status_opts.fallback_colors)
|
||||||
|
local get_hlgroup = astroui.get_hlgroup
|
||||||
|
local lualine_mode = require("astroui.status.hl").lualine_mode
|
||||||
|
local function resolve_lualine(orig, ...) return (not orig or orig == "NONE") and lualine_mode(...) or orig end
|
||||||
|
|
||||||
|
local Normal = get_hlgroup("Normal", { fg = color.fg, bg = color.bg })
|
||||||
|
local Comment = get_hlgroup("Comment", { fg = color.bright_grey, bg = color.bg })
|
||||||
|
local Error = get_hlgroup("Error", { fg = color.red, bg = color.bg })
|
||||||
|
local StatusLine = get_hlgroup("StatusLine", { fg = color.fg, bg = color.dark_bg })
|
||||||
|
local TabLine = get_hlgroup("TabLine", { fg = color.grey, bg = color.none })
|
||||||
|
local TabLineFill = get_hlgroup("TabLineFill", { fg = color.fg, bg = color.dark_bg })
|
||||||
|
local TabLineSel = get_hlgroup("TabLineSel", { fg = color.fg, bg = color.none })
|
||||||
|
local WinBar = get_hlgroup("WinBar", { fg = color.bright_grey, bg = color.bg })
|
||||||
|
local WinBarNC = get_hlgroup("WinBarNC", { fg = color.grey, bg = color.bg })
|
||||||
|
local Conditional = get_hlgroup("Conditional", { fg = color.bright_purple, bg = color.dark_bg })
|
||||||
|
local String = get_hlgroup("String", { fg = color.green, bg = color.dark_bg })
|
||||||
|
local TypeDef = get_hlgroup("TypeDef", { fg = color.yellow, bg = color.dark_bg })
|
||||||
|
local NvimEnvironmentName = get_hlgroup("NvimEnvironmentName", { fg = color.yellow, bg = color.dark_bg })
|
||||||
|
local GitSignsAdd = get_hlgroup("GitSignsAdd", { fg = color.green, bg = color.dark_bg })
|
||||||
|
local GitSignsChange = get_hlgroup("GitSignsChange", { fg = color.orange, bg = color.dark_bg })
|
||||||
|
local GitSignsDelete = get_hlgroup("GitSignsDelete", { fg = color.bright_red, bg = color.dark_bg })
|
||||||
|
local DiagnosticError = get_hlgroup("DiagnosticError", { fg = color.bright_red, bg = color.dark_bg })
|
||||||
|
local DiagnosticWarn = get_hlgroup("DiagnosticWarn", { fg = color.orange, bg = color.dark_bg })
|
||||||
|
local DiagnosticInfo = get_hlgroup("DiagnosticInfo", { fg = color.white, bg = color.dark_bg })
|
||||||
|
local DiagnosticHint = get_hlgroup("DiagnosticHint", { fg = color.bright_yellow, bg = color.dark_bg })
|
||||||
|
local HeirlineInactive =
|
||||||
|
resolve_lualine(get_hlgroup("HeirlineInactive", { bg = nil }).bg, "inactive", color.dark_grey)
|
||||||
|
local HeirlineNormal = resolve_lualine(get_hlgroup("HeirlineNormal", { bg = nil }).bg, "normal", color.blue)
|
||||||
|
local HeirlineInsert = resolve_lualine(get_hlgroup("HeirlineInsert", { bg = nil }).bg, "insert", color.green)
|
||||||
|
local HeirlineVisual = resolve_lualine(get_hlgroup("HeirlineVisual", { bg = nil }).bg, "visual", color.purple)
|
||||||
|
local HeirlineReplace =
|
||||||
|
resolve_lualine(get_hlgroup("HeirlineReplace", { bg = nil }).bg, "replace", color.bright_red)
|
||||||
|
local HeirlineCommand =
|
||||||
|
resolve_lualine(get_hlgroup("HeirlineCommand", { bg = nil }).bg, "command", color.bright_yellow)
|
||||||
|
local HeirlineTerminal =
|
||||||
|
resolve_lualine(get_hlgroup("HeirlineTerminal", { bg = nil }).bg, "insert", HeirlineInsert)
|
||||||
|
|
||||||
|
local colors = {
|
||||||
|
close_fg = Error.fg,
|
||||||
|
fg = StatusLine.fg,
|
||||||
|
bg = StatusLine.bg,
|
||||||
|
section_fg = StatusLine.fg,
|
||||||
|
section_bg = StatusLine.bg,
|
||||||
|
git_branch_fg = Conditional.fg,
|
||||||
|
mode_fg = StatusLine.bg,
|
||||||
|
treesitter_fg = String.fg,
|
||||||
|
virtual_env_fg = NvimEnvironmentName.fg,
|
||||||
|
scrollbar = TypeDef.fg,
|
||||||
|
git_added = GitSignsAdd.fg,
|
||||||
|
git_changed = GitSignsChange.fg,
|
||||||
|
git_removed = GitSignsDelete.fg,
|
||||||
|
diag_ERROR = DiagnosticError.fg,
|
||||||
|
diag_WARN = DiagnosticWarn.fg,
|
||||||
|
diag_INFO = DiagnosticInfo.fg,
|
||||||
|
diag_HINT = DiagnosticHint.fg,
|
||||||
|
winbar_fg = WinBar.fg,
|
||||||
|
winbar_bg = WinBar.bg,
|
||||||
|
winbarnc_fg = WinBarNC.fg,
|
||||||
|
winbarnc_bg = WinBarNC.bg,
|
||||||
|
tabline_bg = TabLineFill.bg,
|
||||||
|
tabline_fg = TabLineFill.bg,
|
||||||
|
buffer_fg = Comment.fg,
|
||||||
|
buffer_path_fg = WinBarNC.fg,
|
||||||
|
buffer_close_fg = Comment.fg,
|
||||||
|
buffer_bg = TabLineFill.bg,
|
||||||
|
buffer_active_fg = Normal.fg,
|
||||||
|
buffer_active_path_fg = WinBarNC.fg,
|
||||||
|
buffer_active_close_fg = Error.fg,
|
||||||
|
buffer_active_bg = Normal.bg,
|
||||||
|
buffer_visible_fg = Normal.fg,
|
||||||
|
buffer_visible_path_fg = WinBarNC.fg,
|
||||||
|
buffer_visible_close_fg = Error.fg,
|
||||||
|
buffer_visible_bg = Normal.bg,
|
||||||
|
buffer_overflow_fg = Comment.fg,
|
||||||
|
buffer_overflow_bg = TabLineFill.bg,
|
||||||
|
buffer_picker_fg = Error.fg,
|
||||||
|
tab_close_fg = Error.fg,
|
||||||
|
tab_close_bg = TabLineFill.bg,
|
||||||
|
tab_fg = TabLine.fg,
|
||||||
|
tab_bg = TabLine.bg,
|
||||||
|
tab_active_fg = TabLineSel.fg,
|
||||||
|
tab_active_bg = TabLineSel.bg,
|
||||||
|
inactive = HeirlineInactive,
|
||||||
|
normal = HeirlineNormal,
|
||||||
|
insert = HeirlineInsert,
|
||||||
|
visual = HeirlineVisual,
|
||||||
|
replace = HeirlineReplace,
|
||||||
|
command = HeirlineCommand,
|
||||||
|
terminal = HeirlineTerminal,
|
||||||
|
}
|
||||||
|
|
||||||
|
local user_colors = status_opts.colors
|
||||||
|
if type(user_colors) == "table" then
|
||||||
|
colors = require("astrocore").extend_tbl(colors, user_colors)
|
||||||
|
elseif type(user_colors) == "function" then
|
||||||
|
local new_colors = user_colors(colors)
|
||||||
|
if new_colors then colors = new_colors end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, section in ipairs {
|
||||||
|
"git_branch",
|
||||||
|
"file_info",
|
||||||
|
"git_diff",
|
||||||
|
"diagnostics",
|
||||||
|
"lsp",
|
||||||
|
"macro_recording",
|
||||||
|
"mode",
|
||||||
|
"cmd_info",
|
||||||
|
"treesitter",
|
||||||
|
"nav",
|
||||||
|
"virtual_env",
|
||||||
|
} do
|
||||||
|
if not colors[section .. "_bg"] then colors[section .. "_bg"] = colors["section_bg"] end
|
||||||
|
if not colors[section .. "_fg"] then colors[section .. "_fg"] = colors["section_fg"] end
|
||||||
|
end
|
||||||
|
|
||||||
|
return colors
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
15
plugins/astroui/status/default.nix
Normal file
15
plugins/astroui/status/default.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astroui_status.lua
|
||||||
|
let
|
||||||
|
attributes = import ./attributes.nix;
|
||||||
|
colors = import ./colors.nix;
|
||||||
|
icon_highlights = import ./icon-highlights.nix;
|
||||||
|
modes = import ./modes.nix;
|
||||||
|
separators = import ./separators.nix;
|
||||||
|
sign_handlers = import ./signs.nix;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
inherit attributes icon_highlights modes separators sign_handlers;
|
||||||
|
|
||||||
|
fallback_colors = colors.fallback;
|
||||||
|
setup_colors = colors.setup;
|
||||||
|
}
|
||||||
7
plugins/astroui/status/icon-highlights.nix
Normal file
7
plugins/astroui/status/icon-highlights.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astroui_status.lua#L111-L116
|
||||||
|
{
|
||||||
|
file_icon = {
|
||||||
|
tabline.__raw = "function(self) return self.is_active or self.is_visible end";
|
||||||
|
statusline = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
42
plugins/astroui/status/modes.nix
Normal file
42
plugins/astroui/status/modes.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astroui_status.lua#L58-L93
|
||||||
|
{
|
||||||
|
# Forced to use raw Lua value to avoid Nix transforming special chars to unicode sequence
|
||||||
|
__raw = ''
|
||||||
|
{
|
||||||
|
["n"] = { "NORMAL", "normal" },
|
||||||
|
["no"] = { "OP", "normal" },
|
||||||
|
["nov"] = { "OP", "normal" },
|
||||||
|
["noV"] = { "OP", "normal" },
|
||||||
|
["no"] = { "OP", "normal" },
|
||||||
|
["niI"] = { "NORMAL", "normal" },
|
||||||
|
["niR"] = { "NORMAL", "normal" },
|
||||||
|
["niV"] = { "NORMAL", "normal" },
|
||||||
|
["i"] = { "INSERT", "insert" },
|
||||||
|
["ic"] = { "INSERT", "insert" },
|
||||||
|
["ix"] = { "INSERT", "insert" },
|
||||||
|
["t"] = { "TERM", "terminal" },
|
||||||
|
["nt"] = { "TERM", "terminal" },
|
||||||
|
["v"] = { "VISUAL", "visual" },
|
||||||
|
["vs"] = { "VISUAL", "visual" },
|
||||||
|
["V"] = { "LINES", "visual" },
|
||||||
|
["Vs"] = { "LINES", "visual" },
|
||||||
|
[""] = { "BLOCK", "visual" },
|
||||||
|
["s"] = { "BLOCK", "visual" },
|
||||||
|
["R"] = { "REPLACE", "replace" },
|
||||||
|
["Rc"] = { "REPLACE", "replace" },
|
||||||
|
["Rx"] = { "REPLACE", "replace" },
|
||||||
|
["Rv"] = { "V-REPLACE", "replace" },
|
||||||
|
["s"] = { "SELECT", "visual" },
|
||||||
|
["S"] = { "SELECT", "visual" },
|
||||||
|
[""] = { "BLOCK", "visual" },
|
||||||
|
["c"] = { "COMMAND", "command" },
|
||||||
|
["cv"] = { "COMMAND", "command" },
|
||||||
|
["ce"] = { "COMMAND", "command" },
|
||||||
|
["r"] = { "PROMPT", "inactive" },
|
||||||
|
["rm"] = { "MORE", "inactive" },
|
||||||
|
["r?"] = { "CONFIRM", "inactive" },
|
||||||
|
["!"] = { "SHELL", "inactive" },
|
||||||
|
["null"] = { "null", "inactive" },
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
}
|
||||||
10
plugins/astroui/status/separators.nix
Normal file
10
plugins/astroui/status/separators.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astroui_status.lua#L94-L102
|
||||||
|
{
|
||||||
|
none = [ "" "" ];
|
||||||
|
left = [ "" " " ];
|
||||||
|
right = [ " " "" ];
|
||||||
|
center = [ " " " " ];
|
||||||
|
tab = [ "" " " ];
|
||||||
|
breadcrumbs = " ";
|
||||||
|
path = " ";
|
||||||
|
}
|
||||||
41
plugins/astroui/status/signs.nix
Normal file
41
plugins/astroui/status/signs.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/_astroui_status.lua#L5-L36
|
||||||
|
{
|
||||||
|
__raw = ''
|
||||||
|
(function()
|
||||||
|
local sign_handlers = {}
|
||||||
|
-- gitsigns handlers
|
||||||
|
local gitsigns_handler = function(_)
|
||||||
|
local gitsigns_avail, gitsigns = pcall(require, "gitsigns")
|
||||||
|
if gitsigns_avail then vim.schedule(gitsigns.preview_hunk) end
|
||||||
|
end
|
||||||
|
for _, sign in ipairs { "Topdelete", "Untracked", "Add", "Change", "Changedelete", "Delete" } do
|
||||||
|
local name = "GitSigns" .. sign
|
||||||
|
if not sign_handlers[name] then sign_handlers[name] = gitsigns_handler end
|
||||||
|
end
|
||||||
|
sign_handlers["gitsigns_extmark_signs_"] = gitsigns_handler
|
||||||
|
-- diagnostic handlers
|
||||||
|
local diagnostics_handler = function(args)
|
||||||
|
if args.mods:find "c" then
|
||||||
|
vim.schedule(vim.lsp.buf.code_action)
|
||||||
|
else
|
||||||
|
vim.schedule(vim.diagnostic.open_float)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for _, sign in ipairs { "Error", "Hint", "Info", "Warn" } do
|
||||||
|
local name = "DiagnosticSign" .. sign
|
||||||
|
if not sign_handlers[name] then sign_handlers[name] = diagnostics_handler end
|
||||||
|
end
|
||||||
|
-- DAP handlers
|
||||||
|
local dap_breakpoint_handler = function(_)
|
||||||
|
local dap_avail, dap = pcall(require, "dap")
|
||||||
|
if dap_avail then vim.schedule(dap.toggle_breakpoint) end
|
||||||
|
end
|
||||||
|
for _, sign in ipairs { "", "Rejected", "Condition" } do
|
||||||
|
local name = "DapBreakpoint" .. sign
|
||||||
|
if not sign_handlers[name] then sign_handlers[name] = dap_breakpoint_handler end
|
||||||
|
end
|
||||||
|
|
||||||
|
return sign_handlers
|
||||||
|
end)()
|
||||||
|
'';
|
||||||
|
}
|
||||||
42
plugins/autopairs.nix
Normal file
42
plugins/autopairs.nix
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
# homepage: https://github.com/windwp/nvim-autopairs
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
extra = {
|
||||||
|
packages = [ pkgs.vimPlugins.nvim-autopairs ];
|
||||||
|
|
||||||
|
# Config (taken from AstroNvim)
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/autopairs.lua#L14-L25
|
||||||
|
# With cmp integration
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/configs/nvim-autopairs.lua#L10
|
||||||
|
config = ''
|
||||||
|
require("nvim-autopairs").setup({
|
||||||
|
check_ts = true,
|
||||||
|
ts_config = { java = false },
|
||||||
|
fast_wrap = {
|
||||||
|
map = "<M-e>",
|
||||||
|
chars = { "{", "[", "(", '"', "'" },
|
||||||
|
pattern = ([[ [%'%"%)%>%]%)%}%,] ]]):gsub("%s+", ""),
|
||||||
|
offset = 0,
|
||||||
|
end_key = "$",
|
||||||
|
keys = "qwertyuiopzxcvbnmasdfghjkl",
|
||||||
|
check_comma = true,
|
||||||
|
highlight = "PmenuSel",
|
||||||
|
highlight_grey = "LineNr",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
--- TODO: uncomment when cmp is setup
|
||||||
|
---require("cmp").event:on("confirm_done", require("nvim-autopairs.completion.cmp").on_confirm_done { tex = false })
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts.keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>ua";
|
||||||
|
action.__raw = "function() require('astrocore.toggles').autopairs() end";
|
||||||
|
options.desc = "Toggle autopairs";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
86
plugins/cmp.nix
Normal file
86
plugins/cmp.nix
Normal file
|
|
@ -0,0 +1,86 @@
|
||||||
|
_:
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
autoEnableSources = true;
|
||||||
|
settings = {
|
||||||
|
snippet.expand = ''function(args) require("luasnip").lsp_expand(args.body) end'';
|
||||||
|
|
||||||
|
sources = [
|
||||||
|
{ name = "nvim_lsp"; priority = 1000; }
|
||||||
|
{ name = "path"; priority = 250; }
|
||||||
|
{ name = "buffer"; priority = 500; group_index = 2; }
|
||||||
|
{ name = "luasnip"; priority = 750; }
|
||||||
|
];
|
||||||
|
|
||||||
|
mapping = {
|
||||||
|
"<Up>" = "cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Select }";
|
||||||
|
"<Down>" = "cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Select }";
|
||||||
|
"<C-P>" = "cmp.mapping(function()
|
||||||
|
if (cmp.core.view:visible() or vim.fn.pumvisible() == 1) then
|
||||||
|
cmp.select_prev_item { behavior = cmp.SelectBehavior.Insert }
|
||||||
|
else
|
||||||
|
cmp.complete()
|
||||||
|
end
|
||||||
|
end)";
|
||||||
|
"<C-N>" = "cmp.mapping(function()
|
||||||
|
if (cmp.core.view:visible() or vim.fn.pumvisible() == 1) then
|
||||||
|
cmp.select_next_item { behavior = cmp.SelectBehavior.Insert }
|
||||||
|
else
|
||||||
|
cmp.complete()
|
||||||
|
end
|
||||||
|
end)";
|
||||||
|
"<C-K>" = "cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Insert }";
|
||||||
|
"<C-J>" = "cmp.mapping.select_next_item { behavior = cmp.SelectBehavior.Insert }";
|
||||||
|
"<C-U>" = "cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' })";
|
||||||
|
"<C-D>" = "cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' })";
|
||||||
|
"<C-Space>" = "cmp.mapping(cmp.mapping.complete(), { 'i', 'c' })";
|
||||||
|
"<C-Y>" = "cmp.config.disable";
|
||||||
|
"<C-E>" = "cmp.mapping { i = cmp.mapping.abort(), c = cmp.mapping.close() }";
|
||||||
|
"<CR>" = "cmp.mapping.confirm { select = false }";
|
||||||
|
"<Tab>" = ''cmp.mapping(function(fallback)
|
||||||
|
local function has_words_before()
|
||||||
|
local line, col = (unpack or table.unpack)(vim.api.nvim_win_get_cursor(0))
|
||||||
|
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match "%s" == nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if (cmp.core.view:visible() or vim.fn.pumvisible() == 1) then
|
||||||
|
cmp.select_next_item()
|
||||||
|
elseif vim.snippet and vim.snippet.active { direction = 1 } then
|
||||||
|
vim.schedule(function() vim.snippet.jump(1) end)
|
||||||
|
elseif has_words_before() then
|
||||||
|
cmp.complete()
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { 'i', 's' })'';
|
||||||
|
"<S-Tab>" = "cmp.mapping(function(fallback)
|
||||||
|
if (cmp.core.view:visible() or vim.fn.pumvisible() == 1) then
|
||||||
|
cmp.select_prev_item()
|
||||||
|
elseif vim.snippet and vim.snippet.active { direction = -1 } then
|
||||||
|
vim.schedule(function() vim.snippet.jump(-1) end)
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end, { 'i', 's' })";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts = {
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>uc";
|
||||||
|
action.__raw = ''require("astrocore.toggles").buffer_cmp'';
|
||||||
|
options.desc = "Toggle autocompletion (buffer)";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>uC";
|
||||||
|
action.__raw = ''require("astrocore.toggles").cmp'';
|
||||||
|
options.desc = "Toggle autocompletion (global)";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
25
plugins/comment.nix
Normal file
25
plugins/comment.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# homepage: https://github.com/numtostr/comment.nvim/
|
||||||
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/comment/index.html
|
||||||
|
_:
|
||||||
|
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
settings.pre_hook = "require('ts_context_commentstring.integrations.comment_nvim').create_pre_hook()";
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
key = "<leader>/";
|
||||||
|
action = "<Plug>(comment_toggle_linewise_current)";
|
||||||
|
options.desc = "Toggle comment line";
|
||||||
|
mode = "n";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>/";
|
||||||
|
action = "<Plug>(comment_toggle_linewise_visual)";
|
||||||
|
options.desc = "Toggle comment line";
|
||||||
|
mode = "v";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
4
plugins/committia.nix
Normal file
4
plugins/committia.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
_:
|
||||||
|
{
|
||||||
|
opts.enable = true;
|
||||||
|
}
|
||||||
235
plugins/dap.nix
Normal file
235
plugins/dap.nix
Normal file
|
|
@ -0,0 +1,235 @@
|
||||||
|
{ icons, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
extra = {
|
||||||
|
packages = [ pkgs.vimPlugins.nvim-dap-ui ];
|
||||||
|
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/configs/nvim-dap-ui.lua
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/dap.lua#L37
|
||||||
|
config = ''
|
||||||
|
local dap, dapui = require "dap", require "dapui"
|
||||||
|
|
||||||
|
dap.listeners.after.event_initialized["dapui_config"] = function() dapui.open() end
|
||||||
|
dap.listeners.before.event_terminated["dapui_config"] = function() dapui.close() end
|
||||||
|
dap.listeners.before.event_exited["dapui_config"] = function() dapui.close() end
|
||||||
|
|
||||||
|
dapui.setup({ floating = { border = "rounded" } })
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
signs = {
|
||||||
|
dapBreakpoint = {
|
||||||
|
text = icons.DapBreakpoint;
|
||||||
|
texthl = "DiagnosticInfo";
|
||||||
|
};
|
||||||
|
|
||||||
|
dapBreakpointCondition = {
|
||||||
|
text = icons.DapBreakpointCondition;
|
||||||
|
texthl = "DiagnosticInfo";
|
||||||
|
};
|
||||||
|
|
||||||
|
dapBreakpointRejected = {
|
||||||
|
text = icons.DapBreakpointRejected;
|
||||||
|
texthl = "DiagnosticError";
|
||||||
|
};
|
||||||
|
|
||||||
|
dapLogPoint = {
|
||||||
|
text = icons.DapLogPoint;
|
||||||
|
texthl = "DiagnosticInfo";
|
||||||
|
};
|
||||||
|
|
||||||
|
dapStopped = {
|
||||||
|
text = icons.DapStopped;
|
||||||
|
texthl = "DiagnosticWarn";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# rootOpts.plugins.cmp-dap.enable = true;
|
||||||
|
rootOpts.keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>dE";
|
||||||
|
options.desc = "Evaluate input";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.ui.input({ prompt = "Expression: " }, function(expr)
|
||||||
|
if expr then require("dapui").eval(expr, { enter = true }) end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>du";
|
||||||
|
action.__raw = "function() require('dapui').toggle() end";
|
||||||
|
options.desc = "Toggle Debugger UI";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>dh";
|
||||||
|
action.__raw = "function() require('dap.ui.widgets').hover() end";
|
||||||
|
options.desc = "Debugger Hover";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "v";
|
||||||
|
key = "<Leader>dE";
|
||||||
|
action.__raw = "function() require('dapui').eval() end";
|
||||||
|
options.desc = "Evaluate Input";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<F5>";
|
||||||
|
action.__raw = "function() require('dap').continue() end";
|
||||||
|
options.desc = "Debugger: Start";
|
||||||
|
}
|
||||||
|
# Shift+F5
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<F17>";
|
||||||
|
action.__raw = "function() require('dap').terminate() end";
|
||||||
|
options.desc = "Debugger: Stop";
|
||||||
|
}
|
||||||
|
# Shift+F9
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<F21>";
|
||||||
|
options.desc = "Debugger: Conditional Breakpoint";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.ui.input({ prompt = "Condition: " }, function(condition)
|
||||||
|
if condition then require("dap").set_breakpoint(condition) end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
# Control+F5
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<F29>";
|
||||||
|
action.__raw = "function() require('dap').restart_frame() end";
|
||||||
|
options.desc = "Debugger: Restart";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<F6>";
|
||||||
|
action.__raw = "function() require('dap').pause() end";
|
||||||
|
options.desc = "Debugger: Pause";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<F9>";
|
||||||
|
action.__raw = "function() require('dap').toggle_breakpoint() end";
|
||||||
|
options.desc = "Debugger: Toggle Breakpoint";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<F10>";
|
||||||
|
action.__raw = "function() require('dap').step_over() end";
|
||||||
|
options.desc = "Debugger: Step Over";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<F11>";
|
||||||
|
action.__raw = "function() require('dap').step_into() end";
|
||||||
|
options.desc = "Debugger: Step Into";
|
||||||
|
}
|
||||||
|
# Shift+F11
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<F23>";
|
||||||
|
action.__raw = "function() require('dap').step_out() end";
|
||||||
|
options.desc = "Debugger: Step Out";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>db";
|
||||||
|
action.__raw = "function() require('dap').toggle_breakpoint() end";
|
||||||
|
options.desc = "Toggle Breakpoint (F9)";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>dB";
|
||||||
|
action.__raw = "function() require('dap').clear_breakpoints() end";
|
||||||
|
options.desc = "Clear Breakpoints";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>dc";
|
||||||
|
action.__raw = "function() require('dap').continue() end";
|
||||||
|
options.desc = "Start/Continue (F5)";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>dC";
|
||||||
|
options.desc = "Conditional Breakpoint (S-F9)";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
vim.ui.input({ prompt = "Condition: " }, function(condition)
|
||||||
|
if condition then require("dap").set_breakpoint(condition) end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>di";
|
||||||
|
action.__raw = "function() require('dap').step_into() end";
|
||||||
|
options.desc = "Step Into (F11)";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>do";
|
||||||
|
action.__raw = "function() require('dap').step_over() end";
|
||||||
|
options.desc = "Step Over (F10)";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>dO";
|
||||||
|
action.__raw = "function() require('dap').step_out() end";
|
||||||
|
options.desc = "Step Out (S-F11)";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>dq";
|
||||||
|
action.__raw = "function() require('dap').close() end";
|
||||||
|
options.desc = "Close Session";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>dQ";
|
||||||
|
action.__raw = "function() require('dap').terminate() end";
|
||||||
|
options.desc = "Terminate Session (S-F5)";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>dp";
|
||||||
|
action.__raw = "function() require('dap').pause() end";
|
||||||
|
options.desc = "Pause (F6)";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>dr";
|
||||||
|
action.__raw = "function() require('dap').restart_frame() end";
|
||||||
|
options.desc = "Restart (C-F5)";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>dR";
|
||||||
|
action.__raw = "function() require('dap').repl.toggle() end";
|
||||||
|
options.desc = "Toggle REPL";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>ds";
|
||||||
|
action.__raw = "function() require('dap').run_to_cursor() end";
|
||||||
|
options.desc = "Run To Cursor";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
39
plugins/default.nix
Normal file
39
plugins/default.nix
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
{ lib, ... }@args:
|
||||||
|
|
||||||
|
let
|
||||||
|
# Flag to enable LSP plugin with servers
|
||||||
|
# Given as an extra special arg when building nixvim module
|
||||||
|
withLSP = args.withLSP or true;
|
||||||
|
|
||||||
|
# Load plugins filenames in list
|
||||||
|
definitions = lib.attrNames (
|
||||||
|
lib.filterAttrs
|
||||||
|
(filename: kind:
|
||||||
|
filename != "default.nix"
|
||||||
|
&& (kind == "regular" || kind == "directory")
|
||||||
|
# If file is an LSP plugin, respect withLSP flag
|
||||||
|
&& (if filename == "lsp.nix" then withLSP else true)
|
||||||
|
)
|
||||||
|
(builtins.readDir ./.)
|
||||||
|
);
|
||||||
|
in
|
||||||
|
lib.mkMerge (
|
||||||
|
map
|
||||||
|
(file:
|
||||||
|
let
|
||||||
|
pluginName = lib.elemAt (lib.splitString "." file) 0;
|
||||||
|
plugin = import ./${file} args;
|
||||||
|
in
|
||||||
|
lib.mkMerge [
|
||||||
|
(lib.optionalAttrs (plugin ? opts) {
|
||||||
|
plugins.${pluginName} = plugin.opts;
|
||||||
|
})
|
||||||
|
(lib.optionalAttrs (plugin ? extra) {
|
||||||
|
extraConfigLua = plugin.extra.config or "";
|
||||||
|
extraPlugins = plugin.extra.packages;
|
||||||
|
})
|
||||||
|
(plugin.rootOpts or { })
|
||||||
|
]
|
||||||
|
)
|
||||||
|
definitions
|
||||||
|
)
|
||||||
18
plugins/dressing.nix
Normal file
18
plugins/dressing.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# homepage: https://github.com/stevearc/dressing.nvim
|
||||||
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/dressing/index.html
|
||||||
|
_:
|
||||||
|
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
input = {
|
||||||
|
default_prompt = "> ";
|
||||||
|
title_pos = "center";
|
||||||
|
};
|
||||||
|
|
||||||
|
select.backend = [ "telescope" "builtin" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
45
plugins/flash.nix
Normal file
45
plugins/flash.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
{pkgs, ... }:
|
||||||
|
{
|
||||||
|
opts.enable = true;
|
||||||
|
|
||||||
|
extra = {
|
||||||
|
packages = [ pkgs.vimPlugins.flash-nvim ];
|
||||||
|
|
||||||
|
config = /*lua*/ ''
|
||||||
|
require("flash").toggle(true) -- activate toggle flash mode
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts.keymaps = [
|
||||||
|
{
|
||||||
|
mode = ["n" "x" "o" ];
|
||||||
|
key = "gs";
|
||||||
|
options.desc = "Flash jump";
|
||||||
|
action.__raw = ''function() require("flash").jump() end'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "gS";
|
||||||
|
options.desc = "Flash Treesitter";
|
||||||
|
action.__raw = ''function() require("flash").treesitter() end'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "o";
|
||||||
|
key = "gR";
|
||||||
|
options.desc = "Remote Flash";
|
||||||
|
action.__raw = ''function() require("flash").remote() end'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "o";
|
||||||
|
key = "gr";
|
||||||
|
options.desc = "Flash Treesitter search";
|
||||||
|
action.__raw = ''function() require("flash").treesitter_search() end'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>uf";
|
||||||
|
options.desc = "Toggle flash search";
|
||||||
|
action.__raw = ''function() require("flash").toggle() end'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
97
plugins/gitsigns.nix
Normal file
97
plugins/gitsigns.nix
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
# homepage: https://github.com/lewis6991/gitsigns.nvim
|
||||||
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/gitsigns/index.html
|
||||||
|
{ icons, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
# Show line blame with custom text
|
||||||
|
current_line_blame = true;
|
||||||
|
current_line_blame_formatter = " <author>, <author_time:%R> – <summary>";
|
||||||
|
current_line_blame_formatter_nc = " Uncommitted";
|
||||||
|
current_line_blame_opts.ignore_whitespace = true;
|
||||||
|
|
||||||
|
# Use same icon for all signs (only color matters)
|
||||||
|
signs = {
|
||||||
|
add.text = icons.GitSign;
|
||||||
|
change.text = icons.GitSign;
|
||||||
|
changedelete.text = icons.GitSign;
|
||||||
|
delete.text = icons.GitSign;
|
||||||
|
topdelete.text = icons.GitSign;
|
||||||
|
untracked.text = icons.GitSign;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts = {
|
||||||
|
# Enable catppuccin colors
|
||||||
|
# https://github.com/catppuccin/nvim/blob/main/lua/catppuccin/groups/integrations/gitsigns.lua
|
||||||
|
colorschemes.catppuccin.settings.integrations.gitsigns = true;
|
||||||
|
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/gitsigns.lua#L9-L21
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "]g";
|
||||||
|
action.__raw = "function() require('gitsigns').next_hunk() end";
|
||||||
|
options.desc = "Next Git hunk";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "[g";
|
||||||
|
action.__raw = "function() require('gitsigns').prev_hunk() end";
|
||||||
|
options.desc = "Previous Git hunk";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>gl";
|
||||||
|
action.__raw = "function() require('gitsigns').blame_line { full = true } end";
|
||||||
|
options.desc = "View full Git blame";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>gp";
|
||||||
|
action.__raw = "function() require('gitsigns').preview_hunk_inline() end";
|
||||||
|
options.desc = "Preview Git hunk";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>gh";
|
||||||
|
action.__raw = "function() require('gitsigns').reset_hunk() end";
|
||||||
|
options.desc = "Reset Git hunk";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>gr";
|
||||||
|
action.__raw = "function() require('gitsigns').reset_buffer() end";
|
||||||
|
options.desc = "Reset Git buffer";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>gs";
|
||||||
|
action.__raw = "function() require('gitsigns').stage_hunk() end";
|
||||||
|
options.desc = "Stage Git hunk";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>gS";
|
||||||
|
action.__raw = "function() require('gitsigns').stage_buffer() end";
|
||||||
|
options.desc = "Stage Git buffer";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>gu";
|
||||||
|
action.__raw = "function() require('gitsigns').undo_stage_hunk() end";
|
||||||
|
options.desc = "Unstage Git hunk";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<Leader>gd";
|
||||||
|
action.__raw = "function() require('gitsigns').diffthis() end";
|
||||||
|
options.desc = "View Git diff";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
14
plugins/guess-indent.nix
Normal file
14
plugins/guess-indent.nix
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
# homepage: https://github.com/NMAC427/guess-indent.nvim
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
extra = {
|
||||||
|
packages = [ pkgs.vimPlugins.guess-indent-nvim ];
|
||||||
|
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/configs/guess-indent.lua
|
||||||
|
config = ''
|
||||||
|
require("guess-indent").setup({})
|
||||||
|
vim.cmd.lua { args = { "require('guess-indent').set_from_buffer()" }, mods = { silent = true } }
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
216
plugins/heirline.nix
Normal file
216
plugins/heirline.nix
Normal file
|
|
@ -0,0 +1,216 @@
|
||||||
|
# homepage: https://github.com/rebelot/heirline.nvim
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
extra = {
|
||||||
|
packages = [ pkgs.vimPlugins.heirline-nvim ];
|
||||||
|
|
||||||
|
# Config from AstroNvim
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/heirline.lua
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/configs/heirline.lua
|
||||||
|
config = /*lua*/ ''
|
||||||
|
local status = require("astroui.status")
|
||||||
|
|
||||||
|
require("heirline").setup({
|
||||||
|
opts = {
|
||||||
|
colors = require("astroui").config.status.setup_colors(),
|
||||||
|
disable_winbar_cb = function(args)
|
||||||
|
return not require("astrocore.buffer").is_valid(args.buf)
|
||||||
|
or status.condition.buffer_matches({ buftype = { "terminal", "nofile" } }, args.buf)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
statusline = { -- statusline
|
||||||
|
hl = { fg = "fg", bg = "bg" },
|
||||||
|
status.component.mode(),
|
||||||
|
status.component.git_branch(),
|
||||||
|
status.component.file_info(),
|
||||||
|
status.component.git_diff(),
|
||||||
|
status.component.diagnostics(),
|
||||||
|
status.component.fill(),
|
||||||
|
status.component.cmd_info(),
|
||||||
|
status.component.fill(),
|
||||||
|
status.component.lsp(),
|
||||||
|
status.component.virtual_env(),
|
||||||
|
status.component.treesitter(),
|
||||||
|
status.component.nav(),
|
||||||
|
status.component.mode { surround = { separator = "right" } },
|
||||||
|
},
|
||||||
|
winbar = { -- winbar
|
||||||
|
init = function(self) self.bufnr = vim.api.nvim_get_current_buf() end,
|
||||||
|
fallthrough = false,
|
||||||
|
{
|
||||||
|
condition = function() return not status.condition.is_active() end,
|
||||||
|
status.component.separated_path(),
|
||||||
|
status.component.file_info {
|
||||||
|
file_icon = { hl = status.hl.file_icon "winbar", padding = { left = 0 } },
|
||||||
|
filename = {},
|
||||||
|
filetype = false,
|
||||||
|
file_read_only = false,
|
||||||
|
hl = status.hl.get_attributes("winbarnc", true),
|
||||||
|
surround = false,
|
||||||
|
update = "BufEnter",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
status.component.breadcrumbs { hl = status.hl.get_attributes("winbar", true) },
|
||||||
|
},
|
||||||
|
tabline = { -- bufferline
|
||||||
|
{ -- automatic sidebar padding
|
||||||
|
condition = function(self)
|
||||||
|
self.winid = vim.api.nvim_tabpage_list_wins(0)[1]
|
||||||
|
self.winwidth = vim.api.nvim_win_get_width(self.winid)
|
||||||
|
return self.winwidth ~= vim.o.columns -- only apply to sidebars
|
||||||
|
and not require("astrocore.buffer").is_valid(vim.api.nvim_win_get_buf(self.winid)) -- if buffer is not in tabline
|
||||||
|
end,
|
||||||
|
provider = function(self) return (" "):rep(self.winwidth + 1) end,
|
||||||
|
hl = { bg = "tabline_bg" },
|
||||||
|
},
|
||||||
|
status.heirline.make_buflist(status.component.tabline_file_info()), -- component for each buffer tab
|
||||||
|
status.component.fill { hl = { bg = "tabline_bg" } }, -- fill the rest of the tabline with background color
|
||||||
|
{ -- tab list
|
||||||
|
condition = function() return #vim.api.nvim_list_tabpages() >= 2 end, -- only show tabs if there are more than one
|
||||||
|
status.heirline.make_tablist { -- component for each tab
|
||||||
|
provider = status.provider.tabnr(),
|
||||||
|
hl = function(self) return status.hl.get_attributes(status.heirline.tab_type(self, "tab"), true) end,
|
||||||
|
},
|
||||||
|
{ -- close button for current tab
|
||||||
|
provider = status.provider.close_button { kind = "TabClose", padding = { left = 1, right = 1 } },
|
||||||
|
hl = status.hl.get_attributes("tab_close", true),
|
||||||
|
on_click = {
|
||||||
|
callback = function() require("astrocore.buffer").close_tab() end,
|
||||||
|
name = "heirline_tabline_close_tab_callback",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
statuscolumn = {
|
||||||
|
init = function(self) self.bufnr = vim.api.nvim_get_current_buf() end,
|
||||||
|
status.component.foldcolumn(),
|
||||||
|
status.component.numbercolumn(),
|
||||||
|
status.component.signcolumn(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts = {
|
||||||
|
autoGroups = {
|
||||||
|
bufferline = { };
|
||||||
|
heirline = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
autoCmd = [
|
||||||
|
{
|
||||||
|
desc = "Update buffers when adding new buffers";
|
||||||
|
event = [ "BufAdd" "BufEnter" "TabNewEntered" ];
|
||||||
|
group = "bufferline";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(args)
|
||||||
|
local buf_utils = require "astrocore.buffer"
|
||||||
|
if not vim.t.bufs then vim.t.bufs = {} end
|
||||||
|
if not buf_utils.is_valid(args.buf) then return end
|
||||||
|
if args.buf ~= buf_utils.current_buf then
|
||||||
|
buf_utils.last_buf = buf_utils.is_valid(buf_utils.current_buf) and buf_utils.current_buf or nil
|
||||||
|
buf_utils.current_buf = args.buf
|
||||||
|
end
|
||||||
|
local bufs = vim.t.bufs
|
||||||
|
if not vim.tbl_contains(bufs, args.buf) then
|
||||||
|
table.insert(bufs, args.buf)
|
||||||
|
vim.t.bufs = bufs
|
||||||
|
end
|
||||||
|
vim.t.bufs = vim.tbl_filter(buf_utils.is_valid, vim.t.bufs)
|
||||||
|
require("astrocore").event "BufsUpdated"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Update buffers when deleting buffers";
|
||||||
|
event = [ "BufDelete" "TermClose" ];
|
||||||
|
group = "bufferline";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function(args)
|
||||||
|
local removed
|
||||||
|
for _, tab in ipairs(vim.api.nvim_list_tabpages()) do
|
||||||
|
local bufs = vim.t[tab].bufs
|
||||||
|
if bufs then
|
||||||
|
for i, bufnr in ipairs(bufs) do
|
||||||
|
if bufnr == args.buf then
|
||||||
|
removed = true
|
||||||
|
table.remove(bufs, i)
|
||||||
|
vim.t[tab].bufs = bufs
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.t.bufs = vim.tbl_filter(require("astrocore.buffer").is_valid, vim.t.bufs)
|
||||||
|
if removed then require("astrocore").event "BufsUpdated" end
|
||||||
|
vim.cmd.redrawtabline()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Refresh heirline colors on colorscheme load";
|
||||||
|
event = [ "ColorScheme" ];
|
||||||
|
group = "heirline";
|
||||||
|
callback.__raw = "function() require('astroui.status.heirline').refresh_colors() end";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>bb";
|
||||||
|
options.desc = "Select buffer from tabline";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astroui.status.heirline").buffer_picker(function(bufnr) vim.api.nvim_win_set_buf(0, bufnr) end)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>bd";
|
||||||
|
options.desc = "Close buffer from tabline";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astroui.status.heirline").buffer_picker(
|
||||||
|
function(bufnr) require("astrocore.buffer").close(bufnr) end
|
||||||
|
)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>b\\";
|
||||||
|
options.desc = "Horizontal split buffer from tabline";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astroui.status.heirline").buffer_picker(function(bufnr)
|
||||||
|
vim.cmd.split()
|
||||||
|
vim.api.nvim_win_set_buf(0, bufnr)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>b|";
|
||||||
|
options.desc = "Vertical split buffer from tabline";
|
||||||
|
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
require("astroui.status.heirline").buffer_picker(function(bufnr)
|
||||||
|
vim.cmd.vsplit()
|
||||||
|
vim.api.nvim_win_set_buf(0, bufnr)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
43
plugins/illuminate.nix
Normal file
43
plugins/illuminate.nix
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
_:
|
||||||
|
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
delay = 200;
|
||||||
|
filetypesDenylist = [ "dirbuf" "dirvish" "fugitive" "toggleterm" ];
|
||||||
|
largeFileOverrides.providers = [ "lsp" ];
|
||||||
|
minCountToHighlight = 2;
|
||||||
|
|
||||||
|
extraOptions = {
|
||||||
|
largeFileCutoff.__raw = "vim.tbl_get(require 'astrocore', 'config', 'features', 'large_buf', 'lines')";
|
||||||
|
should_enable.__raw = "function(bufnr) return require('astrocore.buffer').is_valid(bufnr) end";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts.keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "]r";
|
||||||
|
action.__raw = "function() require('illuminate').goto_next_reference(false) end";
|
||||||
|
options.desc = "Next reference";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "[r";
|
||||||
|
action.__raw = "function() require('illuminate').goto_prev_reference(false) end";
|
||||||
|
options.desc = "Previous reference";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>ur";
|
||||||
|
action.__raw = "function() require('illuminate').toggle_buf() end";
|
||||||
|
options.desc = "Toggle reference highlighting (buffer)";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>uR";
|
||||||
|
action.__raw = "function() require('illuminate').toggle() end";
|
||||||
|
options.desc = "Toggle reference highlighting (global)";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
41
plugins/indent-blankline.nix
Normal file
41
plugins/indent-blankline.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
# homepage: https://github.com/lukas-reineke/indent-blankline.nvim
|
||||||
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/indent-blankline/index.html
|
||||||
|
_:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Enable catppuccin colors
|
||||||
|
# https://github.com/catppuccin/nvim/blob/main/lua/catppuccin/groups/integrations/indent_blankline.lua
|
||||||
|
rootOpts.colorschemes.catppuccin.settings.integrations.indent_blankline = true;
|
||||||
|
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/indent-blankline.lua#L15-L41
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
indent.char = "▏";
|
||||||
|
|
||||||
|
# Disable scope highlighting
|
||||||
|
scope.enabled = false;
|
||||||
|
|
||||||
|
exclude.filetypes = [
|
||||||
|
"aerial"
|
||||||
|
"alpha"
|
||||||
|
"dashboard"
|
||||||
|
"lazy"
|
||||||
|
"mason"
|
||||||
|
"neo-tree"
|
||||||
|
"NvimTree"
|
||||||
|
"neogitstatus"
|
||||||
|
"notify"
|
||||||
|
"startify"
|
||||||
|
"toggleterm"
|
||||||
|
"Trouble"
|
||||||
|
];
|
||||||
|
|
||||||
|
scope = {
|
||||||
|
show_start = false;
|
||||||
|
show_end = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
134
plugins/lsp.nix
Normal file
134
plugins/lsp.nix
Normal file
|
|
@ -0,0 +1,134 @@
|
||||||
|
{ icons, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# Set keymaps when LSP is attached
|
||||||
|
keymaps = {
|
||||||
|
extra = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>li";
|
||||||
|
action = "<cmd>LspInfo<cr>";
|
||||||
|
options.desc = "Show LSP info";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>ll";
|
||||||
|
action.__raw = "function() vim.lsp.codelens.refresh() end";
|
||||||
|
options.desc = "LSP CodeLens refresh";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>lL";
|
||||||
|
action.__raw = "function() vim.lsp.codelens.run() end";
|
||||||
|
options.desc = "LSP CodeLens run";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
lspBuf = {
|
||||||
|
"<leader>la" = {
|
||||||
|
action = "code_action";
|
||||||
|
desc = "LSP code action";
|
||||||
|
};
|
||||||
|
"<leader>lr" = {
|
||||||
|
action = "rename";
|
||||||
|
desc = "Rename current symbol";
|
||||||
|
};
|
||||||
|
# "<leader>lR" = {
|
||||||
|
# action = "references";
|
||||||
|
# desc = "Search references";
|
||||||
|
# };
|
||||||
|
"<leader>lh" = {
|
||||||
|
action = "signature_help";
|
||||||
|
desc = "Signature help";
|
||||||
|
};
|
||||||
|
"<leader>lG" = {
|
||||||
|
action = "workspace_symbol";
|
||||||
|
desc = "Search workspace symbols";
|
||||||
|
};
|
||||||
|
"gK" = {
|
||||||
|
action = "signature_help";
|
||||||
|
desc = "Signature help";
|
||||||
|
};
|
||||||
|
gd = {
|
||||||
|
action = "definition";
|
||||||
|
desc = "Go to definition";
|
||||||
|
};
|
||||||
|
|
||||||
|
gI = {
|
||||||
|
action = "implementation";
|
||||||
|
desc = "Go to implementation";
|
||||||
|
};
|
||||||
|
|
||||||
|
gy = {
|
||||||
|
action = "type_definition";
|
||||||
|
desc = "Go to type definition";
|
||||||
|
};
|
||||||
|
|
||||||
|
K = {
|
||||||
|
action = "hover";
|
||||||
|
desc = "LSP hover";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
postConfig = ''
|
||||||
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "rounded" })
|
||||||
|
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = true,
|
||||||
|
signs = true,
|
||||||
|
underline = true,
|
||||||
|
update_in_insert = true,
|
||||||
|
severity_sort = false,
|
||||||
|
})
|
||||||
|
|
||||||
|
local signs = {
|
||||||
|
Error = "${icons.DiagnosticError}",
|
||||||
|
Warn = "${icons.DiagnosticWarn}",
|
||||||
|
Info = "${icons.DiagnosticInfo}",
|
||||||
|
Hint = "${icons.DiagnosticHint}",
|
||||||
|
}
|
||||||
|
for type, icon in pairs(signs) do
|
||||||
|
local hl = "DiagnosticSign" .. type
|
||||||
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Load all servers definitions
|
||||||
|
servers = {
|
||||||
|
bashls.enable = true;
|
||||||
|
cssls.enable = true;
|
||||||
|
docker-compose-language-service.enable = true;
|
||||||
|
dockerls.enable = true;
|
||||||
|
helm-ls.enable = true;
|
||||||
|
html.enable = true;
|
||||||
|
jsonls.enable = true;
|
||||||
|
lua-ls.enable = true;
|
||||||
|
nginx-language-server.enable = true;
|
||||||
|
nixd.enable = true;
|
||||||
|
pyright.enable = true;
|
||||||
|
yamlls.enable = true;
|
||||||
|
clangd.enable = true;
|
||||||
|
marksman.enable = true;
|
||||||
|
texlab.enable = true;
|
||||||
|
lemminx.enable = true; # XML
|
||||||
|
|
||||||
|
java-language-server.enable = false;
|
||||||
|
zls.enable = false;
|
||||||
|
rust-analyzer.enable = false;
|
||||||
|
|
||||||
|
typos-lsp = {
|
||||||
|
enable = true;
|
||||||
|
extraOptions.init_options.diagnosticSeverity = "Hint";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts = {
|
||||||
|
colorschemes.catppuccin.settings.integrations.native_lsp.enabled = true;
|
||||||
|
extraPackages = [ pkgs.go ];
|
||||||
|
};
|
||||||
|
}
|
||||||
24
plugins/luasnip.nix
Normal file
24
plugins/luasnip.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
_:{
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
fromLua = [
|
||||||
|
{ paths = "~/.config/snippets/"; }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts.keymaps = [
|
||||||
|
{
|
||||||
|
mode = "i";
|
||||||
|
key = "<C-.>";
|
||||||
|
action.__raw = ''function() require("luasnip").jump(1) end'';
|
||||||
|
options.desc = "Jump to next snippet node";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "i";
|
||||||
|
key = "<C-,>";
|
||||||
|
action.__raw = ''function() require("luasnip").jump(-1) end'';
|
||||||
|
options.desc = "Jump to previous snippet node";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
31
plugins/markdown-preview.nix
Normal file
31
plugins/markdown-preview.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
# homepage: https://github.com/iamcco/markdown-preview.nvim
|
||||||
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/markdown-preview/index.html
|
||||||
|
_:
|
||||||
|
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
settings.auto_close = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts.keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>mp";
|
||||||
|
action = "<cmd>MarkdownPreview<cr>";
|
||||||
|
options.desc = "Start Markdown preview";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>ms";
|
||||||
|
action = "<cmd>MarkdownPreviewStop<cr>";
|
||||||
|
options.desc = "Stop Markdown preview";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>mt";
|
||||||
|
action = "<cmd>MarkdownPreviewToggle<cr>";
|
||||||
|
options.desc = "Toggle Markdown preview";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
12
plugins/mini.nix
Normal file
12
plugins/mini.nix
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
# homepage: https://github.com/echasnovski/mini.nvim
|
||||||
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/mini.html
|
||||||
|
_:
|
||||||
|
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# https://github.com/echasnovski/mini.bufremove
|
||||||
|
modules.bufremove = { };
|
||||||
|
};
|
||||||
|
}
|
||||||
280
plugins/neo-tree.nix
Normal file
280
plugins/neo-tree.nix
Normal file
|
|
@ -0,0 +1,280 @@
|
||||||
|
# homepage: https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||||
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/neo-tree/index.html
|
||||||
|
{ icons, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# Automatically clean up broken neo-tree buffers saved in sessions
|
||||||
|
autoCleanAfterSessionRestore = true;
|
||||||
|
|
||||||
|
# Close Neo-tree if it is the last window left in the tab
|
||||||
|
closeIfLastWindow = true;
|
||||||
|
|
||||||
|
# Disable fold column (gutter)
|
||||||
|
eventHandlers = {
|
||||||
|
neo_tree_buffer_enter = ''
|
||||||
|
function(_)
|
||||||
|
vim.opt_local.signcolumn = "auto"
|
||||||
|
vim.opt_local.foldcolumn = "0"
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Extra options not exposed by the plugin
|
||||||
|
extraOptions = {
|
||||||
|
# Custom functions (taken from AstroNvim)
|
||||||
|
commands = {
|
||||||
|
# Focus first directory child item or open directory
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L120-L135
|
||||||
|
child_or_open.__raw = ''
|
||||||
|
function(state)
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
if node:has_children() then
|
||||||
|
if not node:is_expanded() then -- if unexpanded, expand
|
||||||
|
state.commands.toggle_node(state)
|
||||||
|
else -- if expanded and has children, select the next child
|
||||||
|
if node.type == "file" then
|
||||||
|
state.commands.open(state)
|
||||||
|
else
|
||||||
|
require("neo-tree.ui.renderer").focus_node(state, node:get_child_ids()[1])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else -- if has no children
|
||||||
|
state.commands.open(state)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Copy various path format of currently focused item
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L136-L168
|
||||||
|
copy_selector.__raw = ''
|
||||||
|
function(state)
|
||||||
|
local notify = require("astrocore").notify
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
local filepath = node:get_id()
|
||||||
|
local filename = node.name
|
||||||
|
local modify = vim.fn.fnamemodify
|
||||||
|
|
||||||
|
local vals = {
|
||||||
|
["BASENAME"] = modify(filename, ":r"),
|
||||||
|
["EXTENSION"] = modify(filename, ":e"),
|
||||||
|
["FILENAME"] = filename,
|
||||||
|
["PATH (CWD)"] = modify(filepath, ":."),
|
||||||
|
["PATH (HOME)"] = modify(filepath, ":~"),
|
||||||
|
["PATH"] = filepath,
|
||||||
|
["URI"] = vim.uri_from_fname(filepath),
|
||||||
|
}
|
||||||
|
|
||||||
|
local options = vim.tbl_filter(function(val) return vals[val] ~= "" end, vim.tbl_keys(vals))
|
||||||
|
if vim.tbl_isempty(options) then
|
||||||
|
notify("No values to copy", vim.log.levels.WARN)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
table.sort(options)
|
||||||
|
vim.ui.select(options, {
|
||||||
|
prompt = "Choose to copy to clipboard:",
|
||||||
|
format_item = function(item) return ("%s: %s"):format(item, vals[item]) end,
|
||||||
|
}, function(choice)
|
||||||
|
local result = vals[choice]
|
||||||
|
if result then
|
||||||
|
notify(("Copied: `%s`"):format(result))
|
||||||
|
vim.fn.setreg("+", result)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Find file in currently focused item if it is a directory, or its closest parent directory
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L205-L209
|
||||||
|
find_file_in_dir.__raw = ''
|
||||||
|
function(state)
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
local path = node.type == "file" and node:get_parent_id() or node:get_id()
|
||||||
|
TelescopeWithTheme('find_files', { cwd = path }, "")
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Live grep in currently focused item if it is a directory, or its closest parent directory
|
||||||
|
grep_in_dir.__raw = ''
|
||||||
|
function(state)
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
local path = node.type == "file" and node:get_parent_id() or node:get_id()
|
||||||
|
TelescopeWithTheme('live_grep', { cwd = path }, "")
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Focus parent directory of currently focused item or close directory
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L112-L119
|
||||||
|
parent_or_close.__raw = ''
|
||||||
|
function(state)
|
||||||
|
local node = state.tree:get_node()
|
||||||
|
if node:has_children() and node:is_expanded() then
|
||||||
|
state.commands.toggle_node(state)
|
||||||
|
else
|
||||||
|
require("neo-tree.ui.renderer").focus_node(state, node:get_parent_id())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
window = {
|
||||||
|
# Keymaps for filter popup window in fuzzy finder mode (ie. "/")
|
||||||
|
fuzzy_finder_mappings = {
|
||||||
|
"<C-J>" = "move_cursor_down";
|
||||||
|
"<C-K>" = "move_cursor_up";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Keymaps when neotree window is focused
|
||||||
|
mappings = {
|
||||||
|
"[b" = "prev_source";
|
||||||
|
"]b" = "next_source";
|
||||||
|
|
||||||
|
# Disable default behavior to toggle node on Space keypress
|
||||||
|
"<Space>".__raw = "false";
|
||||||
|
|
||||||
|
# See extraOptions.commands for details on following keymaps
|
||||||
|
h = "parent_or_close";
|
||||||
|
l = "child_or_open";
|
||||||
|
F = "find_file_in_dir";
|
||||||
|
W = "grep_in_dir";
|
||||||
|
Y = "copy_selector";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultComponentConfigs = {
|
||||||
|
gitStatus.symbols = {
|
||||||
|
added = icons.GitAdd;
|
||||||
|
conflict = icons.GitConflict;
|
||||||
|
deleted = icons.GitDelete;
|
||||||
|
ignored = icons.GitIgnored;
|
||||||
|
modified = icons.GitChange;
|
||||||
|
renamed = icons.GitRenamed;
|
||||||
|
staged = icons.GitStaged;
|
||||||
|
unstaged = icons.GitUnstaged;
|
||||||
|
untracked = icons.GitUntracked;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
filesystem = {
|
||||||
|
# Find and focus file in active buffer
|
||||||
|
followCurrentFile.enabled = true;
|
||||||
|
|
||||||
|
# Open neotree "fullscreen" when opening a directory
|
||||||
|
hijackNetrwBehavior = "open_current";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Sources tabs
|
||||||
|
sourceSelector = {
|
||||||
|
# Label position
|
||||||
|
contentLayout.__raw = "'center'";
|
||||||
|
|
||||||
|
# No tabs separator
|
||||||
|
separator = "";
|
||||||
|
|
||||||
|
# Show tabs on winbar
|
||||||
|
winbar = true;
|
||||||
|
|
||||||
|
# Sources to show and their labels
|
||||||
|
sources = [
|
||||||
|
{
|
||||||
|
displayName = "${icons.FolderClosed} Files";
|
||||||
|
source = "filesystem";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
displayName = "${icons.DefaultFile} Bufs";
|
||||||
|
source = "buffers";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
displayName = "${icons.Git} Git";
|
||||||
|
source = "git_status";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts = {
|
||||||
|
# Enable catppuccin colors
|
||||||
|
# https://github.com/catppuccin/nvim/blob/main/lua/catppuccin/groups/integrations/neotree.lua
|
||||||
|
colorschemes.catppuccin.settings.integrations.neotree = true;
|
||||||
|
autoGroups.neotree = { };
|
||||||
|
|
||||||
|
# Custom autocommands (taken from AstroNvim)
|
||||||
|
autoCmd =
|
||||||
|
let
|
||||||
|
refresh = ''
|
||||||
|
function()
|
||||||
|
local manager_avail, manager = pcall(require, "neo-tree.sources.manager")
|
||||||
|
if manager_avail then
|
||||||
|
for _, source in ipairs { "filesystem", "git_status", "document_symbols" } do
|
||||||
|
local module = "neo-tree.sources." .. source
|
||||||
|
if package.loaded[module] then manager.refresh(require(module).name) end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
[
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L21-L37
|
||||||
|
{
|
||||||
|
desc = "Open explorer on startup with directory";
|
||||||
|
event = "BufEnter";
|
||||||
|
group = "neotree";
|
||||||
|
|
||||||
|
callback.__raw = ''
|
||||||
|
function()
|
||||||
|
if package.loaded["neo-tree"] then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
local stats = vim.loop.fs_stat(vim.api.nvim_buf_get_name(0))
|
||||||
|
if stats and stats.type == "directory" then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L25-L35
|
||||||
|
{
|
||||||
|
desc = "Refresh explorer sources when closing lazygit";
|
||||||
|
event = "TermClose";
|
||||||
|
group = "neotree";
|
||||||
|
pattern = "*lazygit*";
|
||||||
|
callback.__raw = refresh;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Refresh explorer sources on focus";
|
||||||
|
event = "FocusGained";
|
||||||
|
group = "neotree";
|
||||||
|
callback.__raw = refresh;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>e";
|
||||||
|
action = "<cmd>Neotree toggle<cr>";
|
||||||
|
options.desc = "Toggle explorer";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>o";
|
||||||
|
options.desc = "Toggle explorer focus";
|
||||||
|
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/neo-tree.lua#L12-L18
|
||||||
|
action.__raw = ''
|
||||||
|
function()
|
||||||
|
if vim.bo.filetype == "neo-tree" then
|
||||||
|
vim.cmd.wincmd "p"
|
||||||
|
else
|
||||||
|
vim.cmd.Neotree "focus"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
4
plugins/none-ls.nix
Normal file
4
plugins/none-ls.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
_:
|
||||||
|
{
|
||||||
|
opts.enable = true;
|
||||||
|
}
|
||||||
50
plugins/notify.nix
Normal file
50
plugins/notify.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
# homepage: https://github.com/rcarriga/nvim-notify
|
||||||
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/notify/index.html
|
||||||
|
{ icons, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
fps = 60;
|
||||||
|
stages = "fade";
|
||||||
|
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/notify.lua#L27-L28
|
||||||
|
maxHeight.__raw = "function() return math.floor(vim.o.lines * 0.75) end";
|
||||||
|
maxWidth.__raw = "function() return math.floor(vim.o.columns * 0.75) end";
|
||||||
|
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/notify.lua#L20-L26
|
||||||
|
icons = {
|
||||||
|
debug = icons.Debugger;
|
||||||
|
error = icons.DiagnosticError;
|
||||||
|
info = icons.DiagnosticInfo;
|
||||||
|
trace = icons.DiagnosticHint;
|
||||||
|
warn = icons.DiagnosticWarn;
|
||||||
|
};
|
||||||
|
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/notify.lua#L29-L42
|
||||||
|
onOpen = ''
|
||||||
|
function(win)
|
||||||
|
local buf = vim.api.nvim_win_get_buf(win)
|
||||||
|
vim.api.nvim_buf_set_option(buf, "filetype", "markdown")
|
||||||
|
vim.api.nvim_win_set_config(win, { zindex = 175 })
|
||||||
|
vim.wo[win].conceallevel = 3
|
||||||
|
vim.wo[win].spell = false
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts.keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>uD";
|
||||||
|
action.__raw = "function() require('notify').dismiss { pending = true, silent = true } end";
|
||||||
|
options.desc = "Dismiss notifications";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>fn";
|
||||||
|
action.__raw = "function() TelescopeWithTheme('notify', {}, 'notify') end";
|
||||||
|
options.desc = "Find notifications";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
27
plugins/nvim-highlight-colors.nix
Normal file
27
plugins/nvim-highlight-colors.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
||||||
|
# homepage: https://github.com/brenoprata10/nvim-highlight-colors
|
||||||
|
{ icons, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
extra = {
|
||||||
|
packages = [ pkgs.vimPlugins.nvim-highlight-colors ];
|
||||||
|
|
||||||
|
config = ''
|
||||||
|
require("nvim-highlight-colors").setup({
|
||||||
|
render = "background",
|
||||||
|
virtual_symbol = "${icons.FileModified}",
|
||||||
|
virtual_symbol_position = "eow",
|
||||||
|
virtual_symbol_prefix = " ",
|
||||||
|
virtual_symbol_suffix = "",
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts.keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>uz";
|
||||||
|
action = "<cmd>HighlightColors Toggle<cr>";
|
||||||
|
options.desc = "Toggle color highlight";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
47
plugins/nvim-ufo.nix
Normal file
47
plugins/nvim-ufo.nix
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
# homepage: https://github.com/kevinhwang91/nvim-ufo
|
||||||
|
# nixvim doc: https://nix-community.github.io/nixvim/plugins/nvim-ufo/index.html
|
||||||
|
_:
|
||||||
|
|
||||||
|
{
|
||||||
|
opts = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
preview.mappings = {
|
||||||
|
scrollB = "<c-b>";
|
||||||
|
scrollD = "<c-d>";
|
||||||
|
scrollF = "<c-f>";
|
||||||
|
scrollU = "<c-u>";
|
||||||
|
};
|
||||||
|
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/nvim-ufo.lua#L28-L44
|
||||||
|
providerSelector = ''
|
||||||
|
function(_, filetype, buftype)
|
||||||
|
local function handleFallbackException(bufnr, err, providerName)
|
||||||
|
if type(err) == "string" and err:match "UfoFallbackException" then
|
||||||
|
return require("ufo").getFolds(bufnr, providerName)
|
||||||
|
else
|
||||||
|
return require("promise").reject(err)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return (filetype == "" or buftype == "nofile") and "indent" -- only use indent until a file is opened
|
||||||
|
or function(bufnr)
|
||||||
|
return require("ufo")
|
||||||
|
.getFolds(bufnr, "lsp")
|
||||||
|
:catch(function(err) return handleFallbackException(bufnr, err, "treesitter") end)
|
||||||
|
:catch(function(err) return handleFallbackException(bufnr, err, "indent") end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts.keymaps = [
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/nvim-ufo.lua#L15
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "zp";
|
||||||
|
action.__raw = "function() require('ufo').peekFoldedLinesUnderCursor() end";
|
||||||
|
options.desc = "Peek fold";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
49
plugins/nvim-window-picker/default.nix
Normal file
49
plugins/nvim-window-picker/default.nix
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
{lib, pkgs, ...}:{
|
||||||
|
extra = {
|
||||||
|
packages = [
|
||||||
|
(import ./package.nix { inherit lib pkgs; })
|
||||||
|
];
|
||||||
|
|
||||||
|
config = /*Lua*/ ''
|
||||||
|
require('window-picker').setup({
|
||||||
|
hint = 'statusline-winbar', --alternative: 'floating-big-letter',
|
||||||
|
selection_chars = 'ENARITUDÄMCHLGVFXQ', -- default: 'FJDKSLA;CMRUEIWOQP'
|
||||||
|
picker_config = {
|
||||||
|
statusline_winbar_picker = {
|
||||||
|
selection_display = function(char, windowid)
|
||||||
|
return table.concat({'%=', '=== ', char, ' ===', '%='})
|
||||||
|
end,
|
||||||
|
|
||||||
|
use_winbar = 'smart'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
highlights = {
|
||||||
|
statusline = {
|
||||||
|
focused = {
|
||||||
|
fg = '#E67e80',
|
||||||
|
bg = '#2e383c',
|
||||||
|
bold = true,
|
||||||
|
},
|
||||||
|
unfocused = {
|
||||||
|
fg = '#a7c080',
|
||||||
|
bg = '#2e383c',
|
||||||
|
bold = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
winbar = {
|
||||||
|
focused = {
|
||||||
|
fg = '#E67e80',
|
||||||
|
bg = '#2e383c',
|
||||||
|
bold = true,
|
||||||
|
},
|
||||||
|
unfocused = {
|
||||||
|
fg = '#a7c080',
|
||||||
|
bg = '#2e383c',
|
||||||
|
bold = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
23
plugins/nvim-window-picker/package.nix
Normal file
23
plugins/nvim-window-picker/package.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
{ pkgs, ...}:
|
||||||
|
let
|
||||||
|
version = "v2.0.3";
|
||||||
|
owner = "s1n7ax";
|
||||||
|
repo = "nvim-window-picker";
|
||||||
|
in
|
||||||
|
pkgs.vimUtils.buildVimPlugin {
|
||||||
|
name = "nvim-window-picker";
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
# NOTE: for my work PC, fetchFromGithub fails, due to an SSL error
|
||||||
|
src = builtins.fetchTarball {
|
||||||
|
url = "http://github.com/${owner}/${repo}/archive/${version}.tar.gz";
|
||||||
|
sha256 = "sha256:1bcjsx5qgvj1gi6zdi3fwc44x7afh35xbyrjik0dzl3hj6ds960g";
|
||||||
|
};
|
||||||
|
|
||||||
|
# src = pkgs.fetchFromGitHub {
|
||||||
|
# owner = "s1n7ax";
|
||||||
|
# repo = "nvim-window-picker";
|
||||||
|
# rev = version;
|
||||||
|
# hash = "sha256:1bcjsx5qgvj1gi6zdi3fwc44x7afh35xbyrjik0dzl3hj6ds960g";
|
||||||
|
# }
|
||||||
|
}
|
||||||
18
plugins/oil.nix
Normal file
18
plugins/oil.nix
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
_: {
|
||||||
|
opts.enable = true;
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
key = "<leader>O";
|
||||||
|
action = "<Cmd>Oil<Cr>";
|
||||||
|
options.desc = "Toggle oil floating window";
|
||||||
|
mode = "n";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<leader>to";
|
||||||
|
action.__raw = "function() require('oil').toggle_float() end";
|
||||||
|
options.desc = "Toggle oil floating window";
|
||||||
|
mode = "n";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
3
plugins/otter.nix
Normal file
3
plugins/otter.nix
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
_:{
|
||||||
|
opts.enable = true;
|
||||||
|
}
|
||||||
100
plugins/resession/default.nix
Normal file
100
plugins/resession/default.nix
Normal file
|
|
@ -0,0 +1,100 @@
|
||||||
|
# homepage: https://github.com/stevearc/resession.nvim
|
||||||
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
extra = {
|
||||||
|
packages = [
|
||||||
|
(import ./package.nix { inherit lib pkgs; })
|
||||||
|
];
|
||||||
|
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/resession.lua#L45-L49
|
||||||
|
config = ''
|
||||||
|
require("resession").setup({
|
||||||
|
buf_filter = function(bufnr) return require("astrocore.buffer").is_restorable(bufnr) end,
|
||||||
|
tab_buf_filter = function(tabpage, bufnr) return vim.tbl_contains(vim.t[tabpage].bufs, bufnr) end,
|
||||||
|
extensions = { astrocore = { enable_in_tab = true } },
|
||||||
|
})
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
rootOpts = {
|
||||||
|
autoGroups.resession = { };
|
||||||
|
autoCmd = [
|
||||||
|
{
|
||||||
|
desc = "Save session on close";
|
||||||
|
event = "VimLeavePre";
|
||||||
|
group = "resession";
|
||||||
|
|
||||||
|
# https://github.com/AstroNvim/AstroNvim/blob/v4.7.7/lua/astronvim/plugins/resession.lua#L31-L39
|
||||||
|
callback.__raw = ''
|
||||||
|
function()
|
||||||
|
local buf_utils = require "astrocore.buffer"
|
||||||
|
local autosave = buf_utils.sessions.autosave
|
||||||
|
if autosave and buf_utils.is_valid_session() then
|
||||||
|
local save = require("resession").save
|
||||||
|
if autosave.last then save("last", { notify = false }) end
|
||||||
|
if autosave.cwd then save(vim.fn.getcwd(), { dir = "dirsession", notify = false }) end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>sl";
|
||||||
|
action.__raw = "function() require('resession').load 'last' end";
|
||||||
|
options.desc = "Load last session";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>ss";
|
||||||
|
action.__raw = "function() require('resession').save() end";
|
||||||
|
options.desc = "Save this session";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>sS";
|
||||||
|
action.__raw = "function() require('resession').save(vim.fn.getcwd(), { dir = 'dirsession' }) end";
|
||||||
|
options.desc = "Save this dirsession";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>st";
|
||||||
|
action.__raw = "function() require('resession').save_tab() end";
|
||||||
|
options.desc = "Save this tab's session";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>sd";
|
||||||
|
action.__raw = "function() require('resession').delete() end";
|
||||||
|
options.desc = "Delete a session";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>sD";
|
||||||
|
action.__raw = "function() require('resession').delete(nil, { dir = 'dirsession' }) end";
|
||||||
|
options.desc = "Delete a dirsession";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>sf";
|
||||||
|
action.__raw = "function() require('resession').load() end";
|
||||||
|
options.desc = "Load a session";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>sF";
|
||||||
|
action.__raw = "function() require('resession').load(nil, { dir = 'dirsession' }) end";
|
||||||
|
options.desc = "Load a dirsession";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
mode = "n";
|
||||||
|
key = "<leader>s.";
|
||||||
|
action.__raw = "function() require('resession').load(vim.fn.getcwd(), { dir = 'dirsession' }) end";
|
||||||
|
options.desc = "Load current dirsession";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
17
plugins/resession/package.nix
Normal file
17
plugins/resession/package.nix
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
version = "1.2.1";
|
||||||
|
in
|
||||||
|
pkgs.vimUtils.buildVimPlugin {
|
||||||
|
inherit version;
|
||||||
|
|
||||||
|
name = "resession-nvim";
|
||||||
|
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "stevearc";
|
||||||
|
repo = "resession.nvim";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-GXKDuKDMcfl1SHTTdUFdWuWbtq6TDtk0GsyI3fAc1vE=";
|
||||||
|
};
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue