diff options
Diffstat (limited to '')
617 files changed, 11162 insertions, 5942 deletions
diff --git a/.editorconfig b/.editorconfig index bb0af45c..066942f6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # EditorConfig is awesome: https://EditorConfig.org # top-most EditorConfig file diff --git a/.envrc b/.envrc index 2f9f1a81..294de504 100644 --- a/.envrc +++ b/.envrc @@ -1,2 +1,13 @@ #!/usr/bin/env sh + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use flake diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index e69de29b..00000000 --- a/.gitattributes +++ /dev/null diff --git a/.gitignore b/.gitignore index e75b469a..f18a8bd2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + .direnv .ccls-cache diff --git a/.reuse/templates/default.jinja2 b/.reuse/templates/default.jinja2 new file mode 100644 index 00000000..17499ae1 --- /dev/null +++ b/.reuse/templates/default.jinja2 @@ -0,0 +1,31 @@ +{# +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +#} + +nixos-config - My current NixOS configuration + +{% for copyright_line in copyright_lines %} +{{ copyright_line }} +{% endfor %} +{% for contributor_line in contributor_lines %} +SPDX-FileContributor: {{ contributor_line }} +{% endfor %} +{% for expression in spdx_expressions %} +SPDX-License-Identifier: {{ expression }} +{% endfor %} + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{# + vim: ft=htmldjango +#} diff --git a/CHANGELOG.md b/CHANGELOG.md index efc29655..2a0ccb62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +<!-- +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +--> + # Changelog All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines. diff --git a/COPYING b/COPYING deleted file mode 100644 index f288702d..00000000 --- a/COPYING +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - 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. - - 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. - - 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. - - 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. - - 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. - - 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. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - 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: - - <program> Copyright (C) <year> <name of author> - 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/licenses/why-not-lgpl.html>. diff --git a/LICENSES/GPL-3.0-or-later.txt b/LICENSES/GPL-3.0-or-later.txt new file mode 100644 index 00000000..f6cdd22a --- /dev/null +++ b/LICENSES/GPL-3.0-or-later.txt @@ -0,0 +1,232 @@ +GNU GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/> + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The GNU General Public License is a free, copyleft license for software and other kinds of works. + +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. + +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. + +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. + +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. + +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. + +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. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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: + + <program> Copyright (C) <year> <name of author> + 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>. diff --git a/bootstrap/01_activate.sh b/bootstrap/01_activate.sh deleted file mode 100755 index 72d947c5..00000000 --- a/bootstrap/01_activate.sh +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -. %SCRIPT_ENSURE_CONFIG_VARIABLES - -nix run github:nix-community/disko --experimental-features 'nix-command flakes' -- --flake "git+https://codeberg.org/soispha/nixos-config#$NIX_HOST" --mode mount - -msg "Finished mounting" - -case "$ACTIVATE_TO_SETUP" in -"yes") - nix run "git+https://codeberg.org/soispha/nixos-config#setup" --experimental-features 'nix-command flakes' - ;; -*) ;; -esac - -# vim: ft=sh diff --git a/bootstrap/01_install.sh b/bootstrap/01_install.sh deleted file mode 100755 index 25122568..00000000 --- a/bootstrap/01_install.sh +++ /dev/null @@ -1,82 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -INSTALL=y . %SCRIPT_ENSURE_CONFIG_VARIABLES - -msg "Important information:" -msg2 "Choose disk id is: $NIX_DISK" -warning "This information needs to be entered in the host configuration BEFORE rebuilding it. Otherwise you'll have to wait for a 1 h cooldown!" -info_applied=false -while [ "$info_applied" = false ]; do - readp "Have you updated your chosen host with the choose disk id? [N/y]: " result - # shellcheck disable=SC2154 - case $result in - [Yy]) - info_applied=true - ;; - *) - warning "You won't be able to boot, if you don't update it!" - ;; - esac -done - -msg "Started creating filesystem..." -nix run github:nix-community/disko --experimental-features 'nix-command flakes' -- --flake "git+https://codeberg.org/soispha/nixos-config#$NIX_HOST" --mode disko -msg "Finished mounting and generating btrfs subvolumes" - -msg "Creating swapfile..." -msg2 "$(btrfs filesystem mkswapfile --size "$(free -m | awk '{if (NR==2) {printf "%sm\n", $2 + 500}}')" /mnt/swap/swapfile)" -msg "Finished creating swapfile!" - -msg "Important information:" -msg2 "Swapfile UUID is: $(findmnt -no UUID -T /mnt/swap/swapfile)" -msg2 "Swapfile resume offset is: $(btrfs inspect-internal map-swapfile -r /mnt/swap/swapfile)" -warning "This information needs to be entered in the host configuration BEFORE rebuilding it. Otherwise the system won't boot!" - -info_applied=false -while [ "$info_applied" = false ]; do - readp "Have you updated your chosen host with this information? [N/y]: " result - case $result in - [Yy]) - info_applied=true - ;; - *) - warning "You won't be able to boot, if you don't update it!" - ;; - esac -done - -msg "Checking for incompatibilities..." -ssd_or_hdd="$(cat /sys/block/"$(basename "$(readlink -f "/dev/disk/by-id/$NIX_DISK")" | tr -d '\n')"/queue/rotational)" -case "$ssd_or_hdd" in -0) - msg2 "You seem to use a ssd." - trim_support=$(lsblk --bytes --json --discard | jq --arg name "$(basename "$(readlink -f "/dev/disk/by-id/$NIX_DISK")" | tr -d '\n')" '.blockdevices | .[] | select(.name == $name) | (.["disc-gran"] + .["disc-max"]) != 0') - case $trim_support in - "true") - msg2 "Yay, your ssd supports trim, go on and activate it" - ;; - "false") - msg2 "Nay, your ssd doesn't support trim" - ;; - *) - warning "Your ssd doesn't seem to exists, if this bothers you please open an issue." - ;; - esac - ;; -1) - msg2 "You seem to use a hdd there is nothing you have to do" - ;; -*) - warning "There is no indicator, which shows, which drive your are using.\n This means, that you have to check yourself, which optimizations you should activate." - ;; -esac - -case "$INSTALL_TO_SETUP" in -"yes") - nix run "git+https://codeberg.org/soispha/nixos-config#setup" --experimental-features 'nix-command flakes' - ;; -*) ;; -esac diff --git a/bootstrap/02_setup.sh b/bootstrap/02_setup.sh deleted file mode 100755 index e68b9a90..00000000 --- a/bootstrap/02_setup.sh +++ /dev/null @@ -1,23 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -. %SCRIPT_ENSURE_CONFIG_VARIABLES - -nixos-install --flake git+https://codeberg.org/soispha/nixos-config#"$NIX_HOST" --no-root-passwd - -# clone the git config -git clone https://codeberg.org/soispha/nixos-config.git /mnt/srv/etc/nixos - -# setup persistent home dir -mkdir --parents /mnt/srv/home -chown 1000:100 --recursive /mnt/srv/home -chmod 700 /mnt/srv/home - -case "$SETUP_TO_CONFIG_SETUP" in -"yes") - nix run "git+https://codeberg.org/soispha/nixos-config#config_setup" --experimental-features 'nix-command flakes' - ;; -*) ;; -esac diff --git a/bootstrap/03_config_setup.sh b/bootstrap/03_config_setup.sh deleted file mode 100755 index 349e8ebc..00000000 --- a/bootstrap/03_config_setup.sh +++ /dev/null @@ -1,11 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# clone packer.nvim to the needed dir, for the nvim install to work -git clone --depth 1 https://github.com/wbthomason/packer.nvim /mnt/srv/home/soispha/.local/share/nvim/site/pack/packer/start/packer.nvim - -nixos-enter --command 'nvim -c "PackerSync" -c "qall" -u "/mnt/srv/home/soispha/.config/nvim/init.lua" --headless' - -# vim: ft=sh diff --git a/bootstrap/99_ensure_config_variables.sh b/bootstrap/99_ensure_config_variables.sh deleted file mode 100755 index f0380f6b..00000000 --- a/bootstrap/99_ensure_config_variables.sh +++ /dev/null @@ -1,123 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -if ! [ "$NIX_ENVIRONMENT_VARIABLES_SET" ]; then - if ! [ "$NIX_HOST" ]; then - msg "Select a host:" - _hosts=$(mktmp) - curl https://codeberg.org/soispha/nixos-config/raw/branch/prime/flake/nixosConfigurations/default.nix 2>/dev/null | awk -F '"' '/hosts = /{for (i=2;i<NF;i+=2) {print $i}}' >"$_hosts" - - while ! grep "$host" "$_hosts" >/dev/null || [ "$(printf "%s" "$host" | wc -c)" -eq 0 ]; do - i=1 - while read -r host_read; do - printf "%4s) %s \n" "$i" "$host_read" - i=$((i + 1)) - done <"$_hosts" - printf "%4s) Exit\n" "q" - readp "Enter a option: " host - - [ "$host" = "q" ] && exit 1 - host=$(awk -v i="$host" '{if (NR==i) {print $0}}' "$_hosts") - if ! grep "$host" "$_hosts" >/dev/null || [ "$(printf "%s" "$host" | wc -c)" -eq 0 ]; then - warning "No host selected. Select a host to continue.\n" - fi - done - - export NIX_HOST="$host" - fi - if ! [ "$NIX_DISK" ] && [ "$INSTALL" ]; then - available_disks="$(mktmp)" - lsblk -J | jq '.[] | map(.name) | [foreach .[] as $item ({item: null, index: -1}; {$item, index: (.index + 1)})]' >"$available_disks" - - [ "$(jq '.[]' "$available_disks" | wc -l)" -eq 0 ] && die "No disks found" - msg "Select a disk to format:" - - i=9999 # nobody will have so many disks attached - - while ! jq -e --argjson i "$i" '.[$i]' "$available_disks" >/dev/null 2>&1; do - for _disk in $(jq -c '.[]' "$available_disks"); do - printf "%4s) %s \n" "$(echo "$_disk" | jq '.index')" "$(echo "$_disk" | jq '.item' | tr -d '"')" - done - printf "%4s) Exit\n" "q" - readp "Enter a option: " _disk - - if [ "$_disk" = "q" ]; then - exit 1 - else - i="$_disk" - fi - if jq -e --argjson i "$i" 'nth($i)' "$available_disks" >/dev/null 2>&1; then - _disk=$(mktmp) - jq -e --argjson i "$i" 'nth($i)' "$available_disks" >"$_disk" - else - warning "No disk selected. Select a disk to continue.\n" - fi - done - - warn "All data on disk $(jq '.item' "$_disk") will be deleted." - readp "Continue with this disk? [N/y]: " result - # shellcheck disable=SC2154 - case "$result" in - [Yy]) - msg "Great, continuing..." - _disk="$(jq '.item' "$_disk" | tr -d '"')" - _disk_serial="$(udevadm info --query=all --name="$_disk" | grep ID_SERIAL= | awk 'BEGIN{FS="="}{print $2}')" - case "$_disk" in - "nvme"*) - _nix_disk="nvme-$_disk_serial" - ;; - "sd"*) - _nix_disk="ata-$_disk_serial" - ;; - *) - die "Disk with name '$_disk' and serial '$_disk_serial' not yet supported!" - ;; - esac - export NIX_DISK="$_nix_disk" - ;; - *) - msg "Sure, keep your data" - exit 1 - ;; - esac - fi - - if ! [ "$ACTIVATE_TO_SETUP" ] && ! [ "$INSTALL" ]; then - readp "Do you want to continue with nixos-install after activation? [N/y]: " result - case $result in - [Yy]) - export ACTIVATE_TO_SETUP=yes - ;; - *) - export ACTIVATE_TO_SETUP=no - ;; - esac - fi - if ! [ "$INSTALL_TO_SETUP" ] && [ "$INSTALL" ]; then - readp "Do you want to continue with nixos-install after disk formatting? [N/y]: " result - case $result in - [Yy]) - export INSTALL_TO_SETUP=yes - ;; - *) - export INSTALL_TO_SETUP=no - ;; - esac - fi - if ! [ "$SETUP_TO_CONFIG_SETUP" ]; then - readp "Do you want to continue with the user configuration setup after setup? [N/y]: " result - case $result in - [Yy]) - export SETUP_TO_CONFIG_SETUP=yes - ;; - *) - export SETUP_TO_CONFIG_SETUP=no - ;; - esac - fi - export NIX_ENVIRONMENT_VARIABLES_SET="set" -fi - -# vim: ft=sh diff --git a/bootstrap/default.nix b/bootstrap/default.nix deleted file mode 100644 index c47df9da..00000000 --- a/bootstrap/default.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ - pkgs, - sysLib, - ... -}: let - ensure_config_variables_dependencies = builtins.attrValues {inherit (pkgs) systemd jq dash gnugrep curl;}; - replacementStrings = {SCRIPT_ENSURE_CONFIG_VARIABLES = "${ensure_config_variables}/bin/ensure_config_variables";}; - activate = sysLib.writeShellScript { - dependencies = with pkgs; [jq gawk curl coreutils libuuid lix git] ++ ensure_config_variables_dependencies; - name = "activate"; - src = ./01_activate.sh; - inherit replacementStrings; - }; - install = sysLib.writeShellScript { - dependencies = with pkgs; [jq dash curl gawk btrfs-progs coreutils libuuid gptfdisk dosfstools toybox lix git] ++ ensure_config_variables_dependencies; - name = "install"; - src = ./01_install.sh; - inherit replacementStrings; - }; - setup = sysLib.writeShellScript { - dependencies = with pkgs; [dash gawk curl git lix gnugrep nixos-install-tools coreutils libuuid] ++ ensure_config_variables_dependencies; - name = "setup"; - src = ./02_setup.sh; - inherit replacementStrings; - }; - config_setup = sysLib.writeShellScript { - dependencies = builtins.attrValues {inherit (pkgs) git neovim;} ++ ensure_config_variables_dependencies; - name = "config_setup"; - src = ./03_config_setup.sh; - keepPath = true; - inherit replacementStrings; - }; - ensure_config_variables = sysLib.writeShellScript { - name = "ensure_config_variables"; - src = ./99_ensure_config_variables.sh; - wrap = false; - }; - output = {inherit activate install setup config_setup ensure_config_variables;}; -in - output diff --git a/build.sh b/build.sh index 0e574a3a..de4d536c 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,15 @@ #!/usr/bin/env sh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + host="${1-tiamat}" [ "$#" -gt 0 ] && shift 1 diff --git a/cog.toml b/cog.toml index b42a613d..3941be5b 100644 --- a/cog.toml +++ b/cog.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + from_latest_tag = false tag_prefix = "v" ignore_merge_commits = false diff --git a/flake.lock b/flake.lock index ac446ada..6bcf88a2 100644 --- a/flake.lock +++ b/flake.lock @@ -16,11 +16,11 @@ ] }, "locked": { - "lastModified": 1736955230, - "narHash": "sha256-uenf8fv2eG5bKM8C/UvFaiJMZ4IpUFaQxk9OH5t/1gA=", + "lastModified": 1747575206, + "narHash": "sha256-NwmAFuDUO/PFcgaGGr4j3ozG9Pe5hZ/ogitWhY+D81k=", "owner": "ryantm", "repo": "agenix", - "rev": "e600439ec4c273cf11e06fe4d9d906fb98fa097c", + "rev": "4835b1dc898959d8547a871ef484930675cb47f1", "type": "github" }, "original": { @@ -42,11 +42,11 @@ ] }, "locked": { - "lastModified": 1739094253, - "narHash": "sha256-yDTgmfSuL5Ax7LRuxhdoMJrBi4X9Q3fyyI7TerTXVBA=", + "lastModified": 1747987475, + "narHash": "sha256-vOcpx0ytmD5B+Kd4KHZfz0LGcn0zZnsmzlJFFePopGw=", "owner": "dwarfmaster", "repo": "arkenfox-nixos", - "rev": "27e0c3094e778bd73f93bea799f627ef317e7f22", + "rev": "e2acb9854f22a26cb59ce2f497d006468506454d", "type": "github" }, "original": { @@ -83,11 +83,11 @@ }, "crane": { "locked": { - "lastModified": 1742394900, - "narHash": "sha256-vVOAp9ahvnU+fQoKd4SEXB2JG2wbENkpqcwlkIXgUC0=", + "lastModified": 1748047550, + "narHash": "sha256-t0qLLqb4C1rdtiY8IFRH5KIapTY/n3Lqt57AmxEv9mk=", "owner": "ipetkov", "repo": "crane", - "rev": "70947c1908108c0c551ddfd73d4f750ff2ea67cd", + "rev": "b718a78696060df6280196a6f992d04c87a16aef", "type": "github" }, "original": { @@ -123,11 +123,11 @@ ] }, "locked": { - "lastModified": 1741786315, - "narHash": "sha256-VT65AE2syHVj6v/DGB496bqBnu1PXrrzwlw07/Zpllc=", + "lastModified": 1748225455, + "narHash": "sha256-AzlJCKaM4wbEyEpV3I/PUq5mHnib2ryEy32c+qfj6xk=", "owner": "nix-community", "repo": "disko", - "rev": "0d8c6ad4a43906d14abd5c60e0ffe7b587b213de", + "rev": "a894f2811e1ee8d10c50560551e50d6ab3c392ba", "type": "github" }, "original": { @@ -139,11 +139,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1733328505, - "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", "owner": "edolstra", "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", "type": "github" }, "original": { @@ -159,11 +159,11 @@ ] }, "locked": { - "lastModified": 1741352980, - "narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=", + "lastModified": 1743550720, + "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9", + "rev": "c621e8422220273271f52058f618c94e405bb0f5", "type": "github" }, "original": { @@ -192,32 +192,6 @@ "type": "github" } }, - "flake_version_update": { - "inputs": { - "flake-utils": [ - "flake-utils" - ], - "nixpkgs": [ - "nixpkgs" - ], - "systems": [ - "systems" - ] - }, - "locked": { - "lastModified": 1685288691, - "narHash": "sha256-oP6h34oJ8rm6KlUpyZrX+ww3hnoWny2ecrEXxkU7F3c=", - "ref": "refs/heads/prime", - "rev": "e9a97e01eca780bd16e1dbdbd8856b59558f4959", - "revCount": 5, - "type": "git", - "url": "https://codeberg.org/soispha/flake_version_update.git" - }, - "original": { - "type": "git", - "url": "https://codeberg.org/soispha/flake_version_update.git" - } - }, "git-hooks": { "inputs": { "flake-compat": [ @@ -231,11 +205,11 @@ ] }, "locked": { - "lastModified": 1742649964, - "narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=", + "lastModified": 1747372754, + "narHash": "sha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo+bnXU9D9k=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", + "rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46", "type": "github" }, "original": { @@ -291,11 +265,11 @@ ] }, "locked": { - "lastModified": 1743136572, - "narHash": "sha256-uwaVrKgi6g1TUq56247j6QvvFtYHloCkjCrEpGBvV54=", + "lastModified": 1748529677, + "narHash": "sha256-MJEX3Skt5EAIs/aGHD8/aXXZPcceMMHheyIGSjvxZN0=", "owner": "nix-community", "repo": "home-manager", - "rev": "1efd2503172016a6742c87b47b43ca2c8145607d", + "rev": "da282034f4d30e787b8a10722431e8b650a907ef", "type": "github" }, "original": { @@ -332,16 +306,16 @@ ] }, "locked": { - "lastModified": 1729958008, - "narHash": "sha256-EiOq8jF4Z/zQe0QYVc3+qSKxRK//CFHMB84aYrYGwEs=", + "lastModified": 1748294338, + "narHash": "sha256-FVO01jdmUNArzBS7NmaktLdGA5qA3lUMJ4B7a05Iynw=", "owner": "NuschtOS", "repo": "ixx", - "rev": "9fd01aad037f345350eab2cd45e1946cc66da4eb", + "rev": "cc5f390f7caf265461d4aab37e98d2292ebbdb85", "type": "github" }, "original": { "owner": "NuschtOS", - "ref": "v0.0.6", + "ref": "v0.0.8", "repo": "ixx", "type": "github" } @@ -405,11 +379,11 @@ ] }, "locked": { - "lastModified": 1743221873, - "narHash": "sha256-i8VPNm4UBsC3Ni6VwjojVJvCpS9GZ4vPrpFRtCGJzBs=", + "lastModified": 1748352827, + "narHash": "sha256-sNUUP6qxGkK9hXgJ+p362dtWLgnIWwOCmiq72LAWtYo=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "53d0f0ed11487a4476741fde757d0feabef4cc4e", + "rev": "44a7d0e687a87b73facfe94fba78d323a6686a90", "type": "github" }, "original": { @@ -446,11 +420,11 @@ ] }, "locked": { - "lastModified": 1742701275, - "narHash": "sha256-AulwPVrS9859t+eJ61v24wH/nfBEIDSXYxlRo3fL/SA=", + "lastModified": 1748145500, + "narHash": "sha256-t9fx0l61WOxtWxXCqlXPWSuG/0XMF9DtE2T7KXgMqJw=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "36dc43cb50d5d20f90a28d53abb33a32b0a2aae6", + "rev": "a98adbf54d663395df0b9929f6481d4d80fc8927", "type": "github" }, "original": { @@ -459,32 +433,6 @@ "type": "github" } }, - "nixVim": { - "inputs": { - "flake-parts": [ - "flake-parts" - ], - "nixpkgs": [ - "nixpkgs" - ], - "nuschtosSearch": [ - "nuschtosSearch" - ] - }, - "locked": { - "lastModified": 1743157969, - "narHash": "sha256-ldlSyVKNaXL7ys7Jr7mLhlpGDE4VPVcWmV7Odupn5TY=", - "owner": "nix-community", - "repo": "nixvim", - "rev": "95573411bc9be155a93b0f15d2bad62c6b43b3cc", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixvim", - "type": "github" - } - }, "nixos-generators": { "inputs": { "nixlib": [ @@ -495,11 +443,11 @@ ] }, "locked": { - "lastModified": 1742568034, - "narHash": "sha256-QaMEhcnscfF2MqB7flZr+sLJMMYZPnvqO4NYf9B4G38=", + "lastModified": 1747663185, + "narHash": "sha256-Obh50J+O9jhUM/FgXtI3he/QRNiV9+J53+l+RlKSaAk=", "owner": "nix-community", "repo": "nixos-generators", - "rev": "42ee229088490e3777ed7d1162cb9e9d8c3dbb11", + "rev": "ee07ba0d36c38e9915c55d2ac5a8fb0f05f2afcc", "type": "github" }, "original": { @@ -510,11 +458,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1743095683, - "narHash": "sha256-gWd4urRoLRe8GLVC/3rYRae1h+xfQzt09xOfb0PaHSk=", + "lastModified": 1748370509, + "narHash": "sha256-QlL8slIgc16W5UaI3w7xHQEP+Qmv/6vSNTpoZrrSlbk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5e5402ecbcb27af32284d4a62553c019a3a49ea6", + "rev": "4faa5f5321320e49a78ae7848582f684d64783e9", "type": "github" }, "original": { @@ -524,29 +472,13 @@ "type": "github" } }, - "nixpkgs-lf": { - "locked": { - "lastModified": 1743256538, - "narHash": "sha256-fG19N9PvPtsV3UUwT7lauNJ7tE4ZB/EPKwwENrqqKCQ=", - "owner": "bpeetz", - "repo": "nixpkgs", - "rev": "e315c0e09beaf4daf4041d402067cbdbc84870d9", - "type": "github" - }, - "original": { - "owner": "bpeetz", - "ref": "init-lf.nvim", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs-lib": { "locked": { - "lastModified": 1742692082, - "narHash": "sha256-s3XOULQj7BVO7myY5V4Sob0tRZ7nRpwEOIzXg/MkD/Q=", + "lastModified": 1748135671, + "narHash": "sha256-PIkcBpddXRAGWstWV7zTwRZ9EAPqgzFNssux17p1NTg=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "a09310bc940f245e51b1ffea68731244ca38f2bd", + "rev": "6194ba204e5b188965da97ebb16e05191e560427", "type": "github" }, "original": { @@ -557,20 +489,49 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1742937945, - "narHash": "sha256-lWc+79eZRyvHp/SqMhHTMzZVhpxkRvthsP1Qx6UCq0E=", + "lastModified": 1748437600, + "narHash": "sha256-hYKMs3ilp09anGO7xzfGs3JqEgUqFMnZ8GMAqI6/k04=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "d02d88f8de5b882ccdde0465d8fa2db3aa1169f7", + "rev": "7282cb574e0607e65224d33be8241eae7cfe0979", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-24.11", + "ref": "nixos-25.05", "repo": "nixpkgs", "type": "github" } }, + "nixvim": { + "inputs": { + "flake-parts": [ + "flake-parts" + ], + "nixpkgs": [ + "nixpkgs" + ], + "nuschtosSearch": [ + "nuschtosSearch" + ], + "systems": [ + "systems" + ] + }, + "locked": { + "lastModified": 1748521000, + "narHash": "sha256-EnXH5PIrZBoe8U09hPQr2kOuPTZSqAJy78DqUVLmWXg=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "a9e45072d82374dd3f0d971795e7d7f99e5bc6c2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, "nuschtosSearch": { "inputs": { "flake-utils": [ @@ -582,11 +543,11 @@ ] }, "locked": { - "lastModified": 1743201766, - "narHash": "sha256-bb/dqoIjtIWtJRzASOe8g4m8W2jUIWtuoGPXdNjM/Tk=", + "lastModified": 1748298102, + "narHash": "sha256-PP11GVwUt7F4ZZi5A5+99isuq39C59CKc5u5yVisU/U=", "owner": "NuschtOS", "repo": "search", - "rev": "2651dbfad93d6ef66c440cbbf23238938b187bde", + "rev": "f8a1c221afb8b4c642ed11ac5ee6746b0fe1d32f", "type": "github" }, "original": { @@ -612,11 +573,11 @@ ] }, "locked": { - "lastModified": 1742397518, - "narHash": "sha256-nzgO/ZCSBzWjbMkYDxG+yl9Z2eGbCgQu06Oku3ir5D4=", + "lastModified": 1743690424, + "narHash": "sha256-cX98bUuKuihOaRp8dNV1Mq7u6/CQZWTPth2IJPATBXc=", "owner": "nix-community", "repo": "poetry2nix", - "rev": "b9a98080beff0903a5e5fe431f42cde1e3e50d6b", + "rev": "ce2369db77f45688172384bbeb962bc6c2ea6f94", "type": "github" }, "original": { @@ -638,11 +599,11 @@ ] }, "locked": { - "lastModified": 1742649964, - "narHash": "sha256-DwOTp7nvfi8mRfuL1escHDXabVXFGT1VlPD1JHrtrco=", + "lastModified": 1747372754, + "narHash": "sha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo+bnXU9D9k=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82", + "rev": "80479b6ec16fefd9c1db3ea13aeb038c60530f46", "type": "github" }, "original": { @@ -681,38 +642,6 @@ "url": "https://git.foss-syndicate.org/bpeetz/qmk_layout.git" } }, - "ragenix": { - "inputs": { - "agenix": [ - "agenix" - ], - "crane": [ - "crane" - ], - "flake-utils": [ - "flake-utils" - ], - "nixpkgs": [ - "nixpkgs" - ], - "rust-overlay": [ - "rust-overlay" - ] - }, - "locked": { - "lastModified": 1741508717, - "narHash": "sha256-iQf1WdNxaApOFHIx4RLMRZ4f8g+8Xp0Z1/E/Mz2rLxY=", - "owner": "yaxitech", - "repo": "ragenix", - "rev": "2a2bea99d74927e54adf53cbf113219def67d5c9", - "type": "github" - }, - "original": { - "owner": "yaxitech", - "repo": "ragenix", - "type": "github" - } - }, "root": { "inputs": { "agenix": "agenix", @@ -724,7 +653,6 @@ "flake-compat": "flake-compat", "flake-parts": "flake-parts", "flake-utils": "flake-utils", - "flake_version_update": "flake_version_update", "git-hooks": "git-hooks", "gitignore": "gitignore", "haumea": "haumea", @@ -734,20 +662,17 @@ "library": "library", "nix-darwin": "nix-darwin", "nix-index-database": "nix-index-database", - "nixVim": "nixVim", "nixos-generators": "nixos-generators", "nixpkgs": "nixpkgs", - "nixpkgs-lf": "nixpkgs-lf", "nixpkgs-lib": "nixpkgs-lib", "nixpkgs-stable": "nixpkgs-stable", + "nixvim": "nixvim", "nuschtosSearch": "nuschtosSearch", "poetry2nix": "poetry2nix", "pre-commit-hooks": "pre-commit-hooks", "qmk_firmware": "qmk_firmware", - "ragenix": "ragenix", "rust-overlay": "rust-overlay", "serverphone": "serverphone", - "shell_library": "shell_library", "systems": "systems", "templates": "templates", "treefmt-nix": "treefmt-nix" @@ -760,11 +685,11 @@ ] }, "locked": { - "lastModified": 1743215516, - "narHash": "sha256-52qbrkG65U1hyrQWltgHTgH4nm0SJL+9TWv2UDCEPNI=", + "lastModified": 1748486227, + "narHash": "sha256-veMuFa9cq/XgUXp1S57oC8K0TIw3XyZWL2jIyGWlW0c=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "524463199fdee49338006b049bc376b965a2cfed", + "rev": "4bf1892eb81113e868efe67982b64f1da15c8c5a", "type": "github" }, "original": { @@ -808,35 +733,6 @@ "url": "https://codeberg.org/vhack.eu/serverphone.git" } }, - "shell_library": { - "inputs": { - "flake-utils": [ - "flake-utils" - ], - "flake_version_update": [ - "flake_version_update" - ], - "nixpkgs": [ - "nixpkgs" - ], - "systems": [ - "systems" - ] - }, - "locked": { - "lastModified": 1710519017, - "narHash": "sha256-7C7onkhZiLwzrrf9XfzHEOjht9FmZfGABPbzE8XOYoI=", - "ref": "refs/heads/prime", - "rev": "24713f56f30e755553cac9497258ebc5d73036dc", - "revCount": 180, - "type": "git", - "url": "https://codeberg.org/soispha/shell_library.git" - }, - "original": { - "type": "git", - "url": "https://codeberg.org/soispha/shell_library.git" - } - }, "systems": { "locked": { "lastModified": 1680978846, @@ -888,11 +784,11 @@ ] }, "locked": { - "lastModified": 1743081648, - "narHash": "sha256-WRAylyYptt6OX5eCEBWyTwOEqEtD6zt33rlUkr6u3cE=", + "lastModified": 1748243702, + "narHash": "sha256-9YzfeN8CB6SzNPyPm2XjRRqSixDopTapaRsnTpXUEY8=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "29a3d7b768c70addce17af0869f6e2bd8f5be4b7", + "rev": "1f3f7b784643d488ba4bf315638b2b0a4c5fb007", "type": "github" }, "original": { diff --git a/flake.lock.license b/flake.lock.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/flake.lock.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/flake.nix b/flake.nix index 8d8ce03a..47b1b569 100644 --- a/flake.nix +++ b/flake.nix @@ -1,17 +1,22 @@ -# Copyright (C) 2024 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# nixos-config - My current NixOS configuration # +# Copyright (C) 2024 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> # SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { description = "A NixOS System Configuration"; inputs = { # base - nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.11"; + nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-25.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # open nixpkgs prs - # FIXME: Close these PRs <2024-09-07> - nixpkgs-lf.url = "github:bpeetz/nixpkgs/init-lf.nvim"; library = { url = "git+https://git.foss-syndicate.org/vhack.eu/nix-library?ref=prime"; @@ -114,14 +119,6 @@ nixpkgs.follows = "nixpkgs"; }; }; - flake_version_update = { - url = "git+https://codeberg.org/soispha/flake_version_update.git"; - inputs = { - systems.follows = "systems"; - nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "flake-utils"; - }; - }; # nixos modules home-manager = { @@ -136,12 +133,13 @@ nixpkgs.follows = "nixpkgs"; }; }; - nixVim = { + nixvim = { url = "github:nix-community/nixvim"; inputs = { flake-parts.follows = "flake-parts"; nixpkgs.follows = "nixpkgs"; nuschtosSearch.follows = "nuschtosSearch"; + systems.follows = "systems"; }; }; agenix = { @@ -153,16 +151,6 @@ systems.follows = "systems"; }; }; - ragenix = { - url = "github:yaxitech/ragenix"; - inputs = { - nixpkgs.follows = "nixpkgs"; - agenix.follows = "agenix"; - flake-utils.follows = "flake-utils"; - rust-overlay.follows = "rust-overlay"; - crane.follows = "crane"; - }; - }; impermanence = { url = "github:nix-community/impermanence"; inputs = { @@ -224,15 +212,6 @@ }; # my bins - shell_library = { - url = "git+https://codeberg.org/soispha/shell_library.git"; - inputs = { - nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "flake-utils"; - systems.follows = "systems"; - flake_version_update.follows = "flake_version_update"; - }; - }; qmk_firmware = { url = "git+https://git.foss-syndicate.org/bpeetz/qmk_layout.git?ref=prime"; inputs = { @@ -257,81 +236,85 @@ self, nixpkgs, nixpkgs-stable, - nixpkgs-lf, library, # modules home-manager, nixos-generators, impermanence, agenix, - ragenix, serverphone, disko, lanzaboote, - nixVim, + nixvim, nix-index-database, arkenfox-nixos, # external dependencies treefmt-nix, templates, # my binaries - shell_library, qmk_firmware, ... }: let system = "x86_64-linux"; - sysLib = shell_library.lib.${system}; - baseLib = import ./lib {inherit (pkgs) lib;}; + packageSets = rec { + stable = nixpkgs-stable.legacyPackages.${system}; + unstable = nixpkgs.legacyPackages.${system}; - inherit (library) nixLib; - - pkgsStable = nixpkgs-stable.legacyPackages.${system}; - pkgs = nixpkgs.legacyPackages.${system}; - myPkgs = import ./pkgs { - inherit sysLib pkgs nixLib; + soispha = import ./pkgs { + inherit libraries; + pkgs = unstable; + }; }; - nixpkgs_as_input = nixpkgs; - nixpkgs_open_prs = { - inherit - nixpkgs-lf - ; + libraries = rec { + nix = packageSets.unstable.lib; + base = import ./lib {lib = nix;}; + extra = library.nixLib; }; - outputs = import ./flake { + modules = { inherit - # core - self - pkgs - pkgsStable - nixLib - myPkgs - system - sysLib - baseLib - nixpkgs_as_input - nixpkgs_open_prs - # modules home-manager - nixVim + nixvim nixos-generators impermanence agenix - ragenix serverphone disko lanzaboote nix-index-database arkenfox-nixos - # external dependencies + ; + }; + + externalDependencies = { + inherit treefmt-nix templates - # my binaries - shell_library + ; + }; + + externalBinaries = { + inherit qmk_firmware ; }; + + openPRsNixpkgs = {}; + + outputs = import ./flake { + inherit + self + system + openPRsNixpkgs + packageSets + libraries + modules + externalDependencies + externalBinaries + ; + }; in outputs; } diff --git a/flake/apps/default.nix b/flake/apps/default.nix deleted file mode 100644 index f1709c71..00000000 --- a/flake/apps/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ - self, - system, - ... -}: { - install = { - type = "app"; - program = "${self.packages."${system}".install}/bin/install"; - }; - activate = { - type = "app"; - program = "${self.packages."${system}".activate}/bin/activate"; - }; - setup = { - type = "app"; - program = "${self.packages."${system}".setup}/bin/setup"; - }; - config_setup = { - type = "app"; - program = "${self.packages."${system}".config_setup}/bin/config_setup"; - }; - default = self.apps."${system}".activate; -} diff --git a/flake/default.nix b/flake/default.nix index ae17ad39..1170efa3 100644 --- a/flake/default.nix +++ b/flake/default.nix @@ -1,80 +1,58 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - # core self, - pkgs, - pkgsStable, - nixLib, - baseLib, - myPkgs, system, - sysLib, - nixpkgs_as_input, - nixpkgs_open_prs, - # modules - home-manager, - nixVim, - nixos-generators, - impermanence, - agenix, - ragenix, - serverphone, - disko, - lanzaboote, - nix-index-database, - arkenfox-nixos, - # external dependencies - treefmt-nix, - templates, - # my binaries - shell_library, - qmk_firmware, + openPRsNixpkgs, + packageSets, + libraries, + modules, + externalDependencies, + externalBinaries, }: let - treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;}; + # Unpack common stuff. + nixLib = libraries.extra; + pkgs = packageSets.unstable; - nixosConfigurations = import ./nixosConfigurations { + treefmtEval = import ./treefmt.nix { + inherit (externalDependencies) treefmt-nix; + inherit pkgs; + }; + + nixosConfigurations = import ../hosts { inherit self - pkgsStable - myPkgs system - nixpkgs_as_input - nixpkgs_open_prs - # my things - shell_library - sysLib - nixLib - baseLib - templates - # modules - home-manager - nixVim - nixos-generators - impermanence - agenix - ragenix - serverphone - disko - lanzaboote - nix-index-database - arkenfox-nixos - # bins - qmk_firmware + openPRsNixpkgs + packageSets + libraries + modules + externalDependencies + externalBinaries ; }; tests = import ../tests { - inherit pkgs nixpkgs_as_input myPkgs sysLib nixLib nixpkgs_open_prs system; + inherit pkgs nixLib openPRsNixpkgs system; + myPkgs = packageSets.soispha; inherit (pkgs) lib; extraModules = { nixvim = { - homeManagerModule = nixVim.homeManagerModules.nixvim; + homeManagerModule = modules.nixVim.homeManagerModules.nixvim; }; - agenix = agenix.nixosModules.default; - disko = disko.nixosModules.default; - serverphone = serverphone.nixosModules.default; - inherit (home-manager.nixosModules) home-manager; - inherit (impermanence.nixosModules) impermanence; - inherit (lanzaboote.nixosModules) lanzaboote; + agenix = modules.agenix.nixosModules.default; + disko = modules.disko.nixosModules.default; + serverphone = modules.serverphone.nixosModules.default; + inherit (modules.home-manager.nixosModules) home-manager; + inherit (modules.impermanence.nixosModules) impermanence; + inherit (modules.lanzaboote.nixosModules) lanzaboote; }; }; in { @@ -93,24 +71,15 @@ in { packages."${system}" = import ./packages { inherit - nixos-generators pkgs - pkgsStable - myPkgs - sysLib - system - nixVim self - shell_library ; - inherit (pkgs) lib; + myPkgs = packageSets.soispha; }; formatter."${system}" = treefmtEval.config.build.wrapper; - baseLib."${system}" = baseLib; - - apps."${system}" = import ./apps {inherit self system;}; + baseLib."${system}" = libraries.base; devShells."${system}" = { default = pkgs.mkShell { @@ -121,9 +90,10 @@ in { # other pkgs.cocogitto pkgs.git-bug + pkgs.reuse # secrets - ragenix.packages."${system}".default + pkgs.ragenix pkgs.rage # shell @@ -138,8 +108,8 @@ in { pkgs.deadnix # update - myPkgs.generate_moz_extension # needed for the firefox extension update script - myPkgs.lf-make-map # needed to generate the lf cd mappings + packageSets.soispha.generate_moz_extension # needed for the firefox extension update script + packageSets.soispha.lf-make-map # needed to generate the lf cd mappings ]; }; }; diff --git a/flake/nixosConfigurations/default.nix b/flake/nixosConfigurations/default.nix deleted file mode 100644 index 1831cd1b..00000000 --- a/flake/nixosConfigurations/default.nix +++ /dev/null @@ -1,86 +0,0 @@ -{ - self, - system, - pkgsStable, - myPkgs, - nixpkgs_as_input, - nixpkgs_open_prs, - # my things - shell_library, - sysLib, - nixLib, - baseLib, - templates, - # modules - home-manager, - nixVim, - nixos-generators, - impermanence, - agenix, - ragenix, - serverphone, - disko, - lanzaboote, - nix-index-database, - arkenfox-nixos, - # bins - qmk_firmware, -}: let - modules = [ - agenix.nixosModules.default - disko.nixosModules.default - home-manager.nixosModules.home-manager - impermanence.nixosModules.impermanence - lanzaboote.nixosModules.lanzaboote - serverphone.nixosModules.default - - ../../modules - ../../modules/common - ]; - - specialArgs = { - inherit - # extra package sources - nixpkgs_open_prs - pkgsStable - myPkgs - shell_library - sysLib - nixLib - baseLib - # extra information - system - # modules - impermanence - nix-index-database - nixVim - arkenfox-nixos - # nix registry - nixpkgs_as_input - self - templates - # bins - # TODO: Integrate these into `pkgs/by-name` <2024-05-22> - qmk_firmware - serverphone - ; - }; - - generateHost = name: { - name = "${name}"; - value = nixpkgs_as_input.lib.nixosSystem { - inherit specialArgs; - modules = - [ - ../../hosts/${name} - ] - ++ modules; - }; - }; - - # FIXME: These need to stay in this position for the install script - hosts = ["tiamat" "apzu"]; - - generatedHosts = builtins.listToAttrs (builtins.map generateHost hosts); -in - generatedHosts diff --git a/flake/packages/default.nix b/flake/packages/default.nix index 95aa539a..9c67eda3 100644 --- a/flake/packages/default.nix +++ b/flake/packages/default.nix @@ -1,16 +1,19 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - self, - nixos-generators, pkgs, + self, myPkgs, - pkgsStable, - sysLib, - system, - shell_library, ... }: let inherit (pkgs) lib; - output = import ../../bootstrap {inherit pkgs sysLib;}; run_test_description = pkgs.callPackage ../../tests/infrastructure/run.nix {}; @@ -77,8 +80,6 @@ in # format = "install-iso"; # }; - update_shell_lib = shell_library.packages."${system}".update_shell_library; - # gpg-iso = nixos-generators.nixosGenerate { # system = "x86_64-linux"; # specialArgs = defaultSpecialArgs; @@ -92,6 +93,5 @@ in nvim = nvim.tiamat; inherit run_test_description; } - // output // output_neovim // myPkgsFlat diff --git a/flake/treefmt.nix b/flake/treefmt.nix index e2c6aeae..703a85e8 100644 --- a/flake/treefmt.nix +++ b/flake/treefmt.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { treefmt-nix, pkgs, diff --git a/hosts/apzu/default.nix b/hosts/by-name/apzu/configuration.nix index 133342c3..d4aad0f9 100644 --- a/hosts/apzu/default.nix +++ b/hosts/by-name/apzu/configuration.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, pkgs, @@ -9,16 +18,19 @@ ]; soispha = { - services.backup = { - # Apzu should be regularly synced with Tiamat, which performs updates. - enable = false; - }; bluetooth.enable = true; laptop = { backlight = "intel_backlight"; enable = true; }; + + # TODO: Hard-code all the uids/gids <2025-05-13> + impermanence.directories = [ + "/var/lib/nixos" + "/var/log" + ]; + programs = { yambar = { laptop = true; @@ -53,7 +65,7 @@ modes = ["normal" "locked"]; }; "<MEDIA_MUTEVOLUME>" = { - command = ["spawn" "${lib.getExe pkgs.mpc} toggle"]; + command = ["spawn" "${lib.getExe pkgs.mpp} toggle"]; modes = ["normal" "locked"]; }; diff --git a/hosts/apzu/hardware.nix b/hosts/by-name/apzu/hardware.nix index ae204baa..8d481fa6 100644 --- a/hosts/apzu/hardware.nix +++ b/hosts/by-name/apzu/hardware.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {modulesPath, ...}: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") # TODO: is this necessary? diff --git a/hosts/tiamat/default.nix b/hosts/by-name/tiamat/configuration.nix index 470f88cb..efb77b96 100644 --- a/hosts/tiamat/default.nix +++ b/hosts/by-name/tiamat/configuration.nix @@ -1,9 +1,18 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, pkgs, - baseLib, - qmk_firmware, system, + libraries, + externalBinaries, ... }: { imports = [ @@ -21,11 +30,14 @@ enable = true; systemName = "x86_64-linux"; }; + + # TODO: Hard-code all the uids/gids <2025-05-13> + impermanence.directories = [ + "/var/lib/nixos" + "/var/log" + ]; + services = { - backup = { - backupDiskUuid = "c06ce163-2955-4388-b212-dfec4448fcf4"; - enable = true; - }; unison.foreign.address = "apzu.fritz.box"; }; programs = { @@ -61,7 +73,7 @@ # Audio # "M" = {command = ["spawn" "video-pause toggle"]; modes = ["normal" "locked"]; }; "N" = { - command = ["spawn" "${lib.getExe pkgs.mpc} toggle"]; + command = ["spawn" "${lib.getExe pkgs.mpp} toggle"]; modes = ["normal" "locked"]; }; @@ -80,16 +92,22 @@ # "Y" = {command = ["spawn" "bemenu-run"];}; # Toggle all tags - "0" = {command = ["set-focused-tags" "${builtins.toString ((baseLib.pow 2 32) - 1)}"];}; + "0" = {command = ["set-focused-tags" "${builtins.toString ((libraries.base.pow 2 32) - 1)}"];}; # Support Unicode input - "Z" = {command = ["spawn" "${lib.getExe qmk_firmware.packages.${system}.qmk_unicode_type} 106 65377"];}; + "Z" = {command = ["spawn" "${lib.getExe externalBinaries.qmk_firmware.packages.${system}.qmk_unicode_type} 106 65377"];}; }) // ({ # TODO: add toggle-focus mapping # Toggle all tags - "<Alt+Ctrl+Shift-0>" = {command = ["set-view-tags" "${builtins.toString ((baseLib.pow 2 32) - 1)}"];}; + "<Alt+Ctrl+Shift-0>" = { + command = [ + "set-view-tags" + "${builtins.toString + ((libraries.base.pow 2 32) - 1)}" + ]; + }; # Mouse "<Meta-<MOUSE_LEFT>>" = { @@ -105,7 +123,7 @@ builtins.foldl' (acc: elem: acc // elem) {} ( builtins.map (index: let num = builtins.toString index; - index2tag = input: builtins.toString (baseLib.pow 2 (input - 1)); + index2tag = input: builtins.toString (libraries.base.pow 2 (input - 1)); in { "${map num}" = {command = ["set-focused-tags" (index2tag index)];}; "<Alt+Ctrl+Shift-${num}>" = {command = ["set-view-tags" (index2tag index)];}; diff --git a/hosts/tiamat/hardware.nix b/hosts/by-name/tiamat/hardware.nix index 97600848..2b18a662 100644 --- a/hosts/tiamat/hardware.nix +++ b/hosts/by-name/tiamat/hardware.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {modulesPath, ...}: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") # TODO: is this necessary? diff --git a/hosts/default.nix b/hosts/default.nix new file mode 100644 index 00000000..35b2d08b --- /dev/null +++ b/hosts/default.nix @@ -0,0 +1,61 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + self, + system, + openPRsNixpkgs, + packageSets, + libraries, + modules, + externalDependencies, + externalBinaries, +}: let + hosts = libraries.extra.mkByName { + useShards = false; + baseDirectory = ./by-name; + fileName = "configuration.nix"; + }; + + generateHost = _: path: + self.inputs.nixpkgs.lib.nixosSystem { + specialArgs = { + inherit + libraries + modules + ; + }; + modules = [ + { + _module.args = { + inherit + # extra package sources + openPRsNixpkgs + packageSets + # extra information + system + # nix registry + self + externalDependencies + # bins + # TODO: Integrate these into `pkgs/by-name` <2024-05-22> + externalBinaries + ; + }; + } + path + + ../modules + ../modules/common + ]; + }; + + generatedHosts = builtins.mapAttrs generateHost hosts; +in + generatedHosts diff --git a/hosts/hostinfo.toml b/hosts/hostinfo.toml index b51c0501..c2523a3a 100644 --- a/hosts/hostinfo.toml +++ b/hosts/hostinfo.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [Tiamat] description = "This is my main desktop" diff --git a/lib/default.nix b/lib/default.nix index f18e4b33..d84ac5e2 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {lib}: let /* Converts `number` from a binary number to a decimal one. diff --git a/modules/by-name/ad/adb/module.nix b/modules/by-name/ad/adb/module.nix index ec5d4be6..71bd3c9b 100644 --- a/modules/by-name/ad/adb/module.nix +++ b/modules/by-name/ad/adb/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, config, diff --git a/modules/by-name/ag/age/module.nix b/modules/by-name/ag/age/module.nix new file mode 100644 index 00000000..9a498ab6 --- /dev/null +++ b/modules/by-name/ag/age/module.nix @@ -0,0 +1,25 @@ +{ + config, + lib, + modules, + pkgs, + ... +}: let + cfg = config.soispha.age; +in { + options.soispha.age = { + enable = lib.mkEnableOption "secret management with age"; + }; + + imports = [ + modules.agenix.nixosModules.default + ]; + + config = lib.mkIf cfg.enable { + age = { + # TODO(@bpeetz): Set once <https://github.com/ryantm/agenix/pull/317/files> is merged. <2025-05-16> + # enable = true; + ageBin = lib.getExe pkgs.rage; + }; + }; +} diff --git a/modules/by-name/at/atuin/atuin.zsh b/modules/by-name/at/atuin/atuin.zsh index 60fb74fe..72dd7fa0 100644 --- a/modules/by-name/at/atuin/atuin.zsh +++ b/modules/by-name/at/atuin/atuin.zsh @@ -1,4 +1,15 @@ #! /usr/bin/env zsh + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2034,SC2153,SC2086,SC2155 # Above line is because shellcheck doesn't support zsh, per diff --git a/modules/by-name/at/atuin/module.nix b/modules/by-name/at/atuin/module.nix index 2061fd71..700f50fb 100644 --- a/modules/by-name/at/atuin/module.nix +++ b/modules/by-name/at/atuin/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, @@ -8,10 +17,12 @@ in { options.soispha.programs.atuin = { enable = lib.mkEnableOption "atuin"; + + enableAge = lib.mkEnableOption "atuin with age keys"; }; config = lib.mkIf cfg.enable { - age.secrets.atuin_encryption_key = { + age.secrets.atuin_encryption_key = lib.mkIf cfg.enableAge { file = ./secrets/encryption_key.age; mode = "700"; owner = "soispha"; @@ -28,12 +39,18 @@ in { # We can do this on our own. enableZshIntegration = false; settings = { - key_path = "${config.age.secrets.atuin_encryption_key.path}"; + key_path = lib.mkMerge [ + (lib.mkIf cfg.enableAge "${config.age.secrets.atuin_encryption_key.path}") + (lib.mkIf (!cfg.enableAge) + "${config.home-manager.users.soispha.xdg.dataHome}/atuin/atuin_secret_key.key") + ]; - # TODO: Setup a self-hosted sync server. <2024-10-18> - session_path = ""; - auto_sync = false; - sync_address = ""; + sync = lib.mkIf cfg.enableAge { + # The v2 sync API + records = true; + }; + auto_sync = lib.mkIf cfg.enableAge true; + sync_address = lib.mkIf cfg.enableAge "https://atuin-sync.vhack.eu"; # Use the rather reasonable syntax of `skim` to search. search_mode = "skim"; diff --git a/modules/by-name/at/atuin/secrets/encryption_key.age.license b/modules/by-name/at/atuin/secrets/encryption_key.age.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/at/atuin/secrets/encryption_key.age.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/ba/backup/module.nix b/modules/by-name/ba/backup/module.nix index 92700bf2..d0805092 100644 --- a/modules/by-name/ba/backup/module.nix +++ b/modules/by-name/ba/backup/module.nix @@ -1,51 +1,207 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, - pkgs, config, + pkgs, ... }: let - backup-script = pkgs.writeShellScriptBin "backsnap" '' - set -xeu; - - ${pkgs.util-linux}/bin/mount --mkdir "/dev/disk/by-uuid/${cfg.backupDiskUuid}" "/run/media/${cfg.backupDiskUuid}"; - ${pkgs.snap-sync-forked}/bin/snap-sync-forked --UUID "${cfg.backupDiskUuid}" --noconfirm; - ${pkgs.util-linux}/bin/umount "/run/media/${cfg.backupDiskUuid}"; - ''; - cfg = config.soispha.services.backup; + + snapshotDir = "/srv/last_snapshot"; in { options.soispha.services.backup = { - enable = lib.mkEnableOption "backups with my forked snap-sync"; - backupDiskUuid = lib.mkOption { - type = lib.types.str; - example = lib.literalExpression "d1d20ae7-3d8a-44da-86da-677dbbb10c89"; - description = "The UUID of the backup disk"; + storagebox = { + enable = lib.mkEnableOption "remote backups"; + user = lib.mkOption { + type = lib.types.str; + description = "The storagebox-user to use"; + example = "u384702-sub2"; + }; + + sshKey = lib.mkOption { + type = lib.types.path; + description = "The age-encrypted ssh-key, passed to agenix"; + default = ./secrets/storagebox/ssh_key.age; + }; + + repositoryPassword = lib.mkOption { + type = lib.types.path; + description = "The age-encrypted restic password, passed to agenix"; + default = ./secrets/storagebox/repository_password.age; + }; + }; + + local = { + enable = lib.mkEnableOption "local backups"; + + repositoryPassword = lib.mkOption { + type = lib.types.path; + description = "The age-encrypted restic password, passed to agenix"; + default = ./secrets/local/repository_password.age; + }; + + backupMountPoint = lib.mkOption { + type = lib.types.path; + description = "The path where to expect the mounted backup disk"; + default = "/mnt/backup"; + }; }; }; - config = lib.mkIf cfg.enable { - systemd = { - services.backup = { - wantedBy = lib.mkForce []; - unitConfig = { - Description = "Backup the last snapshots of the persitent-storage subvolume."; - }; + config = { + age.secrets = { + resticStorageboxSshKey = lib.mkIf cfg.storagebox.enable { + file = cfg.storagebox.sshKey; + mode = "0700"; + owner = "root"; + group = "root"; + }; + resticStorageboxRepositoryPassword = lib.mkIf cfg.storagebox.enable { + file = cfg.storagebox.repositoryPassword; + mode = "0700"; + owner = "root"; + group = "root"; + }; + resticLocalRepositoryPassword = lib.mkIf cfg.local.enable { + file = cfg.local.repositoryPassword; + mode = "0700"; + owner = "root"; + group = "root"; + }; + }; + + soispha.programs.ssh = lib.mkIf cfg.storagebox.enable { + enable = true; + rootKnownHosts = { + "[u459143-sub1.your-storagebox.de]:23" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIICf9svRenC/PLKIL9nk6K/pxQgoiFC41wTNvoIncOxs"; + }; + }; + + systemd.services = { + prepare-backup = { + requires = []; + after = []; + + description = "Prepare a backup by snapshotting the system."; + serviceConfig = { + ExecStart = lib.getExe (pkgs.writeShellApplication { + name = "prepareBackup"; + text = '' + set -x + + [ -d "${snapshotDir}" ] && btrfs subvolume delete "${snapshotDir}" + + # -r := Make the snapshot read-only + btrfs subvolume snapshot -r /srv "${snapshotDir}"; + ''; + + inheritPath = false; + runtimeInputs = [ + pkgs.btrfs-progs + ]; + }); + Type = "oneshot"; - ExecStart = "${backup-script}/bin/backsnap"; + + User = "root"; + Group = "root"; + + # TODO: Hardening <2025-05-04> }; }; - timers.backup = { - wantedBy = ["timers.target"]; - unitConfig = { - Description = "Backup 15min after boot and every 8 hours"; + restic-backups-storagebox = lib.mkIf cfg.storagebox.enable { + requires = ["prepare-backup.service"]; + after = ["prepare-backup.service"]; + }; + + restic-backups-local = lib.mkIf cfg.local.enable { + requires = ["prepare-backup.service"]; + after = ["prepare-backup.service"]; + + serviceConfig = { + ConditionPathIsDirectory = "${cfg.local.backupMountPoint}"; }; + }; + }; + + services.restic.backups = let + homeDir = "${snapshotDir}/home"; + + paths = [ + snapshotDir + ]; + exclude = [ + "${homeDir}/soispha/.cache" + ]; + extraBackupArgs = [ + "--verbose=2" + ]; + in { + local = lib.mkIf cfg.local.enable { + inhibitsSleep = true; + initialize = true; + + inherit paths exclude extraBackupArgs; + + passwordFile = config.age.secrets.resticLocalRepositoryPassword.path; + + repository = "${cfg.local.backupMountPoint}/restic-backup-data/"; + + # Start on demand. + timerConfig = null; + }; + + storagebox = lib.mkIf cfg.storagebox.enable { + inhibitsSleep = true; + initialize = true; + + inherit paths exclude extraBackupArgs; + + passwordFile = config.age.secrets.resticStorageboxRepositoryPassword.path; + extraOptions = [ + "rclone.program='ssh -p 23 ${cfg.storagebox.user}@${cfg.storagebox.user}.your-storagebox.de -i ${config.age.secrets.resticStorageboxSshKey.path} command_forced_on_remote'" + ]; + + # This setting is normally passed to rclone, but we force + # the command on the remote. + # As such, the value does not matter and must only be parseable by restic. + repository = "rclone: "; + timerConfig = { - OnBootSec = "15min"; - OnUnitActiveSec = "8h"; + Requires = "network-online.target"; + OnActiveSec = "30m"; + OnUnitInactiveSec = "2h"; + Persistent = true; }; }; + + # This is only for listing, pruning and such stuff. + storagebox-admin = lib.mkIf cfg.storagebox.enable { + inhibitsSleep = false; + initialize = false; + + passwordFile = config.age.secrets.resticStorageboxRepositoryPassword.path; + extraOptions = [ + "rclone.program='ssh -p 23 ${cfg.storagebox.user}@${cfg.storagebox.user}.your-storagebox.de command_forced_on_remote'" + ]; + + # This setting is normally passed to rclone, but we force + # the command on the remote. + # As such, the value does not matter and must only be parseable by restic. + repository = "rclone: "; + + timerConfig = null; + }; }; }; } diff --git a/modules/by-name/ba/backup/secrets/local/repository_password.age b/modules/by-name/ba/backup/secrets/local/repository_password.age new file mode 100644 index 00000000..b1508e49 --- /dev/null +++ b/modules/by-name/ba/backup/secrets/local/repository_password.age @@ -0,0 +1,20 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBqVCtBZzNBWFlxQnhlb3c2 +NG0xMjV3V2hQUWhNb01ROGpFbzM0c3NjRWlvCjRqMTdxNlNsY1lDM2VCUGRjcldZ +SUhScGRSejY3TFlwVjlweTRERkU4ZTQKLT4gc3NoLWVkMjU1MTkgelpFb25nIGtj +cVN4RzFseTJCVXhOc0tEWi96ckpGQjhNdUZrb1FVWnJ6TU1vSHZCMUkKc1JwM2Ir +TzNzZEV5VEE4QUp4cDdTNWZvTFlZR0tUbUFZTnNEZE1McnhISQotPiBzc2gtZWQy +NTUxOSA3SGZGVXcgYVQzRHdaa1NYUUpLODUyL0orV3d4Z1o1V2hhekZXVWFzNW50 +enhSYnlWbwpzbnZwK1dSczJ5SGZsRjNyRWZraUcreWlBakZOZkVyZ01CWml5V0E4 +TzY4Ci0+ICpMUC1ncmVhc2UgV0IKUTZVMzR1QTVGdWRyNWprVVpjaWhCTTFSRzY3 +bHVtdHpJQXlWQVFHZ3FzbkZncHRsQnJIaHlEekl5ZE15Sko0YQpSVEUKLS0tIGFy +N1Y2OUREY1NOL2xPODd4Y3Y4Wk83NFJ5ZVBpNnJYelo3RmZPL1V4Q28KcA+6qt2d +LrL0FS279XL1uqSeXiDdBBBh5i951dRx9ML33g7IoQxaGqSWU0yP/y7fcSp3B/rT +/alQGRL/uYnCS2z8zCngr2YCQBXAI8bOgf+th7fzc15FXNB14WMGvrCVRB8Rr6JZ +itTxcAebY192xeINJG269iL6Ef0YrmZLUufKQ9lcVob/G32tG0vxSbSBBx3asf7y +toiNdlXpxJPrIpFx5mc3dnkaXCTSRuXjiAqnncW/HNxovCI90sY3dyL+XRC8iEOD +sql7C7jUUvLubptk1gGW5pHmGvqeCLr+fJ6XrVqXE5VxOSbzvSUsdS84WOBInLiO +V36aUtthEzdRXd81P/n7U26O93GWpIwzctu0WwSHHHsPKhxqFY4RuWa3mO4Zk6fu +O6fsYnpAqYiCUd/k2zKrDtLosTnwuwc7Vm1glm4DEEtvteVibw47SR1LLfUds5XL +j1OR7Z6/ljIEKPjE1a81pQjYRfHDUtceXUvrlL6iCID30zU= +-----END AGE ENCRYPTED FILE----- diff --git a/modules/by-name/ba/backup/secrets/storagebox/repository_password.age b/modules/by-name/ba/backup/secrets/storagebox/repository_password.age new file mode 100644 index 00000000..a2aa984a --- /dev/null +++ b/modules/by-name/ba/backup/secrets/storagebox/repository_password.age @@ -0,0 +1,14 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBzbnJ5Z3NXRFRtdEdCNk1z +NG9Cb2FUTEZ2U2hTdUptWGpneHd2RGxGQlY0ClhqcHlMSUZlLzBPZko4a2hKdnE1 +Q1hnc3ErWlJiSk1HVXFLcSswQlV0WTAKLT4gc3NoLWVkMjU1MTkgelpFb25nIG5I +cFpMY21ZdU9TUHY5VksraG1xeFByQlM1WE1INEk0SWFJQzIvSXhZbXMKSWxiNlIr +NjZ6bEgySUJGdnpoZTY2MmxxajJMaUVTM3RkTmhpdkxaRnNCQQotPiBzc2gtZWQy +NTUxOSA3SGZGVXcgRGtLMHFORm9mUDUwZnBXM0djcFlxTExJbWVDeDJmbVVSRi9l +QTFmekpROApZY3Z0Zlc1SUdCcllKQ01ZNmdFQkI3UnViVGxzNTJNUkhqc2hOejY3 +MndrCi0+IG1Hbi1ncmVhc2UgUDJJdgpGUmVHa1NPWGtzUmZmMXM3eWkxVnJkek1h +MUxZeS9qMlArendXZ1ltdFgvMTBabTlPM2hzSjhuVXBQNktHKzc1ClF6bjZob09B +Ci0tLSB3dEZpbnpVR0pPdGpFVmNyM0JzUGl6eGcreXpkTG9xQUc5S09ndUthaEpR +CuHgXCIq/AUCuIQWepBRapAab6zczOwxEBpDv5R2kw2mw34UVRLuFs7hB1cHE79y +7Fc= +-----END AGE ENCRYPTED FILE----- diff --git a/modules/by-name/ba/backup/secrets/storagebox/ssh_key.age b/modules/by-name/ba/backup/secrets/storagebox/ssh_key.age new file mode 100644 index 00000000..a7f30c7c --- /dev/null +++ b/modules/by-name/ba/backup/secrets/storagebox/ssh_key.age @@ -0,0 +1,22 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBJOTFaQVpnQ2VJN1pJbmdu +STF2UTF1Y3lyU2p3OUJlcWRFWlg3Mm9vSEFFCjg4RklaZ0hqdWdZSlJ0dGx0ckJN +eHE4R1QyTEJEVkZudnVQV2VpblBYTW8KLT4gc3NoLWVkMjU1MTkgelpFb25nIDR0 +Z2RwTXJGV1VYT2Y1OUcxbXpnOGNEbG9BWmFxeWUzZ1huNW1YQk5BM3cKK1hLNnYx +VnNvRDZWM3Y4VUpCQTRtbHJOcDJLdTBOUXJ1ak52Mkp3TE9OcwotPiBzc2gtZWQy +NTUxOSA3SGZGVXcgSHFSOXM1Vm1lY0ErRkZobndEU0xvQjVXbnhDbUlGNmE2dStY +SEFqSk9TMAo2VU5UbW9rc29kendvcHNuU3hFQ2lBQWNjRUxUSE10RmtjbkdwWGlv +cTRVCi0+IDwtZ3JlYXNlIHNPT3N1IHNkZzcoQzUgLUM3Ml1Tcgorb3FQcWlDSkJQ +L1g4WisydkYxdnJMeDNISVVDTGlZdmUyRkV0TkFUdW4ycXZBSlF3UWM2R3FTYjRs +ckEyaTg2ClVrbwotLS0gdHF5Q3BqV3h2TzEySCs4OFNIYmx1U0hsTWo1RDlTV3VC +T1RmelZaWXh4YwoeRkYbirDGX9aZj6OVxZ8sVsm2Sz23ikcBhAdTIXKErM7eQcdp +Y2nA5kUebPVznbSq/XSQNbqvCfSv9wVVTZWww7AqkrltjFS8yxQVMKB37IfnJsZI +92OCjJKArxAbvS7ERKY51Cf9oY/VqGk5WqxExH5ZvdbL144UI8JzrxhDopVXBWNd +fCrHirRAdlu3wgVILXV3vk1kmE69sspuV4cer5f/kOBKT1w09s2NFFHH4TO3cLTJ +Obgi/HWYHBjqGSgwd4bDtNOW2UDE1LN3YeUhloutWhuX8yt+NFzZJtl+CBrRqLKA +0CK+ZPKPWWKYPCNlzKT4vDF9BZeyCfoEj9dTXvxrNPEB6YYi16aQ8DhI8wxADl41 +ShrULlEmB8rfz7V+8TFmERKISBRSSH0p+XJi8e2DWh2dSco16rizmbFFNDdcYiGT +WWbXYCFNzj+kNFI/vEtt9dEWmfXlgg01khnyoOuRLedtoCDSuF+8z7YYy6oYt/2h +gmf4NHOUgyxK56c17JMQ3xT97d2odgqmwB+YZQ13IJCjt3M3pmSssD4sTgmA5alH +vtUlci6dZdO801h5vOesbAJplXCEyw== +-----END AGE ENCRYPTED FILE----- diff --git a/modules/by-name/bl/bluetooth/module.nix b/modules/by-name/bl/bluetooth/module.nix index 486f6e6f..7750e70d 100644 --- a/modules/by-name/bl/bluetooth/module.nix +++ b/modules/by-name/bl/bluetooth/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/bo/boot/boot_pictures/gnu.png.license b/modules/by-name/bo/boot/boot_pictures/gnu.png.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/bo/boot/boot_pictures/gnu.png.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/bo/boot/boot_pictures/gnulin_emb_1.png.license b/modules/by-name/bo/boot/boot_pictures/gnulin_emb_1.png.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/bo/boot/boot_pictures/gnulin_emb_1.png.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/bo/boot/boot_pictures/gnulin_emb_2.png.license b/modules/by-name/bo/boot/boot_pictures/gnulin_emb_2.png.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/bo/boot/boot_pictures/gnulin_emb_2.png.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/bo/boot/iso_entry/archlive_iso.nix b/modules/by-name/bo/boot/iso_entry/archlive_iso.nix index d19a4a87..d0ae8457 100644 --- a/modules/by-name/bo/boot/iso_entry/archlive_iso.nix +++ b/modules/by-name/bo/boot/iso_entry/archlive_iso.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs ? (builtins.getFlake "nixpkgs").legacyPackages."x86_64-linux"}: let signing_key = import ./signing_key.nix {inherit pkgs;}; diff --git a/modules/by-name/bo/boot/iso_entry/signing_key.nix b/modules/by-name/bo/boot/iso_entry/signing_key.nix index 788447be..d9268d75 100644 --- a/modules/by-name/bo/boot/iso_entry/signing_key.nix +++ b/modules/by-name/bo/boot/iso_entry/signing_key.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs ? (builtins.getFlake "nixpkgs").legacyPackages."x86_64-linux"}: pkgs.stdenv.mkDerivation { name = "archlinux_signing_keys"; diff --git a/modules/by-name/bo/boot/module.nix b/modules/by-name/bo/boot/module.nix index 8b71ce65..404352ac 100644 --- a/modules/by-name/bo/boot/module.nix +++ b/modules/by-name/bo/boot/module.nix @@ -1,7 +1,17 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, pkgs, + modules, ... }: let cfg = config.soispha.boot; @@ -12,6 +22,10 @@ in { # enableIsoEntry = lib.mkEnableOption "an tails iso boot entry"; }; + imports = [ + modules.lanzaboote.nixosModules.lanzaboote + ]; + config = lib.mkIf cfg.enable ( # let # cfg = config.boot.loader.systemd-boot; diff --git a/modules/by-name/ca/cargo/module.nix b/modules/by-name/ca/cargo/module.nix index f7153509..980ebcba 100644 --- a/modules/by-name/ca/cargo/module.nix +++ b/modules/by-name/ca/cargo/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/cl/cleanup/module.nix b/modules/by-name/cl/cleanup/module.nix index f8307b73..98c699eb 100644 --- a/modules/by-name/cl/cleanup/module.nix +++ b/modules/by-name/cl/cleanup/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/dc/dconf/module.nix b/modules/by-name/dc/dconf/module.nix index e4a1c7a9..ec055a6f 100644 --- a/modules/by-name/dc/dconf/module.nix +++ b/modules/by-name/dc/dconf/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { # needed to make home-manager play nice with some apps. See: # https://nix-community.github.io/home-manager/index.xhtml#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal diff --git a/modules/by-name/di/direnv/module.nix b/modules/by-name/di/direnv/module.nix index 1ddf3d5d..7c81e671 100644 --- a/modules/by-name/di/direnv/module.nix +++ b/modules/by-name/di/direnv/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/di/disks/fstrim.nix b/modules/by-name/di/disks/fstrim.nix index 6daeb65e..0fbb6c83 100644 --- a/modules/by-name/di/disks/fstrim.nix +++ b/modules/by-name/di/disks/fstrim.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, lib, diff --git a/modules/by-name/di/disks/hibernate.nix b/modules/by-name/di/disks/hibernate.nix index a50e5b57..e983f9c7 100644 --- a/modules/by-name/di/disks/hibernate.nix +++ b/modules/by-name/di/disks/hibernate.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs}: { services = { hibernate-preparation = { diff --git a/modules/by-name/di/disks/module.nix b/modules/by-name/di/disks/module.nix index c0e5bcfd..d88fa3df 100644 --- a/modules/by-name/di/disks/module.nix +++ b/modules/by-name/di/disks/module.nix @@ -1,7 +1,17 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, pkgs, + modules, ... }: let # FIXME: The iso redeploy requires a bigger efi partition <2024-05-12> @@ -37,6 +47,10 @@ in { }; }; + imports = [ + modules.disko.nixosModules.default + ]; + config = lib.mkIf cfg.enable { systemd = lib.recursiveUpdate (import ./hibernate.nix {inherit pkgs;}) (import ./fstrim.nix {inherit pkgs lib cfg;}); diff --git a/modules/by-name/do/documentation/module.nix b/modules/by-name/do/documentation/module.nix index 4616a991..e4e51409 100644 --- a/modules/by-name/do/documentation/module.nix +++ b/modules/by-name/do/documentation/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/fi/firefox/extensions.json b/modules/by-name/fi/firefox/extensions.json index 062f1a5e..cc098acd 100644 --- a/modules/by-name/fi/firefox/extensions.json +++ b/modules/by-name/fi/firefox/extensions.json @@ -3,17 +3,17 @@ "addonId": "addon@darkreader.org", "default_area": "navbar", "pname": "darkreader", - "sha256": "sha256:f565b2263a71626a0310380915b7aef90be8cc6fe16ea43ac1a0846efedc2e4c", - "url": "https://addons.mozilla.org/firefox/downloads/file/4439735/darkreader-4.9.103.xpi", - "version": "4.9.103" + "sha256": "sha256:23c94085063aa6b57fae40ca9111ab049fffca5476c29e9990db3aa1a3fe1f10", + "url": "https://addons.mozilla.org/firefox/downloads/file/4488139/darkreader-4.9.106.xpi", + "version": "4.9.106" }, "keepassxc-browser": { "addonId": "keepassxc-browser@keepassxc.org", "default_area": "navbar", "pname": "keepassxc-browser", - "sha256": "sha256:f4ecad9cabe70511fbff42fe4fe831c560cc3a0b6da10a740ce670f4f6597f42", - "url": "https://addons.mozilla.org/firefox/downloads/file/4441759/keepassxc_browser-1.9.7.xpi", - "version": "1.9.7" + "sha256": "sha256:7629ee8fe6a8bace5d0f12c3aef41803c2ab01407a22ad8803633992a6c4eda2", + "url": "https://addons.mozilla.org/firefox/downloads/file/4477789/keepassxc_browser-1.9.8.xpi", + "version": "1.9.8" }, "torproject-snowflake": { "addonId": "{b11bea1f-a888-4332-8d8a-cec2be7d24b9}", @@ -35,9 +35,9 @@ "addonId": "uBlock0@raymondhill.net", "default_area": "menupanel", "pname": "ublock-origin", - "sha256": "sha256:d93176cef4dc042e41ba500aa2a90e5d57b5be77449cbd522111585e3a0cd158", - "url": "https://addons.mozilla.org/firefox/downloads/file/4458450/ublock_origin-1.63.2.xpi", - "version": "1.63.2" + "sha256": "sha256:b9e1c868bd1ac1defcabf2e01776d1a90effba34b07fe6a21350d45f022e0e9f", + "url": "https://addons.mozilla.org/firefox/downloads/file/4492375/ublock_origin-1.64.0.xpi", + "version": "1.64.0" }, "vhack-libredirect": { "addonId": "vhack-libredirect@addons.vhack.eu", diff --git a/modules/by-name/fi/firefox/extensions.json.license b/modules/by-name/fi/firefox/extensions.json.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/fi/firefox/extensions.json.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/fi/firefox/module.nix b/modules/by-name/fi/firefox/module.nix index 17bfa049..b5c1ff9a 100644 --- a/modules/by-name/fi/firefox/module.nix +++ b/modules/by-name/fi/firefox/module.nix @@ -1,7 +1,17 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, config, pkgs, + modules, ... }: let cfg = config.soispha.programs.firefox; @@ -194,6 +204,10 @@ in { }; home-manager.users.soispha = { + imports = [ + modules.arkenfox-nixos.hmModules.arkenfox + ]; + home.sessionVariables = { # Improve touch input and make scrolling smother MOZ_USE_XINPUT2 = "1"; diff --git a/modules/by-name/fi/firefox/profile.nix b/modules/by-name/fi/firefox/profile.nix index 195c2075..d82bfafa 100644 --- a/modules/by-name/fi/firefox/profile.nix +++ b/modules/by-name/fi/firefox/profile.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, pkgs, diff --git a/modules/by-name/fi/firefox/search_engines/default.nix b/modules/by-name/fi/firefox/search_engines/default.nix index 51a447e1..f36be0a7 100644 --- a/modules/by-name/fi/firefox/search_engines/default.nix +++ b/modules/by-name/fi/firefox/search_engines/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { # DEFAULT brave-search = { diff --git a/modules/by-name/fi/firefox/search_engines/logos/arch_linux.svg.license b/modules/by-name/fi/firefox/search_engines/logos/arch_linux.svg.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/fi/firefox/search_engines/logos/arch_linux.svg.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/fi/firefox/search_engines/logos/brave.svg.license b/modules/by-name/fi/firefox/search_engines/logos/brave.svg.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/fi/firefox/search_engines/logos/brave.svg.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/fi/firefox/search_engines/logos/google_scholar.ico.license b/modules/by-name/fi/firefox/search_engines/logos/google_scholar.ico.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/fi/firefox/search_engines/logos/google_scholar.ico.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/fi/firefox/search_engines/logos/rust_std.svg.license b/modules/by-name/fi/firefox/search_engines/logos/rust_std.svg.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/fi/firefox/search_engines/logos/rust_std.svg.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/fi/firefox/search_engines/logos/rust_tokio.png.license b/modules/by-name/fi/firefox/search_engines/logos/rust_tokio.png.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/fi/firefox/search_engines/logos/rust_tokio.png.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/fi/firefox/search_engines/logos/wikipedia.svg.license b/modules/by-name/fi/firefox/search_engines/logos/wikipedia.svg.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/fi/firefox/search_engines/logos/wikipedia.svg.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/fi/firefox/update_extensions.sh b/modules/by-name/fi/firefox/update_extensions.sh index efcc83c6..588a7530 100755 --- a/modules/by-name/fi/firefox/update_extensions.sh +++ b/modules/by-name/fi/firefox/update_extensions.sh @@ -1,5 +1,15 @@ #!/usr/bin/env sh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # The `generate_extensions` binary is provided in the devshell. generate_extensions \ diff --git a/modules/by-name/fi/firefox/userChrome.css b/modules/by-name/fi/firefox/userChrome.css index 0b3aff77..6e0d705d 100644 --- a/modules/by-name/fi/firefox/userChrome.css +++ b/modules/by-name/fi/firefox/userChrome.css @@ -1,3 +1,15 @@ +/* + * nixos-config - My current NixOS configuration + * + * Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> + * SPDX-License-Identifier: GPL-3.0-or-later + * + * This file is part of my nixos-config. + * + * You should have received a copy of the License along with this program. + * If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + */ + /* thickness of tab when you have too many open tabs */ .tabbrowser-tab:not([pinned="true"]) { min-width: 10px !important; diff --git a/modules/by-name/fo/fonts/emoji_font.xml b/modules/by-name/fo/fonts/emoji_font.xml index f3f6bb3e..8a922f61 100644 --- a/modules/by-name/fo/fonts/emoji_font.xml +++ b/modules/by-name/fo/fonts/emoji_font.xml @@ -1,4 +1,17 @@ <?xml version="1.0"?> + +<!-- +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +--> + <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <alias binding="weak"> diff --git a/modules/by-name/fo/fonts/module.nix b/modules/by-name/fo/fonts/module.nix index 057c3f36..f8752ae6 100644 --- a/modules/by-name/fo/fonts/module.nix +++ b/modules/by-name/fo/fonts/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/fw/fwupd/module.nix b/modules/by-name/fw/fwupd/module.nix index 5ad4f467..0c4a7bf3 100644 --- a/modules/by-name/fw/fwupd/module.nix +++ b/modules/by-name/fw/fwupd/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/gi/git/aliases.nix b/modules/by-name/gi/git/aliases.nix index 96456bea..bc30ea40 100644 --- a/modules/by-name/gi/git/aliases.nix +++ b/modules/by-name/gi/git/aliases.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, defaultBranchName, diff --git a/modules/by-name/gi/git/git_ignore.git.license b/modules/by-name/gi/git/git_ignore.git.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/gi/git/git_ignore.git.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/gi/git/git_template.git.license b/modules/by-name/gi/git/git_template.git.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/gi/git/git_template.git.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/gi/git/module.nix b/modules/by-name/gi/git/module.nix index 8e413e8a..a70c38d7 100644 --- a/modules/by-name/gi/git/module.nix +++ b/modules/by-name/gi/git/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, config, diff --git a/modules/home.legacy/conf/gpg/keys/key_1.asc b/modules/by-name/gp/gpg/keys/key_1.asc index 795f82af..f29184d8 100644 --- a/modules/home.legacy/conf/gpg/keys/key_1.asc +++ b/modules/by-name/gp/gpg/keys/key_1.asc @@ -1,3 +1,13 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + -----BEGIN PGP PUBLIC KEY BLOCK----- Comment: 8321 ED3A 8DB9 99A5 1F3B F80F F268 2914 EA42 DE26 Comment: Benedikt Peetz <benedikt.peetz@b-peetz.de> diff --git a/modules/home.legacy/conf/gpg/keys/key_2.asc b/modules/by-name/gp/gpg/keys/key_2.asc index 47188da7..7433a3f2 100644 --- a/modules/home.legacy/conf/gpg/keys/key_2.asc +++ b/modules/by-name/gp/gpg/keys/key_2.asc @@ -1,3 +1,13 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + -----BEGIN PGP PUBLIC KEY BLOCK----- Comment: 2FEA 7BDB 9171 70A7 B8E7 2001 DF18 78E6 D9C3 B27F Comment: Silas <sils@sils.li> diff --git a/modules/by-name/gp/gpg/module.nix b/modules/by-name/gp/gpg/module.nix new file mode 100644 index 00000000..89d7b356 --- /dev/null +++ b/modules/by-name/gp/gpg/module.nix @@ -0,0 +1,90 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +# TODO: Migrate to squoia-sq <2025-04-25> +{ + config, + pkgs, + lib, + ... +}: let + cfg = config.soispha.programs.gpg; + homeConfig = config.home-manager.users.soispha; +in { + options.soispha.programs.gpg = { + enable = lib.mkEnableOption "gpg"; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.soispha = { + programs.gpg = { + enable = true; + homedir = "${homeConfig.xdg.dataHome}/gnupg"; + mutableKeys = true; + mutableTrust = true; + + settings = { + default-key = "Benedikt Peetz <benedikt.peetz@b-peetz.de>"; + # TODO: add more + }; + + publicKeys = [ + { + source = ./keys/key_1.asc; + trust = "ultimate"; + } + { + source = ./keys/key_2.asc; + trust = "full"; + } + ]; + }; + services = { + gpg-agent = { + enable = true; + enableZshIntegration = true; + enableScDaemon = true; # smartcards and such things + + # Cache the key passwords + defaultCacheTtl = 60 * 50; + defaultCacheTtlSsh = 60 * 50; + maxCacheTtl = 60 * 50; + maxCacheTtlSsh = 60 * 50; + + pinentry = { + package = pkgs.pinentry-curses; + # package = pkgs.pinentry-tty; + }; + + enableSshSupport = true; + sshKeys = let + removeSpace = str: builtins.replaceStrings [" "] [""] str; + in [ + (removeSpace "8321 ED3A 8DB9 99A5 1F3B F80F F268 2914 EA42 DE26") + ]; + }; + }; + }; + + soispha.programs.zsh.integrations.gpg = '' + export GPG_TTY=$(tty) + + # Magic copied from the gpg-agent manual + unset SSH_AGENT_PID + if [ "''${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + fi + + + # Ensure that get gpg agent is started (necessary because ssh does not start it + # automatically and has it's tty updated) + gpg-connect-agent /bye + ''; + }; +} diff --git a/modules/by-name/ha/hardware/module.nix b/modules/by-name/ha/hardware/module.nix index 850416b7..599f5d23 100644 --- a/modules/by-name/ha/hardware/module.nix +++ b/modules/by-name/ha/hardware/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/ho/home-manager/module.nix b/modules/by-name/ho/home-manager/module.nix index 5da40834..d7eccbd6 100644 --- a/modules/by-name/ho/home-manager/module.nix +++ b/modules/by-name/ho/home-manager/module.nix @@ -1,22 +1,17 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, - pkgsStable, - nixpkgs_open_prs, - sysLib, - # extra information system, - # bins - # TODO: Integrate these <2024-05-22> - shell_library, - qmk_firmware, - # external deps - user_js, - # modules - impermanence, - nix-index-database, - nixVim, - arkenfox-nixos, + modules, ... }: let cfg = config.soispha.home-manager; @@ -25,6 +20,10 @@ in { enable = lib.mkEnableOption "home-manager with custom config."; }; + imports = [ + modules.home-manager.nixosModules.home-manager + ]; + # TODO: Find a way to throw this error below, when a user `enable`s a home-manager # module, but not this module. Without having to plaster all the `home-manager` modules # with `assert`s. <2024-10-18> @@ -33,24 +32,12 @@ in { home-manager = { useGlobalPkgs = true; useUserPackages = true; + + # TODO(@bpeetz): Remove this once the legacy -> by-name migration is done. <2025-05-16> users.soispha = import ../../../home.legacy; extraSpecialArgs = { inherit - nixpkgs_open_prs - pkgsStable - sysLib - # extra information system - # bins - shell_library - qmk_firmware - # external deps - user_js - # modules - impermanence - nixVim - nix-index-database - arkenfox-nixos ; }; }; diff --git a/modules/by-name/i3/i3bar-river/module.nix b/modules/by-name/i3/i3bar-river/module.nix new file mode 100644 index 00000000..b32ec6a5 --- /dev/null +++ b/modules/by-name/i3/i3bar-river/module.nix @@ -0,0 +1,197 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.soispha.programs.i3bar-river; + + toColor = color: + if builtins.isString color + then lib.trivial.fromHexString color + else color; + + substractColor = color_a: color_b: let + saturatingSub = a: b: + if a < b + then 0 + else a - b; + in { + red = saturatingSub color_a.red color_b.red; + green = saturatingSub color_a.green color_b.green; + blue = saturatingSub color_a.blue color_b.blue; + alpha = saturatingSub color_a.alpha color_b.alpha; + inherit (color_a) __toString; + }; + + colorOption = red: green: blue: alpha: + lib.mkOption { + type = lib.types.submodule { + options = { + red = lib.mkOption { + type = lib.types.ints.between 0 255; + description = "The amount of red in this color"; + default = toColor red; + }; + green = lib.mkOption { + type = lib.types.ints.between 0 255; + description = "The amount of green in this color"; + default = toColor green; + }; + blue = lib.mkOption { + type = lib.types.ints.between 0 255; + description = "The amount of blue in this color"; + default = toColor blue; + }; + alpha = lib.mkOption { + type = lib.types.ints.between 0 255; + description = "The amount of alpha in this color"; + default = toColor alpha; + }; + + __toString = lib.mkOption { + internal = true; + + default = self: let + tH = num: let + converted = lib.trivial.toHexString num; + in + if builtins.stringLength converted == 1 + then "0${converted}" + else assert (builtins.stringLength converted) == 2; converted; + + output = "#${tH self.red}${tH self.green}${tH self.blue}${tH self.alpha}"; + in + output; + + description = "Convert this type to a string before use"; + }; + }; + }; + + default = { + red = toColor red; + green = toColor green; + blue = toColor blue; + alpha = toColor alpha; + }; + + description = "The specific color to use for this name."; + }; +in { + options.soispha.programs.i3bar-river = { + enable = lib.mkEnableOption "i3bar-river"; + + package = lib.mkPackageOption pkgs "i3bar-river-patched" {}; + + colors = { + none = colorOption 00 00 00 00; + + white = colorOption "ff" "ff" "ff" "ff"; + + blue = colorOption "99" "d1" "db" "ff"; + green = colorOption "a6" "e3" "a1" "dd"; + lavendar = colorOption "b4" "be" "fe" "dd"; + mauve = colorOption "cb" "a6" "f7" "dd"; + normal = colorOption "c6" "ce" "ef" "ff"; + peach = colorOption "fa" "b3" "87" "dd"; + sapphire = colorOption "74" "c7" "ec" "dd"; + teal = colorOption "94" "e2" "d5" "dd"; + + light_gray = colorOption "58" "5b" "70" "ff"; + gray = colorOption "45" "47" "5a" "ff"; + dark_gray = colorOption "30" "34" "46" "ff"; + bright_red = colorOption "e7" "82" "84" "ff"; + + vivid_burgundy = colorOption "9f" "1d" "35" "ff"; + + unfocused_offset = colorOption "33" "33" "33" "00"; + }; + }; + + config = lib.mkIf cfg.enable { + soispha.programs.river.init.backgroundStart = [cfg.package]; + + home-manager.users.soispha = { + programs.i3bar-river = { + enable = true; + inherit (cfg) package; + + settings = { + theme = { + palette = { + # Colors + background = toString cfg.colors.none; + color = toString cfg.colors.white; # Only used, if blocks do not specify one + separator = toString cfg.colors.vivid_burgundy; + + # Tag is set (but not focused or urgent) + tag_fg = toString cfg.colors.white; + tag_bg = toString cfg.colors.light_gray; + + tag_urgent_fg = toString cfg.colors.white; + tag_urgent_bg = toString cfg.colors.bright_red; + + tag_focused_fg = toString cfg.colors.white; + tag_focused_bg = toString cfg.colors.teal; + + tag_inactive_fg = toString cfg.colors.white; + tag_inactive_bg = toString cfg.colors.none; + + # Shop options + blend = true; # whether tags/blocks colors should blend with bar's background + hide_inactive_tags = false; + show_layout_name = false; + show_mode = true; + show_tags = true; + }; + + unfocused_palette = { + hide_inactive_tags = true; + + color = toString (substractColor cfg.colors.white cfg.colors.unfocused_offset); + separator = toString (substractColor cfg.colors.vivid_burgundy cfg.colors.unfocused_offset); + + tag_fg = toString (substractColor cfg.colors.white cfg.colors.unfocused_offset); + tag_bg = toString (substractColor cfg.colors.light_gray cfg.colors.unfocused_offset); + + tag_urgent_fg = toString (substractColor cfg.colors.white cfg.colors.unfocused_offset); + tag_urgent_bg = toString (substractColor cfg.colors.bright_red cfg.colors.unfocused_offset); + + tag_focused_fg = toString (substractColor cfg.colors.white cfg.colors.unfocused_offset); + tag_focused_bg = toString cfg.colors.vivid_burgundy; + + tag_inactive_fg = toString (substractColor cfg.colors.white cfg.colors.unfocused_offset); + tag_inactive_bg = toString (substractColor cfg.colors.none cfg.colors.unfocused_offset); + }; + }; + + # The font and various sizes + font = "SauceCodePro Nerd Font Mono:pixelsize=26"; + height = 24; + margin_top = 10; + margin_bottom = 0; + margin_left = 0; + margin_right = 0; + separator_width = 0; + tags_r = 10.0; + tags_padding = 10.0; + tags_margin = 5.0; + blocks_r = 6.0; + blocks_overlap = 0.0; + + # Misc + position = "top"; # either "top" or "bottom" + layer = "overlay"; # one of "top", "overlay", "bottom" or "background" + invert_touchpad_scrolling = true; + start_hidden = false; # whether the bar is initially in the 'hidden' state + + # WM-specific options + wm.river = { + max_tag = 9; # Show only the first nine tags + }; + }; + }; + }; + }; +} diff --git a/modules/by-name/i3/i3status-rust/module.nix b/modules/by-name/i3/i3status-rust/module.nix new file mode 100644 index 00000000..5bd911d8 --- /dev/null +++ b/modules/by-name/i3/i3status-rust/module.nix @@ -0,0 +1,152 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.soispha.programs.i3status-rust; + + mkScript = name: deps: + lib.getExe (pkgs.writeShellApplication { + inherit name; + text = builtins.readFile ./scripts/${name}; + + inheritPath = false; + runtimeInputs = deps; + }); +in { + options.soispha.programs.i3status-rust = { + enable = lib.mkEnableOption "i3status-rust"; + + package = lib.mkPackageOption pkgs "i3status-rust-patched" {}; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.soispha = { + programs.i3status-rust = { + enable = true; + inherit (cfg) package; + + bars.default = { + settings = { + icons = { + icons = "material-nf"; + + overrides = { + cpu = [ + "" # nf-md-memory + ]; + memory_mem = ""; # nf-fa-bars + }; + }; + + theme = { + theme = "slick"; + + overrides = { + separator = "native"; + alternating_tint_bg = "none"; + alternating_tint_fg = "none"; + }; + }; + }; + + blocks = [ + { + block = "time"; + format = " $timestamp.datetime(format:'%d/%m/%y (%a) %H:%M %:z') "; + interval = 60; + } + + { + # TODO(@bpeetz): Switch to “music” when mpd gets mpris support <2025-05-20> + block = "custom"; + interval = "once"; + persistent = true; + command = mkScript "mpd_song_name.sh" [pkgs.mpc pkgs.coreutils]; + hide_when_empty = true; + shell = "${lib.getExe pkgs.dash}"; + format = " $text.str(max_width:60,rot_interval:0.5) "; + } + + { + block = "sound"; + driver = "pulseaudio"; + headphones_indicator = true; + } + + # System info + { + block = "cpu"; + } + { + block = "memory"; + format = " $icon $mem_used_percents {($swap_used_percents.eng(range:1..)) | }"; + } + { + block = "amd_gpu"; + format = " $icon $utilization (^icon_memory_mem $vram_used_percents) "; + } + + { + block = "net"; + format = " ^icon_net_down $speed_down.eng(prefix:Ki) ^icon_net_up $speed_up.eng(prefix:Ki) "; + } + { + block = "privacy"; + driver = [ + {name = "v4l";} + {name = "pipewire";} + ]; + } + + { + block = "disk_space"; + path = "/srv"; + info_type = "used"; + format = " $icon $used.eng(prefix:Gi) ($percentage) "; + backend = "btrfs"; + + # warn if 80 % is used, alert after 90 % used. + warning = 80; + alert = 90; + } + { + block = "backlight"; + missing_format = ""; + } + { + block = "battery"; + missing_format = ""; + } + + # { + # block = "calendar"; + # + # source = { + # calendars = ["user/calendar"]; + # auth = { + # type = "unauthenticated"; + # }; + # }; + # } + # { + # block = "focused_window"; + # driver = "wlr_toplevel_management"; + # } + # { + # block = "maildir"; + # display_type = "new"; + # inboxes = ["~/.local/share/maildir/soispha/*"]; + # interval = 60; + # threshold_critical = 10; + # threshold_warning = 1; + # } + ]; + }; + }; + + programs.i3bar-river.settings.command = "${lib.getExe cfg.package} config-default.toml"; + }; + }; +} diff --git a/modules/by-name/i3/i3status-rust/scripts/mpd_song_name.sh b/modules/by-name/i3/i3status-rust/scripts/mpd_song_name.sh new file mode 100755 index 00000000..28921520 --- /dev/null +++ b/modules/by-name/i3/i3status-rust/scripts/mpd_song_name.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env dash + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +while true; do + state="$(mpc status '%state%')" + + if [ "$state" = "playing" ]; then + song="$(mpc --format '[[%artist% - ]%title%]|[%file%]' current)" + progress="$(mpc status "%currenttime%/%totaltime%")" + + echo "$song :: $progress" + else + # The song has stopped, we are done displaying it. + echo "" + + # Wait for a new song. (Or in this case for a new event.) + mpc idle + fi + + sleep 1 +done + +# vim: ft=sh diff --git a/modules/by-name/im/impermanence/module.nix b/modules/by-name/im/impermanence/module.nix index 94789755..4ce86b25 100644 --- a/modules/by-name/im/impermanence/module.nix +++ b/modules/by-name/im/impermanence/module.nix @@ -1,6 +1,16 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, + modules, ... }: let cfg = config.soispha.impermanence; @@ -23,6 +33,10 @@ in { }; }; + imports = [ + modules.impermanence.nixosModules.impermanence + ]; + config = lib.mkIf cfg.enable { environment.persistence = { "/srv" = { @@ -39,7 +53,6 @@ in { ".local/state/wireplumber" ".config/Signal" - ".config/Element" ".config/iamb/profiles" ".cache" diff --git a/modules/by-name/im/imv/module.nix b/modules/by-name/im/imv/module.nix index 0a324e01..fdf95982 100644 --- a/modules/by-name/im/imv/module.nix +++ b/modules/by-name/im/imv/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/is/issue_file/module.nix b/modules/by-name/is/issue_file/module.nix index d8b6faa8..f9a7b58a 100644 --- a/modules/by-name/is/issue_file/module.nix +++ b/modules/by-name/is/issue_file/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, self, diff --git a/modules/by-name/la/laptop/module.nix b/modules/by-name/la/laptop/module.nix index f70230ad..dd8935b9 100644 --- a/modules/by-name/la/laptop/module.nix +++ b/modules/by-name/la/laptop/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, config, diff --git a/modules/by-name/le/less/command.less.license b/modules/by-name/le/less/command.less.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/le/less/command.less.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/le/less/env.less.license b/modules/by-name/le/less/env.less.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/le/less/env.less.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/le/less/line-edit.less.license b/modules/by-name/le/less/line-edit.less.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/le/less/line-edit.less.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/le/less/module.nix b/modules/by-name/le/less/module.nix index f2475b73..0dd45a90 100644 --- a/modules/by-name/le/less/module.nix +++ b/modules/by-name/le/less/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/lf/lf/colors.license b/modules/by-name/lf/lf/colors.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/lf/lf/colors.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/lf/lf/commands/base.sh b/modules/by-name/lf/lf/commands/base.sh index 61b59a7b..99852c3e 100755 --- a/modules/by-name/lf/lf/commands/base.sh +++ b/modules/by-name/lf/lf/commands/base.sh @@ -1,5 +1,15 @@ #!/usr/bin/env sh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 id="$id" diff --git a/modules/by-name/lf/lf/commands/default.nix b/modules/by-name/lf/lf/commands/default.nix index 0c42607b..f953834b 100644 --- a/modules/by-name/lf/lf/commands/default.nix +++ b/modules/by-name/lf/lf/commands/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: let functionCall = { name, @@ -116,6 +125,7 @@ in { dependencies = with pkgs; [ river # for `riverctl` swaybg + procps ]; }; @@ -124,22 +134,17 @@ in { dependencies = [pkgs.gnused]; }; - open = async { - name = "open"; - dependencies = [pkgs.handlr-regex]; - }; - trash = pipe { name = "trash"; dependencies = [pkgs.trash-cli]; }; trash_clear = shell { name = "trash_clear"; - dependencies = with pkgs; [conceal fzf gawk trashy]; + dependencies = with pkgs; [conceal fzf gawk trashy gnused]; }; trash_restore = shell { name = "trash_restore"; - dependencies = with pkgs; [conceal fzf gawk trashy]; + dependencies = with pkgs; [conceal fzf gawk trashy gnused]; }; view_file = async { diff --git a/modules/by-name/lf/lf/commands/run.sh b/modules/by-name/lf/lf/commands/run.sh index 6a9b8cab..06106aed 100755 --- a/modules/by-name/lf/lf/commands/run.sh +++ b/modules/by-name/lf/lf/commands/run.sh @@ -1,5 +1,15 @@ #!/usr/bin/env sh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Run one of the commands for debugging purposes. [ "$#" -gt 1 ] || { diff --git a/modules/by-name/lf/lf/commands/scripts/archive_compress.sh b/modules/by-name/lf/lf/commands/scripts/archive_compress.sh index c3776a80..b42688bf 100755 --- a/modules/by-name/lf/lf/commands/scripts/archive_compress.sh +++ b/modules/by-name/lf/lf/commands/scripts/archive_compress.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh b/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh index 08374176..11d634b1 100755 --- a/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh +++ b/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/cd_project_root.sh b/modules/by-name/lf/lf/commands/scripts/cd_project_root.sh index 19100947..c2de61e6 100755 --- a/modules/by-name/lf/lf/commands/scripts/cd_project_root.sh +++ b/modules/by-name/lf/lf/commands/scripts/cd_project_root.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/chmod.sh b/modules/by-name/lf/lf/commands/scripts/chmod.sh index 3dc5f19c..757f3c9c 100755 --- a/modules/by-name/lf/lf/commands/scripts/chmod.sh +++ b/modules/by-name/lf/lf/commands/scripts/chmod.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/cow_cp.sh b/modules/by-name/lf/lf/commands/scripts/cow_cp.sh index 98675b9e..dbe00654 100755 --- a/modules/by-name/lf/lf/commands/scripts/cow_cp.sh +++ b/modules/by-name/lf/lf/commands/scripts/cow_cp.sh @@ -1,5 +1,15 @@ #!/usr/bin/env bash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH diff --git a/modules/by-name/lf/lf/commands/scripts/dragon.sh b/modules/by-name/lf/lf/commands/scripts/dragon.sh index 916c09ee..a4a52c72 100755 --- a/modules/by-name/lf/lf/commands/scripts/dragon.sh +++ b/modules/by-name/lf/lf/commands/scripts/dragon.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/dragon_individual.sh b/modules/by-name/lf/lf/commands/scripts/dragon_individual.sh index c6b3b2a6..370e9753 100755 --- a/modules/by-name/lf/lf/commands/scripts/dragon_individual.sh +++ b/modules/by-name/lf/lf/commands/scripts/dragon_individual.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/dragon_stay.sh b/modules/by-name/lf/lf/commands/scripts/dragon_stay.sh index 7296a6b9..86a19370 100755 --- a/modules/by-name/lf/lf/commands/scripts/dragon_stay.sh +++ b/modules/by-name/lf/lf/commands/scripts/dragon_stay.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/execute.sh b/modules/by-name/lf/lf/commands/scripts/execute.sh index 1d5dc87f..ce62dfa0 100755 --- a/modules/by-name/lf/lf/commands/scripts/execute.sh +++ b/modules/by-name/lf/lf/commands/scripts/execute.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/follow_link.sh b/modules/by-name/lf/lf/commands/scripts/follow_link.sh index 509fc2e0..71fa6825 100755 --- a/modules/by-name/lf/lf/commands/scripts/follow_link.sh +++ b/modules/by-name/lf/lf/commands/scripts/follow_link.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/mk_directory.sh b/modules/by-name/lf/lf/commands/scripts/mk_directory.sh index 58921ccd..f3bd6d29 100755 --- a/modules/by-name/lf/lf/commands/scripts/mk_directory.sh +++ b/modules/by-name/lf/lf/commands/scripts/mk_directory.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/mk_file.sh b/modules/by-name/lf/lf/commands/scripts/mk_file.sh index 5dafe30d..78271aaa 100755 --- a/modules/by-name/lf/lf/commands/scripts/mk_file.sh +++ b/modules/by-name/lf/lf/commands/scripts/mk_file.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/mk_link.sh b/modules/by-name/lf/lf/commands/scripts/mk_link.sh index 40b2099d..35f49c38 100755 --- a/modules/by-name/lf/lf/commands/scripts/mk_link.sh +++ b/modules/by-name/lf/lf/commands/scripts/mk_link.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/mk_script.sh b/modules/by-name/lf/lf/commands/scripts/mk_script.sh index bbdf6d39..a708825d 100755 --- a/modules/by-name/lf/lf/commands/scripts/mk_script.sh +++ b/modules/by-name/lf/lf/commands/scripts/mk_script.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/open.sh b/modules/by-name/lf/lf/commands/scripts/open.sh deleted file mode 100755 index b494074f..00000000 --- a/modules/by-name/lf/lf/commands/scripts/open.sh +++ /dev/null @@ -1,15 +0,0 @@ -# shellcheck shell=sh - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -# TODO: For some reason, `xdg-utils` tries to open firefox with it's default profile for -# _everything_. Using `handlr-regex` sort-of solves this. <2025-04-04> -handlr open "$f" -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh b/modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh index 893452e1..f4cb5115 100755 --- a/modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh +++ b/modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/set_wallpaper.sh b/modules/by-name/lf/lf/commands/scripts/set_wallpaper.sh index 4387cd9a..6311031e 100755 --- a/modules/by-name/lf/lf/commands/scripts/set_wallpaper.sh +++ b/modules/by-name/lf/lf/commands/scripts/set_wallpaper.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 @@ -9,8 +19,8 @@ fs="$fs" # shellcheck disable=SC2269 id="$id" -pid="$(pgrep swaybg)" -[ -n "$pid" ] && kill "$pid" +# Kill all previous instances +pkill swaybg # We cannot control the available commands for river. # Thus we ensure that it can correctly start `swaybg` diff --git a/modules/by-name/lf/lf/commands/scripts/stripspace.sh b/modules/by-name/lf/lf/commands/scripts/stripspace.sh index 95f8f742..9253b6de 100755 --- a/modules/by-name/lf/lf/commands/scripts/stripspace.sh +++ b/modules/by-name/lf/lf/commands/scripts/stripspace.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/trash.sh b/modules/by-name/lf/lf/commands/scripts/trash.sh index 958bc3f9..68b36774 100755 --- a/modules/by-name/lf/lf/commands/scripts/trash.sh +++ b/modules/by-name/lf/lf/commands/scripts/trash.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/trash_clear.sh b/modules/by-name/lf/lf/commands/scripts/trash_clear.sh index a41dce27..597995f9 100755 --- a/modules/by-name/lf/lf/commands/scripts/trash_clear.sh +++ b/modules/by-name/lf/lf/commands/scripts/trash_clear.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh while IFS="$(printf '\n')" read -r file; do diff --git a/modules/by-name/lf/lf/commands/scripts/trash_restore.sh b/modules/by-name/lf/lf/commands/scripts/trash_restore.sh index cc2d4890..7b078c26 100755 --- a/modules/by-name/lf/lf/commands/scripts/trash_restore.sh +++ b/modules/by-name/lf/lf/commands/scripts/trash_restore.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/commands/scripts/view_file.sh b/modules/by-name/lf/lf/commands/scripts/view_file.sh index 38e6b778..48cdd85e 100755 --- a/modules/by-name/lf/lf/commands/scripts/view_file.sh +++ b/modules/by-name/lf/lf/commands/scripts/view_file.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=sh # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/default.nix b/modules/by-name/lf/lf/ctpv/default.nix index 98438fba..6f9988b9 100644 --- a/modules/by-name/lf/lf/ctpv/default.nix +++ b/modules/by-name/lf/lf/ctpv/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, config, diff --git a/modules/by-name/lf/lf/ctpv/helpers.sh b/modules/by-name/lf/lf/ctpv/helpers.sh index 30e4483a..71524082 100644 --- a/modules/by-name/lf/lf/ctpv/helpers.sh +++ b/modules/by-name/lf/lf/ctpv/helpers.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 cache_f="$cache_f" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/prev/any.sh b/modules/by-name/lf/lf/ctpv/prev/any.sh index 0b0ee573..01c31e2b 100644 --- a/modules/by-name/lf/lf/ctpv/prev/any.sh +++ b/modules/by-name/lf/lf/ctpv/prev/any.sh @@ -1,13 +1,23 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 w="$w" # shellcheck disable=SC2269 -e="$e" +e="${e:-[missing extension]}" # shellcheck disable=SC2269 -m="$m" +m="${m:-[missing mime type]}" # shellcheck disable=SC2269 h="$h" diff --git a/modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh b/modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh index 3aebfbb3..2bf8a89f 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh +++ b/modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix index febacb7d..aee5c732 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { atool = { diff --git a/modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix index 00c7e389..121f419d 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { dll = { diff --git a/modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh b/modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh index e365fe0a..6ec68d55 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh +++ b/modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh @@ -1,13 +1,23 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 w="$w" # shellcheck disable=SC2269 -e="$e" +e="${e:-[missing extension]}" # shellcheck disable=SC2269 -m="$m" +m="${m:-[missing mime type]}" # shellcheck disable=SC2269 h="$h" diff --git a/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix index b4df845a..d28503e2 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { epub = { diff --git a/modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh b/modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh index cad95860..87c33dff 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh +++ b/modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh @@ -1,13 +1,23 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 w="$w" # shellcheck disable=SC2269 -e="$e" +e="${e:-[missing extension]}" # shellcheck disable=SC2269 -m="$m" +m="${m:-[missing mime type]}" # shellcheck disable=SC2269 h="$h" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix index 24112737..e30aab3e 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { pdf = { diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh b/modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh index 4d99f4b0..2c2e5ff9 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh +++ b/modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix index 32f42783..c9001176 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { pgp = { diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh b/modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh index 4747a8c4..cfe359ea 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh +++ b/modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix index 54b8c29e..ab200dd9 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { sqlite = { diff --git a/modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh index 62c1abec..2d3a45fe 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh +++ b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix index 504623a0..dfd6911b 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { torrent = { diff --git a/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh index f1da355a..38838d2e 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh +++ b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/default.nix index a6a32808..fb82aa8a 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { pem = { diff --git a/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/pem.sh b/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/pem.sh index 76ee3002..2948e25a 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/pem.sh +++ b/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/pem.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/prev/audio/audio.sh b/modules/by-name/lf/lf/ctpv/prev/audio/audio.sh index 2e9e147c..324a2170 100644 --- a/modules/by-name/lf/lf/ctpv/prev/audio/audio.sh +++ b/modules/by-name/lf/lf/ctpv/prev/audio/audio.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/prev/audio/default.nix b/modules/by-name/lf/lf/ctpv/prev/audio/default.nix index 20df04b3..7ae5d7fd 100644 --- a/modules/by-name/lf/lf/ctpv/prev/audio/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/audio/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { audio = { diff --git a/modules/by-name/lf/lf/ctpv/prev/default.nix b/modules/by-name/lf/lf/ctpv/prev/default.nix index 3e54e88a..d7e420d0 100644 --- a/modules/by-name/lf/lf/ctpv/prev/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, config, diff --git a/modules/by-name/lf/lf/ctpv/prev/font/default.nix b/modules/by-name/lf/lf/ctpv/prev/font/default.nix index 48bcb7ad..76a284f4 100644 --- a/modules/by-name/lf/lf/ctpv/prev/font/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/font/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { font = { diff --git a/modules/by-name/lf/lf/ctpv/prev/font/font.sh b/modules/by-name/lf/lf/ctpv/prev/font/font.sh index 9e5ef3c1..49e12ec7 100644 --- a/modules/by-name/lf/lf/ctpv/prev/font/font.sh +++ b/modules/by-name/lf/lf/ctpv/prev/font/font.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/prev/image/default.nix b/modules/by-name/lf/lf/ctpv/prev/image/default.nix index 87fba00c..79037d5a 100644 --- a/modules/by-name/lf/lf/ctpv/prev/image/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/image/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { image = { diff --git a/modules/by-name/lf/lf/ctpv/prev/image/image.sh b/modules/by-name/lf/lf/ctpv/prev/image/image.sh index 42c99c23..d021cbf6 100644 --- a/modules/by-name/lf/lf/ctpv/prev/image/image.sh +++ b/modules/by-name/lf/lf/ctpv/prev/image/image.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix b/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix index 90915c84..25bd6f77 100644 --- a/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { svg = { diff --git a/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/svg.sh b/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/svg.sh index ce588ada..b16e4fc5 100644 --- a/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/svg.sh +++ b/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/svg.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/default.nix b/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/default.nix index a3394ef4..5af6c501 100644 --- a/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { xcf = { diff --git a/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/xcf.sh b/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/xcf.sh index abb83a89..4ad4b34b 100644 --- a/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/xcf.sh +++ b/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/xcf.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/default.nix b/modules/by-name/lf/lf/ctpv/prev/inode/default.nix index eaade0f1..fe5ee3e1 100644 --- a/modules/by-name/lf/lf/ctpv/prev/inode/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/inode/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { ls = { diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/ls.sh b/modules/by-name/lf/lf/ctpv/prev/inode/ls.sh index f5b95d13..73e036eb 100644 --- a/modules/by-name/lf/lf/ctpv/prev/inode/ls.sh +++ b/modules/by-name/lf/lf/ctpv/prev/inode/ls.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh b/modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh index fb0dea8f..2629f62a 100644 --- a/modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh +++ b/modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/libreoffice.sh b/modules/by-name/lf/lf/ctpv/prev/libreoffice.sh index 9407aade..ade1038e 100644 --- a/modules/by-name/lf/lf/ctpv/prev/libreoffice.sh +++ b/modules/by-name/lf/lf/ctpv/prev/libreoffice.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/prev/remove_default_previews.nix b/modules/by-name/lf/lf/ctpv/prev/remove_default_previews.nix index 1407386b..6614fa8d 100644 --- a/modules/by-name/lf/lf/ctpv/prev/remove_default_previews.nix +++ b/modules/by-name/lf/lf/ctpv/prev/remove_default_previews.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { soispha.programs.lf.ctpv.extraConfigPre = '' remove any diff --git a/modules/by-name/lf/lf/ctpv/prev/text/bat.sh b/modules/by-name/lf/lf/ctpv/prev/text/bat.sh index a466c9c7..b20e9cea 100644 --- a/modules/by-name/lf/lf/ctpv/prev/text/bat.sh +++ b/modules/by-name/lf/lf/ctpv/prev/text/bat.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/prev/text/default.nix b/modules/by-name/lf/lf/ctpv/prev/text/default.nix index 14e74a4d..edb6e09d 100644 --- a/modules/by-name/lf/lf/ctpv/prev/text/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/text/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { glow = { diff --git a/modules/by-name/lf/lf/ctpv/prev/text/diff/default.nix b/modules/by-name/lf/lf/ctpv/prev/text/diff/default.nix index e0fa15bb..f21acd5e 100644 --- a/modules/by-name/lf/lf/ctpv/prev/text/diff/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/text/diff/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { delta = { diff --git a/modules/by-name/lf/lf/ctpv/prev/text/diff/delta.sh b/modules/by-name/lf/lf/ctpv/prev/text/diff/delta.sh index 3f8b5631..d30565df 100644 --- a/modules/by-name/lf/lf/ctpv/prev/text/diff/delta.sh +++ b/modules/by-name/lf/lf/ctpv/prev/text/diff/delta.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/text/glow.sh b/modules/by-name/lf/lf/ctpv/prev/text/glow.sh index 30f2af78..2e8d9f58 100644 --- a/modules/by-name/lf/lf/ctpv/prev/text/glow.sh +++ b/modules/by-name/lf/lf/ctpv/prev/text/glow.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/ctpv/prev/text/json/default.nix b/modules/by-name/lf/lf/ctpv/prev/text/json/default.nix index 7e2ef090..9538c365 100644 --- a/modules/by-name/lf/lf/ctpv/prev/text/json/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/text/json/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { jq = { diff --git a/modules/by-name/lf/lf/ctpv/prev/text/json/jq.sh b/modules/by-name/lf/lf/ctpv/prev/text/json/jq.sh index c7090ccb..fa7c47b6 100644 --- a/modules/by-name/lf/lf/ctpv/prev/text/json/jq.sh +++ b/modules/by-name/lf/lf/ctpv/prev/text/json/jq.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/video/default.nix b/modules/by-name/lf/lf/ctpv/prev/video/default.nix index f38f61c7..d500fbd9 100644 --- a/modules/by-name/lf/lf/ctpv/prev/video/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/video/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { soispha.programs.lf.ctpv.previewers = { video = { diff --git a/modules/by-name/lf/lf/ctpv/prev/video/video.sh b/modules/by-name/lf/lf/ctpv/prev/video/video.sh index d1972187..dac75205 100644 --- a/modules/by-name/lf/lf/ctpv/prev/video/video.sh +++ b/modules/by-name/lf/lf/ctpv/prev/video/video.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck disable=SC2269 f="$f" # shellcheck disable=SC2269 diff --git a/modules/by-name/lf/lf/icons.license b/modules/by-name/lf/lf/icons.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/lf/lf/icons.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/lf/lf/keybindings/default.nix b/modules/by-name/lf/lf/keybindings/default.nix index c5d6427d..d4c2a6a3 100644 --- a/modules/by-name/lf/lf/keybindings/default.nix +++ b/modules/by-name/lf/lf/keybindings/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { uid, downloadDir, diff --git a/modules/by-name/lf/lf/module.nix b/modules/by-name/lf/lf/module.nix index 6dc8e919..ea9970ef 100644 --- a/modules/by-name/lf/lf/module.nix +++ b/modules/by-name/lf/lf/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, config, @@ -10,6 +19,8 @@ commands = import ./commands {inherit pkgs sysLib shell_library system;}; keybindings = import ./keybindings {inherit (cfg.keymaps) uid downloadDir;}; + packages = import ./wrappers {inherit pkgs;}; + cfg = config.soispha.programs.lf; in { imports = [ @@ -49,6 +60,11 @@ in { "lf/colors".source = ./colors; }; + programs.zsh.shellAliases = { + ll = ". ${lib.getExe packages.ll}"; + lm = ". ${lib.getExe packages.lm}"; + }; + programs.lf = { enable = true; @@ -75,7 +91,7 @@ in { icons = true; ifs = "\\n"; # internal field separator for shell commands #info = "size"; # show the size of a directory - shell = "sh"; + shell = "${lib.getExe pkgs.dash}"; shellopts = "-eu"; # e: exit on error; u: error for unset variables }; extraConfig = '' diff --git a/modules/by-name/lf/lf/wrappers/default.nix b/modules/by-name/lf/lf/wrappers/default.nix new file mode 100644 index 00000000..7257a66e --- /dev/null +++ b/modules/by-name/lf/lf/wrappers/default.nix @@ -0,0 +1,4 @@ +{pkgs}: { + ll = pkgs.callPackage ./ll {}; + lm = pkgs.callPackage ./lm {}; +} diff --git a/modules/by-name/lf/lf/wrappers/ll/default.nix b/modules/by-name/lf/lf/wrappers/ll/default.nix new file mode 100644 index 00000000..6e4ee336 --- /dev/null +++ b/modules/by-name/lf/lf/wrappers/ll/default.nix @@ -0,0 +1,18 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{writeShellApplication}: +writeShellApplication { + name = "ll"; + text = builtins.readFile ./ll.sh; + + # This is sourced in the shell + inheritPath = true; + bashOptions = []; +} diff --git a/modules/by-name/lf/lf/wrappers/ll/ll.sh b/modules/by-name/lf/lf/wrappers/ll/ll.sh new file mode 100755 index 00000000..e012cffa --- /dev/null +++ b/modules/by-name/lf/lf/wrappers/ll/ll.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env dash + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +last_directory="$(mktemp)" +cleanup() { + rm "$last_directory" +} +trap cleanup EXIT + +command lf -last-dir-path="$last_directory" "$@" + +dir="$(cat "$last_directory")" +if cd "$dir"; then + [ -d "$XDG_RUNTIME_DIR/ll" ] || mkdir "$XDG_RUNTIME_DIR/ll" + echo "$dir" >"$XDG_RUNTIME_DIR/ll/last_directory" +else + die "$dir does not exist!" +fi + +# vim: ft=sh diff --git a/modules/by-name/lf/lf/wrappers/lm/default.nix b/modules/by-name/lf/lf/wrappers/lm/default.nix new file mode 100644 index 00000000..42bdc687 --- /dev/null +++ b/modules/by-name/lf/lf/wrappers/lm/default.nix @@ -0,0 +1,18 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{writeShellApplication}: +writeShellApplication { + name = "lm"; + text = builtins.readFile ./lm.sh; + + # This is sourced in the shell + inheritPath = true; + bashOptions = []; +} diff --git a/modules/by-name/lf/lf/wrappers/lm/lm.sh b/modules/by-name/lf/lf/wrappers/lm/lm.sh new file mode 100755 index 00000000..71213721 --- /dev/null +++ b/modules/by-name/lf/lf/wrappers/lm/lm.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env dash + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +die() { + echo "ERROR: $1" + exit 1 +} + +msg() { + echo "$1" +} + +if [ -f "$XDG_RUNTIME_DIR/ll/last_directory" ]; then + last_dir="$(cat "$XDG_RUNTIME_DIR/ll/last_directory")" + cd "$last_dir" || die "$last_dir does not exist!" +else + msg "No last directory saved (try using ll instead)." +fi +# vim: ft=sh diff --git a/modules/by-name/li/libvirtd/module.nix b/modules/by-name/li/libvirtd/module.nix index 3481ef3b..ba1cc2e1 100644 --- a/modules/by-name/li/libvirtd/module.nix +++ b/modules/by-name/li/libvirtd/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { # FIXME(@bpeetz): Do something with this module. <2025-04-04> diff --git a/modules/by-name/lo/locale/keymaps/dvorak_modified.xkb.license b/modules/by-name/lo/locale/keymaps/dvorak_modified.xkb.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/lo/locale/keymaps/dvorak_modified.xkb.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/lo/locale/module.nix b/modules/by-name/lo/locale/module.nix index eda707af..17096731 100644 --- a/modules/by-name/lo/locale/module.nix +++ b/modules/by-name/lo/locale/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/ma/mako/module.nix b/modules/by-name/ma/mako/module.nix new file mode 100644 index 00000000..1630d2d0 --- /dev/null +++ b/modules/by-name/ma/mako/module.nix @@ -0,0 +1,81 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.soispha.services.mako; + + iconPath = "${pkgs.gruvbox-dark-icons-gtk.overrideAttrs (prev: final: { + # Remove unused dependencies + propagatedBuildInputs = []; + })}/share/icons/oomox-gruvbox-dark"; +in { + options.soispha.services.mako = { + enable = lib.mkEnableOption "mako"; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.soispha = { + services.mako = { + enable = true; + + # See mako(5) + settings = { + max-history = 5; + sort = "-time"; + + background-color = "#2e3440"; + border-color = "#88c0d0"; + border-radius = 25; + border-size = 2; + default-timeout = 5000; + font = "Source Code Pro 10"; + group-by = "body"; + height = 500; + icon-path = iconPath; + icons = true; + ignore-timeout = false; + layer = "overlay"; + markup = true; + max-icon-size = 64; + width = 500; + + "urgency=low" = { + border-color = "#cccccc"; + }; + + "urgency=normal" = { + border-color = "#d08770"; + }; + + "urgency=high" = { + border-size = 3; + border-color = "#bf616a"; + default-timeout = 0; + }; + + "urgency=critical" = { + border-size = 4; + border-color = "#bf616a"; + default-timeout = 0; + }; + + "category=mpd" = { + default-timeout = 2000; + group-by = "category"; + }; + }; + }; + }; + }; +} diff --git a/modules/by-name/mp/mpd/module.nix b/modules/by-name/mp/mpd/module.nix index 6f045f9f..b7c7ab5a 100644 --- a/modules/by-name/mp/mpd/module.nix +++ b/modules/by-name/mp/mpd/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, pkgs, diff --git a/modules/by-name/mp/mpd/mpc.nix b/modules/by-name/mp/mpd/mpc.nix index 031465fe..cd4a4ec0 100644 --- a/modules/by-name/mp/mpd/mpc.nix +++ b/modules/by-name/mp/mpd/mpc.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, @@ -5,7 +14,6 @@ ... }: let cfg = config.soispha.services.mpd.mpc; - parentCfg = config.soispha.services.mpd; in { options.soispha.services.mpd.mpc = { enable = lib.mkEnableOption "mpc with extensions"; @@ -29,9 +37,7 @@ in { beets = cfg.beetsPkg; }) # Displays the lyrics of the currently playing song - (pkgs.mpp-lyrics.override { - mpd_music_dir = parentCfg.directories.music; - }) + pkgs.mpp-lyrics ]; }; } diff --git a/modules/by-name/mp/mpd/mpdconf.example.license b/modules/by-name/mp/mpd/mpdconf.example.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/mp/mpd/mpdconf.example.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/mp/mpv/module.nix b/modules/by-name/mp/mpv/module.nix index 49a97c3c..7c8435d5 100644 --- a/modules/by-name/mp/mpv/module.nix +++ b/modules/by-name/mp/mpv/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, @@ -20,11 +29,8 @@ in { "Shift+q" = "quit-watch-later 1"; }; config = { - # uosc provides seeking & volume indicators (via flash-timeline and flash-volume commands) - # if you decide to use them, you don't need osd-bar - osd-bar = false; + osd-bar = true; - # uosc will draw its own window controls and border if you disable window border border = false; }; scriptOpts = { @@ -32,272 +38,6 @@ in { scalewindowed = 0.8; hidetimeout = 300; }; - uosc = { - # Display style of current position. available: line, bar - timeline_style = "line"; - - # Line display style config - timeline_line_width = 2; - - # Timeline size when fully expanded, in pixels, 0 to disable - timeline_size = 40; - - # Comma separated states when element should always be fully visible. - # Available: paused, audio, image, video, idle, windowed, fullscreen - timeline_persistency = ""; - - # Top border of background color to help visually separate timeline from video - timeline_border = 1; - - # When scrolling above timeline, wheel will seek by this amount of seconds. - # Default uses fast seeking. Add `!` suffix to enable exact seeks. Example: `5!` - timeline_step = 5; - - # Render cache indicators for streaming content - timeline_cache = true; - - # When to display an always visible progress bar (minimized timeline). Can be: windowed, fullscreen, always, never - # Can also be toggled on demand with `toggle-progress` command. - progress = "windowed"; - progress_size = 2; - progress_line_width = 20; - - # A comma delimited list of controls above the timeline. Set to `never` to disable. - # Parameter spec: enclosed in `{}` means value, enclosed in `[]` means optional - # Full item syntax: `[<[!]{disposition1}[,[!]{dispositionN}]>]{element}[:{paramN}][#{badge}[>{limit}]][?{tooltip}]` - # Common properties: - # `{icon}` - parameter used to specify an icon name (example: `face`) - # - pick here: https://fonts.google.com/icons?icon.platform=web&icon.set=Material+Icons&icon.style=Rounded - # `{element}`s and their parameters: - # `{shorthand}` - preconfigured shorthands: - # `play-pause`, `menu`, `subtitles`, `audio`, `video`, `playlist`, - # `chapters`, `editions`, `stream-quality`, `open-file`, `items`, - # `next`, `prev`, `first`, `last`, `audio-device`, `fullscreen`, - # `loop-playlist`, `loop-file`, `shuffle`, `autoload` - # `speed[:{scale}]` - display speed slider, [{scale}] - factor of controls_size, default: 1.3 - # `command:{icon}:{command}` - button that executes a {command} when pressed - # `toggle:{icon}:{prop}[@{owner}]` - button that toggles mpv property. shorthand for yes/no cycle below - # `cycle:{default_icon}:{prop}[@{owner}]:{value1}[={icon1}][!]/{valueN}[={iconN}][!]` - # - button that cycles mpv property between values, each optionally having different icon and active flag - # - presence of `!` at the end will style the button as active - # - `{owner}` is the name of a script that manages this property if any. Set to `uosc` to tap into uosc options. - # `gap[:{scale}]` - display an empty gap - # {scale} - factor of controls_size, default: 0.3 - # `space` - fills all available space between previous and next item, useful to align items to the right - # - multiple spaces divide the available space among themselves, which can be used for centering - # `button:{name}` - button whose state, look, and click action are managed by external script - # Item visibility control: - # `<[!]{disposition1}[,[!]{dispositionN}]>` - optional prefix to control element's visibility - # - `{disposition}` can be one of: - # - `idle` - true if mpv is in idle mode (no file loaded) - # - `image` - true if current file is a single image - # - `audio` - true for audio only files - # - `video` - true for files with a video track - # - `has_many_video` - true for files with more than one video track - # - `has_image` - true for files with a cover or other image track - # - `has_audio` - true for files with an audio track - # - `has_many_audio` - true for files with more than one audio track - # - `has_sub` - true for files with an subtitle track - # - `has_many_sub` - true for files with more than one subtitle track - # - `has_many_edition` - true for files with more than one edition - # - `has_chapter` - true for files with chapter list - # - `stream` - true if current file is read from a stream - # - `has_playlist` - true if current playlist has 2 or more items in it - # - prefix with `!` to negate the required disposition - # Examples: - # - `<stream>stream-quality` - show stream quality button only for streams - # - `<has_audio,!audio>audio` - show audio tracks button for all files that have - # an audio track, but are not exclusively audio only files - # Place `#{badge}[>{limit}]` after the element params to give it a badge. Available badges: - # `sub`, `audio`, `video` - track type counters - # `{mpv_prop}` - any mpv prop that makes sense to you: https://mpv.io/manual/master/#property-list - # - if prop value is an array it'll display its size - # `>{limit}` will display the badge only if it's numerical value is above this threshold. - # Example: `#audio>1` - # Place `?{tooltip}` after the element config to give it a tooltip. - # Example implementations: - # menu = command:menu:script-binding uosc/menu-blurred?Menu - # subtitles = command:subtitles:script-binding uosc/subtitles#sub?Subtitles - # fullscreen = cycle:crop_free:fullscreen:no/yes=fullscreen_exit!?Fullscreen - # loop-playlist = cycle:repeat:loop-playlist:no/inf!?Loop playlist - # toggle:{icon}:{prop} = cycle:{icon}:{prop}:no/yes! - controls = "menu,gap,subtitles,<has_many_audio>audio,<has_many_video>video,<has_many_edition>editions,<stream>stream-quality,gap,space,speed,space,shuffle,loop-playlist,loop-file,gap,prev,items,next,gap,fullscreen"; - controls_size = 32; - controls_margin = 8; - controls_spacing = 2; - controls_persistency = ""; - - # Where to display volume controls: none, left, right - volume = "right"; - volume_size = 40; - volume_border = 1; - volume_step = 1; - volume_persistency = ""; - - # Playback speed widget: mouse drag or wheel to change, click to reset - speed_step = 0.1; - speed_step_is_factor = false; - speed_persistency = ""; - - # Controls all menus, such as context menu, subtitle loader/selector, etc - menu_item_height = 36; - menu_min_width = 260; - menu_padding = 4; - - # Determines if `/` or `ctrl+f` is required to activate the search, or if typing - # any text is sufficient. - # When enabled, you can no longer toggle a menu off with the same key that opened it, if the key is a unicode character. - menu_type_to_search = true; - - # Top bar with window controls and media title - # Can be: never, no-border, always - top_bar = "never"; - top_bar_size = 40; - # Can be: `no` (hide), left or right - top_bar_controls = false; - # Can be: `no` (hide), `yes` (inherit title from mpv.conf), or a custom template string - top_bar_title = false; - # Template string to enable alternative top bar title. If alt title matches main title, - # it'll be hidden. Tip: use `${media-title}` for main, and `${filename}` for alt title. - top_bar_alt_title = ""; - # Can be: - # `below` => display alt title below the main one - # `toggle` => toggle the top bar title text between main and alt by clicking - # the top bar, or calling `toggle-title` binding - top_bar_alt_title_place = "below"; - # Flash top bar when any of these file types is loaded. Available: audio,video,image,chapter - top_bar_flash_on = "video,audio"; - top_bar_persistency = ""; - - # Window border drawn in no-border mode - window_border_size = 1; - - # If there's no playlist and file ends, load next file in directory - # Uses `load_types` config below to determine what type of file to load next. - # When enabled, usoc will set mpv config `keep-open` to `yes`, and `keep-open-pause` to `no`. - autoload = false; - # Enable uosc's playlist/directory shuffle mode - # This simply makes the next selected playlist or directory item be random, just - # like any other player in the world. It also has an easily togglable control button. - shuffle = false; - - # Scale the interface by this factor - scale = 1; - # Scale in fullscreen - scale_fullscreen = 1.3; - # Adjust the text scaling to fit your font - font_scale = 1; - # Border of text and icons when drawn directly on top of video - text_border = 1.2; - # Border radius of buttons, menus, and all other rectangles - border_radius = 4; - # A comma delimited list of color overrides in RGB HEX format. Defaults: - # foreground=ffffff,foreground_text=000000,background=000000,background_text=ffffff,curtain=111111,success=a5e075,error=ff616e - color = ""; - # A comma delimited list of opacity overrides for various UI element backgrounds and shapes. - # This does not affect any text, which is always rendered fully opaque. Defaults: - # timeline=0.9,position=1,chapters=0.8,slider=0.9,slider_gauge=1,controls=0,speed=0.6,menu=1,submenu=0.4,border=1,title=1,tooltip=1,thumbnail=1,curtain=0.8,idle_indicator=0.8,audio_indicator=0.5,buffering_indicator=0.3,playlist_position=0.8 - opacity = ""; - - # A comma delimited list of features to refine at a cost of some performance impact. - # text_width - Use a more accurate text width measurement that measures each text string individually - # instead of just measuring the width of known letters once and adding them up. - # sorting - Use filename sorting that handles non-english languages better, especially asian ones. - # At the moment, this is only available on windows, and has no effect on other platforms. - refine = ""; - - # Duration of animations in milliseconds - animation_duration = 100; - - # Execute command for background clicks shorter than this number of milliseconds, 0 to disable - # Execution always waits for `input-doubleclick-time` to filter out double-clicks - click_threshold = 0; - click_command = "cycle pause; script-binding uosc/flash-pause-indicator"; - - # Flash duration in milliseconds used by `flash-{element}` commands - flash_duration = 1000; - - # Distances in pixels below which elements are fully faded in/out - proximity_in = 40; - proximity_out = 120; - - # Use only bold font weight throughout the whole UI - font_bold = false; - - # One of `total`, `playtime-remaining` (scaled by the current speed), `time-remaining` (remaining length of file) - destination_time = "playtime-remaining"; - - # Display sub second fraction in timestamps up to this precision - time_precision = 0; - - # Display stream's buffered time in timeline if it's lower than this amount of seconds, 0 to disable - buffered_time_threshold = 60; - - # Hide UI when mpv autohides the cursor. Timing is controlled by `cursor-autohide` in `mpv.conf` (in milliseconds). - autohide = true; - - # Can be: flash, static, manual (controlled by flash-pause-indicator and decide-pause-indicator commands) - pause_indicator = "static"; - - # Sizes to list in stream quality menu - stream_quality_options = "4320,2160,1440,1080,720,480,360,240,144"; - - # Types to identify media files - video_types = "3g2,3gp,asf,avi,f4v,flv,h264,h265,m2ts,m4v,mkv,mov,mp4,mp4v,mpeg,mpg,ogm,ogv,rm,rmvb,ts,vob,webm,wmv,y4m"; - audio_types = "aac,ac3,aiff,ape,au,cue,dsf,dts,flac,m4a,mid,midi,mka,mp3,mp4a,oga,ogg,opus,spx,tak,tta,wav,weba,wma,wv"; - image_types = "apng,avif,bmp,gif,j2k,jp2,jfif,jpeg,jpg,jxl,mj2,png,svg,tga,tif,tiff,webp"; - subtitle_types = "aqt,ass,gsub,idx,jss,lrc,mks,pgs,pjs,psb,rt,sbv,slt,smi,sub,sup,srt,ssa,ssf,ttxt,txt,usf,vt,vtt"; - playlist_types = "m3u,m3u8,pls,url,cue"; - - # Type pools used by file navigation and `autoload` to determine what type of file to load next - # Available: video,audio,image,playlist,same. `same` means the same type pool (not just extension) as currently open file. - load_types = "video,audio,image"; - - # Default open-file menu directory. Use `{drives}` to open drives menu on windows (defaults to `/` on unix). - default_directory = "~/"; - - # List hidden files when reading directories. Due to environment limitations, this currently only hides - # files starting with a dot. Doesn't hide hidden files on windows (we have no way to tell they're hidden). - show_hidden_files = false; - - # Move files to trash (recycle bin) when deleting files. Dependencies: - # - Linux: `sudo apt install trash-cli` - # - MacOS: `brew install trash` - use_trash = false; - - # Adjusted osd margins based on the visibility of UI elements - adjust_osd_margins = true; - - # Adds chapter range indicators to some common chapter types. - # Additionally to displaying the start of the chapter as a diamond icon on top of the timeline, - # the portion of the timeline of that chapter range is also colored based on the config below. - # - # The syntax is a comma-delimited list of `{type}:{color}` pairs, where: - # `{type}` => range type. Currently supported ones are: - # - `openings`, `endings` => anime openings/endings - # - `intros`, `outros` => video intros/outros - # - `ads` => segments created by sponsor-block software like https://github.com/po5/mpv_sponsorblock - # `{color}` => an RGB(A) HEX color code (`rrggbb`, or `rrggbbaa`) - # - # To exclude marking any of the range types, simply remove them from the list. - chapter_ranges = "openings:30abf964,endings:30abf964,ads:c54e4e80"; - - # Add alternative lua patterns to identify beginnings of simple chapter ranges (except for `ads`) - # Syntax: `{type}:{pattern}[,{patternN}][;{type}:{pattern}[,{patternN}]]` - chapter_range_patterns = "openings:オープニング;endings:エンディング"; - - # Localization language priority from highest to lowest. - # Also controls what languages are fetched by `download-subtitles` menu. - # Built in languages can be found in `uosc/intl`. - # `slang` is a keyword to inherit values from `--slang` mpv config. - # Supports paths to custom json files: `languages=~~/custom.json,slang,en` - languages = "slang,en"; - - # A comma separated list of element IDs to disable. Available IDs: - # window_border, top_bar, timeline, controls, volume, - # idle_indicator, audio_indicator, buffering_indicator, pause_indicator - disable_elements = ""; - }; thumbfast = { hwdec = true; network = false; @@ -307,7 +47,6 @@ in { }; }; scripts = with pkgs.mpvScripts; [ - uosc thumbfast ]; }; diff --git a/modules/by-name/ne/networking/module.nix b/modules/by-name/ne/networking/module.nix index 8448e9b3..6f8633e8 100644 --- a/modules/by-name/ne/networking/module.nix +++ b/modules/by-name/ne/networking/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/zs/zsh/config/command_not_found/command_not_found.sh b/modules/by-name/ni/nix-index/command_not_found.sh index fb21b676..f650cf7b 100644 --- a/modules/by-name/zs/zsh/config/command_not_found/command_not_found.sh +++ b/modules/by-name/ni/nix-index/command_not_found.sh @@ -1,5 +1,15 @@ #!/usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # This was taken from the # `${pkgs.nix-index}/etc/profile.d/command-not-found.sh` file on 2024-02-28 @@ -48,7 +58,7 @@ EOF The program '$cmd' is currently not installed. It is provided by several packages. You can run it once with: EOF - awk --assign=toplevel="$toplevel" 'BEGIN{counter=0} {printf("%3s)", counter); printf(" nix shell %s#%s\n", toplevel, $1); counter+=1}' "$(ptmp "$attrs")" + echo "$attrs" | awk --assign=toplevel="$toplevel" 'BEGIN{counter=0} {printf("%3s)", counter); printf(" nix shell %s#%s\n", toplevel, $1); counter+=1}' ;; esac diff --git a/modules/by-name/ni/nix-index/module.nix b/modules/by-name/ni/nix-index/module.nix new file mode 100644 index 00000000..06acfc8a --- /dev/null +++ b/modules/by-name/ni/nix-index/module.nix @@ -0,0 +1,44 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + config, + lib, + modules, + ... +}: let + cfg = config.soispha.programs.nix-index; +in { + options.soispha.programs.nix-index = { + enable = lib.mkEnableOption "nix-index"; + }; + + config = lib.mkIf cfg.enable { + soispha.programs.zsh.integrations.nix-index = ./command_not_found.sh; + home-manager.users.soispha = { + imports = [ + modules.nix-index-database.hmModules.nix-index + ]; + + programs.nix-index = { + enable = true; + symlinkToCacheHome = true; + + # Handled by myself (and the script is overridden) + enableBashIntegration = false; + enableZshIntegration = false; + enableFishIntegration = false; + }; + + programs.nix-index-database = { + comma.enable = false; + }; + }; + }; +} diff --git a/modules/by-name/ni/nix/module.nix b/modules/by-name/ni/nix/module.nix index 48834b2d..2b91f59b 100644 --- a/modules/by-name/ni/nix/module.nix +++ b/modules/by-name/ni/nix/module.nix @@ -1,24 +1,32 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, # flakes - nixpkgs_as_input, - templates, self, system, + externalDependencies, ... }: { # TODO(@bpeetz): Modularize <2025-02-08> nix = { - package = pkgs.lix; + package = pkgs.lixPackageSets.latest.lix; # Disable nix channels (this is a remnant of old days) channel.enable = false; registry = { - nixpkgs.flake = nixpkgs_as_input; + nixpkgs.flake = self.inputs.nixpkgs; n.flake = - nixpkgs_as_input + self.inputs.nixpkgs // { # Otherwise nixpkgs's config and overlays are not available: @@ -27,7 +35,7 @@ legacyPackages."${system}" = pkgs; }; - t.flake = templates; + t.flake = externalDependencies.templates; my_flake.flake = self; m.flake = self; diff --git a/modules/by-name/ni/nixos-shell/module.nix b/modules/by-name/ni/nixos-shell/module.nix new file mode 100644 index 00000000..219f080d --- /dev/null +++ b/modules/by-name/ni/nixos-shell/module.nix @@ -0,0 +1,128 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Jörg Thalheim and contributors +# SPDX-License-Identifier: MIT +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + lib, + config, + pkgs, + self, + ... +}: let + cfg = config.soispha.nixos-shell; +in { + options.soispha.nixos-shell = { + enable = lib.mkEnableOption "nixos-shell"; + + user_name = lib.mkOption { + type = lib.types.str; + default = "soispha"; + description = "The user to auto-login into the vm."; + }; + + configuration = { + specialArgs = lib.mkOption { + type = lib.types.attrsOf lib.types.anything; + default = {}; + description = '' + The arguments to pass to the `specialArgs` attribute set. + ''; + }; + value = lib.mkOption { + type = lib.types.deferredModule; + default = {}; + description = '' + Additional NixOS configuration to load into the VM's config. + ''; + }; + }; + + mounts = lib.mkOption { + type = lib.types.attrsOf (lib.types.submodule ({config, ...}: { + options = { + target = lib.mkOption { + type = lib.types.path; + description = "Target on the guest."; + }; + + cache_mode = lib.mkOption { + type = lib.types.enum ["none" "loose" "fscache" "mmap"]; + default = "loose"; # bad idea? Well, at least it is fast!1!! + description = "9p caching policy"; + }; + + readOnly = + (lib.mkEnableOption "mount this disk in read-only mode") + // { + default = true; + }; + + tag = lib.mkOption { + type = lib.types.str; + internal = true; + }; + }; + + config.tag = lib.mkDefault ( + builtins.substring 0 31 ( # tags must be shorter than 32 bytes + "a" + + # tags must not begin with a digit + builtins.hashString "md5" config._module.args.name + ) + ); + })); + default = {}; + description = '' + Extra paths to make available in the vm. + These will be mounted ro to their `target.` + ''; + }; + }; + + config = let + vmSystem = self.inputs.nixpkgs.lib.nixosSystem { + inherit (cfg.configuration) specialArgs; + + modules = [ + { + # TODO(@bpeetz): This should be bumped each release. <2025-05-17> + system.stateVersion = "25.05"; + } + + cfg.configuration.value + + (import ./shell_setup.nix {inherit cfg;}) + ]; + }; + + nixos-shell = pkgs.writeShellApplication { + name = "nixos-shell"; + text = builtins.readFile ./nixos-shell.sh; + + # We need to keep the PATH, as we otherwise can't pass it along. + inheritPath = true; + + runtimeInputs = [ + vmSystem.config.system.build.vm + pkgs.mktemp + pkgs.coreutils + pkgs.moreutils # for sponge + ]; + runtimeEnv = { + HOST_NAME = vmSystem.config.system.name; + }; + }; + in + lib.mkIf cfg.enable { + environment.systemPackages = [ + nixos-shell + ]; + + system.build.nixos-shell = vmSystem.config.system.build.vm; + }; +} diff --git a/modules/by-name/ni/nixos-shell/nixos-shell.sh b/modules/by-name/ni/nixos-shell/nixos-shell.sh new file mode 100755 index 00000000..390e60b1 --- /dev/null +++ b/modules/by-name/ni/nixos-shell/nixos-shell.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env dash + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Jörg Thalheim and contributors +# SPDX-License-Identifier: MIT +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +SHARED_DIR="$(mktemp --directory)" +cleanup() { + rm --recursive "$SHARED_DIR" +} +trap cleanup EXIT +export SHARED_DIR + +TMPDIR="$SHARED_DIR" +export TMPDIR + +cat <<EOF >"$SHARED_DIR/.env_variables" +{ + "pwd": "$PWD", + "term": "$TERM", + "path": "$PATH" +} +EOF + +mk_tag() { + additional_path="$1" + + # tags must be shorter than 32 bytes + # and must not begin with a digit. + { + printf "a" + echo "$additional_path" | sha256sum | head -c 30 + } +} + +for raw_additional_path in "$@"; do + additional_path="$(realpath "$raw_additional_path")" + tag="$(mk_tag "$additional_path")" + + if [ "$(jq --arg mount "$tag" '.mount.[$mount]' "$SHARED_DIR/.env_variables")" != "null" ]; then + echo "Path '$additional_path' alread added." + shift 1 + continue + fi + + jq --arg mount "$tag" --arg target "$additional_path" \ + '. + {mount: {$mount: $target}}' "$SHARED_DIR/.env_variables" | sponge "$SHARED_DIR/.env_variables" + + set -- "$@" -virtfs "local,path=$additional_path,security_model=none,readonly=on,mount_tag=$tag" + shift 1 +done + +# Do not exec here, as we don't want to lose our cleanup hooks. +"run-$HOST_NAME-vm" "$@" diff --git a/modules/by-name/ni/nixos-shell/shell_setup.nix b/modules/by-name/ni/nixos-shell/shell_setup.nix new file mode 100644 index 00000000..75af0678 --- /dev/null +++ b/modules/by-name/ni/nixos-shell/shell_setup.nix @@ -0,0 +1,191 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Jörg Thalheim and contributors +# SPDX-License-Identifier: MIT +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +# This file contains the code that is used to setup the VM shell. +{cfg}: { + lib, + config, + pkgs, + modulesPath, + ... +}: let + mkVMDefault = lib.mkOverride 970; + + env_file = "/tmp/shared/.env_variables"; +in { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + (modulesPath + "/virtualisation/qemu-vm.nix") + ]; + + config = { + assertions = [ + { + assertion = builtins.elem cfg.user_name (lib.mapAttrsToList (name: value: name) config.users.users); + message = '' + Your user ${cfg.user_name} is not a recorded user in `config.users.users`. + Auto-login will not work. + ''; + } + ]; + + # Lock root login. + users.users.root.hashedPassword = ""; + + # Remove unneeded clutter. + system.switch.enable = false; + + virtualisation = { + # See https://wiki.qemu.org/Documentation/9psetup#Performance_Considerations. + # It is effectively a balance between ram and IO speed. + msize = let + kib = x: x * 1024; + in + mkVMDefault (kib 512); + + graphics = mkVMDefault false; + memorySize = mkVMDefault 1700; # in MB + cores = mkVMDefault 16; + + # Do not persist this VM. + diskImage = mkVMDefault null; + + fileSystems = + lib.mapAttrs' + (_: mount: { + name = mount.target; + + value = { + device = mount.tag; + fsType = "9p"; + options = + [ + "trans=virtio" + "version=9p2000.L" + "cache=${mount.cache_mode}" + "msize=${toString config.virtualisation.msize}" + ] + ++ lib.optionals mount.readOnly ["ro"]; + }; + }) + cfg.mounts; + + qemu = { + consoles = lib.mkIf (!config.virtualisation.graphics) ["tty0" "hvc0"]; + + options = let + mkMount = options: "-virtfs " + (builtins.concatStringsSep "," options); + in + lib.optionals (!config.virtualisation.graphics) [ + "-serial null" + "-device virtio-serial" + "-chardev stdio,mux=on,id=char0,signal=off" + "-mon chardev=char0,mode=readline" + "-device virtconsole,chardev=char0,nr=0" + ] + ++ (lib.mapAttrsToList + (hostPath: mount: + mkMount [ + "local" + "path=${builtins.toString hostPath}" + "security_model=none" + "readonly=on" + "mount_tag=${mount.tag}" + ]) + cfg.mounts); + }; + }; + + services = { + getty.helpLine = '' + If you are connect via serial console: + Type Ctrl-a c to switch to the qemu console + and `quit` to stop the VM. + ''; + + getty.autologinUser = cfg.user_name; + }; + + system.activationScripts = { + mountAdditionalPaths = + # bash + '' + PATH="${pkgs.jq}/bin:${pkgs.util-linux}/bin:$PATH" + export PATH + + max_index="$(jq '.mount | keys | length' --raw-output ${env_file})" + index=0 + + mount --mkdir --type=tmpfs none "/.rw" --options=rw,relatime,mode=0755 + while [ "$index" -lt "$max_index" ]; do + what="$(jq --argjson index "$index" '.mount | keys | map(.)[$index]' --raw-output ${env_file})" + where="$(jq --argjson index "$index" '.mount | map(.)[$index]' --raw-output ${env_file})" + + mkdir "/.rw/$what" + mount --mkdir "$what" "/.ro/$what" \ + --type=9p \ + --options=ro,trans=virtio,version=9p2000.L,msize=${toString config.virtualisation.msize},x-systemd.requires=modprobe@9pnet_virtio.service + + mkdir "/.rw/work-$what" + mount --mkdir --type=overlay overlay \ + --options=rw,relatime,lowerdir="/.ro/$what",upperdir="/.rw/$what",workdir="/.rw/work-$what",uuid=on \ + "/.ov/$what" + + index="$((index + 1))" + done + ''; + }; + + systemd.services.mountAdditionalPaths = { + after = ["local-fs.target"]; + wantedBy = ["multi-user.target"]; + path = [pkgs.jq]; + script = + # bash + '' + max_index="$(jq '.mount | keys | length' --raw-output ${env_file})" + index=0 + + while [ "$index" -lt "$max_index" ]; do + what="$(jq --argjson index "$index" '.mount | keys | map(.)[$index]' --raw-output ${env_file})" + where="$(jq --argjson index "$index" '.mount | map(.)[$index]' --raw-output ${env_file})" + + systemd-mount --type none "/.ov/$what" "$where" --options=bind + + # HACK(@bpeetz): Nearly all of the paths are in $HOME anyways. So simply avoid + # the permission issue. + # Ideally, we would pass the original owners along with the mount. <2025-05-17> + chown --recursive soispha:users "/home/soispha" + + index="$((index + 1))" + done + ''; + }; + + environment = { + systemPackages = [ + pkgs.jq + ]; + + sessionVariables = { + IN_NIXOS_SHELL = "true"; + }; + + loginShellInit = + # bash + '' + cd "$(jq '.pwd' --raw-output ${env_file})" + export TERM="$(jq '.term' --raw-output ${env_file})" + export PATH="$(jq '.path' --raw-output ${env_file}):$PATH" + ''; + }; + + networking.firewall.enable = mkVMDefault true; + }; +} diff --git a/modules/by-name/ni/nixpkgs/config.nix b/modules/by-name/ni/nixpkgs/config.nix index 1a24444d..ea8f3c45 100644 --- a/modules/by-name/ni/nixpkgs/config.nix +++ b/modules/by-name/ni/nixpkgs/config.nix @@ -1,10 +1,19 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { cfg, - myPkgs, lib, + packageSets, ... }: let - myPkgsOverlay = self: super: myPkgs; + myPkgsOverlay = self: super: packageSets.soispha; in { nixpkgs = { hostPlatform = cfg.systemName; @@ -22,6 +31,12 @@ in { allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "pypemicro" # required by pynitrokey + + # TODO(@bpeetz): Allow moving them to their respective module. <2025-04-25> + "steam" + "steam-unwrapped" + "steam-original" + "steam-run" ]; }; }; diff --git a/modules/by-name/ni/nixpkgs/module.nix b/modules/by-name/ni/nixpkgs/module.nix index eda3ac89..fcde9505 100644 --- a/modules/by-name/ni/nixpkgs/module.nix +++ b/modules/by-name/ni/nixpkgs/module.nix @@ -1,8 +1,18 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, config, + packageSets, ... -} @ args: let +}: let cfg = config.soispha.nixpkgs; in { options.soispha.nixpkgs = { @@ -13,5 +23,35 @@ in { type = lib.types.str; }; }; - config = lib.mkIf cfg.enable (import ./config.nix (args // {inherit cfg;})); + config = let + myPkgsOverlay = self: super: packageSets.soispha; + in + lib.mkIf cfg.enable + { + nixpkgs = { + hostPlatform = cfg.systemName; + + overlays = [ + myPkgsOverlay + ]; + + config = { + # TODO: this fails because of the root tempsize, which should be increased + # contentAddressedByDefault = true; + + hostSystem = cfg.systemName; + + allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + "pypemicro" # required by pynitrokey + + # TODO(@bpeetz): Allow moving them to their respective module. <2025-04-25> + "steam" + "steam-unwrapped" + "steam-original" + "steam-run" + ]; + }; + }; + }; } diff --git a/modules/by-name/nv/nvim/autocmds/default.nix b/modules/by-name/nv/nvim/autocmds/default.nix index 54fd6831..706f1bbd 100644 --- a/modules/by-name/nv/nvim/autocmds/default.nix +++ b/modules/by-name/nv/nvim/autocmds/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/clipboard/default.nix b/modules/by-name/nv/nvim/clipboard/default.nix index 4cc3bd8a..f6348e44 100644 --- a/modules/by-name/nv/nvim/clipboard/default.nix +++ b/modules/by-name/nv/nvim/clipboard/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/mappings/default.nix b/modules/by-name/nv/nvim/mappings/default.nix index 4b6344c2..4997f66c 100644 --- a/modules/by-name/nv/nvim/mappings/default.nix +++ b/modules/by-name/nv/nvim/mappings/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, @@ -18,34 +27,6 @@ in { action = "<cmd>noh<CR><Esc>"; options.desc = "Disable the search highlighting and send Escape"; } - { - key = "hh"; - mode = ["i"]; - action.__raw = '' - function() - local cmp = require('cmp'); - local luasnip = require('luasnip'); - - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - end - end - ''; - options.desc = "completion trigger/ forward in completen menu"; - } - { - key = "uu"; - mode = ["i"]; - action.__raw = '' - function() - local cmp = require('cmp'); - cmp.confirm() - end - ''; - options.desc = "confirm the selected item"; - } { key = "<C-Tab>"; diff --git a/modules/by-name/nv/nvim/module.nix b/modules/by-name/nv/nvim/module.nix index 0eb416f6..819646d6 100644 --- a/modules/by-name/nv/nvim/module.nix +++ b/modules/by-name/nv/nvim/module.nix @@ -1,7 +1,17 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, lib, config, + modules, ... }: let cfg = config.soispha.programs.nvim; @@ -24,6 +34,10 @@ in { config = lib.mkIf cfg.enable { home-manager.users.soispha = { + imports = [ + modules.nixvim.homeManagerModules.nixvim + ]; + home.sessionVariables = { EDITOR = "nvim"; VISUAL = "nvim"; diff --git a/modules/by-name/nv/nvim/options/default.nix b/modules/by-name/nv/nvim/options/default.nix index be475b13..301f0ac0 100644 --- a/modules/by-name/nv/nvim/options/default.nix +++ b/modules/by-name/nv/nvim/options/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, @@ -23,7 +32,6 @@ in { confirm = true; # confirm to save changes before closing modified buffer colorcolumn = "+1"; # show a +1 before the 'textwidth' - completeopt = ["menuone" "noselect"]; # have a better completion experience # https://www.compart.com/en/unicode/U+XXXX (unicode character code) fillchars = { diff --git a/modules/by-name/nv/nvim/plgs/colorscheme/default.nix b/modules/by-name/nv/nvim/plgs/colorscheme/default.nix index ebc26826..f8cd5892 100644 --- a/modules/by-name/nv/nvim/plgs/colorscheme/default.nix +++ b/modules/by-name/nv/nvim/plgs/colorscheme/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, config, diff --git a/modules/by-name/nv/nvim/plgs/colorscheme/lua/mk_todos_readable.lua b/modules/by-name/nv/nvim/plgs/colorscheme/lua/mk_todos_readable.lua index d02171b5..44c76084 100644 --- a/modules/by-name/nv/nvim/plgs/colorscheme/lua/mk_todos_readable.lua +++ b/modules/by-name/nv/nvim/plgs/colorscheme/lua/mk_todos_readable.lua @@ -1,3 +1,13 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + local opts = { bg = "NONE", bold = true } ---@param hl_group string: The name of the hl group diff --git a/modules/by-name/nv/nvim/plgs/colorscheme/lua/nightfox.lua b/modules/by-name/nv/nvim/plgs/colorscheme/lua/nightfox.lua index 4c502153..38f6f0a1 100644 --- a/modules/by-name/nv/nvim/plgs/colorscheme/lua/nightfox.lua +++ b/modules/by-name/nv/nvim/plgs/colorscheme/lua/nightfox.lua @@ -1,3 +1,13 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + require("nightfox").setup({ options = { -- Compiled file's destination location diff --git a/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix b/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix index bd70c5c2..b404843e 100644 --- a/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix +++ b/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/debugprint/default.nix b/modules/by-name/nv/nvim/plgs/debugprint/default.nix index 4a3af1c5..79e557bd 100644 --- a/modules/by-name/nv/nvim/plgs/debugprint/default.nix +++ b/modules/by-name/nv/nvim/plgs/debugprint/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, lib, diff --git a/modules/by-name/nv/nvim/plgs/debugprint/lua/debugprint.lua b/modules/by-name/nv/nvim/plgs/debugprint/lua/debugprint.lua index da7e1735..b934d619 100644 --- a/modules/by-name/nv/nvim/plgs/debugprint/lua/debugprint.lua +++ b/modules/by-name/nv/nvim/plgs/debugprint/lua/debugprint.lua @@ -1,3 +1,13 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + require("debugprint").setup({ create_keymaps = false, }) diff --git a/modules/by-name/nv/nvim/plgs/default.nix b/modules/by-name/nv/nvim/plgs/default.nix index 991bc315..aaebb3b1 100644 --- a/modules/by-name/nv/nvim/plgs/default.nix +++ b/modules/by-name/nv/nvim/plgs/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { imports = [ diff --git a/modules/by-name/nv/nvim/plgs/femaco/default.nix b/modules/by-name/nv/nvim/plgs/femaco/default.nix index adf0ba63..a30bb59f 100644 --- a/modules/by-name/nv/nvim/plgs/femaco/default.nix +++ b/modules/by-name/nv/nvim/plgs/femaco/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, lib, diff --git a/modules/by-name/nv/nvim/plgs/femaco/lua/femaco.lua b/modules/by-name/nv/nvim/plgs/femaco/lua/femaco.lua index c113e4c7..1371a825 100644 --- a/modules/by-name/nv/nvim/plgs/femaco/lua/femaco.lua +++ b/modules/by-name/nv/nvim/plgs/femaco/lua/femaco.lua @@ -1,3 +1,13 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + local clip_val = require("femaco.utils").clip_val require("femaco").setup({ -- should prepare a new buffer and return the winid diff --git a/modules/by-name/nv/nvim/plgs/flatten-nvim/default.nix b/modules/by-name/nv/nvim/plgs/flatten-nvim/default.nix index 48fcd8a6..8d61d859 100644 --- a/modules/by-name/nv/nvim/plgs/flatten-nvim/default.nix +++ b/modules/by-name/nv/nvim/plgs/flatten-nvim/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, lib, diff --git a/modules/by-name/nv/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua b/modules/by-name/nv/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua index 2cdbcdde..0c86cd27 100644 --- a/modules/by-name/nv/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua +++ b/modules/by-name/nv/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua @@ -1,3 +1,13 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + ---Types: -- -- Passed to callbacks that handle opening files diff --git a/modules/by-name/nv/nvim/plgs/goto-preview/default.nix b/modules/by-name/nv/nvim/plgs/goto-preview/default.nix index 5c56fe8c..93761dfd 100644 --- a/modules/by-name/nv/nvim/plgs/goto-preview/default.nix +++ b/modules/by-name/nv/nvim/plgs/goto-preview/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, lib, diff --git a/modules/by-name/nv/nvim/plgs/goto-preview/lua/goto-preview.lua b/modules/by-name/nv/nvim/plgs/goto-preview/lua/goto-preview.lua index 9687a5a0..ad285033 100644 --- a/modules/by-name/nv/nvim/plgs/goto-preview/lua/goto-preview.lua +++ b/modules/by-name/nv/nvim/plgs/goto-preview/lua/goto-preview.lua @@ -1,3 +1,13 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + require("goto-preview").setup({ width = 120, -- Width of the floating window height = 15, -- Height of the floating window diff --git a/modules/by-name/nv/nvim/plgs/harpoon/default.nix b/modules/by-name/nv/nvim/plgs/harpoon/default.nix index 05a40d9f..c85c7c80 100644 --- a/modules/by-name/nv/nvim/plgs/harpoon/default.nix +++ b/modules/by-name/nv/nvim/plgs/harpoon/default.nix @@ -1,100 +1,53 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - pkgs, - config, lib, + config, ... }: let - numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9"]; - mkNumberedCommand = { - command_template, - prefix, - number, - desc_template, - }: { - key = "${prefix}${number}"; - action.__raw = '' - function() - ${command_template number} - end - ''; - options.desc = "${desc_template number}"; - }; - mkGotoTerminalCommand = number: let - desc_template = number: "Goto terminal number ${number}"; - command_template = number: ''require("harpoon.term").gotoTerminal(${number})''; - prefix = "gt"; - in - mkNumberedCommand {inherit desc_template command_template prefix number;}; - mkGotoFileCommand = number: let - desc_template = number: "Goto Buffer number ${number}"; - command_template = number: ''require("harpoon.ui").nav_file(${number})''; - prefix = "gf"; - in - mkNumberedCommand {inherit desc_template command_template prefix number;}; - - gotoTerminalMappings = builtins.map mkGotoTerminalCommand numbers; - gotoFileMappings = builtins.map mkGotoFileCommand numbers; cfg = config.soispha.programs.nvim; in { home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - plugins.harpoon = { - enable = true; - package = pkgs.vimPlugins.harpoon; - enableTelescope = true; - # menu.width = "vim.api.nvim_win_get_width(0) - 4"; # TODO: integrate that - keymaps = { - tmuxGotoTerminal = null; # TODO: - }; - }; + plugins.harpoon.enable = true; + keymaps = - [ - { - key = "-"; - action.__raw = '' + lib.mapAttrsToList + (key: action: { + mode = "n"; + inherit key; + action.__raw = builtins.elemAt action 0; + options.silent = true; + options.desc = builtins.elemAt action 1; + }) + { + # add current file + "<leader><leader>" = [ + # lua + '' function() - require("harpoon.ui").nav_next() - end - ''; - options.desc = "go to the next marked file"; - } - { - key = "_"; - action.__raw = '' - function() - require("harpoon.ui").nav_prev() - end - ''; - options.desc = "go to the previous marked file"; - } - { - key = "<leader><leader>"; - action.__raw = '' - function() - require("harpoon.mark").add_file() - end - ''; - options.desc = "add a mark to the open file in harpoon."; - } - { - key = "gqc"; - action.__raw = '' - function() - require("harpoon.cmd-ui").toggle_quick_menu() + require("harpoon"):list():add() end - ''; - options.desc = "toggle the harpoon command quick menu to see all commands."; - } - { - key = "<leader>q"; - action.__raw = '' + '' + "Add a mark to the open file in harpoon." + ]; + + # open menu + "<leader>q" = [ + # lua + '' function() - require("harpoon.ui").toggle_quick_menu() + require("harpoon").ui:toggle_quick_menu(require("harpoon"):list()) end - ''; - options.desc = "toggle the harpoon normal quick menu to see all marks."; - } - ] - ++ gotoFileMappings - ++ gotoTerminalMappings; + '' + "Toggle the harpoon normal quick menu to see all marks." + ]; + }; }; } diff --git a/modules/by-name/nv/nvim/plgs/leap/default.nix b/modules/by-name/nv/nvim/plgs/leap/default.nix index 57e78879..e5c42d2f 100644 --- a/modules/by-name/nv/nvim/plgs/leap/default.nix +++ b/modules/by-name/nv/nvim/plgs/leap/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix b/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix index 1e7c91e3..3a1c6bf9 100644 --- a/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix +++ b/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix @@ -1,23 +1,28 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, lib, config, - nixpkgs_open_prs, - system, ... }: let cfg = config.soispha.programs.nvim; in { + # TODO: package lf-nvim though a module + # TODO: change the nvim path, when I change the path with lf home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - # TODO: package lf-nvim though a module - # FIXME: change the nvim path, when I change the path with lf extraConfigLuaPost = '' ${lib.strings.fileContents ./lua/lf-nvim.lua} ''; extraPlugins = [ - nixpkgs_open_prs.nixpkgs-lf.legacyPackages."${system}".vimPlugins.lf-nvim - - pkgs.vimPlugins.toggleterm-nvim # required by lf-nvim + pkgs.vimPlugins.lf-nvim ]; }; } diff --git a/modules/by-name/nv/nvim/plgs/lf-nvim/lua/lf-nvim.lua b/modules/by-name/nv/nvim/plgs/lf-nvim/lua/lf-nvim.lua index 1eadf375..8c40ab50 100644 --- a/modules/by-name/nv/nvim/plgs/lf-nvim/lua/lf-nvim.lua +++ b/modules/by-name/nv/nvim/plgs/lf-nvim/lua/lf-nvim.lua @@ -1,3 +1,13 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + local fn = vim.fn -- Defaults diff --git a/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/default.nix b/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/default.nix index 1a2fb6eb..85458310 100644 --- a/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/default.nix +++ b/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, config, diff --git a/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua b/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua index 5a2cff26..2886d821 100644 --- a/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua +++ b/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua @@ -1,3 +1,13 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + --- @type table<string, any> require("lsp-progress").setup({ -- Spinning icons. diff --git a/modules/by-name/nv/nvim/plgs/lsp/default.nix b/modules/by-name/nv/nvim/plgs/lsp/default.nix index d97f2f0a..27a6f909 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/default.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/lsp/keymaps/default.nix b/modules/by-name/nv/nvim/plgs/lsp/keymaps/default.nix index 903e8c17..7cc9f6d5 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/keymaps/default.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/keymaps/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix index 605046d4..8ff130fe 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { imports = [ # ./servers/pylyzer.nix diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix index 5a37e133..8d2b0d03 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, config, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix index 9f3195fa..eed7f349 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix index 03b7d4c1..e55cf377 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix index 39e4b989..9350cd37 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix index 94ca99ce..3b7e2523 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix index 94f7b067..fba1113f 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/pylyzer.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/pylyzer.nix index 3ac66102..47e8de7a 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/pylyzer.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/pylyzer.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix index 48a3a71c..82d3b5a9 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix index 57cb8366..4f9834ee 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, config, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix index 093f5250..fd344c50 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix index 1fe3c764..5f001177 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/lspkind/default.nix b/modules/by-name/nv/nvim/plgs/lspkind/default.nix index 078d607d..6e966ad1 100644 --- a/modules/by-name/nv/nvim/plgs/lspkind/default.nix +++ b/modules/by-name/nv/nvim/plgs/lspkind/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/ltex_extra/default.nix b/modules/by-name/nv/nvim/plgs/ltex_extra/default.nix index c37a7591..a01d5653 100644 --- a/modules/by-name/nv/nvim/plgs/ltex_extra/default.nix +++ b/modules/by-name/nv/nvim/plgs/ltex_extra/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, config, diff --git a/modules/by-name/nv/nvim/plgs/ltex_extra/lua/ltex_extra.lua b/modules/by-name/nv/nvim/plgs/ltex_extra/lua/ltex_extra.lua index d532428a..883b22c4 100644 --- a/modules/by-name/nv/nvim/plgs/ltex_extra/lua/ltex_extra.lua +++ b/modules/by-name/nv/nvim/plgs/ltex_extra/lua/ltex_extra.lua @@ -1,3 +1,13 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + require("ltex_extra").setup({ -- table <string> : languages for witch dictionaries will be loaded, e.g. { "es-AR", "en-US" } -- https://valentjn.github.io/ltex/supported-languages.html#natural-languages diff --git a/modules/by-name/nv/nvim/plgs/lualine/default.nix b/modules/by-name/nv/nvim/plgs/lualine/default.nix index 2f3bb552..7a69519b 100644 --- a/modules/by-name/nv/nvim/plgs/lualine/default.nix +++ b/modules/by-name/nv/nvim/plgs/lualine/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/luasnip/default.nix b/modules/by-name/nv/nvim/plgs/luasnip/default.nix index f67c9899..222b5070 100644 --- a/modules/by-name/nv/nvim/plgs/luasnip/default.nix +++ b/modules/by-name/nv/nvim/plgs/luasnip/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, config, @@ -7,14 +16,81 @@ cfg = config.soispha.programs.nvim; in { home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + keymaps = [ + { + key = "<C-K>"; + mode = ["i"]; + action.__raw = '' + function() + require('luasnip').expand() + end + ''; + options = { + # silent = true; + desc = "Expand the snippet"; + }; + } + { + key = "<C-L>"; + mode = ["i" "s"]; + action.__raw = '' + function() + require('luasnip').jump(1) + end + ''; + options = { + # silent = true; + desc = "Jump forward in snippet insert nodes"; + }; + } + { + key = "<C-J>"; + mode = ["i" "s"]; + action.__raw = '' + function() + require('luasnip').jump(-1) + end + ''; + options = { + # silent = true; + desc = "Jump backwards in snippet insert nodes"; + }; + } + { + key = "<C-E>"; + mode = ["i" "s"]; + action.__raw = '' + function() + if require('luasnip').choice_active() then + require('luasnip').change_choice(1) + end + end + ''; + options = { + # silent = true; + desc = "Cycle through the snippets choice nodes"; + }; + } + ]; plugins.luasnip = { enable = true; + + settings = { + # Enable auto triggered snippets. + enable_autosnippets = true; + + # Use Tab to trigger visual selection. + store_selection_keys = "<Tab>"; + }; + + fromLua = [ + { + paths = ./snippets; + lazyLoad = true; + } + ]; }; - extraConfigLuaPost = '' - ${lib.strings.fileContents ./lua/luasnip.lua}; - require("luasnip.loaders.from_lua").load({paths = "${./lua/snippets}"}); - require("luasnip.loaders.from_lua").lazy_load({paths = "${./lua/snippets}"}); - ''; + extraPlugins = [ # needed for the todo-comments snippets pkgs.vimPlugins.comment-nvim diff --git a/modules/by-name/nv/nvim/plgs/luasnip/lua/luasnip.lua b/modules/by-name/nv/nvim/plgs/luasnip/lua/luasnip.lua deleted file mode 100644 index a05fa57f..00000000 --- a/modules/by-name/nv/nvim/plgs/luasnip/lua/luasnip.lua +++ /dev/null @@ -1,7 +0,0 @@ -require("luasnip").config.set_config({ - -- Enable auto triggered snippets - enable_autosnippets = true, - - -- Use Tab (or some other key if you prefer) to trigger visual selection - store_selection_keys = "<Tab>", -}) diff --git a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/all.lua b/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/all.lua deleted file mode 100644 index 2b923f20..00000000 --- a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/all.lua +++ /dev/null @@ -1,211 +0,0 @@ -local ls = require("luasnip") --- auto_pairs {{{ -local get_visual = function(args, parent) - if #parent.snippet.env.SELECT_RAW > 0 then - return sn(nil, i(1, parent.snippet.env.SELECT_RAW)) - else - return sn(nil, i(1, "")) - end -end -local function char_count_same(c1, c2) - local line = vim.api.nvim_get_current_line() - -- '%'-escape chars to force explicit match (gsub accepts patterns). - -- second return value is number of substitutions. - local _, ct1 = string.gsub(line, "%" .. c1, "") - local _, ct2 = string.gsub(line, "%" .. c2, "") - return ct1 == ct2 -end - -local function even_count(c, ...) - local line = vim.api.nvim_get_current_line() - local _, ct = string.gsub(line, c, "") - return ct % 2 == 0 -end - --- This makes creation of pair-type snippets easier. -local function pair(pair_begin, pair_end, file_types, condition_function) - -- FIXME(@Soispha): This only works if file_types == nil, otherwise the snippet does not expand. - -- It would be nice, if it would support both an empty array (`{}`) and nil <2023-08-27> - -- file_types = file_types or {}; - - return s( - { trig = pair_begin, wordTrig = false, snippetType = "autosnippet" }, - { t({ pair_begin }), d(1, get_visual), t({ pair_end }) }, - { - condition = function() - local filetype_check = true - if file_types ~= nil then filetype_check = file_types[vim.bo.filetype] or false end - return (not condition_function(pair_begin, pair_end)) and filetype_check - end, - } - ) -end - -local auto_pairs = { - pair("(", ")", nil, char_count_same), - pair("{", "}", nil, char_count_same), - pair("[", "]", nil, char_count_same), - pair("<", ">", { ["rust"] = true, ["tex"] = true }, char_count_same), - pair("'", "'", nil, even_count), - pair("\"", "\"", nil, even_count), - pair("`", "`", nil, even_count), -} - -ls.add_snippets("all", auto_pairs, { type = "snippets", key = "auto_pairs" }) --- }}} - --- todo_comments {{{ -local calculate_comment_string = require("Comment.ft").calculate -local utils = require("Comment.utils") - -local read_git_config = function(config_value) - local command = string.format("git config \"%s\"", config_value) - local handle = io.popen(command) - if handle == nil then return error(string.format("Failed to call `%s`.", command)) end - local result = handle:read("*a") - handle:close() - -- stripped = string.gsub(str, '%s+', '') - return string.gsub(result, "\n", "") -end - -local name_to_handle = function(name) - -- from: https://stackoverflow.com/a/7615129 - local split = function(inputstr, sep) - local t = {} - for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do - table.insert(t, str) - end - return t - end - - local parts = split(name, "%s") - - local output_name = "" - if #parts > 2 then - for _, val in ipairs(parts) do - output_name = string.format("%s%s", output_name, val:sub(1, 1)) - end - elseif #parts == 2 then - output_name = string.format("%s%s", parts[1]:sub(1, 1), parts[2]) - elseif #parts == 1 then - output_name = parts[1] - else - -- parts is 0 - output_name = "<NoName>" - end - return string.format("@%s", output_name:lower()) -end - -_G.luasnip = {} -_G.luasnip.vars = { - username = function() return name_to_handle(read_git_config("user.name")) end, - email = function() return read_git_config("user.email") end, -} - ---- Get the comment string {beg,end} table ----@param ctype integer 1 for `line`-comment and 2 for `block`-comment ----@return table comment_strings {begcstring, endcstring} -local get_cstring = function(ctype) - -- use the `Comments.nvim` API to fetch the comment string for the region (eq. '--%s' or '--[[%s]]' for `lua`) - local cstring = calculate_comment_string({ ctype = ctype, range = utils.get_region() }) or vim.bo.commentstring - -- as we want only the strings themselves and not strings ready for using `format` we want to split the left and right side - local left, right = utils.unwrap_cstr(cstring) - -- create a `{left, right}` table for it - return { left, right } -end - ---- Options for marks to be used in a TODO comment ----@return table,table: The first table contains a node for the date, the second for the signature -local marks = { - signature = function() return t("(" .. _G.luasnip.vars:username() .. ")"), t("") end, - date_signature = function() return t("<" .. os.date("%Y-%m-%d") .. ">"), t("(" .. _G.luasnip.vars:username() .. ")") end, - date = function() return t("<" .. os.date("%Y-%m-%d") .. ">"), t("") end, - empty = function() return t(""), t("") end, -} - ----@param alias string ----@param opts table ----@param mark_function function: This function should return two nodes ----@return table: Returns the comment node -local todo_snippet_nodes = function(alias, opts, mark_function) - local date_node, signature_node = mark_function() - -- format them into the actual snippet - local comment_node = fmta("<> <><>: <> <> <>", { - f(function() - return get_cstring(opts.ctype)[1] -- get <comment-string[1]> - end), - t(alias), -- [name-of-comment] - signature_node, - i(0), -- {comment-text} - date_node, - f(function() - return get_cstring(opts.ctype)[2] -- get <comment-string[2]> - end), - }) - return comment_node -end - ---- Generate a TODO comment snippet with an automatic description and docstring ----@param context table merged with the generated context table `trig` must be specified ----@param alias string of aliases for the todo comment (ex.: {FIX, ISSUE, FIXIT, BUG}) ----@param opts table merged with the snippet opts table ----@param mark_function function: The function used to get the marks -local todo_snippet = function(context, alias, opts, mark_function) - opts = opts or {} - context = context or {} - if not context.trig then - return error("context doesn't include a `trig` key which is mandatory", 2) -- all we need from the context is the trigger - end - opts.ctype = opts.ctype or 1 -- comment type can be passed in the `opts` table, but if it is not, we have to ensure, it is defined - local alias_string = alias -- `choice_node` documentation - context.name = context.name or (alias_string .. " comment") -- generate the `name` of the snippet if not defined - context.dscr = context.dscr or (alias_string .. " comment with a signature-mark") -- generate the `dscr` if not defined - context.docstring = context.docstring or (" {1:" .. alias_string .. "}: {3} <{2:mark}>{0} ") -- generate the `docstring` if not defined - local comment_node = todo_snippet_nodes(alias, opts, mark_function) - return s(context, comment_node, opts) -- the final todo-snippet constructed from our parameters -end - ----@param context table: The luasnip context ----@param opts table: The luasnip opts table, needs to have a ctype set ----@param aliases string: All aliases for a name ----@param marks table: Possible marks to account in snipped generation ----@return table: All possible snippets build from the marks -local process_marks = function(context, aliases, opts, marks) - local output = {} - for mark_name, mark_function in pairs(marks) do - local contex_trig_local = context.trig - context.trig = context.trig .. "-" .. mark_name - output[#output + 1] = todo_snippet(context, aliases, opts, mark_function) - context.trig = contex_trig_local - end - return output -end - -local todo_snippet_specs = { - { { trig = "todo" }, { "TODO" }, { ctype = 1 } }, - { { trig = "fix" }, { "FIXME", "ISSUE" }, { ctype = 1 } }, - { { trig = "hack" }, { "HACK" }, { ctype = 1 } }, - { { trig = "warn" }, { "WARNING" }, { ctype = 1 } }, - { { trig = "perf" }, { "PERFORMANCE", "OPTIMIZE" }, { ctype = 1 } }, - { { trig = "note" }, { "NOTE", "INFO" }, { ctype = 1 } }, - - -- NOTE: Block commented todo-comments - { { trig = "todob" }, { "TODO" }, { ctype = 2 } }, - { { trig = "fixb" }, { "FIXME", "ISSUE" }, { ctype = 2 } }, - { { trig = "hackb" }, { "HACK" }, { ctype = 2 } }, - { { trig = "warnb" }, { "WARNING" }, { ctype = 2 } }, - { { trig = "perfb" }, { "PERF", "PERFORMANCE", "OPTIM", "OPTIMIZE" }, { ctype = 2 } }, - { { trig = "noteb" }, { "NOTE", "INFO" }, { ctype = 2 } }, -} - -local todo_comment_snippets = {} -for _, v in ipairs(todo_snippet_specs) do - local snippets = process_marks(v[1], v[2][1], v[3], marks) - for _, value in pairs(snippets) do - table.insert(todo_comment_snippets, value) - end -end - -ls.add_snippets("all", todo_comment_snippets, { type = "snippets", key = "todo_comments" }) - --- }}} diff --git a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/html/html.lua b/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/html/html.lua deleted file mode 100644 index 568c97ec..00000000 --- a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/html/html.lua +++ /dev/null @@ -1,102 +0,0 @@ -local get_visual = function(args, parent) - if #parent.snippet.env.SELECT_RAW > 0 then - return sn(nil, i(1, parent.snippet.env.SELECT_RAW)) - else - return sn(nil, i(1)) - end -end - -local line_begin = require("luasnip.extras.expand_conditions").line_begin - -return { - -- HEADER - s( - { - trig = "h([123456])", - regTrig = true, - wordTrig = false, - snippetType = "autosnippet", - }, - fmt( - [[ - <h{}>{}</h{}> - ]], - { - f(function(_, snip) return snip.captures[1] end), - d(1, get_visual), - f(function(_, snip) return snip.captures[1] end), - } - ), - { condition = line_begin } - ), -- PARAGRAPH - s( - { trig = "pp", snippetType = "autosnippet" }, - fmt( - [[ - <p>{}</p> - ]], - { d(1, get_visual) } - ), - { condition = line_begin } - ), -- UNORDERED LIST - s( - { trig = "itt", snippetType = "autosnippet" }, - fmt( - [[ - <ul> - <li>{}</li>{} - </ul> - ]], - { i(1), i(0) } - ), - { condition = line_begin } - ), -- LIST ITEM - s( - { trig = "ii", snippetType = "autosnippet" }, - fmt( - [[ - <li>{}</li> - ]], - { d(1, get_visual) } - ), - { condition = line_begin } - ), - -- DOCUMENT TEMPLATE - s( - { trig = "base" }, - fmt( - [[ - <!doctype HTML> - <html lang="en"> - <head> - <meta charset="UTF-8"> - <title>{}</title> - </head> - <body> - {} - </body> - </html> - ]], - { i(1, "FooBar"), i(0) } - ), - { condition = line_begin } - ), -- ANCHOR TAG - s( - { - trig = "([^%l])aa", - regTrig = true, - wordTrig = false, - snippetType = "autosnippet", - }, - fmt( - [[ - {}<a href="{}">{}</a> - ]], - { - f(function(_, snip) return snip.captures[1] end), - i(1), - d(2, get_visual), - } - ) - ), -} diff --git a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua b/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua deleted file mode 100644 index ef453973..00000000 --- a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua +++ /dev/null @@ -1,28 +0,0 @@ -local get_visual = function(args, parent) - if #parent.snippet.env.SELECT_RAW > 0 then - return sn(nil, i(1, parent.snippet.env.SELECT_RAW)) - else - return sn(nil, i(1, "")) - end -end - -local translation_table = { ["("] = ")", ["{"] = "}", ["["] = "]" } - --- Return snippet tables -return { - -- LEFT/RIGHT ALL BRACES - s( - { - trig = "([^%a])l([%(%[%{])", - regTrig = true, - wordTrig = false, - snippetType = "autosnippet", - }, - fmta("<>\\left<><>\\right<>", { - f(function(_, snip) return snip.captures[1] end), - f(function(_, snip) return snip.captures[2] end), - d(1, get_visual), - f(function(_, snip) return translation_table[snip.captures[2]] end), - }) - ), -} diff --git a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/tex/greek.lua b/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/tex/greek.lua deleted file mode 100644 index ebf4f9d7..00000000 --- a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/tex/greek.lua +++ /dev/null @@ -1,37 +0,0 @@ --- Return snippet tables -return { - s({ trig = ";a", snippetType = "autosnippet" }, { t("\\alpha") }), - s({ trig = ";b", snippetType = "autosnippet" }, { t("\\beta") }), - s({ trig = ";g", snippetType = "autosnippet" }, { t("\\gamma") }), - s({ trig = ";G", snippetType = "autosnippet" }, { t("\\Gamma") }), - s({ trig = ";d", snippetType = "autosnippet" }, { t("\\delta") }), - s({ trig = ";D", snippetType = "autosnippet" }, { t("\\Delta") }), - s({ trig = ";e", snippetType = "autosnippet" }, { t("\\epsilon") }), - s({ trig = ";ve", snippetType = "autosnippet" }, { t("\\varepsilon") }), - s({ trig = ";z", snippetType = "autosnippet" }, { t("\\zeta") }), - s({ trig = ";h", snippetType = "autosnippet" }, { t("\\eta") }), - s({ trig = ";o", snippetType = "autosnippet" }, { t("\\theta") }), - s({ trig = ";vo", snippetType = "autosnippet" }, { t("\\vartheta") }), - s({ trig = ";O", snippetType = "autosnippet" }, { t("\\Theta") }), - s({ trig = ";k", snippetType = "autosnippet" }, { t("\\kappa") }), - s({ trig = ";l", snippetType = "autosnippet" }, { t("\\lambda") }), - s({ trig = ";L", snippetType = "autosnippet" }, { t("\\Lambda") }), - s({ trig = ";m", snippetType = "autosnippet" }, { t("\\mu") }), - s({ trig = ";n", snippetType = "autosnippet" }, { t("\\nu") }), - s({ trig = ";x", snippetType = "autosnippet" }, { t("\\xi") }), - s({ trig = ";X", snippetType = "autosnippet" }, { t("\\Xi") }), - s({ trig = ";i", snippetType = "autosnippet" }, { t("\\pi") }), - s({ trig = ";I", snippetType = "autosnippet" }, { t("\\Pi") }), - s({ trig = ";r", snippetType = "autosnippet" }, { t("\\rho") }), - s({ trig = ";s", snippetType = "autosnippet" }, { t("\\sigma") }), - s({ trig = ";S", snippetType = "autosnippet" }, { t("\\Sigma") }), - s({ trig = ";t", snippetType = "autosnippet" }, { t("\\tau") }), - s({ trig = ";f", snippetType = "autosnippet" }, { t("\\phi") }), - s({ trig = ";vf", snippetType = "autosnippet" }, { t("\\varphi") }), - s({ trig = ";F", snippetType = "autosnippet" }, { t("\\Phi") }), - s({ trig = ";c", snippetType = "autosnippet" }, { t("\\chi") }), - s({ trig = ";p", snippetType = "autosnippet" }, { t("\\psi") }), - s({ trig = ";P", snippetType = "autosnippet" }, { t("\\Psi") }), - s({ trig = ";w", snippetType = "autosnippet" }, { t("\\omega") }), - s({ trig = ";W", snippetType = "autosnippet" }, { t("\\Omega") }), -} diff --git a/modules/by-name/nv/nvim/plgs/luasnip/snippets/all.lua b/modules/by-name/nv/nvim/plgs/luasnip/snippets/all.lua new file mode 100644 index 00000000..371f5539 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/luasnip/snippets/all.lua @@ -0,0 +1,338 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +local ls = require("luasnip") +local fmt = require("luasnip.extras.fmt").fmt + +--- Get the comment string {begin,end} table +--- +---@param comment_type integer 1 for `line`-comment and 2 for `block`-comment +---@return table comment_strings {["begin"]=begin_comment_string, ["end"]=end_comment_string} +local get_comment_string = function(comment_type) + local calculate_comment_string = require("Comment.ft").calculate + local utils = require("Comment.utils") + + -- use the `Comments.nvim` API to fetch the comment string for the region (eq. '--%s' or '--[[%s]]' for `lua`) + local cstring = + calculate_comment_string({ ctype = comment_type; range = utils.get_region(); }) + + if cstring == nil then + -- TODO: Use `vim.bo.commentstring` <2025-05-02> + + -- Use some useful default values. + return { ["begin"] = "#"; ["end"] = ""; } + end + + -- as we want only the strings themselves and not strings ready for using `format` we want to split the left and right side + local left, right = utils.unwrap_cstr(cstring) + + -- create a `{left, right}` table for it + return { ["begin"] = left; ["end"] = right; } +end + +--- Wraps a table of snippet nodes in two comment function nodes. +--- +---@param comment_type integer 1 for `line`-comment and 2 for `block`-comment +---@param nodes table The nodes that should be wrapped +---@return table wrapped_nodes The now wrapped `nodes` table. +local wrap_snippet_in_comments = function(comment_type, nodes) + local output = {} + + table.insert(output, ls.function_node(function() + return get_comment_string(comment_type)["begin"] + end)) + + + for _, v in ipairs(nodes) do + table.insert(output, v) + end + + table.insert(output, ls.function_node(function() + return get_comment_string(comment_type)["end"] + end)) + + return output +end + +-- auto_pairs {{{ +local get_visual = function(_, parent) + if #parent.snippet.env.SELECT_RAW > 0 then + return ls.snippet_node(nil, ls.insert_node(1, parent.snippet.env.SELECT_RAW)) + else + return ls.snippet_node(nil, ls.insert_node(1, "")) + end +end + +local function char_count_same(c1, c2) + local line = vim.api.nvim_get_current_line() + -- '%'-escape chars to force explicit match (gsub accepts patterns). + -- second return value is number of substitutions. + local _, ct1 = string.gsub(line, "%" .. c1, "") + local _, ct2 = string.gsub(line, "%" .. c2, "") + return ct1 == ct2 +end + +local function even_count(c, ...) + local line = vim.api.nvim_get_current_line() + local _, ct = string.gsub(line, c, "") + return ct % 2 == 0 +end + +-- This makes creation of pair-type snippets easier. +local function pair(pair_begin, pair_end, file_types, condition_function) + -- FIXME(@Soispha): This only works if file_types == nil, otherwise the snippet does not expand. + -- It would be nice, if it would support both an empty array (`{}`) and nil <2023-08-27> + -- file_types = file_types or {}; + + return ls.snippet( + { + trig = pair_begin; + wordTrig = false; + snippetType = "autosnippet"; + }, + { + ls.text_node({ pair_begin; }); + ls.dynamic_node(1, get_visual); + ls.text_node({ pair_end; }); + }, + { + condition = function() + local filetype_check = true + + if file_types ~= nil then + filetype_check = file_types[vim.bo.filetype] or false + end + + return (not condition_function(pair_begin, pair_end)) and filetype_check + end; + } + ) +end + +local auto_pairs = { + pair("(", ")", nil, char_count_same); + pair("{", "}", nil, char_count_same); + pair("[", "]", nil, char_count_same); + pair("<", ">", { ["rust"] = true; ["tex"] = true; }, char_count_same); + pair("'", "'", nil, even_count); + pair("\"", "\"", nil, even_count); + pair("`", "`", nil, even_count); +} + +ls.add_snippets("all", auto_pairs, { type = "snippets"; key = "auto_pairs"; }) +-- }}} + +-- todo_comments {{{ +local read_git_config = function(config_value) + local command = string.format("git config \"%s\"", config_value) + + local handle = io.popen(command) + if handle == nil then + return error(string.format("Failed to call `%s`.", command)) + end + + local result = handle:read("*a") + handle:close() + + -- stripped = string.gsub(str, '%s+', '') + return string.gsub(result, "\n", "") +end + +--- Create a @handle from a full name. +--- +--- Example: +--- “Benedikt Peetz” -> “@bpeetz” +local handle_from_name = function(name) + -- from: https://stackoverflow.com/a/7615129 + local split = function(inputstr, sep) + local t = {} + for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do + table.insert(t, str) + end + return t + end + + -- Split on spaces + local parts = split(name, "%s") + + local output_name = "" + + if #parts > 2 then + -- Only use the first chars. + -- + -- Example: + -- “Richard Matthew Stallman” -> “rms” + for _, val in ipairs(parts) do + output_name = string.format("%s%s", output_name, val:sub(1, 1)) + end + elseif #parts == 2 then + output_name = string.format("%s%s", parts[1]:sub(1, 1), parts[2]) + elseif #parts == 1 then + output_name = parts[1] + elseif #parts == 0 then + output_name = "<NoName>" + end + + return string.format("@%s", output_name:lower()) +end + +--- Generate a comment snippet +--- +---@param trig string The trigger +---@param name string name for the comment (ex.: {FIX, ISSUE, FIXIT, BUG}) +---@param comment_type integer The comment type. +---@param mark_function function: The function used to get the marks +local todo_snippet = function(trig, name, comment_type, mark_function) + assert(trig, "context doesn't include a `trig` key which is mandatory") + assert(comment_type == 1 or comment_type == 2) + + local context = {} + context.name = name .. " comment" + context.trig = trig + + local date_node, signature_node = mark_function() + + local nodes = fmt("{} {}{}: {} {} {}", wrap_snippet_in_comments(comment_type, { + ls.text_node(name); + signature_node; + ls.insert_node(1, "content"); + date_node; + })) + + return ls.snippet(context, nodes, { ctype = comment_type; }) +end + +---@param trigger string: The luasnip trigger +---@param comment_type integer: The luasnip comment type +---@param name string: All aliases for a name +---@return table: All possible snippets build from the marks +local process_marks = function(trigger, name, comment_type) + local username = function() + return handle_from_name(read_git_config("user.name")) + end + + local marks = { + signature = function() + return ls.text_node("(" .. username() .. ")"), ls.text_node("") + end; + + date_signature = function() + return ls.text_node("<" .. os.date("%Y-%m-%d") .. ">"), ls.text_node("(" .. username() .. ")") + end; + + date = function() + return ls.text_node("<" .. os.date("%Y-%m-%d") .. ">"), ls.text_node("") + end; + + empty = function() + return ls.text_node(""), ls.text_node("") + end; + } + + local output = {} + for mark_name, mark_function in pairs(marks) do + local trig = trigger .. "-" .. mark_name + + output[#output + 1] = todo_snippet(trig, name, comment_type, mark_function) + end + + return output +end + +local todo_snippet_specs = { + { { trig = "todo"; }; { "TODO"; }; { ctype = 1; }; }; + { { trig = "fix"; }; { "FIXME"; "ISSUE"; }; { ctype = 1; }; }; + { { trig = "hack"; }; { "HACK"; }; { ctype = 1; }; }; + { { trig = "warn"; }; { "WARNING"; }; { ctype = 1; }; }; + { { trig = "perf"; }; { "PERFORMANCE"; "OPTIMIZE"; }; { ctype = 1; }; }; + { { trig = "note"; }; { "NOTE"; "INFO"; }; { ctype = 1; }; }; + + -- NOTE: Block commented todo-comments + { { trig = "todob"; }; { "TODO"; }; { ctype = 2; }; }; + { { trig = "fixb"; }; { "FIXME"; "ISSUE"; }; { ctype = 2; }; }; + { { trig = "hackb"; }; { "HACK"; }; { ctype = 2; }; }; + { { trig = "warnb"; }; { "WARNING"; }; { ctype = 2; }; }; + { { trig = "perfb"; }; { "PERF"; "PERFORMANCE"; "OPTIM"; "OPTIMIZE"; }; { ctype = 2; }; }; + { { trig = "noteb"; }; { "NOTE"; "INFO"; }; { ctype = 2; }; }; +} + +local todo_comment_snippets = {} +for _, v in ipairs(todo_snippet_specs) do + local snippets = process_marks(v[1].trig, v[2][1], v[3].ctype) + for _, value in pairs(snippets) do + table.insert(todo_comment_snippets, value) + end +end + +ls.add_snippets("all", todo_comment_snippets, { type = "snippets"; key = "todo_comments"; }) +-- }}} + +-- spdx snippets {{{ +local generate_spdx_snippet = function(comment_type, spdx_license_expr, trigger) + assert(trigger, "context doesn't include a `trig` key which is mandatory") + assert(comment_type == 1 or comment_type == 2) + + local context = {} + context.name = trigger .. " spdx snippet expr" + context.trig = trigger + + + local nodes = { + fmt("{} SPDX-SnippetBegin {}", wrap_snippet_in_comments(comment_type, {})); + + fmt("{} SPDX-SnippetCopyrightText: {} {} <{}> {}", + wrap_snippet_in_comments(comment_type, { + ls.insert_node(1, "year"); + ls.insert_node(2, "author"); + ls.insert_node(3, "email"); + }) + ); + + fmt("{} SPDX-License-Identifier: {} {}", wrap_snippet_in_comments(comment_type, { + ls.text_node(spdx_license_expr); + })); + + { ls.insert_node(4, "content"); }; + + fmt("{} SPDX-SnippetEnd {}", wrap_snippet_in_comments(comment_type, {})); + + { ls.insert_node(0); }; + } + + local newline_nodes = {} + for _, sub_nodes in ipairs(nodes) do + for _, node in ipairs(sub_nodes) do + table.insert(newline_nodes, node) + end + + -- luasnip requires newlines to be encoded like this: + table.insert(newline_nodes, ls.text_node({ ""; ""; })) + end + + return ls.snippet(context, newline_nodes, { ctype = comment_type; }) +end + +local spdx = { + { trigger = "spdx-AGPL3+"; license = "AGPL-3.0-or-later"; }; + { trigger = "spdx-GPL3+"; license = "GPL-3.0-or-later"; }; + { trigger = "spdx-MIT"; license = "MIT"; }; +} + +local spdx_snippets = {} +for _, value in ipairs(spdx) do + local snippet = generate_spdx_snippet(1, value.license, value.trigger) + table.insert(spdx_snippets, snippet) + + snippet = generate_spdx_snippet(2, value.license, value.trigger .. "-block") + table.insert(spdx_snippets, snippet) +end + +ls.add_snippets("all", spdx_snippets, { type = "snippets"; key = "spdx_snippets"; }) +-- }}} diff --git a/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/delimiter.lua b/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/delimiter.lua new file mode 100644 index 00000000..bcd128f7 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/delimiter.lua @@ -0,0 +1,41 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +local ls = require("luasnip") +local fmt = require("luasnip.extras.fmt").fmt + +local get_visual = function(_, parent) + if #parent.snippet.env.SELECT_RAW > 0 then + return ls.snippet_node(nil, ls.insert_node(1, parent.snippet.env.SELECT_RAW)) + else + return ls.snippet_node(nil, ls.insert_node(1, "")) + end +end + +local translation_table = { ["("] = ")"; ["{"] = "}"; ["["] = "]"; } + +-- Return snippet tables +return { + -- LEFT/RIGHT ALL BRACES + ls.snippet( + { + trig = "([^%a])l([%(%[%{])"; + regTrig = true; + wordTrig = false; + snippetType = "autosnippet"; + }, + fmt("{}\\left{}{}\\right{}", { + ls.function_node(function(_, snip) return snip.captures[1] end); + ls.function_node(function(_, snip) return snip.captures[2] end); + ls.dynamic_node(1, get_visual); + ls.function_node(function(_, snip) return translation_table[snip.captures[2]] end); + }) + ); +} diff --git a/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/greek.lua b/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/greek.lua new file mode 100644 index 00000000..21aa7414 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/greek.lua @@ -0,0 +1,49 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +local ls = require("luasnip") + +-- Return snippet tables +return { + ls.snippet({ trig = ";a"; snippetType = "autosnippet"; }, { ls.text_node("\\alpha"); }); + ls.snippet({ trig = ";b"; snippetType = "autosnippet"; }, { ls.text_node("\\beta"); }); + ls.snippet({ trig = ";g"; snippetType = "autosnippet"; }, { ls.text_node("\\gamma"); }); + ls.snippet({ trig = ";G"; snippetType = "autosnippet"; }, { ls.text_node("\\Gamma"); }); + ls.snippet({ trig = ";d"; snippetType = "autosnippet"; }, { ls.text_node("\\delta"); }); + ls.snippet({ trig = ";D"; snippetType = "autosnippet"; }, { ls.text_node("\\Delta"); }); + ls.snippet({ trig = ";e"; snippetType = "autosnippet"; }, { ls.text_node("\\epsilon"); }); + ls.snippet({ trig = ";ve"; snippetType = "autosnippet"; }, { ls.text_node("\\varepsilon"); }); + ls.snippet({ trig = ";z"; snippetType = "autosnippet"; }, { ls.text_node("\\zeta"); }); + ls.snippet({ trig = ";h"; snippetType = "autosnippet"; }, { ls.text_node("\\eta"); }); + ls.snippet({ trig = ";o"; snippetType = "autosnippet"; }, { ls.text_node("\\theta"); }); + ls.snippet({ trig = ";vo"; snippetType = "autosnippet"; }, { ls.text_node("\\vartheta"); }); + ls.snippet({ trig = ";O"; snippetType = "autosnippet"; }, { ls.text_node("\\Theta"); }); + ls.snippet({ trig = ";k"; snippetType = "autosnippet"; }, { ls.text_node("\\kappa"); }); + ls.snippet({ trig = ";l"; snippetType = "autosnippet"; }, { ls.text_node("\\lambda"); }); + ls.snippet({ trig = ";L"; snippetType = "autosnippet"; }, { ls.text_node("\\Lambda"); }); + ls.snippet({ trig = ";m"; snippetType = "autosnippet"; }, { ls.text_node("\\mu"); }); + ls.snippet({ trig = ";n"; snippetType = "autosnippet"; }, { ls.text_node("\\nu"); }); + ls.snippet({ trig = ";x"; snippetType = "autosnippet"; }, { ls.text_node("\\xi"); }); + ls.snippet({ trig = ";X"; snippetType = "autosnippet"; }, { ls.text_node("\\Xi"); }); + ls.snippet({ trig = ";i"; snippetType = "autosnippet"; }, { ls.text_node("\\pi"); }); + ls.snippet({ trig = ";I"; snippetType = "autosnippet"; }, { ls.text_node("\\Pi"); }); + ls.snippet({ trig = ";r"; snippetType = "autosnippet"; }, { ls.text_node("\\rho"); }); + ls.snippet({ trig = ";s"; snippetType = "autosnippet"; }, { ls.text_node("\\sigma"); }); + ls.snippet({ trig = ";S"; snippetType = "autosnippet"; }, { ls.text_node("\\Sigma"); }); + ls.snippet({ trig = ";t"; snippetType = "autosnippet"; }, { ls.text_node("\\tau"); }); + ls.snippet({ trig = ";f"; snippetType = "autosnippet"; }, { ls.text_node("\\phi"); }); + ls.snippet({ trig = ";vf"; snippetType = "autosnippet"; }, { ls.text_node("\\varphi"); }); + ls.snippet({ trig = ";F"; snippetType = "autosnippet"; }, { ls.text_node("\\Phi"); }); + ls.snippet({ trig = ";c"; snippetType = "autosnippet"; }, { ls.text_node("\\chi"); }); + ls.snippet({ trig = ";p"; snippetType = "autosnippet"; }, { ls.text_node("\\psi"); }); + ls.snippet({ trig = ";P"; snippetType = "autosnippet"; }, { ls.text_node("\\Psi"); }); + ls.snippet({ trig = ";w"; snippetType = "autosnippet"; }, { ls.text_node("\\omega"); }); + ls.snippet({ trig = ";W"; snippetType = "autosnippet"; }, { ls.text_node("\\Omega"); }); +} diff --git a/modules/by-name/nv/nvim/plgs/neorg/default.nix b/modules/by-name/nv/nvim/plgs/neorg/default.nix index 03afb16c..ea451d3a 100644 --- a/modules/by-name/nv/nvim/plgs/neorg/default.nix +++ b/modules/by-name/nv/nvim/plgs/neorg/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, @@ -44,11 +53,7 @@ in { __empty = null; }; "core.dirman".config = { - workspaces = { - general = "~/repos/notes/general"; - journal = "~/repos/notes/journal"; - projects = "~/repos/notes/projects"; - }; + workspaces = { }; }; "core.export".config = { __empty = null; diff --git a/modules/by-name/nv/nvim/plgs/neorg/key_mappings.lua b/modules/by-name/nv/nvim/plgs/neorg/key_mappings.lua index e2ebb653..5391bf0b 100644 --- a/modules/by-name/nv/nvim/plgs/neorg/key_mappings.lua +++ b/modules/by-name/nv/nvim/plgs/neorg/key_mappings.lua @@ -1,3 +1,13 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + -- Override some of my default key mappings to better integrate into neorg. -- They still to the same conceptual thing. diff --git a/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix b/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix index 8d61dbd7..315f3fc7 100644 --- a/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix +++ b/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, @@ -5,49 +14,82 @@ }: let cfg = config.soispha.programs.nvim; in { - home-manager.users.soispha.programs.nixvim.plugins.cmp = lib.mkIf cfg.enable { - /* - TODO: integrate this: - ```lua - enabled = { - function() - -- disable completion in comments - local context = require 'cmp.config.context' - -- keep command mode completion enabled when cursor is in a comment - -- te - if vim.api.nvim_get_mode().mode == 'c' then - return true - else - return not context.in_treesitter_capture("comment") - and not context.in_syntax_group("Comment") + home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + opts.completeopt = [ + "menu" # Show completions in a menu + "menuone" # Also open menu, when only one completion exists + "noselect" # Do not pre select one of the completions + ]; + + keymaps = [ + { + key = "hh"; + mode = ["i"]; + action.__raw = '' + function() + require('cmp').select_next_item() end - end - }, - ``` - */ - enable = true; - autoEnableSources = true; - settings = { - mapping = { - # TODO: add support for desc and which key here - "<C-d>" = "cmp.mapping.scroll_docs(-4)"; # desc = "Scroll up by four lines" - "<C-f>" = "cmp.mapping.scroll_docs(4)"; # desc = "Scroll down by four lines" - "HH" = "cmp.mapping.complete()"; # desc = "Confirm snipped" - }; + ''; + options.desc = "go forward in completion menu"; + } + { + key = "uu"; + mode = ["i"]; + action.__raw = '' + function() + require('cmp').confirm() + end + ''; + options.desc = "confirm the selected item"; + } + + { + key = "<C-d>"; + mode = ["i"]; + action.__raw = '' + function() + require('cmp').mapping.scroll_docs(-4) + end + ''; + options.desc = "Scroll up by four lines"; + } + { + key = "<C-f>"; + mode = ["i"]; + action.__raw = '' + function() + require('cmp').mapping.scroll_docs(4) + end + ''; + options.desc = "Scroll down by four lines"; + } + ]; + + plugins.cmp = { + enable = true; + autoEnableSources = true; - snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; + settings = { + mapping = {}; - sources = [ - {name = "nvim_lsp";} - {name = "luasnip";} - {name = "path";} - {name = "git";} # TODO: I might want to add config to allow all issues/prs <2023-10-16> - # {name = "convertionalcommits";} # TODO: Useless without commitlint [https://commitlint.js.org/] <2023-10-16> - # {name = "rg";} # TODO: This might really RIP-grep my system <2023-10-16> - # {name = "buffer";} - # {name = "digraphs";} - {name = "calc";} - ]; + snippet.expand.__raw = '' + function(args) + require('luasnip').lsp_expand(args.body) + end + ''; + + sources = [ + {name = "nvim_lsp";} + {name = "luasnip";} + {name = "path";} + {name = "git";} # TODO: I might want to add config to allow all issues/prs <2023-10-16> + # {name = "convertionalcommits";} # TODO: Useless without commitlint [https://commitlint.js.org/] <2023-10-16> + # {name = "rg";} # TODO: This might really RIP-grep my system <2023-10-16> + # {name = "buffer";} + # {name = "digraphs";} + {name = "calc";} + ]; + }; }; }; } diff --git a/modules/by-name/nv/nvim/plgs/nvim-lint/default.nix b/modules/by-name/nv/nvim/plgs/nvim-lint/default.nix index ee057a9b..90e81832 100644 --- a/modules/by-name/nv/nvim/plgs/nvim-lint/default.nix +++ b/modules/by-name/nv/nvim/plgs/nvim-lint/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, config, diff --git a/modules/by-name/nv/nvim/plgs/nvim-lint/lua/nvim-lint.lua b/modules/by-name/nv/nvim/plgs/nvim-lint/lua/nvim-lint.lua index 770c3bb5..5b5fd4b8 100644 --- a/modules/by-name/nv/nvim/plgs/nvim-lint/lua/nvim-lint.lua +++ b/modules/by-name/nv/nvim/plgs/nvim-lint/lua/nvim-lint.lua @@ -1,3 +1,13 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + require("lint").linters_by_ft = { -- text markdown = {}, diff --git a/modules/by-name/nv/nvim/plgs/raw_plugins/default.nix b/modules/by-name/nv/nvim/plgs/raw_plugins/default.nix index e5d401a0..c981ee08 100644 --- a/modules/by-name/nv/nvim/plgs/raw_plugins/default.nix +++ b/modules/by-name/nv/nvim/plgs/raw_plugins/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/telescope/default.nix b/modules/by-name/nv/nvim/plgs/telescope/default.nix index 193ee1ac..b2c66edc 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/telescope/defaults/default.nix b/modules/by-name/nv/nvim/plgs/telescope/defaults/default.nix index 11d04304..7cfe9698 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/defaults/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/defaults/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/default.nix index 8eee9a27..693db974 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {config, ...}: let cfg = config.soispha.programs.nvim; in { diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/tex.lua b/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/tex.lua index 4107a7c5..fbe7c993 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/tex.lua +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/tex.lua @@ -1,3 +1,13 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + -- local used = false; -- vim.keymap.set('n', '<leader>t', function() -- used = not used; diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/default.nix index 0b1e033a..0b0ed0f6 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { imports = [ ./bibtex diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/frecency/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/frecency/default.nix index f4e3d116..3d5eae99 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/frecency/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/frecency/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, config, diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/fzy-native/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/fzy-native/default.nix index 4194e688..7a2fc164 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/fzy-native/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/fzy-native/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/default.nix index 6153b063..4d91e988 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, config, diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua b/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua index 48a8588d..b6542429 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua @@ -1,3 +1,13 @@ +-- nixos-config - My current NixOS configuration +-- +-- Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +-- SPDX-License-Identifier: GPL-3.0-or-later +-- +-- This file is part of my nixos-config. +-- +-- You should have received a copy of the License along with this program. +-- If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + -- Taken from: https://github.com/desdic/telescope-rooter.nvim/blob/69423216c75a5f1f1477bbf8faf6b0dc8af04099/lua/telescope/_extensions/rooter.lua local has_telescope, telescope = pcall(require, "telescope") if not has_telescope then diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/symbols/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/symbols/default.nix index adbb466a..1f82523d 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/symbols/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/symbols/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, config, diff --git a/modules/by-name/nv/nvim/plgs/telescope/keymaps/default.nix b/modules/by-name/nv/nvim/plgs/telescope/keymaps/default.nix index a474f097..d5cc55f5 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/keymaps/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/keymaps/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/todo-comments/default.nix b/modules/by-name/nv/nvim/plgs/todo-comments/default.nix index ddbe367d..cd1a7dbf 100644 --- a/modules/by-name/nv/nvim/plgs/todo-comments/default.nix +++ b/modules/by-name/nv/nvim/plgs/todo-comments/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/treesitter/default.nix b/modules/by-name/nv/nvim/plgs/treesitter/default.nix index 02088d0a..c8b48cd1 100644 --- a/modules/by-name/nv/nvim/plgs/treesitter/default.nix +++ b/modules/by-name/nv/nvim/plgs/treesitter/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, pkgs, @@ -6,15 +15,17 @@ }: let cfg = config.soispha.programs.nvim; in { - home-manager.users.soispha. programs.nixvim = lib.mkIf cfg.enable { + home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + # NOTE: These are required to build grammars, but I already use the nix grammars <2024-07-13> + dependencies = { + tree-sitter.enable = false; + nodejs.enable = false; + gcc.enable = false; + }; + plugins.treesitter = { enable = true; - # NOTE: These are required to build grammars, but I already use the nix grammars <2024-07-13> - gccPackage = null; - nodejsPackage = null; - treesitterPackage = null; - # inject nixvim specific highlighting (eg in extraConfigLua). nixvimInjections = true; diff --git a/modules/by-name/nv/nvim/plgs/vim-tex/default.nix b/modules/by-name/nv/nvim/plgs/vim-tex/default.nix index 680f169a..739b69d9 100644 --- a/modules/by-name/nv/nvim/plgs/vim-tex/default.nix +++ b/modules/by-name/nv/nvim/plgs/vim-tex/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/nv/nvim/plgs/which-key/default.nix b/modules/by-name/nv/nvim/plgs/which-key/default.nix index 20004bb1..e5bca546 100644 --- a/modules/by-name/nv/nvim/plgs/which-key/default.nix +++ b/modules/by-name/nv/nvim/plgs/which-key/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/ol/ollama/module.nix b/modules/by-name/ol/ollama/module.nix index 7a4e8038..f819c035 100644 --- a/modules/by-name/ol/ollama/module.nix +++ b/modules/by-name/ol/ollama/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/op/openssh/module.nix b/modules/by-name/op/openssh/module.nix index b733dbe7..97cf7fd7 100644 --- a/modules/by-name/op/openssh/module.nix +++ b/modules/by-name/op/openssh/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { services.openssh = { enable = true; diff --git a/modules/by-name/pi/printing/module.nix b/modules/by-name/pi/printing/module.nix index 85d15b16..cfcd2154 100644 --- a/modules/by-name/pi/printing/module.nix +++ b/modules/by-name/pi/printing/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/po/polkit/module.nix b/modules/by-name/po/polkit/module.nix index fb13505b..c6d1c750 100644 --- a/modules/by-name/po/polkit/module.nix +++ b/modules/by-name/po/polkit/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/po/postgresql/module.nix b/modules/by-name/po/postgresql/module.nix index 62233e96..5cdf6c77 100644 --- a/modules/by-name/po/postgresql/module.nix +++ b/modules/by-name/po/postgresql/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/po/power/module.nix b/modules/by-name/po/power/module.nix index 13013879..3489853c 100644 --- a/modules/by-name/po/power/module.nix +++ b/modules/by-name/po/power/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/ri/river/init_base.sh b/modules/by-name/ri/river/init_base.sh index 938b46b1..b68d147b 100755 --- a/modules/by-name/ri/river/init_base.sh +++ b/modules/by-name/ri/river/init_base.sh @@ -1,7 +1,17 @@ #!/usr/bin/env sh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # NOTE: Keep this in sync with the file from `river-start` <2025-02-03> -RIVER_LOG_FILE="$HOME/.local/share/river/log" +RIVER_LOG_FILE="$HOME/.cache/river/log" err_fail() { if ! "$@"; then diff --git a/modules/by-name/ri/river/module.nix b/modules/by-name/ri/river/module.nix index 139e8b66..38d4bdef 100644 --- a/modules/by-name/ri/river/module.nix +++ b/modules/by-name/ri/river/module.nix @@ -1,9 +1,18 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, - qmk_firmware, system, pkgs, + externalBinaries, ... }: let cfg = config.soispha.programs.river; @@ -167,7 +176,7 @@ in { }; config = lib.mkIf cfg.enable { - services.udev.packages = lib.mkIf cfg.unicodeInput.enable [qmk_firmware.packages.${system}.qmk_unicode_type]; + services.udev.packages = lib.mkIf cfg.unicodeInput.enable [externalBinaries.qmk_firmware.packages.${system}.qmk_unicode_type]; home-manager.users.soispha = { home.sessionVariables = { @@ -184,7 +193,7 @@ in { }; home.packages = [ - pkgs.river-start + (pkgs.callPackage ./river-start/package.nix {}) ]; xdg.configFile."river/init" = { diff --git a/modules/by-name/ri/river/river-start/package.nix b/modules/by-name/ri/river/river-start/package.nix new file mode 100644 index 00000000..10957cc0 --- /dev/null +++ b/modules/by-name/ri/river/river-start/package.nix @@ -0,0 +1,23 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + writeShellApplication, + river, +}: +writeShellApplication { + name = "river-start"; + text = builtins.readFile ./river-start.sh; + runtimeInputs = [ + river + ]; + meta = { + mainProgram = "river-start"; + }; +} diff --git a/modules/by-name/ri/river/river-start/river-start.sh b/modules/by-name/ri/river/river-start/river-start.sh new file mode 100755 index 00000000..b4c5b0a6 --- /dev/null +++ b/modules/by-name/ri/river/river-start/river-start.sh @@ -0,0 +1,20 @@ +#! /usr/bin/env sh + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +# NOTE: Keep this in sync with the file from `base_init.sh` <2025-02-03> +RIVER_LOG_FILE="$HOME/.cache/river/log" + +[ -d "$(dirname "$RIVER_LOG_FILE")" ] || mkdir --parents "$(dirname "$RIVER_LOG_FILE")" + +exec river -log-level info >"$RIVER_LOG_FILE" 2>&1 + +# vim: ft=sh diff --git a/modules/by-name/sc/scanning/module.nix b/modules/by-name/sc/scanning/module.nix index dda507fa..30e99bd1 100644 --- a/modules/by-name/sc/scanning/module.nix +++ b/modules/by-name/sc/scanning/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/se/serverphone/certificates/ca.crt.license b/modules/by-name/se/serverphone/certificates/ca.crt.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/se/serverphone/certificates/ca.crt.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/se/serverphone/certificates/server.crt.license b/modules/by-name/se/serverphone/certificates/server.crt.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/se/serverphone/certificates/server.crt.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/se/serverphone/module.currently_ignored.nix b/modules/by-name/se/serverphone/module.currently_ignored.nix index aaa818c2..f7280bed 100644 --- a/modules/by-name/se/serverphone/module.currently_ignored.nix +++ b/modules/by-name/se/serverphone/module.currently_ignored.nix @@ -1,13 +1,33 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, serverphone, system, lib, + modules, ... -}: { +}: let + cfg = config.soispha.serverphone; +in { # FIXME: Reactive this module, when serverphone is working again <2024-05-11> - config = lib.mkIf config.soispha.secrets.enable { + options.soispha.serverphone = { + enable = lib.mkEnableOption "serverphone"; + }; + + imports = [ + modules.serverphone.nixosModules.default + ]; + + config = lib.mkIf cfg.enable { age.secrets = { serverphoneCa = { file = ./private_keys/ca.key; diff --git a/modules/by-name/se/serverphone/private_keys/ca.key.license b/modules/by-name/se/serverphone/private_keys/ca.key.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/se/serverphone/private_keys/ca.key.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/se/serverphone/private_keys/server.key.license b/modules/by-name/se/serverphone/private_keys/server.key.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/se/serverphone/private_keys/server.key.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/sn/snapper/module.nix b/modules/by-name/sn/snapper/module.nix index bf8201a4..c232a177 100644 --- a/modules/by-name/sn/snapper/module.nix +++ b/modules/by-name/sn/snapper/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/so/sound/module.nix b/modules/by-name/so/sound/module.nix index 8b519f09..622cc01d 100644 --- a/modules/by-name/so/sound/module.nix +++ b/modules/by-name/so/sound/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/ss/ssh/module.nix b/modules/by-name/ss/ssh/module.nix new file mode 100644 index 00000000..91cc4aeb --- /dev/null +++ b/modules/by-name/ss/ssh/module.nix @@ -0,0 +1,55 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.soispha.programs.ssh; +in { + options.soispha.programs.ssh = { + enable = lib.mkEnableOption "ssh config"; + rootKnownHosts = lib.mkOption { + type = lib.types.attrsOf lib.types.str; + description = '' + An attrset of keys (the domain) and values (the host key.) + These are only applied to the root user. + ''; + default = {}; + apply = value: + builtins.concatStringsSep "\n" + (lib.attrsets.mapAttrsToList (hostName: hostKey: "${hostName} ${hostKey}") value); + }; + }; + + config = lib.mkIf cfg.enable { + home-manager.users = { + root.programs.ssh = { + enable = true; + compression = true; + hashKnownHosts = false; + serverAliveInterval = 240; + userKnownHostsFile = builtins.toString (pkgs.writeTextFile { + name = "root-known-hosts"; + text = cfg.rootKnownHosts; + }); + }; + + soispha.programs.ssh = { + enable = true; + compression = true; + hashKnownHosts = false; + serverAliveInterval = 240; + userKnownHostsFile = "${config.home-manager.users.soispha.xdg.dataHome}/ssh/known_hosts"; + }; + }; + }; +} diff --git a/modules/by-name/st/steam/module.nix b/modules/by-name/st/steam/module.nix index 49149cd7..a02b2e4b 100644 --- a/modules/by-name/st/steam/module.nix +++ b/modules/by-name/st/steam/module.nix @@ -1,23 +1,42 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, config, pkgs, ... }: let - cfg = config.soispha.services.steam; + cfg = config.soispha.programs.steam; in { - options.soispha.services.steam = { + options.soispha.programs.steam = { enable = lib.mkEnableOption "Steam"; }; config = lib.mkIf cfg.enable { + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + # NOTE: These are not really applied. Look at + # <modules/by-name/ni/nixpkgs/config.nix> instead. <2025-04-25> + "steam" + "steam-unwrapped" + "steam-original" + "steam-run" + ]; + programs.steam = { enable = true; }; environment.systemPackages = [ # TODO: Why is this package needed? <2024-05-16> - pkgs.wineWowPackages.waylandFull + # pkgs.wineWowPackages.waylandFull ]; }; } diff --git a/modules/by-name/sw/swaylock/images/GTDcanonical.png.license b/modules/by-name/sw/swaylock/images/GTDcanonical.png.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/sw/swaylock/images/GTDcanonical.png.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/sw/swaylock/images/commands.jpg.license b/modules/by-name/sw/swaylock/images/commands.jpg.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/sw/swaylock/images/commands.jpg.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/sw/swaylock/images/duwon-lee-tempano-port.jpg.license b/modules/by-name/sw/swaylock/images/duwon-lee-tempano-port.jpg.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/sw/swaylock/images/duwon-lee-tempano-port.jpg.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/sw/swaylock/images/gnu.png.license b/modules/by-name/sw/swaylock/images/gnu.png.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/sw/swaylock/images/gnu.png.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/sw/swaylock/module.nix b/modules/by-name/sw/swaylock/module.nix index fc296de7..ab18f41b 100644 --- a/modules/by-name/sw/swaylock/module.nix +++ b/modules/by-name/sw/swaylock/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/sy/system_diff/module.nix b/modules/by-name/sy/system_diff/module.nix index 052ffae2..cc2ec75c 100644 --- a/modules/by-name/sy/system_diff/module.nix +++ b/modules/by-name/sy/system_diff/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/ta/taskwarrior/module.nix b/modules/by-name/ta/taskwarrior/module.nix index c5549ac9..bb881768 100644 --- a/modules/by-name/ta/taskwarrior/module.nix +++ b/modules/by-name/ta/taskwarrior/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, config, @@ -67,6 +76,8 @@ in { options.soispha.programs.taskwarrior = { enable = lib.mkEnableOption "taskwarrior"; + enableAge = lib.mkEnableOption "taskwarrior with age keys"; + includeFiles = lib.mkOption { type = lib.types.attrsOf lib.types.path; description = "Extra files to include in the taskwarrior config"; @@ -99,8 +110,17 @@ in { inherit mkHook; }; + age.secrets.taskwarrior_sync_server_encryption_key = lib.mkIf (cfg.enable && cfg.enableAge) { + file = ./secrets/sync_server_encryption_key.age; + mode = "700"; + owner = "soispha"; + group = "users"; + }; + + soispha.programs.taskwarrior.includeFiles.syncServerSecret = lib.mkIf (cfg.enable && cfg.enableAge) config.age.secrets.taskwarrior_sync_server_encryption_key.path; + home-manager.users.soispha = lib.mkIf cfg.enable { - services.taskwarrior-sync = { + services.taskwarrior-sync = lib.mkIf cfg.enableAge { enable = true; package = pkgs.taskwarrior3; }; @@ -118,6 +138,8 @@ in { tags = true; }; + news.version = "3.4.1"; + regex = true; weekstart = "Monday"; @@ -128,6 +150,11 @@ in { }; }; + sync.server = lib.mkIf cfg.enableAge { + client_id = "a3619d43-031f-4f85-848f-5512804f9a1d"; + url = "https://taskchampion.vhack.eu"; + }; + alias = { mod = "modify"; }; diff --git a/modules/by-name/ta/taskwarrior/nord.theme.license b/modules/by-name/ta/taskwarrior/nord.theme.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/ta/taskwarrior/nord.theme.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/ta/taskwarrior/secrets/sync_server_encryption_key.age b/modules/by-name/ta/taskwarrior/secrets/sync_server_encryption_key.age new file mode 100644 index 00000000..1e1a252e --- /dev/null +++ b/modules/by-name/ta/taskwarrior/secrets/sync_server_encryption_key.age @@ -0,0 +1,41 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBhUEkzOWlvdU00NnVYcVN1 +TjZMMWUwY3l1c1JEbUFHZFZtcmZ2YWU2VVRnCjYzS3ZrNC9Nc2J2d1Nxc0FtbHM1 +WGJjenE5UFhROGxOdVhka2ZCcm04TUEKLT4gc3NoLWVkMjU1MTkgelpFb25nIEpk +LysxejJOcnNJNEpxWnQzcEd5YWlhTEUreS90R1hiNlRYNmJQTGRYSE0KeU0yVEZy +WTcrZVRiUjZyWFdQWTVTak9Ua3dwZ3pKZXBCRHJhMXN1UElXRQotPiBzc2gtZWQy +NTUxOSA3SGZGVXcgUHlFZnkrd3RuN3ROK1lmdG1hcGJHZmFPMENOTjNMdndsSEJL +VDRNL0pCdwo0MmZIRTlTeWFNM2Q5NW1ja1hwY0dCOUg5YUhHYzVkWGlta2ZSTWI3 +aHVvCi0+IFkrRC1ncmVhc2UgNGZkCk5KSzd2RjhIaUFnMHFFeVhOcFM3MktEWERI +cUY1dlY4SDA0Ci0tLSBtSi9zUkdQV0xWMlA4SUtEeGJCeTRGZmFpbC9EMUN3ZVRQ +YXIzaXNWS3lJCitm6obeMX9iJ9HZ48/kS0qt6PjOI5iWfag3oiBVhUAaab3P42KM +KS3Vi1nTKXR5FHigy84Z10uV2apxq73g9uwD97IPH7APyeQsibs6q5aJXmntBYLi +bROu9pSHSYHUrOMHL3hrzs/9bbmS0TXPm1q9ixem2Zm93z96AJQ95IunaeNtA1ya +UooQ2MtYWtLkbj7Z78PydKzqMYsk1zBehBFfHbdyVenDAoaTXpzhRBCGgRmDvvNA +vL/7GKOXLg7Djh8DR4sPXYt3d07DXkrFsxF9GgA+dmhCIMmS6KCldyAfRLHQaYjb +5WQ/Xmx0MpZwdMNF8AWNX7U2/ZlfJwH4zSZ1SMPYgKqbk4FxzktY5BVsGCyq7aqz +fU8EgoIAU3wio6GLWnvwI6AA0evowooUkHncmBDIFTfNY64wD8KeYyz0EiLOfOLd +tjnnzzl2u6aWN8nOToRDDTzVIJg3mQNJjgxZF8G7iJh4WtGYyhrldgcefrGfFRP9 +ZoNj5JhWsNA96KrfdFZPTH1RKZsDd631UEpkP5aA3wv1mzK4D+R0tuttc6AD5Gk7 +QlwSz86OUN4hDGbUEGtRt9WBt34VkFLeH4WgPP6trkXGr8gtGHBnxLzl1JgssmC1 +evoz/jHUDT2f3/gFfe6mZFIMgEuibmL18vQ9FUYfZsigMzvkOTnpIbKX8FXm4Hfy +/4qi8q6rqrwRttDuzX1mK0frqx7MIIUp45UvemfJVN7qDB4IrKBfjw5ICy3gifx3 +7dVgjXBmGAzGkzXk2PtRUscSHW9r21cMICwRsDRM4dawTF1Rk0pkkkureZ0fnLNv +krhmv5SQEEWILm+hkg2963a4osbeHIMQnRiPd3wgfhTcd0peNq+E+S1+w5/3+R5M +Cc4JbHbYiHxCcfhFNI5iPkQVm4lMWi53YvPrweLw09+IGpUwTVB4jN3q2qvlCGeF +7n615QH8xchMxKfB4fwa7uXo5T8phYo31KguPBYX94vJPK/R6mR9WUnq8//+m6VD +n9SDSrSYUq/ckCbQkPAWnBzwUzm9Ykok9XKPbdMfeeyMc8wQ/FaXNoofvkWiCTDp +BVYNrlQUnRavmjTW6r8CMz/PIRCk3MzTeMX8nvpxeMALBTJjKGt1ZPaCTiObAcBh +QDrohH6c/iRQu1ZmaKwtcDfwJKNAnsqnZWWwfFayV/PXvVl5jgwYpwJYbC/Pu7Km +ssdrpCcW/O48L861lw7wF5f4Fneo/ZbSx0erGTviYqiaoRgLaeEhMBZZFhdENHbS +MDJ24qu3qHl/h725edpmiAMziD5jeE9oBUvh7JkhVobc87dFpBHC6znseRlIpr+J +8csSU8mQEAHy7tW9PGK4wZLVGQr9mpADyYgYpow3X6HNuX/DHqzs0GDHanG4uOiF +vSeW2YADEU7O1focnfFGBhEMzbbNVfSBmvcU0avGa2ZajW1h6S2JpfDPsyQfC6Xr +4LmRL+myH0V9i72m9kChsDuQPHGRYBW+iQctoYalXzPFrU7Kpl+/yURecV7JI/v5 +ujHtGPgzvfqTEama/PGbjxC0kVQ9TayPB7ymIjjJquBYKTW74S/exvpYbZz8vN1B +xcwyd7TeMdRYI2nfuI82Q13WoLdLUEW1O5VXPxTm+5pnYbvxfipR4S45+U3tbaaE +YNy26DiZEKUXdyL5Jd+LlArXJXSLd5lzJXs+h8YeogxjtJ7PMmUqmtUDj6PCDrsF +54T5sTGjO2w7QSanwsXgALRgBQpvPTniFpFBllSH44Nj9B2LybmbWIyph67FeIeM +p+YedymnlewwiM2nGcjY/Zs/abdrQwnnKsgkWRGRAHHxhV0pamXfdoZJZEHzebWU +u5iGa9slaCAJxuLs5DQ940e8VFESEwM+e0AECwRmCf+1YazXemiJ+w== +-----END AGE ENCRYPTED FILE----- diff --git a/modules/by-name/ti/timewarrior/module.nix b/modules/by-name/ti/timewarrior/module.nix index f33d02be..90a541d8 100644 --- a/modules/by-name/ti/timewarrior/module.nix +++ b/modules/by-name/ti/timewarrior/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/ti/timewarrior/nord.theme.license b/modules/by-name/ti/timewarrior/nord.theme.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/ti/timewarrior/nord.theme.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/ti/timewarrior/taskwarrior_hooks/on-modify.track-timewarrior.py b/modules/by-name/ti/timewarrior/taskwarrior_hooks/on-modify.track-timewarrior.py index 0bef8bc2..3b42b3f2 100755 --- a/modules/by-name/ti/timewarrior/taskwarrior_hooks/on-modify.track-timewarrior.py +++ b/modules/by-name/ti/timewarrior/taskwarrior_hooks/on-modify.track-timewarrior.py @@ -1,30 +1,15 @@ #!/usr/bin/env python3 -############################################################################### +# nixos-config - My current NixOS configuration # +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> # Copyright 2016 - 2021, 2023, Gothenburg Bit Factory +# SPDX-License-Identifier: GPL-3.0-or-later # -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: +# This file is part of my nixos-config. # -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -# -# https://www.opensource.org/licenses/mit-license.php -# -############################################################################### +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. import json import subprocess diff --git a/modules/by-name/ti/timewarrior/taskwarrior_hooks/on-modify.track-total-active-time.py b/modules/by-name/ti/timewarrior/taskwarrior_hooks/on-modify.track-total-active-time.py index 0b6be082..303a5c57 100755 --- a/modules/by-name/ti/timewarrior/taskwarrior_hooks/on-modify.track-total-active-time.py +++ b/modules/by-name/ti/timewarrior/taskwarrior_hooks/on-modify.track-total-active-time.py @@ -1,8 +1,17 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +# nixos-config - My current NixOS configuration +# # Copyright (C) 2016-present Arctic Ice Studio <development@arcticicestudio.com> # Copyright (C) 2016-present Sven Greb <development@svengreb.de> +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. # Project: igloo # Repository: https://github.com/arcticicestudio/igloo diff --git a/modules/by-name/ts/tskm/module.nix b/modules/by-name/ts/tskm/module.nix index 51be48fe..9bf2b389 100644 --- a/modules/by-name/ts/tskm/module.nix +++ b/modules/by-name/ts/tskm/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, config, @@ -110,7 +119,7 @@ in { home-manager.users.soispha = { home.sessionVariables = { # TODO: Remove this hard-coded path with a reference. <2025-04-04> - "TSKM_PROJECT_FILE" = "/home/soispha/repos/nix/config/modules/common/projects.json"; + "TSKM_PROJECT_FILE" = "/home/soispha/repos/nix/own/config/modules/common/projects.json"; }; programs.nixvim = { diff --git a/modules/by-name/ts/tskm/taskwarrior_hooks/enforce-projects.sh b/modules/by-name/ts/tskm/taskwarrior_hooks/enforce-projects.sh index 217e6052..c3e377c0 100755 --- a/modules/by-name/ts/tskm/taskwarrior_hooks/enforce-projects.sh +++ b/modules/by-name/ts/tskm/taskwarrior_hooks/enforce-projects.sh @@ -1,5 +1,15 @@ #!/usr/bin/env sh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + new_task="$1" project="$(echo "$new_task" | jq '.project' --raw-output)" diff --git a/modules/by-name/un/unison/module.nix b/modules/by-name/un/unison/module.nix index 9de27c0f..8d156b00 100644 --- a/modules/by-name/un/unison/module.nix +++ b/modules/by-name/un/unison/module.nix @@ -1,13 +1,21 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, config, pkgs, - sysLib, ... }: let cfg = config.soispha.services.unison; - script = import ./shellScript.nix {inherit sysLib lib pkgs cfg;}; + script = import ./shellScript.nix {inherit lib pkgs cfg;}; in { options.soispha.services.unison = let homePath = lib.types.strMatching "^~.*"; diff --git a/modules/by-name/un/unison/shellScript.nix b/modules/by-name/un/unison/shellScript.nix index 4618ae8e..df373805 100644 --- a/modules/by-name/un/unison/shellScript.nix +++ b/modules/by-name/un/unison/shellScript.nix @@ -1,5 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - sysLib, lib, pkgs, cfg, @@ -60,7 +68,7 @@ lib.strings.concatStringsSep " " [ "unison" "${serialiseArgs cfg.unisonOptions}" - "$EXTRA_OPTIONS" + "\"$@\"" "${getIgnored cfg.pathsToIgnore path}" "${esa path}" (esa "ssh://${cfg.foreign.userName}@${cfg.foreign.address}/${path}") @@ -68,24 +76,18 @@ script = lib.strings.concatStringsSep "\n" (builtins.map mkScriptLine cfg.pathsToSync); in - sysLib.writeShellScript { + pkgs.writeShellApplication { name = "unison-sync"; - src = builtins.toFile "unison-backup" ('' - #!/usr/bin/env dash + text = script; - # shellcheck source=/dev/null - SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - - export UNISON=${esa cfg.dataDir}; - - EXTRA_OPTIONS="$UNISON_EXTRA_OPTIONS $*" - '' - + script); + runtimeEnv = { + UNISON = cfg.dataDir; + }; - dependencies = with pkgs; [ - unison - openssh # needed to connect to the other server - less # needed to show diffs - diffutils # needed to compute diffs + runtimeInputs = [ + pkgs.unison + pkgs.openssh # needed to connect to the other server + pkgs.less # needed to show diffs + pkgs.diffutils # needed to compute diffs ]; } diff --git a/modules/by-name/us/users/module.nix b/modules/by-name/us/users/module.nix index a44df7e8..555e61f9 100644 --- a/modules/by-name/us/users/module.nix +++ b/modules/by-name/us/users/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, pkgs, @@ -8,6 +17,7 @@ in { options.soispha.users = { enable = lib.mkEnableOption "user set-up for soispha"; + hashedPassword = lib.mkOption { type = lib.types.str; example = lib.literalExpression "$y$jFT$ONrCqZIJKB7engmfA4orD/$0GO58/wV5wrYWj0cyONhyujZPjFmbT0XKtx2AvXLG0B"; @@ -31,19 +41,42 @@ in { users = { mutableUsers = false; - users.soispha = { - isNormalUser = true; - home = "/home/soispha"; - createHome = true; - shell = pkgs.zsh; - initialHashedPassword = cfg.hashedPassword; - extraGroups = cfg.groups ++ lib.optional cfg.enableDeprecatedPlugdev "plugdev"; - - uid = 1000; - openssh.authorizedKeys.keys = [ - # TODO: This should be parameterized. <2024-05-16> - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIME4ZVa+IoZf6T3U08JG93i6QIAJ4amm7mkBzO14JSkz" - ]; + users = { + soispha = { + isNormalUser = true; + home = "/home/soispha"; + createHome = true; + shell = pkgs.zsh; + initialHashedPassword = cfg.hashedPassword; + extraGroups = cfg.groups ++ lib.optional cfg.enableDeprecatedPlugdev "plugdev"; + + uid = 1000; + openssh.authorizedKeys.keys = [ + # TODO: This should be parameterized. <2024-05-16> + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIME4ZVa+IoZf6T3U08JG93i6QIAJ4amm7mkBzO14JSkz" + ]; + }; + + root = { + hashedPassword = lib.mkForce null; # to lock root + openssh.authorizedKeys.keys = lib.mkForce []; + }; + }; + }; + + home-manager.users = { + soispha.home = { + username = "soispha"; + homeDirectory = config.users.users.soispha.home; + stateVersion = "23.05"; + enableNixpkgsReleaseCheck = true; + }; + + root.home = { + username = "root"; + homeDirectory = config.users.users.root.home; + stateVersion = "23.05"; + enableNixpkgsReleaseCheck = true; }; }; }; diff --git a/modules/by-name/ve/version/module.nix b/modules/by-name/ve/version/module.nix index 77cada14..fc03b107 100644 --- a/modules/by-name/ve/version/module.nix +++ b/modules/by-name/ve/version/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/wa/water-reminder/module.nix b/modules/by-name/wa/water-reminder/module.nix new file mode 100644 index 00000000..76e5aafa --- /dev/null +++ b/modules/by-name/wa/water-reminder/module.nix @@ -0,0 +1,66 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.soispha.services.water-reminder; +in { + options.soispha.services.water-reminder = { + enable = lib.mkEnableOption "periodic reminder for water intake"; + + frequency = lib.mkOption { + type = lib.types.str; + default = "*-*-* *:00/30:00"; # Every 30 minutes + description = '' + How often to remind. This value is passed to the systemd + timer configuration as the `OnCalendar` option. See + {manpage}`systemd.time(7)` for more information about the format. + ''; + }; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.soispha = { + systemd.user.services.water-reminder = { + Unit = {Description = "Water reminder";}; + Service = { + CPUSchedulingPolicy = "idle"; + IOSchedulingClass = "idle"; + ExecStart = lib.getExe ( + pkgs.writeShellApplication { + name = "water-reminder"; + + inheritPath = false; + runtimeInputs = [pkgs.libnotify]; + + text = + # bash + '' + notify-send 'Seek fluid intake' 'Water intake required' --wait --expire-time=0 --urgency=critical + ''; + } + ); + }; + }; + + systemd.user.timers.water-reminder = { + Unit = {Description = "periodic reminder for water intake";}; + Timer = { + Unit = "water-reminder.service"; + OnCalendar = cfg.frequency; + }; + Install = {WantedBy = ["timers.target"];}; + }; + }; + }; +} diff --git a/modules/by-name/wa/waydroid/module.nix b/modules/by-name/wa/waydroid/module.nix index 58bce7d1..a55ccf90 100644 --- a/modules/by-name/wa/waydroid/module.nix +++ b/modules/by-name/wa/waydroid/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/xd/xdg/module.nix b/modules/by-name/xd/xdg/module.nix index f1781d86..94c5a975 100644 --- a/modules/by-name/xd/xdg/module.nix +++ b/modules/by-name/xd/xdg/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, lib, @@ -38,6 +47,8 @@ in { config = lib.mkIf cfg.enable { home-manager.users.soispha = { xdg = { + configFile."xdg-desktop-portal-termfilechooser/config".source = tfcConfigFile; + desktopEntries = { url-handler = { name = "url-handler"; @@ -107,8 +118,6 @@ in { }; }; - environment.etc."xdg/xdg-desktop-portal-termfilechooser/config".source = tfcConfigFile; - systemd.user.services.xdg-desktop-portal-termfilechooser = { serviceConfig.ExecStart = [ "" diff --git a/modules/by-name/xd/xdg/scripts/lf-wrapper.sh b/modules/by-name/xd/xdg/scripts/lf-wrapper.sh index f85f7bac..6a5c5295 100755 --- a/modules/by-name/xd/xdg/scripts/lf-wrapper.sh +++ b/modules/by-name/xd/xdg/scripts/lf-wrapper.sh @@ -1,4 +1,15 @@ #!/usr/bin/env sh + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # This wrapper script is invoked by xdg-desktop-portal-termfilechooser. # # For more information about input/output arguments read `xdg-desktop-portal-termfilechooser(5)` diff --git a/modules/by-name/xd/xdg/scripts/url-handler.sh b/modules/by-name/xd/xdg/scripts/url-handler.sh index 5aa01a48..b3563349 100755 --- a/modules/by-name/xd/xdg/scripts/url-handler.sh +++ b/modules/by-name/xd/xdg/scripts/url-handler.sh @@ -1,8 +1,18 @@ #!/usr/bin/env sh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + project="$({ tskm projects list - echo nvim zathura + printf "%s\n" nvim zathura } | rofi -sep "$(printf "\n")" -dmenu)" if [ "$project" = "nvim" ]; then @@ -10,9 +20,10 @@ if [ "$project" = "nvim" ]; then elif [ "$project" = "zathura" ]; then zathura "$1" elif [ "$project" ]; then - tskm open "$project" "$1" + tskm open project "$project" "$1" else - notify-send "(URL HANDLER) No project selected"; exit 1 + notify-send "(URL HANDLER) No project selected" + exit 1 fi # vim: ft=sh diff --git a/modules/by-name/ya/yambar/config/config.yml b/modules/by-name/ya/yambar/config/config.yml index 442135aa..14da18fd 100644 --- a/modules/by-name/ya/yambar/config/config.yml +++ b/modules/by-name/ya/yambar/config/config.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + --- # Config file for yambar # Note that this may be version-dependent, this file is written for v1.8.0 diff --git a/modules/by-name/ya/yambar/module.nix b/modules/by-name/ya/yambar/module.nix index 2d0f1e97..40edf978 100644 --- a/modules/by-name/ya/yambar/module.nix +++ b/modules/by-name/ya/yambar/module.nix @@ -1,6 +1,14 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, - sysLib, pkgs, lib, ... @@ -12,12 +20,11 @@ dependencies, ... }: - sysLib.writeShellScript { + lib.getExe (pkgs.writeShellApplication { inherit name; - src = ./scripts/${name}.sh; - dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash;}); - } - + "/bin/${name}"; + text = builtins.readFile ./scripts/${name}.sh; + runtimeInputs = dependencies ++ (builtins.attrValues {inherit (pkgs) dash;}); + }); mkWrapper = bin: cmd: pkgs.writeShellScript cmd '' diff --git a/modules/by-name/ya/yambar/scripts/disk.sh b/modules/by-name/ya/yambar/scripts/disk.sh index a5547a74..4efe1384 100755 --- a/modules/by-name/ya/yambar/scripts/disk.sh +++ b/modules/by-name/ya/yambar/scripts/disk.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH diff --git a/modules/by-name/ya/yambar/scripts/mpd_song_name.sh b/modules/by-name/ya/yambar/scripts/mpd_song_name.sh index 7d294781..5c288d1a 100755 --- a/modules/by-name/ya/yambar/scripts/mpd_song_name.sh +++ b/modules/by-name/ya/yambar/scripts/mpd_song_name.sh @@ -1,5 +1,15 @@ #!/usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH diff --git a/modules/by-name/ya/yambar/scripts/network.sh b/modules/by-name/ya/yambar/scripts/network.sh index adfc93df..d642e6c7 100755 --- a/modules/by-name/ya/yambar/scripts/network.sh +++ b/modules/by-name/ya/yambar/scripts/network.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH diff --git a/modules/by-name/ya/yambar/scripts/sound-volume.sh b/modules/by-name/ya/yambar/scripts/sound-volume.sh index 8a98daf7..9d9f7be8 100755 --- a/modules/by-name/ya/yambar/scripts/sound-volume.sh +++ b/modules/by-name/ya/yambar/scripts/sound-volume.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck source=/dev/null SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH diff --git a/modules/by-name/ya/yambar/settings/default.nix b/modules/by-name/ya/yambar/settings/default.nix index 52c3d1f7..ebe17261 100644 --- a/modules/by-name/ya/yambar/settings/default.nix +++ b/modules/by-name/ya/yambar/settings/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. # TODO: This should not do something depending on whether the host is a laptop or not. It # should instead match on monitor-width or scale factor. <2024-11-29> { diff --git a/modules/by-name/yt/yt/config.toml b/modules/by-name/yt/yt/config.toml index 981481d9..aecb74ba 100644 --- a/modules/by-name/yt/yt/config.toml +++ b/modules/by-name/yt/yt/config.toml @@ -1,2 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [download] max_cache_size = "5 GiB" diff --git a/modules/by-name/yt/yt/input.conf.license b/modules/by-name/yt/yt/input.conf.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/yt/yt/input.conf.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/yt/yt/module.nix b/modules/by-name/yt/yt/module.nix index b93feeb5..4e7e90fe 100644 --- a/modules/by-name/yt/yt/module.nix +++ b/modules/by-name/yt/yt/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/yt/yt/mpv.conf.license b/modules/by-name/yt/yt/mpv.conf.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/yt/yt/mpv.conf.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/by-name/za/zathura/module.nix b/modules/by-name/za/zathura/module.nix index 1c55be54..a332e313 100644 --- a/modules/by-name/za/zathura/module.nix +++ b/modules/by-name/za/zathura/module.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/by-name/zs/zsh/config/command_not_found/command_not_found_insult.sh b/modules/by-name/zs/zsh/config/command_not_found/command_not_found_insult.sh index 5126845a..a5d71939 100644 --- a/modules/by-name/zs/zsh/config/command_not_found/command_not_found_insult.sh +++ b/modules/by-name/zs/zsh/config/command_not_found/command_not_found_insult.sh @@ -1,4 +1,15 @@ #! /usr/bin/env bash + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + print_message() { local messages diff --git a/modules/by-name/zs/zsh/config/custom_cursor.zsh b/modules/by-name/zs/zsh/config/custom_cursor.zsh index 071bb5fe..aa137173 100644 --- a/modules/by-name/zs/zsh/config/custom_cursor.zsh +++ b/modules/by-name/zs/zsh/config/custom_cursor.zsh @@ -1,5 +1,15 @@ #!/usr/bin/env zsh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + autoload -U add-zsh-hook autoload -U add-zle-hook-widget diff --git a/modules/by-name/zs/zsh/config/edit_command_line.zsh b/modules/by-name/zs/zsh/config/edit_command_line.zsh index 1d51a4e8..e14da5c6 100644 --- a/modules/by-name/zs/zsh/config/edit_command_line.zsh +++ b/modules/by-name/zs/zsh/config/edit_command_line.zsh @@ -1,5 +1,15 @@ #! /usr/bin/env zsh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + autoload -Uz edit-command-line wrapped_edit-command-line() { diff --git a/modules/by-name/zs/zsh/config/keymaps/.safe.zsh b/modules/by-name/zs/zsh/config/keymaps/.safe.zsh index ee3bfa32..b37d22f2 100644 --- a/modules/by-name/zs/zsh/config/keymaps/.safe.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/.safe.zsh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + bindkey -M .safe "^J" .accept-line bindkey -M .safe "^M" .accept-line bindkey -R -M .safe "^@"-"^I" .self-insert diff --git a/modules/by-name/zs/zsh/config/keymaps/command.zsh b/modules/by-name/zs/zsh/config/keymaps/command.zsh index 81ae6dda..e195ed4c 100644 --- a/modules/by-name/zs/zsh/config/keymaps/command.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/command.zsh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Keymap used in the vicmd `execute-named-cmd` mode bindkey -N command diff --git a/modules/by-name/zs/zsh/config/keymaps/emacs.zsh b/modules/by-name/zs/zsh/config/keymaps/emacs.zsh index b789faf5..1cbf77e9 100644 --- a/modules/by-name/zs/zsh/config/keymaps/emacs.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/emacs.zsh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + bindkey -N emacs bindkey -M emacs "^[A" accept-and-hold diff --git a/modules/by-name/zs/zsh/config/keymaps/isearch.zsh b/modules/by-name/zs/zsh/config/keymaps/isearch.zsh index db80bae8..d5e68f1b 100644 --- a/modules/by-name/zs/zsh/config/keymaps/isearch.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/isearch.zsh @@ -1,2 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Nothing? bindkey -N isearch diff --git a/modules/by-name/zs/zsh/config/keymaps/vicmd.zsh b/modules/by-name/zs/zsh/config/keymaps/vicmd.zsh index ceb4f348..acf3746d 100644 --- a/modules/by-name/zs/zsh/config/keymaps/vicmd.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/vicmd.zsh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + bindkey -N vicmd # Bind in string to out string diff --git a/modules/by-name/zs/zsh/config/keymaps/viins.zsh b/modules/by-name/zs/zsh/config/keymaps/viins.zsh index d215d190..3353956c 100644 --- a/modules/by-name/zs/zsh/config/keymaps/viins.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/viins.zsh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + bindkey -N viins # Completion Debugging diff --git a/modules/by-name/zs/zsh/config/keymaps/viopp.zsh b/modules/by-name/zs/zsh/config/keymaps/viopp.zsh index 8b291d00..3dd900f8 100644 --- a/modules/by-name/zs/zsh/config/keymaps/viopp.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/viopp.zsh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + bindkey -N viopp bindkey -M viopp "t" down-line diff --git a/modules/by-name/zs/zsh/config/keymaps/visual.zsh b/modules/by-name/zs/zsh/config/keymaps/visual.zsh index c09cd578..73191d94 100644 --- a/modules/by-name/zs/zsh/config/keymaps/visual.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/visual.zsh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + bindkey -N visual bindkey -M visual "^[" deactivate-region diff --git a/modules/by-name/zs/zsh/config/keymaps_end.zsh b/modules/by-name/zs/zsh/config/keymaps_end.zsh index 2e973de4..2ce403a5 100644 --- a/modules/by-name/zs/zsh/config/keymaps_end.zsh +++ b/modules/by-name/zs/zsh/config/keymaps_end.zsh @@ -1,2 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Use the vi imitation keymap as default bindkey -A viins main diff --git a/modules/by-name/zs/zsh/config/keymaps_start.zsh b/modules/by-name/zs/zsh/config/keymaps_start.zsh index 2504e799..dfae8dcc 100644 --- a/modules/by-name/zs/zsh/config/keymaps_start.zsh +++ b/modules/by-name/zs/zsh/config/keymaps_start.zsh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Delete all default keymaps (with the exception of .safe) bindkey -D command emacs isearch main vicmd viins viopp visual diff --git a/modules/by-name/zs/zsh/config/zsh-init.zsh b/modules/by-name/zs/zsh/config/zsh-init.zsh index aac344dc..740fc44b 100644 --- a/modules/by-name/zs/zsh/config/zsh-init.zsh +++ b/modules/by-name/zs/zsh/config/zsh-init.zsh @@ -1,5 +1,15 @@ #!/usr/bin/env zsh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Display current tasks [ -z "$NVIM" ] && task next diff --git a/modules/by-name/zs/zsh/module.nix b/modules/by-name/zs/zsh/module.nix index b50e72ac..bf7e2a71 100644 --- a/modules/by-name/zs/zsh/module.nix +++ b/modules/by-name/zs/zsh/module.nix @@ -1,8 +1,17 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, - shell_library, system, + pkgs, ... }: let cfg = config.soispha.programs.zsh; @@ -12,7 +21,10 @@ sourceFile = path: "source ${path}\n"; extraFiles = builtins.concatStringsSep "\n" ( - builtins.map sourceFile ( + builtins.map (value: + if builtins.isPath value + then (sourceFile value) + else value) ( builtins.attrValues cfg.integrations ) ); @@ -21,7 +33,7 @@ in { enable = lib.mkEnableOption "zsh"; integrations = lib.mkOption { - type = lib.types.attrsOf lib.types.path; + type = lib.types.attrsOf (lib.types.either lib.types.path lib.types.str); example = '' { atuin = ./integrations/atuin.zsh; @@ -91,23 +103,18 @@ in { setopt VI ''; - initExtraFirst = - sourceFile ./config/zsh-init.zsh - + '' - SHELL_LIBRARY_VERSION="2.1.2" source ${shell_library.rawLib.${system}} - ''; - - initExtra = let + initContent = let start = lib.modules.mkBefore ( - # NOTE: This must be before the insult, as we otherwise override the previous handler <2024-02-28> - sourceFile ./config/command_not_found/command_not_found.sh - + sourceFile ./config/command_not_found/command_not_found_insult.sh + sourceFile ./config/zsh-init.zsh + sourceFile ./config/custom_cursor.zsh + sourceFile ./config/edit_command_line.zsh + sourceFile ./plugins/zsh-history-substring-search.zsh ); end = lib.modules.mkAfter ( - sourceFile ./config/keymaps_start.zsh + # NOTE(@bpeetz): Put this here, so that command handler in `extraFiles` + # are not overriding this. <2025-05-16> + sourceFile ./config/command_not_found/command_not_found_insult.sh + + sourceFile ./config/keymaps_start.zsh + sourceFile ./config/keymaps/command.zsh + sourceFile ./config/keymaps/emacs.zsh + sourceFile ./config/keymaps/isearch.zsh @@ -131,11 +138,6 @@ in { HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND = "bg=cyan,fg=white"; HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND = "fg=red,underline,standout,bold"; }; - - shellAliases = { - ll = ". ll"; - lm = ". lm"; - }; }; }; }; diff --git a/modules/by-name/zs/zsh/plugins/zsh-history-substring-search.zsh b/modules/by-name/zs/zsh/plugins/zsh-history-substring-search.zsh index 4314b784..cc2b6e98 100644 --- a/modules/by-name/zs/zsh/plugins/zsh-history-substring-search.zsh +++ b/modules/by-name/zs/zsh/plugins/zsh-history-substring-search.zsh @@ -1,46 +1,25 @@ #!/usr/bin/env zsh -############################################################################## -# Original Source before 2024 modifications: -# https://github.com/zsh-users/zsh-history-substring-search/blob/87ce96b1862928d84b1afe7c173316614b30e301/zsh-history-substring-search.zsh + +# nixos-config - My current NixOS configuration # # Copyright (c) 2009 Peter Stephenson # Copyright (c) 2011 Guido van Steen -# Copyright (c) 2011 Suraj N. Kurapati # Copyright (c) 2011 Sorin Ionescu +# Copyright (c) 2011 Suraj N. Kurapati # Copyright (c) 2011 Vincent Guerci # Copyright (c) 2016 Geza Lore # Copyright (c) 2017 Bengt Brodersen -# Copyright (c) 2024 Benedikt Peetz -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: +# Copyright (c) 2024 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later # -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. +# This file is part of my nixos-config. # -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# -# * Neither the name of the FIZSH nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################## +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +# Original Source before 2024 modifications: +# https://github.com/zsh-users/zsh-history-substring-search/blob/87ce96b1862928d84b1afe7c173316614b30e301/zsh-history-substring-search.zsh #----------------------------------------------------------------------------- # declare global configuration variables diff --git a/modules/common/abstract-nord.png.license b/modules/common/abstract-nord.png.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/common/abstract-nord.png.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/common/default.nix b/modules/common/default.nix index 4fc6bf51..aadb22bd 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -1,12 +1,31 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. # This file contains common configuration applied to every host. # It should only `enable` options defined in the `modules/by-name` directory. { config, pkgs, lib, + # Needed for nixos-shell + libraries, + modules, + openPRsNixpkgs, + packageSets, + system, + self, + externalDependencies, + externalBinaries, ... }: { soispha = { + age.enable = true; boot.enable = true; cleanup.enable = true; documentation.enable = true; @@ -16,17 +35,60 @@ enableEmoji = true; }; + hardware = { + enable = lib.mkDefault true; + }; home-manager.enable = true; impermanence = { enable = true; directories = [ "/etc/nixos" - "/var/log" "/var/lib/systemd" - "/var/lib/nixos" ]; }; + + nixos-shell = { + enable = lib.mkDefault true; + configuration = { + specialArgs = { + inherit + libraries + modules + ; + }; + value = lib.mkMerge [ + { + _module.args = { + inherit + # extra package sources + openPRsNixpkgs + packageSets + # extra information + system + # nix registry + self + externalDependencies + # bins + # TODO: Integrate these into `pkgs/by-name` <2024-05-22> + externalBinaries + ; + }; + } + + { + require = [ + ./nixos_shell_configuration.nix + + ../../modules + ../../modules/common + ]; + } + ]; + }; + mounts = {}; + }; + polkit.enable = true; power.enable = true; xdg.enable = true; @@ -36,7 +98,17 @@ enable = true; user = "soispha"; }; + backup = { + storagebox = { + enable = lib.mkDefault true; + user = "u459143-sub1"; + }; + local = { + enable = lib.mkDefault true; + }; + }; fwupd.enable = true; + mako.enable = true; mpd = { enable = true; directories = let @@ -57,10 +129,10 @@ printing.enable = true; scanning.enable = true; snapper.enable = true; - steam.enable = false; + water-reminder.enable = true; systemDiff.enable = true; unison = { - enable = true; + enable = lib.mkDefault true; foreign.userName = "soispha"; dataDir = "${config.home-manager.users.soispha.xdg.dataHome}/unison"; @@ -73,14 +145,20 @@ config.home-manager.users.soispha.home.file); in [ - # already synchronized by the taskserver + # TODO(@bpeetz): Move these to their respective modules <2025-05-09> + # Already synchronized by TaskChampion sync server "~/.local/share/task" + # Already synchronized by atuin sync server + "~/.local/share/atuin" + # Already synchronized by mbsync + "~/.local/share/maildir" # Should not be synchronized "~/.local/share/unison" - # Is just to big to be synchronized (# TODO: Work around that <2024-08-31> ) + # These are just to big to be synchronized (# TODO: Work around that <2024-08-31> ) "~/media/music" + "~/.local/share/Steam" ] ++ homeManagerSymlinks; @@ -100,19 +178,26 @@ }; programs = { + i3bar-river.enable = true; + i3status-rust.enable = true; + nvim = { enable = true; shell = pkgs.zsh; }; - atuin.enable = true; + atuin = { + enable = true; + enableAge = lib.mkDefault true; + }; cargo.enable = true; direnv.enable = true; git.enable = true; imv.enable = true; less.enable = true; lf.enable = true; + gpg.enable = true; river = { - enable = true; + enable = lib.mkDefault true; init = { rules = [ { @@ -174,8 +259,8 @@ pointer-12951-6505-ZSA_Technology_Labs_Moonlander_Mark_I = [["pointer-accel" "0"] ["accel-profile" "none"]]; }; backgroundStart = [ + # TODO(@bpeetz): Move these to systemd units/their own modules <2025-05-18> pkgs.gammastep - pkgs.yambar pkgs.mako ["${lib.getExe pkgs.swaybg}" "--image" "${./abstract-nord.png}"] @@ -186,17 +271,22 @@ }; firefox.enable = true; mpv.enable = true; + steam.enable = true; + ssh.enable = true; swaylock.enable = true; timewarrior.enable = true; taskwarrior = { enable = true; + enableAge = lib.mkDefault true; + hooks = import ./hooks {inherit pkgs lib config;}; }; tskm = { enable = true; projects = builtins.fromJSON (builtins.readFile ./projects.json); }; - yambar.enable = true; + nix-index.enable = true; + yambar.enable = false; yt.enable = true; zathura.enable = true; zsh.enable = true; diff --git a/modules/common/hooks/default.nix b/modules/common/hooks/default.nix index e2d12807..5b694039 100644 --- a/modules/common/hooks/default.nix +++ b/modules/common/hooks/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, lib, diff --git a/modules/common/hooks/scripts/sync-git-repo.sh b/modules/common/hooks/scripts/sync-git-repo.sh index ad7368f3..fe0d0085 100755 --- a/modules/common/hooks/scripts/sync-git-repo.sh +++ b/modules/common/hooks/scripts/sync-git-repo.sh @@ -1,5 +1,15 @@ #!/usr/bin/env sh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + task_data="$(task _get rc.data.location)" [ "$task_data" ] || die "Taskwarrior should have a location set" diff --git a/modules/common/nixos_shell_configuration.nix b/modules/common/nixos_shell_configuration.nix new file mode 100644 index 00000000..1bec0145 --- /dev/null +++ b/modules/common/nixos_shell_configuration.nix @@ -0,0 +1,66 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{...}: { + soispha = { + networking = { + enable = true; + hostName = "lahmu"; + mode = "systemd-networkd"; + }; + + nixos-shell.enable = false; + + nixpkgs = { + enable = true; + systemName = "x86_64-linux"; + }; + + services = { + unison.enable = false; + backup = { + storagebox.enable = false; + local.enable = false; + }; + }; + + programs = { + river.enable = false; + + # We don't have access to the age secrets. + atuin.enableAge = false; + taskwarrior.enableAge = false; + }; + + locale = { + enable = true; + keyMap = "us"; + }; + + users = { + enable = true; + enableDeprecatedPlugdev = true; + + # Make logging in impossible. + # (This also removes root a obvious access-point from the virtual machine) + hashedPassword = ""; + }; + }; + + soispha = { + hardware = { + enable = false; + }; + + disks.enable = false; + }; + + # We run without state + # system.stateVersion = null; +} diff --git a/modules/common/projects.json b/modules/common/projects.json index 48a10f03..36a2ae45 100644 --- a/modules/common/projects.json +++ b/modules/common/projects.json @@ -36,6 +36,7 @@ "bank": {}, "google": {}, "health": {}, + "job": {}, "sweden": {} } }, diff --git a/modules/common/projects.json.license b/modules/common/projects.json.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/common/projects.json.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/default.nix b/modules/default.nix index a34e807f..ef885a21 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,9 +1,18 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. # NOTE: This file **must** not depend on `pkgs`. This is because `pkgs` is defined in a # module imported by it, and thus would require infinite recursion. <2024-10-18> -{nixLib, ...}: let +{libraries, ...}: let files = builtins.attrValues - (nixLib.mkByName { + (libraries.extra.mkByName { baseDirectory = ./by-name; fileName = "module.nix"; finalizeFunction = name: value: value; diff --git a/modules/home.legacy/conf/alacritty/default.nix b/modules/home.legacy/conf/alacritty/default.nix index 87d02959..493c4114 100644 --- a/modules/home.legacy/conf/alacritty/default.nix +++ b/modules/home.legacy/conf/alacritty/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {lib, ...}: let config_file = '' ${lib.strings.fileContents ./toml/general.toml} diff --git a/modules/home.legacy/conf/alacritty/toml/bell.toml b/modules/home.legacy/conf/alacritty/toml/bell.toml index 912d08e3..821306cc 100644 --- a/modules/home.legacy/conf/alacritty/toml/bell.toml +++ b/modules/home.legacy/conf/alacritty/toml/bell.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Bell # # The bell is rung every time the BEL control character is received. diff --git a/modules/home.legacy/conf/alacritty/toml/colorscheme.toml b/modules/home.legacy/conf/alacritty/toml/colorscheme.toml index f98a5b91..13c796c9 100644 --- a/modules/home.legacy/conf/alacritty/toml/colorscheme.toml +++ b/modules/home.legacy/conf/alacritty/toml/colorscheme.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Nightfox Alacritty Colors ## name: carbonfox ## upstream: https://github.com/edeneast/nightfox.nvim/raw/main/extra/carbonfox/alacritty.toml diff --git a/modules/home.legacy/conf/alacritty/toml/cursor.toml b/modules/home.legacy/conf/alacritty/toml/cursor.toml index d9cb93f4..6e633b5a 100644 --- a/modules/home.legacy/conf/alacritty/toml/cursor.toml +++ b/modules/home.legacy/conf/alacritty/toml/cursor.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [cursor] blink_interval = 750 blink_timeout = 5 diff --git a/modules/home.legacy/conf/alacritty/toml/env.toml b/modules/home.legacy/conf/alacritty/toml/env.toml index fdd4e5d1..307f1f1d 100644 --- a/modules/home.legacy/conf/alacritty/toml/env.toml +++ b/modules/home.legacy/conf/alacritty/toml/env.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [env] TERM = "alacritty" COLORTERM = "truecolor" diff --git a/modules/home.legacy/conf/alacritty/toml/font.toml b/modules/home.legacy/conf/alacritty/toml/font.toml index dd18a6fb..fd8b0b94 100644 --- a/modules/home.legacy/conf/alacritty/toml/font.toml +++ b/modules/home.legacy/conf/alacritty/toml/font.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [font] builtin_box_drawing = true size = 12.0 diff --git a/modules/home.legacy/conf/alacritty/toml/general.toml b/modules/home.legacy/conf/alacritty/toml/general.toml index 4651b51b..588d8ea0 100644 --- a/modules/home.legacy/conf/alacritty/toml/general.toml +++ b/modules/home.legacy/conf/alacritty/toml/general.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Configuration for Alacritty, the GPU enhanced terminal emulator. [general] diff --git a/modules/home.legacy/conf/alacritty/toml/hints.toml b/modules/home.legacy/conf/alacritty/toml/hints.toml index 31d91a37..da18dc59 100644 --- a/modules/home.legacy/conf/alacritty/toml/hints.toml +++ b/modules/home.legacy/conf/alacritty/toml/hints.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [hints] alphabet = "jfkdls;ahgurieowpq" diff --git a/modules/home.legacy/conf/alacritty/toml/keyboard_bindings.toml b/modules/home.legacy/conf/alacritty/toml/keyboard_bindings.toml index 8e0b1e13..f2a6eb55 100644 --- a/modules/home.legacy/conf/alacritty/toml/keyboard_bindings.toml +++ b/modules/home.legacy/conf/alacritty/toml/keyboard_bindings.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [[keyboard.bindings]] action = "Paste" key = "P" diff --git a/modules/home.legacy/conf/alacritty/toml/mouse.toml b/modules/home.legacy/conf/alacritty/toml/mouse.toml index eba68edf..cbc9cd32 100644 --- a/modules/home.legacy/conf/alacritty/toml/mouse.toml +++ b/modules/home.legacy/conf/alacritty/toml/mouse.toml @@ -1,2 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [mouse] hide_when_typing = false diff --git a/modules/home.legacy/conf/alacritty/toml/mouse_bindings.toml b/modules/home.legacy/conf/alacritty/toml/mouse_bindings.toml index 1b281748..e566a452 100644 --- a/modules/home.legacy/conf/alacritty/toml/mouse_bindings.toml +++ b/modules/home.legacy/conf/alacritty/toml/mouse_bindings.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [[mouse.bindings]] action = "Copy" mouse = "Middle" diff --git a/modules/home.legacy/conf/alacritty/toml/scrolling.toml b/modules/home.legacy/conf/alacritty/toml/scrolling.toml index ed7c22cf..09240872 100644 --- a/modules/home.legacy/conf/alacritty/toml/scrolling.toml +++ b/modules/home.legacy/conf/alacritty/toml/scrolling.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [scrolling] history = 10000 multiplier = 3 diff --git a/modules/home.legacy/conf/alacritty/toml/selection.toml b/modules/home.legacy/conf/alacritty/toml/selection.toml index 60ea0495..ebc8c849 100644 --- a/modules/home.legacy/conf/alacritty/toml/selection.toml +++ b/modules/home.legacy/conf/alacritty/toml/selection.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [selection] save_to_clipboard = false semantic_escape_chars = ",│`|:\"' ()[]{}<>\t" diff --git a/modules/home.legacy/conf/alacritty/toml/window.toml b/modules/home.legacy/conf/alacritty/toml/window.toml index 123b5b7a..edc9cf6e 100644 --- a/modules/home.legacy/conf/alacritty/toml/window.toml +++ b/modules/home.legacy/conf/alacritty/toml/window.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [window] decorations = "none" decorations_theme_variant = "None" diff --git a/modules/home.legacy/conf/alacritty/yaml/base.yml b/modules/home.legacy/conf/alacritty/yaml/base.yml index 0791a60f..637d0d2e 100644 --- a/modules/home.legacy/conf/alacritty/yaml/base.yml +++ b/modules/home.legacy/conf/alacritty/yaml/base.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + --- # Configuration for Alacritty, the GPU enhanced terminal emulator. diff --git a/modules/home.legacy/conf/alacritty/yaml/bell.yml b/modules/home.legacy/conf/alacritty/yaml/bell.yml index bd071aeb..4331a121 100644 --- a/modules/home.legacy/conf/alacritty/yaml/bell.yml +++ b/modules/home.legacy/conf/alacritty/yaml/bell.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Bell # # The bell is rung every time the BEL control character is received. diff --git a/modules/home.legacy/conf/alacritty/yaml/colors.yml b/modules/home.legacy/conf/alacritty/yaml/colors.yml index 899c660a..05d2e0e6 100644 --- a/modules/home.legacy/conf/alacritty/yaml/colors.yml +++ b/modules/home.legacy/conf/alacritty/yaml/colors.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Colors (Tomorrow Night) colors: # Default colors diff --git a/modules/home.legacy/conf/alacritty/yaml/colorscheme.yml b/modules/home.legacy/conf/alacritty/yaml/colorscheme.yml index 4e0abfae..0b07fe80 100644 --- a/modules/home.legacy/conf/alacritty/yaml/colorscheme.yml +++ b/modules/home.legacy/conf/alacritty/yaml/colorscheme.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Nightfox Alacritty Colors # Style: carbonfox # Upstream: https://github.com/edeneast/nightfox.nvim/raw/main/extra/carbonfox/nightfox_alacritty.yml diff --git a/modules/home.legacy/conf/alacritty/yaml/cursor.yml b/modules/home.legacy/conf/alacritty/yaml/cursor.yml index ef700ebc..5a3946f2 100644 --- a/modules/home.legacy/conf/alacritty/yaml/cursor.yml +++ b/modules/home.legacy/conf/alacritty/yaml/cursor.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + cursor: # Cursor style style: diff --git a/modules/home.legacy/conf/alacritty/yaml/debug.yml b/modules/home.legacy/conf/alacritty/yaml/debug.yml index 2c391da2..e876d801 100644 --- a/modules/home.legacy/conf/alacritty/yaml/debug.yml +++ b/modules/home.legacy/conf/alacritty/yaml/debug.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + #debug: # Display the time it takes to redraw each frame. #render_timer: false diff --git a/modules/home.legacy/conf/alacritty/yaml/env.yml b/modules/home.legacy/conf/alacritty/yaml/env.yml index ee7528b7..585416a1 100644 --- a/modules/home.legacy/conf/alacritty/yaml/env.yml +++ b/modules/home.legacy/conf/alacritty/yaml/env.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Any items in the `env` entry below will be added as # environment variables. Some entries may override variables # set by alacritty itself. diff --git a/modules/home.legacy/conf/alacritty/yaml/font.yml b/modules/home.legacy/conf/alacritty/yaml/font.yml index a3fd3b1d..a711f231 100644 --- a/modules/home.legacy/conf/alacritty/yaml/font.yml +++ b/modules/home.legacy/conf/alacritty/yaml/font.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Font configuration font: # Normal (roman) font face diff --git a/modules/home.legacy/conf/alacritty/yaml/hints.yml b/modules/home.legacy/conf/alacritty/yaml/hints.yml index 8c35548b..b9d75378 100644 --- a/modules/home.legacy/conf/alacritty/yaml/hints.yml +++ b/modules/home.legacy/conf/alacritty/yaml/hints.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Hints # # Terminal hints can be used to find text or hyperlink in the visible part of diff --git a/modules/home.legacy/conf/alacritty/yaml/key_bindings.yml b/modules/home.legacy/conf/alacritty/yaml/key_bindings.yml index c8be747e..6bf31719 100644 --- a/modules/home.legacy/conf/alacritty/yaml/key_bindings.yml +++ b/modules/home.legacy/conf/alacritty/yaml/key_bindings.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Key bindings # # Key bindings are specified as a list of objects. For example, this is the diff --git a/modules/home.legacy/conf/alacritty/yaml/mouse.yml b/modules/home.legacy/conf/alacritty/yaml/mouse.yml index 4bdb408b..c5d2acbb 100644 --- a/modules/home.legacy/conf/alacritty/yaml/mouse.yml +++ b/modules/home.legacy/conf/alacritty/yaml/mouse.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + mouse: # Click settings # diff --git a/modules/home.legacy/conf/alacritty/yaml/mouse_bindings.yml b/modules/home.legacy/conf/alacritty/yaml/mouse_bindings.yml index ab244d21..82e2b92b 100644 --- a/modules/home.legacy/conf/alacritty/yaml/mouse_bindings.yml +++ b/modules/home.legacy/conf/alacritty/yaml/mouse_bindings.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Mouse bindings # # Mouse bindings are specified as a list of objects, much like the key diff --git a/modules/home.legacy/conf/alacritty/yaml/scrolling.yml b/modules/home.legacy/conf/alacritty/yaml/scrolling.yml index 50365627..0d108f76 100644 --- a/modules/home.legacy/conf/alacritty/yaml/scrolling.yml +++ b/modules/home.legacy/conf/alacritty/yaml/scrolling.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + scrolling: # Maximum number of lines in the scrollback buffer. # Specifying '0' will disable scrolling. diff --git a/modules/home.legacy/conf/alacritty/yaml/selection.yml b/modules/home.legacy/conf/alacritty/yaml/selection.yml index 5e5bd544..100118fc 100644 --- a/modules/home.legacy/conf/alacritty/yaml/selection.yml +++ b/modules/home.legacy/conf/alacritty/yaml/selection.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + selection: # This string contains all characters that are used as separators for # "semantic words" in Alacritty. diff --git a/modules/home.legacy/conf/alacritty/yaml/shell.yml b/modules/home.legacy/conf/alacritty/yaml/shell.yml index 04844dd0..4da99581 100644 --- a/modules/home.legacy/conf/alacritty/yaml/shell.yml +++ b/modules/home.legacy/conf/alacritty/yaml/shell.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # Shell # # You can set `shell.program` to the path of your favorite shell, e.g. diff --git a/modules/home.legacy/conf/alacritty/yaml/window.yml b/modules/home.legacy/conf/alacritty/yaml/window.yml index 7b89b6ed..2d4006ba 100644 --- a/modules/home.legacy/conf/alacritty/yaml/window.yml +++ b/modules/home.legacy/conf/alacritty/yaml/window.yml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + window: # Window dimensions (changes require restart) # diff --git a/modules/home.legacy/conf/beets/default.nix b/modules/home.legacy/conf/beets/default.nix index e0421a9d..de05ca24 100644 --- a/modules/home.legacy/conf/beets/default.nix +++ b/modules/home.legacy/conf/beets/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, lib, diff --git a/modules/home.legacy/conf/beets/plugins.nix b/modules/home.legacy/conf/beets/plugins.nix index 9500364b..09eeac5b 100644 --- a/modules/home.legacy/conf/beets/plugins.nix +++ b/modules/home.legacy/conf/beets/plugins.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: # NOTE: This list is here and not split over the various plugin dirs, as we need a way to # specify the order plugins are loaded in. <2024-08-11> diff --git a/modules/home.legacy/conf/beets/plugins/badfiles/default.nix b/modules/home.legacy/conf/beets/plugins/badfiles/default.nix index 33884785..505ecb5b 100644 --- a/modules/home.legacy/conf/beets/plugins/badfiles/default.nix +++ b/modules/home.legacy/conf/beets/plugins/badfiles/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, pkgs, diff --git a/modules/home.legacy/conf/beets/plugins/default.nix b/modules/home.legacy/conf/beets/plugins/default.nix index a0b44e3c..65cd935c 100644 --- a/modules/home.legacy/conf/beets/plugins/default.nix +++ b/modules/home.legacy/conf/beets/plugins/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { imports = [ ./badfiles diff --git a/modules/home.legacy/conf/beets/plugins/duplicates/default.nix b/modules/home.legacy/conf/beets/plugins/duplicates/default.nix index c8a6c108..6ab08d55 100644 --- a/modules/home.legacy/conf/beets/plugins/duplicates/default.nix +++ b/modules/home.legacy/conf/beets/plugins/duplicates/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { programs.beets.settings.duplicates = { keys = ["acoustid_fingerprint"]; diff --git a/modules/home.legacy/conf/beets/plugins/fuzzy/default.nix b/modules/home.legacy/conf/beets/plugins/fuzzy/default.nix index b86b3a20..de37c4e8 100644 --- a/modules/home.legacy/conf/beets/plugins/fuzzy/default.nix +++ b/modules/home.legacy/conf/beets/plugins/fuzzy/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { programs.beets.settings.fuzzy = { # The prefix denoting that a search should be run in fuzzy mode diff --git a/modules/home.legacy/conf/beets/plugins/ihate/default.nix b/modules/home.legacy/conf/beets/plugins/ihate/default.nix index 145f5f8b..51cb6f11 100644 --- a/modules/home.legacy/conf/beets/plugins/ihate/default.nix +++ b/modules/home.legacy/conf/beets/plugins/ihate/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { programs.beets.settings.ihate = { warn = [ diff --git a/modules/home.legacy/conf/beets/plugins/inline/default.nix b/modules/home.legacy/conf/beets/plugins/inline/default.nix index 0dda8cfc..b5655028 100644 --- a/modules/home.legacy/conf/beets/plugins/inline/default.nix +++ b/modules/home.legacy/conf/beets/plugins/inline/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { programs.beets.settings = { item_fields = { diff --git a/modules/home.legacy/conf/beets/plugins/lastgenre/default.nix b/modules/home.legacy/conf/beets/plugins/lastgenre/default.nix index d10ca49f..4d3dcfb0 100644 --- a/modules/home.legacy/conf/beets/plugins/lastgenre/default.nix +++ b/modules/home.legacy/conf/beets/plugins/lastgenre/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { programs.beets.settings.lastgenre = { prefer_specific = false; diff --git a/modules/home.legacy/conf/beets/plugins/lyrics/default.nix b/modules/home.legacy/conf/beets/plugins/lyrics/default.nix index 80544aea..4d566f0b 100644 --- a/modules/home.legacy/conf/beets/plugins/lyrics/default.nix +++ b/modules/home.legacy/conf/beets/plugins/lyrics/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { programs.beets.settings.lyrics = { # Always fetch lyrics (and update them, if some were found) diff --git a/modules/home.legacy/conf/beets/plugins/mbsubmit/default.nix b/modules/home.legacy/conf/beets/plugins/mbsubmit/default.nix index b70f1c63..bdcb3721 100644 --- a/modules/home.legacy/conf/beets/plugins/mbsubmit/default.nix +++ b/modules/home.legacy/conf/beets/plugins/mbsubmit/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, pkgs, diff --git a/modules/home.legacy/conf/beets/plugins/play/default.nix b/modules/home.legacy/conf/beets/plugins/play/default.nix index 635848c0..9d26f16a 100644 --- a/modules/home.legacy/conf/beets/plugins/play/default.nix +++ b/modules/home.legacy/conf/beets/plugins/play/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, pkgs, diff --git a/modules/home.legacy/conf/beets/plugins/replaygain/default.nix b/modules/home.legacy/conf/beets/plugins/replaygain/default.nix index 611f3799..dd176541 100644 --- a/modules/home.legacy/conf/beets/plugins/replaygain/default.nix +++ b/modules/home.legacy/conf/beets/plugins/replaygain/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { programs.beets.settings = { replaygain = { diff --git a/modules/home.legacy/conf/beets/plugins/smartplaylist/default.nix b/modules/home.legacy/conf/beets/plugins/smartplaylist/default.nix index b55c487c..9b52c1ad 100644 --- a/modules/home.legacy/conf/beets/plugins/smartplaylist/default.nix +++ b/modules/home.legacy/conf/beets/plugins/smartplaylist/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {config, ...}: { programs.beets.settings.smartplaylist = { relative_to = config.services.mpd.musicDirectory; diff --git a/modules/home.legacy/conf/beets/plugins/xtractor/default.nix b/modules/home.legacy/conf/beets/plugins/xtractor/default.nix index d4582c5f..0a54385e 100644 --- a/modules/home.legacy/conf/beets/plugins/xtractor/default.nix +++ b/modules/home.legacy/conf/beets/plugins/xtractor/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, pkgs, diff --git a/modules/home.legacy/conf/beets/replace_override.yaml b/modules/home.legacy/conf/beets/replace_override.yaml index 23d6ea55..aea5e54a 100644 --- a/modules/home.legacy/conf/beets/replace_override.yaml +++ b/modules/home.legacy/conf/beets/replace_override.yaml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + --- replace: '[\\/]': _ diff --git a/modules/home.legacy/conf/btop/default.nix b/modules/home.legacy/conf/btop/default.nix index 48572568..ee835b65 100644 --- a/modules/home.legacy/conf/btop/default.nix +++ b/modules/home.legacy/conf/btop/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { programs.btop = { enable = true; diff --git a/modules/home.legacy/conf/dconf/default.nix b/modules/home.legacy/conf/dconf/default.nix index dc439e1e..7aaf03a7 100644 --- a/modules/home.legacy/conf/dconf/default.nix +++ b/modules/home.legacy/conf/dconf/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { # Also see: https://github.com/gvolpe/dconf2nix dconf.settings = { diff --git a/modules/home.legacy/conf/default.nix b/modules/home.legacy/conf/default.nix index 767039c6..622f32d5 100644 --- a/modules/home.legacy/conf/default.nix +++ b/modules/home.legacy/conf/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { imports = [ ./alacritty @@ -5,7 +14,6 @@ ./btop ./dconf ./gammastep - ./gpg ./gtk ./himalaya ./hyfetch @@ -13,17 +21,14 @@ ./keepassxc ./latexindent ./mail - ./mako ./mbsync ./mumble ./neomutt - ./nix-index ./npm ./prusa_slicer ./python ./rclone ./rofi - ./ssh ./starship ./swayidle ./tridactyl diff --git a/modules/home.legacy/conf/gammastep/default.nix b/modules/home.legacy/conf/gammastep/default.nix index 1ae0550b..b4d8bf84 100644 --- a/modules/home.legacy/conf/gammastep/default.nix +++ b/modules/home.legacy/conf/gammastep/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, nixosConfig, diff --git a/modules/home.legacy/conf/gpg/default.nix b/modules/home.legacy/conf/gpg/default.nix deleted file mode 100644 index 1acdf628..00000000 --- a/modules/home.legacy/conf/gpg/default.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: { - programs.gpg = { - enable = true; - homedir = "${config.xdg.dataHome}/gnupg"; - mutableKeys = true; - mutableTrust = true; - - settings = { - default-key = "Benedikt Peetz <benedikt.peetz@b-peetz.de>"; - # TODO: add more - }; - - publicKeys = [ - { - source = ./keys/key_1.asc; - trust = "ultimate"; - } - { - source = ./keys/key_2.asc; - trust = "full"; - } - ]; - }; - services = { - gpg-agent = { - enable = true; - enableZshIntegration = true; - enableScDaemon = true; # smartcards and such things - - # Cache the key passwords - defaultCacheTtl = 60 * 50; - defaultCacheTtlSsh = 60 * 50; - maxCacheTtl = 60 * 50; - maxCacheTtlSsh = 60 * 50; - - pinentryPackage = pkgs.pinentry-curses; - # pinentryPackage = pkgs.pinentry-tty; - - enableSshSupport = true; - sshKeys = let - removeSpace = str: builtins.replaceStrings [" "] [""] str; - in [ - (removeSpace "8321 ED3A 8DB9 99A5 1F3B F80F F268 2914 EA42 DE26") - ]; - }; - }; - - programs.zsh.initExtraFirst = lib.mkBefore '' - export GPG_TTY=$(tty) - - # Magic copied from the gpg-agent manual - unset SSH_AGENT_PID - if [ "''${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then - export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" - fi - - - # Ensure that get gpg agent is started (necessary because ssh does not start it - # automatically and has it's tty updated) - gpg-connect-agent /bye - ''; -} diff --git a/modules/home.legacy/conf/gtk/default.nix b/modules/home.legacy/conf/gtk/default.nix index b19ef3a9..68bef531 100644 --- a/modules/home.legacy/conf/gtk/default.nix +++ b/modules/home.legacy/conf/gtk/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, pkgs, diff --git a/modules/home.legacy/conf/himalaya/default.nix b/modules/home.legacy/conf/himalaya/default.nix index c072693e..22fbe306 100644 --- a/modules/home.legacy/conf/himalaya/default.nix +++ b/modules/home.legacy/conf/himalaya/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { programs.himalaya = { enable = true; diff --git a/modules/home.legacy/conf/hyfetch/default.nix b/modules/home.legacy/conf/hyfetch/default.nix index aec21dbc..bac0731e 100644 --- a/modules/home.legacy/conf/hyfetch/default.nix +++ b/modules/home.legacy/conf/hyfetch/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { programs.hyfetch = { enable = true; diff --git a/modules/home.legacy/conf/iamb/config.json.license b/modules/home.legacy/conf/iamb/config.json.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/home.legacy/conf/iamb/config.json.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/home.legacy/conf/iamb/default.nix b/modules/home.legacy/conf/iamb/default.nix index 2a93472c..764e2efc 100644 --- a/modules/home.legacy/conf/iamb/default.nix +++ b/modules/home.legacy/conf/iamb/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { xdg.configFile."iamb/config.json".source = ./config.json; } diff --git a/modules/home.legacy/conf/keepassxc/default.nix b/modules/home.legacy/conf/keepassxc/default.nix index 38df9055..40f61ba0 100644 --- a/modules/home.legacy/conf/keepassxc/default.nix +++ b/modules/home.legacy/conf/keepassxc/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { xdg.configFile."keepassxc/keepassxc.ini".source = ./keepassxc.ini; } diff --git a/modules/home.legacy/conf/keepassxc/keepassxc.ini b/modules/home.legacy/conf/keepassxc/keepassxc.ini index 288a194b..326f1d99 100644 --- a/modules/home.legacy/conf/keepassxc/keepassxc.ini +++ b/modules/home.legacy/conf/keepassxc/keepassxc.ini @@ -1,3 +1,13 @@ +; nixos-config - My current NixOS configuration +; +; Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +; SPDX-License-Identifier: GPL-3.0-or-later +; +; This file is part of my nixos-config. +; +; You should have received a copy of the License along with this program. +; If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [General] AutoSaveAfterEveryChange=true BackupBeforeSave=true diff --git a/modules/home.legacy/conf/latexindent/default.nix b/modules/home.legacy/conf/latexindent/default.nix index 8dccc73e..aeedd411 100644 --- a/modules/home.legacy/conf/latexindent/default.nix +++ b/modules/home.legacy/conf/latexindent/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { xdg.configFile."latexindent/indentconfig.yaml".source = ./indentconfig.yaml; xdg.configFile."latexindent/mysettings.yaml".source = ./mysettings.yaml; diff --git a/modules/home.legacy/conf/latexindent/indentconfig.yaml b/modules/home.legacy/conf/latexindent/indentconfig.yaml index d67351f3..6465a17a 100644 --- a/modules/home.legacy/conf/latexindent/indentconfig.yaml +++ b/modules/home.legacy/conf/latexindent/indentconfig.yaml @@ -1,2 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + paths: - /home/dt/.config/latexindent/mysettings.yaml diff --git a/modules/home.legacy/conf/latexindent/mysettings.yaml b/modules/home.legacy/conf/latexindent/mysettings.yaml index 9a0f8b2f..122821da 100644 --- a/modules/home.legacy/conf/latexindent/mysettings.yaml +++ b/modules/home.legacy/conf/latexindent/mysettings.yaml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # defaultSettings.yaml for latexindent.pl, version 3.19.1, 2022-12-04 # a script that aims to # beautify .tex, .sty, .cls files diff --git a/modules/home.legacy/conf/mail/accounts/benedikt.nix b/modules/home.legacy/conf/mail/accounts/benedikt.nix index 2fe72fca..e75cb523 100644 --- a/modules/home.legacy/conf/mail/accounts/benedikt.nix +++ b/modules/home.legacy/conf/mail/accounts/benedikt.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs}: { address = "benedikt.peetz@b-peetz.de"; userName = "benedikt.peetz@b-peetz.de"; diff --git a/modules/home.legacy/conf/mail/accounts/soispha.nix b/modules/home.legacy/conf/mail/accounts/soispha.nix index 6e3e6228..6bcb0da6 100644 --- a/modules/home.legacy/conf/mail/accounts/soispha.nix +++ b/modules/home.legacy/conf/mail/accounts/soispha.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs}: { address = "soispha@vhack.eu"; userName = "soispha@vhack.eu"; diff --git a/modules/home.legacy/conf/mail/default.nix b/modules/home.legacy/conf/mail/default.nix index 46526173..17957c82 100644 --- a/modules/home.legacy/conf/mail/default.nix +++ b/modules/home.legacy/conf/mail/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, pkgs, diff --git a/modules/home.legacy/conf/mako/default.nix b/modules/home.legacy/conf/mako/default.nix deleted file mode 100644 index 6acf0afe..00000000 --- a/modules/home.legacy/conf/mako/default.nix +++ /dev/null @@ -1,40 +0,0 @@ -{...}: { - services.mako = { - enable = true; - backgroundColor = "#2e3440"; - borderColor = "#88c0d0"; - borderRadius = 25; - borderSize = 2; - defaultTimeout = 5000; - font = "Source Code Pro 10"; - width = 500; - height = 500; - icons = true; - ignoreTimeout = true; - layer = "overlay"; - markup = true; # TODO: - maxIconSize = 64; - sort = "-time"; - extraConfig = '' - [urgency=low] - border-color=#cccccc - - [urgency=normal] - border-color=#d08770 - - [urgency=high] - border-size=3 - border-color=#bf616a - default-timeout=0 - - [urgency=critical] - border-size=4 - border-color=#bf616a - default-timeout=0 - - [category=mpd] - default-timeout=2000 - group-by=category - ''; - }; -} diff --git a/modules/home.legacy/conf/mbsync/default.nix b/modules/home.legacy/conf/mbsync/default.nix index 8418d92d..058d576c 100644 --- a/modules/home.legacy/conf/mbsync/default.nix +++ b/modules/home.legacy/conf/mbsync/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {lib, ...}: { # This configures the program in itself (i.e., sets-up a config file, etc.) programs.mbsync = { diff --git a/modules/home.legacy/conf/mumble/Mumble.conf.license b/modules/home.legacy/conf/mumble/Mumble.conf.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/home.legacy/conf/mumble/Mumble.conf.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/home.legacy/conf/mumble/default.nix b/modules/home.legacy/conf/mumble/default.nix index 6fa524dc..1c1bc64e 100644 --- a/modules/home.legacy/conf/mumble/default.nix +++ b/modules/home.legacy/conf/mumble/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { xdg.configFile."Mumble/Mumble.conf".source = ./Mumble.conf; } diff --git a/modules/home.legacy/conf/neomutt/default.nix b/modules/home.legacy/conf/neomutt/default.nix index 10da8f0e..5947e675 100644 --- a/modules/home.legacy/conf/neomutt/default.nix +++ b/modules/home.legacy/conf/neomutt/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { programs.neomutt = { enable = true; diff --git a/modules/home.legacy/conf/nix-index/default.nix b/modules/home.legacy/conf/nix-index/default.nix deleted file mode 100644 index eb8132d9..00000000 --- a/modules/home.legacy/conf/nix-index/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -{...}: { - programs.nix-index = { - enable = true; - symlinkToCacheHome = true; - - # Handled by myself (and the script is overridden) - enableBashIntegration = false; - enableZshIntegration = false; - enableFishIntegration = false; - }; - programs.nix-index-database = { - comma.enable = false; - }; -} diff --git a/modules/home.legacy/conf/npm/.npmrc b/modules/home.legacy/conf/npm/.npmrc index d0d846bd..ef7db71a 100644 --- a/modules/home.legacy/conf/npm/.npmrc +++ b/modules/home.legacy/conf/npm/.npmrc @@ -1,3 +1,13 @@ +; nixos-config - My current NixOS configuration +; +; Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +; SPDX-License-Identifier: GPL-3.0-or-later +; +; This file is part of my nixos-config. +; +; You should have received a copy of the License along with this program. +; If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + scripts-prepend-node-path=true node_gyp= prefix=${XDG_DATA_HOME}/npm diff --git a/modules/home.legacy/conf/npm/default.nix b/modules/home.legacy/conf/npm/default.nix index d836e89c..6f17277a 100644 --- a/modules/home.legacy/conf/npm/default.nix +++ b/modules/home.legacy/conf/npm/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { xdg.configFile."npm/.npmrc".source = ./.npmrc; } diff --git a/modules/home.legacy/conf/prusa_slicer/default.nix b/modules/home.legacy/conf/prusa_slicer/default.nix index 9529e13d..923ebbfc 100644 --- a/modules/home.legacy/conf/prusa_slicer/default.nix +++ b/modules/home.legacy/conf/prusa_slicer/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { xdg.configFile."PrusaSlicer/PrusaSlicer.ini".source = ./prusa_slicer.ini; } diff --git a/modules/home.legacy/conf/prusa_slicer/prusa_slicer.ini b/modules/home.legacy/conf/prusa_slicer/prusa_slicer.ini index 0416a398..c9b7df5c 100644 --- a/modules/home.legacy/conf/prusa_slicer/prusa_slicer.ini +++ b/modules/home.legacy/conf/prusa_slicer/prusa_slicer.ini @@ -1,3 +1,13 @@ +; nixos-config - My current NixOS configuration +; +; Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +; SPDX-License-Identifier: GPL-3.0-or-later +; +; This file is part of my nixos-config. +; +; You should have received a copy of the License along with this program. +; If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + alert_when_supports_needed = 1 allow_auto_color_change = 1 allow_ip_resolve = 1 diff --git a/modules/home.legacy/conf/python/default.nix b/modules/home.legacy/conf/python/default.nix index 09f5c5ce..12764f9f 100644 --- a/modules/home.legacy/conf/python/default.nix +++ b/modules/home.legacy/conf/python/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {config, ...}: { xdg.configFile."python/pythonrc".source = ./pythonrc.py; home.sessionVariables = { diff --git a/modules/home.legacy/conf/python/pythonrc.py b/modules/home.legacy/conf/python/pythonrc.py index 466d9788..b733dc48 100644 --- a/modules/home.legacy/conf/python/pythonrc.py +++ b/modules/home.legacy/conf/python/pythonrc.py @@ -1,5 +1,15 @@ #!/usr/bin/env python3 +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + def is_vanilla() -> bool: import sys diff --git a/modules/home.legacy/conf/rclone/default.nix b/modules/home.legacy/conf/rclone/default.nix index caae4c9e..87de601b 100644 --- a/modules/home.legacy/conf/rclone/default.nix +++ b/modules/home.legacy/conf/rclone/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { xdg.configFile."rclone/rclone.conf".source = ./rclone.conf; } diff --git a/modules/home.legacy/conf/rclone/rclone.conf.license b/modules/home.legacy/conf/rclone/rclone.conf.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/home.legacy/conf/rclone/rclone.conf.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/home.legacy/conf/rofi/default.nix b/modules/home.legacy/conf/rofi/default.nix index 10363ab5..3de22ea0 100644 --- a/modules/home.legacy/conf/rofi/default.nix +++ b/modules/home.legacy/conf/rofi/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {pkgs, ...}: { programs.rofi = { enable = true; diff --git a/modules/home.legacy/conf/rofi/nord-twoLines.rasi.license b/modules/home.legacy/conf/rofi/nord-twoLines.rasi.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/home.legacy/conf/rofi/nord-twoLines.rasi.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/home.legacy/conf/ssh/default.nix b/modules/home.legacy/conf/ssh/default.nix deleted file mode 100644 index de9b0d90..00000000 --- a/modules/home.legacy/conf/ssh/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{config, ...}: { - programs.ssh = { - enable = true; - compression = true; - hashKnownHosts = false; - serverAliveInterval = 240; - userKnownHostsFile = "${config.xdg.dataHome}/ssh/known_hosts"; - - matchBlocks = { - "codeberg.org" = { - # TODO: Remove this once they fix their ipv6 config - addressFamily = "inet"; - }; - }; - }; -} diff --git a/modules/home.legacy/conf/starship/default.nix b/modules/home.legacy/conf/starship/default.nix index 5255ba66..6a6938f7 100644 --- a/modules/home.legacy/conf/starship/default.nix +++ b/modules/home.legacy/conf/starship/default.nix @@ -1,20 +1,33 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, nixosConfig, + pkgs, ... }: { programs.starship = { enable = true; enableZshIntegration = true; + settings = { add_newline = false; format = lib.concatStrings [ "$directory" "$username" + "\${custom.in_nixos_shell}" "$cmd_duration" "$status" "$character" ]; + right_format = lib.concatStrings ( [ "$git_metrics" @@ -28,24 +41,30 @@ nixosConfig.soispha.laptop.enable "$battery" ); + scan_timeout = 20; + character = { # success_symbol = "[❯](bold blue)"; # a = "⬢"; success_symbol = "[](bold blue)"; error_symbol = "[](bold red)"; }; + status = { disabled = false; format = "([($common_meaning )($status)( $signal_name)]($style) )"; }; + time = { disabled = false; format = "[\\[$time\\]]($style)"; }; + username = { format = "as [$user]($style) "; }; + git_branch = { format = "[($symbol$branch(:$remote_branch) )]($style)"; }; @@ -76,22 +95,28 @@ tag_symbol = "v"; format = "[(\\[$tag\\] )]($style)"; }; + directory = { truncate_to_repo = true; read_only = " "; before_repo_root_style = "black bold dimmed"; }; + cmd_duration = { min_time = 2000; # Milliseconds style = "bold white"; }; + custom = { - # status_output = { - # format = "$output"; - # command = "if test $STARSHIP_CMD_STATUS -ne 0; then echo \"bold red\"; else echo \"bold cyan\"; fi"; - # shell = [ "${pkgs.dash}" ]; - # }; + in_nixos_shell = { + symbol = "VM "; + style = "bold white"; + when = ''test "$IN_NIXOS_SHELL" = true ''; + shell = ["${lib.getExe pkgs.dash}"]; + description = "Show if a shell is run in a vm"; + }; }; + battery = { # ' ' # ' ' diff --git a/modules/home.legacy/conf/swayidle/config.license b/modules/home.legacy/conf/swayidle/config.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/home.legacy/conf/swayidle/config.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/home.legacy/conf/swayidle/default.nix b/modules/home.legacy/conf/swayidle/default.nix index e0106cbf..4483c8b9 100644 --- a/modules/home.legacy/conf/swayidle/default.nix +++ b/modules/home.legacy/conf/swayidle/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { # TODO: This fails to hibernate when the hardware swap was not previously activated. <2025-04-04> xdg.configFile."swayidle/config".source = ./config; diff --git a/modules/home.legacy/conf/tridactyl/config.vim b/modules/home.legacy/conf/tridactyl/config.vim index 84e290cb..aa843bc8 100644 --- a/modules/home.legacy/conf/tridactyl/config.vim +++ b/modules/home.legacy/conf/tridactyl/config.vim @@ -1,3 +1,13 @@ +" nixos-config - My current NixOS configuration +" +" Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +" SPDX-License-Identifier: GPL-3.0-or-later +" +" This file is part of my nixos-config. +" +" You should have received a copy of the License along with this program. +" If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + " vim: filetype=vim " This wipes all existing settings. This means that if a setting in this file diff --git a/modules/home.legacy/conf/tridactyl/default.nix b/modules/home.legacy/conf/tridactyl/default.nix index 23307cfe..de92c665 100644 --- a/modules/home.legacy/conf/tridactyl/default.nix +++ b/modules/home.legacy/conf/tridactyl/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { xdg.configFile."tridactyl/tridactylrc".source = ./config.vim; } diff --git a/modules/home.legacy/default.nix b/modules/home.legacy/default.nix index 706e2045..fd543661 100644 --- a/modules/home.legacy/default.nix +++ b/modules/home.legacy/default.nix @@ -1,11 +1,14 @@ -{ - nixVim, - nix-index-database, - arkenfox-nixos, - ... -}: let - username = "soispha"; - homeDirectory = "/home/${username}"; +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{config, ...}: let + inherit (config.home) homeDirectory; # xdg configHome = "${homeDirectory}/.config"; @@ -19,20 +22,11 @@ in { ./conf ./files ./pkgs - - nixVim.homeManagerModules.nixvim - nix-index-database.hmModules.nix-index - arkenfox-nixos.hmModules.arkenfox ]; # I don't know what this does, but I've seen it a lot online, so it should be good, right? programs.home-manager.enable = true; - home = { - inherit username homeDirectory; - stateVersion = "23.05"; - enableNixpkgsReleaseCheck = true; - }; xdg = { enable = true; inherit configHome dataHome stateHome cacheHome; #binHome; # TODO: add binHome, when the standard is extended diff --git a/modules/home.legacy/files/default.nix b/modules/home.legacy/files/default.nix index 50b340b8..5a04ab7a 100644 --- a/modules/home.legacy/files/default.nix +++ b/modules/home.legacy/files/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { imports = [ ./manifest_json diff --git a/modules/home.legacy/files/manifest_json/default.nix b/modules/home.legacy/files/manifest_json/default.nix index af8d85d2..5b4821ac 100644 --- a/modules/home.legacy/files/manifest_json/default.nix +++ b/modules/home.legacy/files/manifest_json/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { config, lib, diff --git a/modules/home.legacy/files/manifest_json/profile/manifest.json.license b/modules/home.legacy/files/manifest_json/profile/manifest.json.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/home.legacy/files/manifest_json/profile/manifest.json.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/home.legacy/pkgs/default.nix b/modules/home.legacy/pkgs/default.nix index 31942f0d..5ab1e73b 100644 --- a/modules/home.legacy/pkgs/default.nix +++ b/modules/home.legacy/pkgs/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, lib, @@ -27,7 +36,6 @@ with pkgs; let Misc = [ killall # kill a application by name - snap-sync-forked # A btrfs based backup solution bc # Smart calculator aumo # Automatic mount jq # Json parser @@ -85,7 +93,8 @@ with pkgs; let SystemUpdate = [ fupdate # Generic update tool. - update-sys # System update tool (meant to slot into `fupdate`). + fupdate-sys # System update tool (meant to slot into `fupdate`). + fupdate-flake # Nix flake update tool (meant to slot into `fupdate`). ]; FileListers = [ @@ -93,8 +102,6 @@ with pkgs; let fd # Simple, fast and user-friendly alternative to find ripgrep # A search tool that combines the usability of ag with the raw speed of grep file # Show information about a file - ll # Wrapper around `lf` to automatically change the path - lm # Wrapper around `ll` to automatically cd to the last accessed path ]; Programming = { diff --git a/notes/backup_disk.md b/notes/backup_disk.md index 363bae11..d2e8f12e 100644 --- a/notes/backup_disk.md +++ b/notes/backup_disk.md @@ -1,3 +1,15 @@ +<!-- +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +--> + # How to create a backup disk (for `soispha.services.backup`) ## Find the disk diff --git a/notes/beets_import.md b/notes/beets_import.md index fb9a9ff6..6725192e 100644 --- a/notes/beets_import.md +++ b/notes/beets_import.md @@ -1,3 +1,15 @@ +<!-- +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +--> + # How to import an artist into beets 1. Download said artist (`deerix`) diff --git a/notes/git_crypt.md b/notes/git_crypt.md index b123a77b..8c42bb62 100644 --- a/notes/git_crypt.md +++ b/notes/git_crypt.md @@ -1,3 +1,15 @@ +<!-- +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +--> + # What to do, when nix wants to build the locked repository Simply delete the source path: diff --git a/notes/gpg_keys.md b/notes/gpg_keys.md index 39602e3b..4a6fb5d1 100644 --- a/notes/gpg_keys.md +++ b/notes/gpg_keys.md @@ -1,3 +1,15 @@ +<!-- +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +--> + # How to add a comment to gpg keys Export it as follows: @@ -11,38 +23,38 @@ or add it manually, the supported options include (RFC4880): - "Version", which states the OpenPGP implementation and version used to encode the message. -- "Comment", a user-defined comment. OpenPGP defines all text to - be in UTF-8. A comment may be any UTF-8 string. However, the +- "Comment", a user-defined comment. OpenPGP defines all text to + be in UTF-8. A comment may be any UTF-8 string. However, the whole point of armoring is to provide seven-bit-clean data. Consequently, if a comment has characters that are outside the US-ASCII range of UTF, they may very well not survive transport. -- "MessageID", a 32-character string of printable characters. The +- "MessageID", a 32-character string of printable characters. The string must be the same for all parts of a multi-part message - that uses the "PART X" Armor Header. MessageID strings should be + that uses the "PART X" Armor Header. MessageID strings should be unique enough that the recipient of the mail can associate all - the parts of a message with each other. A good checksum or + the parts of a message with each other. A good checksum or cryptographic hash function is sufficient. The MessageID SHOULD NOT appear unless it is in a multi-part - message. If it appears at all, it MUST be computed from the + message. If it appears at all, it MUST be computed from the finished (encrypted, signed, etc.) message in a deterministic - fashion, rather than contain a purely random value. This is to + fashion, rather than contain a purely random value. This is to allow the legitimate recipient to determine that the MessageID cannot serve as a covert means of leaking cryptographic key information. - "Hash", a comma-separated list of hash algorithms used in this - message. This is used only in cleartext signed messages. + message. This is used only in cleartext signed messages. - "Charset", a description of the character set that the plaintext - is in. Please note that OpenPGP defines text to be in UTF-8. An + is in. Please note that OpenPGP defines text to be in UTF-8. An implementation will get best results by translating into and out - of UTF-8. However, there are many instances where this is easier - said than done. Also, there are communities of users who have no + of UTF-8. However, there are many instances where this is easier + said than done. Also, there are communities of users who have no need for UTF-8 because they are all happy with a character set - like ISO Latin-5 or a Japanese character set. In such instances, + like ISO Latin-5 or a Japanese character set. In such instances, an implementation MAY override the UTF-8 default by using this - header key. An implementation MAY implement this key and any + header key. An implementation MAY implement this key and any translations it cares to; an implementation MAY ignore it and assume all text is UTF-8. diff --git a/notes/laptop.md b/notes/laptop.md index 38ae5a24..bc9ddc86 100644 --- a/notes/laptop.md +++ b/notes/laptop.md @@ -1,3 +1,15 @@ +<!-- +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +--> + # backlight Run `ls /sys/class/backlight` to see possible options. diff --git a/notes/names.md b/notes/names.md index 44339580..6906d29e 100644 --- a/notes/names.md +++ b/notes/names.md @@ -1,3 +1,15 @@ +<!-- +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +--> + # Naming scheme The hosts naming scheme follows two list of Mesopotamian (Babylonian) deities: diff --git a/notes/password.md b/notes/password.md index 96366bae..2717af48 100644 --- a/notes/password.md +++ b/notes/password.md @@ -1,3 +1,15 @@ +<!-- +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +--> + # Password Run `nix run n#mkpasswd -- -m yescrypt -s -R 11` diff --git a/notes/wifi.md b/notes/wifi.md new file mode 100644 index 00000000..d27b11b4 --- /dev/null +++ b/notes/wifi.md @@ -0,0 +1,61 @@ +<!-- +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +--> + +# How to set-up “corporate” Wi-Fi with NetworkManager (`nmcli`) + +```bash +nmcli connection add \ +type wifi \ +connection.id "$name_you_want_to_use" \ +wifi.ssid "$actual_ssid" \ +wifi.mode infrastructure \ +wifi-sec.key-mgmt wpa-eap \ +802-1x.eap peap \ +802-1x.identity "$your_login_name" \ +802-1x.phase2-auth mschapv2 + +# Ask, so that `nmcli` can determine your password. +nmcli connection up "$name_you_want_to_use" --ask +``` + +## This will result in a configuration file, similar to this one: + +```ini +[connection] +id="$name_you_want_to_use" +uuid=aaaaaaaa-aaaa-aaaa-aaaa-deadbeef1245 +type=wifi +interface-name=wlo1 + +[wifi] +mode=infrastructure +ssid="$actual_ssid" + +[wifi-security] +key-mgmt=wpa-eap + +[802-1x] +ca-cert=/home/user_name/.local/share/nm/ca-cert.cer +domain-suffix-match=dnsx.topackt.net +eap=peap; +identity="$identity" +phase2-auth=mschapv2 + +[ipv4] +method=auto + +[ipv6] +addr-gen-mode=stable-privacy +method=auto + +[proxy] +``` diff --git a/pkgs/by-name/at/atuin-dvorak/package.nix b/pkgs/by-name/at/atuin-dvorak/package.nix index c651eb75..d3f92961 100644 --- a/pkgs/by-name/at/atuin-dvorak/package.nix +++ b/pkgs/by-name/at/atuin-dvorak/package.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {atuin}: atuin.overrideAttrs (finalAttrs: previousAttrs: { pname = previousAttrs.pname + "-dvorak"; diff --git a/pkgs/by-name/at/atuin-dvorak/set-dvorak-keybindings.patch.license b/pkgs/by-name/at/atuin-dvorak/set-dvorak-keybindings.patch.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/pkgs/by-name/at/atuin-dvorak/set-dvorak-keybindings.patch.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/pkgs/by-name/au/aumo/aumo.sh b/pkgs/by-name/au/aumo/aumo.sh index 84d39deb..dba5ef63 100755 --- a/pkgs/by-name/au/aumo/aumo.sh +++ b/pkgs/by-name/au/aumo/aumo.sh @@ -1,28 +1,73 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +NAME="aumo" + +error() { + printf "\033[1;91m==> ERROR:\033[0m \033[1;93m%s\033[0m\n" "$*" >&2 +} + +die() { + error "$1" + exit "${2-1}" +} + +usage() { + echo "Usage: $NAME mount|unmount" +} + +get_mounted_labels() { + findmnt --output label --json | jq '.filesystems | map(.label) | sort | unique | map(select(. != null))' +} +get_unmounted_labels() { + first=true + + find /dev/disk/by-label -printf "%P\n" | while read -r label; do + if ! get_mounted_labels | jq 'join("\n")' --raw-output | grep "$label" --quiet; then + if [ "$first" = "true" ]; then + first=false + else + printf "|" + fi + printf "%s" "$label" + fi + done +} unmounting() { - disk_name="$(find /dev/disk/by-label -type l -printf "%P|" | rofi -sep "|" -dmenu -p "Select disk to mount")" + disk_name="$(get_mounted_labels | jq 'join("|")' --join-output | rofi -sep "|" -dmenu -p "Select disk to unmount")" udisksctl unmount --block-device "/dev/disk/by-label/$disk_name" } mounting() { - disk_name="$(find /dev/disk/by-label -type l -printf "%P|" | rofi -sep "|" -dmenu -p "Select disk to mount")" + disk_name="$(get_unmounted_labels | rofi -sep "|" -dmenu -p "Select disk to mount")" udisksctl mount --block-device "/dev/disk/by-label/$disk_name" } -case "$1" in +case "${1-unset}" in "mount") mounting ;; "unmount" | "umount") unmounting ;; +"unset") + usage + die "You need to provide one argument." + ;; *) - die "Usage: $NAME mount|unmount" + usage + die "Unknown command: '$1'" ;; esac diff --git a/pkgs/by-name/au/aumo/package.nix b/pkgs/by-name/au/aumo/package.nix index 20054bb5..8132a15a 100644 --- a/pkgs/by-name/au/aumo/package.nix +++ b/pkgs/by-name/au/aumo/package.nix @@ -1,17 +1,32 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - sysLib, + writeShellApplication, + # Dependencies udisks, findutils, rofi, + jq, + gnugrep, + util-linux, }: -sysLib.writeShellScript { +writeShellApplication { name = "aumo"; - src = ./aumo.sh; - generateCompletions = false; - keepPath = false; - dependencies = [ + text = builtins.readFile ./aumo.sh; + inheritPath = false; + runtimeInputs = [ udisks findutils rofi + jq + gnugrep + util-linux # for findmnt ]; } diff --git a/pkgs/by-name/ba/battery/battery.sh b/pkgs/by-name/ba/battery/battery.sh index e650ba5d..5ccb303d 100755 --- a/pkgs/by-name/ba/battery/battery.sh +++ b/pkgs/by-name/ba/battery/battery.sh @@ -1,7 +1,14 @@ #!/usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. capacity="$(cat /sys/class/power_supply/BAT0/capacity)" status="$(cat /sys/class/power_supply/BAT0/status)" diff --git a/pkgs/by-name/ba/battery/package.nix b/pkgs/by-name/ba/battery/package.nix index 9c0e194b..560ec59b 100644 --- a/pkgs/by-name/ba/battery/package.nix +++ b/pkgs/by-name/ba/battery/package.nix @@ -1,9 +1,20 @@ -{sysLib}: -sysLib.writeShellScript { +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + writeShellApplication, + # Dependencies + coreutils, +}: +writeShellApplication { name = "battery"; - src = ./battery.sh; - generateCompletions = false; - keepPath = false; - dependencies = [ - ]; + text = builtins.readFile ./battery.sh; + inheritPath = false; + runtimeInputs = [coreutils]; } diff --git a/pkgs/by-name/be/beetsExtraPlugins/package.nix b/pkgs/by-name/be/beetsExtraPlugins/package.nix index f019922e..b310715b 100644 --- a/pkgs/by-name/be/beetsExtraPlugins/package.nix +++ b/pkgs/by-name/be/beetsExtraPlugins/package.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {...}: { # xtractor = pkgs.callPackage ./xtractor.nix {beets = pkgs.beetsPackages.beets-minimal;}; } diff --git a/pkgs/by-name/be/beetsExtraPlugins/xtractor.nix b/pkgs/by-name/be/beetsExtraPlugins/xtractor.nix index 17981cdb..c6b942fd 100644 --- a/pkgs/by-name/be/beetsExtraPlugins/xtractor.nix +++ b/pkgs/by-name/be/beetsExtraPlugins/xtractor.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, fetchFromGitHub, diff --git a/pkgs/by-name/br/brightness/brightness.sh b/pkgs/by-name/br/brightness/brightness.sh index 887dbb1e..f38bb5a5 100755 --- a/pkgs/by-name/br/brightness/brightness.sh +++ b/pkgs/by-name/br/brightness/brightness.sh @@ -1,24 +1,33 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +#!/usr/bin/env sh + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +die() { + echo "ERROR: $1" + exit 1 +} help() { cat <<EOF This is a system brightness manager USAGE: - $NAME up [VALUE] | down [VALUE] + $NAME set VALUE OPTIONS: --help | -h Output this help and exit. - --version | -v - Output the version and exit. - COMMANDS: - set [VALUE] + set VALUE Set the brightness to the specified percentage. ARGUMENTS: @@ -27,17 +36,14 @@ ARGUMENTS: EOF } -BACKLIGHT="/sys/class/backlight/%BACKLIGHT_NAME" +BACKLIGHT="/sys/class/backlight/$BACKLIGHT_NAME" brightness() { perc="$1" - max="$(cat $BACKLIGHT/max_brightness)" - + max="$(cat "$BACKLIGHT/max_brightness")" new="$(echo | awk --assign=perc="$perc" '{printf (perc / 100)}')" - output="$(echo | awk --assign=new="$new" --assign=max="$max" '{printf max * new}')" - echo "$output" >"$BACKLIGHT/brightness" } @@ -47,10 +53,6 @@ for arg in "$@"; do help exit 0 ;; - "--version" | "-v") - version - exit 0 - ;; esac done diff --git a/pkgs/by-name/br/brightness/package.nix b/pkgs/by-name/br/brightness/package.nix index c2e31a0c..f3797d43 100644 --- a/pkgs/by-name/br/brightness/package.nix +++ b/pkgs/by-name/br/brightness/package.nix @@ -1,14 +1,29 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - sysLib, + writeShellApplication, + # Arguments backlightName ? "intel_backlight", # nixosConfig.soispha.laptop.backlight + # Dependencies + gawk, + coreutils, }: -sysLib.writeShellScript { +writeShellApplication { name = "brightness"; - src = ./brightness.sh; - generateCompletions = true; - keepPath = false; + text = builtins.readFile ./brightness.sh; + inheritPath = false; - replacementStrings = {BACKLIGHT_NAME = backlightName;}; + runtimeEnv = {BACKLIGHT_NAME = backlightName;}; - dependencies = []; + runtimeInputs = [ + gawk + coreutils + ]; } diff --git a/pkgs/by-name/co/con2pdf/con2pdf.sh b/pkgs/by-name/co/con2pdf/con2pdf.sh index 27c9d092..ebe35ad3 100755 --- a/pkgs/by-name/co/con2pdf/con2pdf.sh +++ b/pkgs/by-name/co/con2pdf/con2pdf.sh @@ -1,19 +1,18 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# needed for help() and version -# shellcheck disable=2034 -AUTHORS="Soispha" -# shellcheck disable=2034 -YEARS="2023" -# shellcheck disable=2034 -VERSION="1.0.0" - -# NAME is from the wrapper -# shellcheck disable=SC2269 -NAME="$NAME" +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +# TODO(@bpeetz): This should probably be rewritten in rust. <2025-04-14> + +NAME="con2pdf" help() { cat <<EOF Scan images and turn them into a pdf. @@ -52,7 +51,7 @@ ARGUMENTS: NUM | *([0-9]) := 0 | 1 | 2 | 3 | 4 Possible numbers of pages, can be more than 4 - DEVICE := [[$(cat %DEVICE_FUNCTION)]] + DEVICE := [[$(cat "$DEVICE_FUNCTION")]] Possible scanner names METHOD := ADF | Flatbed diff --git a/pkgs/by-name/co/con2pdf/package.nix b/pkgs/by-name/co/con2pdf/package.nix index 8eb994fd..11d45ab5 100644 --- a/pkgs/by-name/co/con2pdf/package.nix +++ b/pkgs/by-name/co/con2pdf/package.nix @@ -1,24 +1,34 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - sysLib, + writeShellApplication, writeText, - # dependencies + # Dependencies sane-backends, imagemagick, coreutils, fd, }: -sysLib.writeShellScript { +writeShellApplication { name = "con2pdf"; - src = ./con2pdf.sh; - generateCompletions = true; - keepPath = false; - dependencies = [ + text = builtins.readFile ./con2pdf.sh; + inheritPath = false; + + runtimeInputs = [ sane-backends imagemagick coreutils fd ]; - replacementStrings = { + + runtimeEnv = { DEVICE_FUNCTION = # This is here, because escaping the whole function, to use it in the shell script # directly just isn't possible diff --git a/pkgs/by-name/ct/ctpv-64-types/allow-up-to-64-types.patch.license b/pkgs/by-name/ct/ctpv-64-types/allow-up-to-64-types.patch.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/pkgs/by-name/ct/ctpv-64-types/allow-up-to-64-types.patch.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/pkgs/by-name/ct/ctpv-64-types/package.nix b/pkgs/by-name/ct/ctpv-64-types/package.nix index 763b0325..087e1d28 100644 --- a/pkgs/by-name/ct/ctpv-64-types/package.nix +++ b/pkgs/by-name/ct/ctpv-64-types/package.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {ctpv}: ctpv.overrideAttrs (finalAttrs: previousAttrs: { pname = previousAttrs.pname + "-64-types"; diff --git a/pkgs/by-name/fd/fd_list/fd_list.sh b/pkgs/by-name/fd/fd_list/fd_list.sh new file mode 100755 index 00000000..568d73c8 --- /dev/null +++ b/pkgs/by-name/fd/fd_list/fd_list.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +# Lists all fds in use with their respective associated programs. +# This can be useful, if you need to debug, why your system is out of fds. + +# This script is not POSIX shell compatible, as the `ulimit` flags `-H` and `-n` are not defined by POSIX (thus we use `bash` instead). + +find /proc/ -maxdepth 1 | while read -r path; do + pid="${path#/proc/}" + fd_dir="$path/fd/" + + [ -d "$fd_dir" ] && echo "PID = $pid with $(find "$fd_dir" | wc -l) file descriptors" +done | sort -rn -k5 | head | while read -r _ _ pid _ fdcount _; do + command_execution="$(ps -o cmd -p "$pid" -h)" + + command_arguments="$(echo "$command_execution" | awk '{$1=""; print $0}')" + command_name="$(basename "$(echo "$command_execution" | awk '{print $1}')")" + + command="$command_name$command_arguments" + + printf "PID %8d with %4d file descriptors: %s\n" "$pid" "$fdcount" "$command" +done || true +# ^ Ignore SIGPIPE + +printf "\nThe Kernel has %7d file handles allocated.\n" "$(awk '{print $1}' /proc/sys/fs/file-nr)" +printf " -> The per-process fd maxium is: %d\n" "$(ulimit -Hn)" +printf " -> The per-process fd soft-maximum is: %d\n" "$(ulimit -n)" +printf " -> The global fd maximum is: %d\n" "$(cat /proc/sys/fs/file-max)" + +# vim: ft=sh diff --git a/pkgs/by-name/fd/fd_list/package.nix b/pkgs/by-name/fd/fd_list/package.nix new file mode 100644 index 00000000..34129b10 --- /dev/null +++ b/pkgs/by-name/fd/fd_list/package.nix @@ -0,0 +1,28 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + writeShellApplication, + findutils, + gawk, + coreutils, + procps, +}: +writeShellApplication { + name = "fd_list"; + text = builtins.readFile ./fd_list.sh; + + inheritPath = false; + runtimeInputs = [ + findutils + gawk + coreutils + procps + ]; +} diff --git a/pkgs/by-name/fu/fupdate-flake/fupdate-flake.sh b/pkgs/by-name/fu/fupdate-flake/fupdate-flake.sh new file mode 100755 index 00000000..5b8d9469 --- /dev/null +++ b/pkgs/by-name/fu/fupdate-flake/fupdate-flake.sh @@ -0,0 +1,194 @@ +#! /usr/bin/env sh + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +UPDATE_SCRIPT_NAME="update.sh" + +info() { + echo "Info: $1" +} +dbg() { + if [ "${DEBUG_ENABLE-unset}" != "unset" ]; then + echo "Debug: $1" >&2 + fi +} +die() { + echo "Error: $1" + exit 1 +} + +# Search for a file “upwards”. +# This will return the relative path from "$1" to the found file. +# +# # Type +# upfind :: Path -> String -> Path +# +# # Arguments +# $1 +# : The directory to use as start of your search. +# +# $2 +# : The file to search for. +# +# # Example +# upfind "/home/user1" "/usr" +# => /usr +upfind() { + starting_directory="$(readlink --canonicalize "$1")" + search_string="$2" + + current_directory="$starting_directory" + + while + search_result=$(fd "$search_string" "$current_directory/" --max-depth 1) + dbg "upfind - search in $current_directory gives: $search_result" + [ -z "$search_result" ] && [ "$current_directory" != "/" ] + do current_directory=$(dirname "$current_directory"); done + + realpath --relative-to="$1" "$search_result" +} + +# Construct the storage path for the update script allowed hashes. +# +# # Type +# get_storage_path :: Path -> Path +# +# # Arguments +# $1 +# : The path to the update script +# +# # Returns +# The constructed storage path. +get_storage_path() { + update_script="$(realpath "$1")" + + storage_path="$XDG_DATA_HOME/fupdate-flake/$update_script" + echo "$storage_path" +} + +# Checks if a given path to the update script is allowed. +# +# # Type +# is_allowed :: Path -> bool +# +# # Arguments +# $1 +# : The path to the update script to check. +# +# # Return exit code +# 0 +# : If the update script is allowed +# +# 1 +# : If it is not. +is_allowed() { + update_script="$(realpath "$1")" + + storage_path="$(get_storage_path "$update_script")" + + # Use this invocation, to also include the path to the `$update_script` + update_script_hash="$(sha256sum "$update_script")" + + if [ -f "$storage_path" ]; then + if [ "$(cat "$storage_path")" = "$update_script_hash" ]; then + return 0 + else + return 1 + fi + else + return 1 + fi +} + +# Asks the user if they want to allow a given script. +# +# # Type +# ask_to_allow_update_script :: Path +# +# # Arguments +# $1 +# : The path to the update script to ask for. +ask_to_allow_update_script() { + update_script="$(realpath "$1")" + + printf "\033[2J" # clear the screen + cat "$update_script" + + printf "Do you want to allow this script?[N/y]: " + read -r allow + + case "$allow" in + [yY]) + info "Update script allowed." + + storage_path="$(get_storage_path "$update_script")" + update_script_hash="$(sha256sum "$update_script")" + + mkdir --parents "$(dirname "$storage_path")" + printf "%s" "$update_script_hash" >"$storage_path" + ;; + *) + info "Update script not allowed." + ;; + esac +} + +# Performs a full update. +# This consists of running an update script. +# Additionally, it also checks for duplicated inputs in a `flake.lock` file, if it exists. +# +# # Type +# update :: Path -> Path -> [String] +# +# # Arguments +# $1 +# : The path to the update script to execute. +# +# $2 +# : The base directory from which to start the update. +# +# $3 +# : Arguments to pass to the update script. +update() { + update_script="$1" + base_directory="$2" + shift 2 + + cd "$base_directory" || die "The provided base directory '$base_directory' cannot be accessed" + dbg "Changed directory to: $base_directory" + + dbg "Executing update script ('$update_script') following args: '$*'" + "$update_script" "$@" + + if [ -f "flake.lock" ] && grep '[^0-9]_[0-9]' flake.lock --quiet; then + batgrep '[^0-9]_[0-9]' flake.lock + die "Your flake.nix contains duplicate inputs!" + fi +} + +main() { + base_directory="$(git rev-parse --show-toplevel)" + update_script="$(upfind "$PWD" "$UPDATE_SCRIPT_NAME")" + dbg "update_script is: $update_script" + + if [ "$update_script" = "" ]; then + die "Failed to find update script." + elif is_allowed "$update_script"; then + update "$update_script" "$base_directory" "$@" + else + ask_to_allow_update_script "$update_script" + is_allowed "$update_script" && main "$@" + fi +} + +main "$@" + +# vim: ft=sh diff --git a/pkgs/by-name/fu/fupdate-flake/package.nix b/pkgs/by-name/fu/fupdate-flake/package.nix new file mode 100644 index 00000000..c8646f26 --- /dev/null +++ b/pkgs/by-name/fu/fupdate-flake/package.nix @@ -0,0 +1,37 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + writeShellApplication, + # Dependencies + coreutils, + fd, + gnugrep, + bat-extras, # For `batgrep` + bat, # used by batgrep + gnused, # required by batgrep + git, +}: +writeShellApplication { + name = "fupdate-flake"; + text = builtins.readFile ./fupdate-flake.sh; + + # The `update.sh` script might actually want to keep the path. + inheritPath = true; + + runtimeInputs = [ + coreutils + fd + gnugrep + bat-extras.batgrep + bat # Used by `batgrep` + gnused # Required by `batgrep` + git + ]; +} diff --git a/pkgs/by-name/fu/fupdate-sys/fupdate-sys.sh b/pkgs/by-name/fu/fupdate-sys/fupdate-sys.sh new file mode 100755 index 00000000..4ec3e9e8 --- /dev/null +++ b/pkgs/by-name/fu/fupdate-sys/fupdate-sys.sh @@ -0,0 +1,168 @@ +#!/usr/bin/env dash + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +# FIXME(@bpeetz): Ideally I could replace this script with a deployment tool. Thus we +# would have the same tool on the server as I use in my config. <2025-04-14> + +# Shell library {{{ +die() { + error "$1" + if [ -n "$2" ]; then + exit "$2" + else + exit 1 + fi +} +print() { + # shellcheck disable=SC2059 + printf "$*" +} +println() { + # shellcheck disable=SC2059 + printf "$*\n" +} +eprint() { + >&2 print "$@" +} +eprintln() { + >&2 println "$@" +} +if [ "${NO_COLOR-unset}" != "unset" ]; then + error() { + eprintln "==> ERROR:" "$*" + } + warning() { + eprintln "==> WARNING:" "$*" + } + debug() { + [ -n "$SHELL_LIBRARY_DEBUG" ] && eprintln "==> [Debug:]" "$*" + } + debug2() { + [ -n "$SHELL_LIBRARY_DEBUG" ] && eprintln " -> [Debug:]" "$*" + } + msg() { + eprintln "==>" "$*" + } + msg2() { + eprintln " ->" "$*" + } + prompt() { + eprint "..>" "$*" + } +else + error() { + eprintln "\033[1;91m==> ERROR:\033[0m" "\033[1;93m$*\033[0m" + } + warning() { + eprintln "\033[1;91m==> WARNING:\033[0m" "\033[1;93m$*\033[0m" + } + debug() { + [ -n "$SHELL_LIBRARY_DEBUG" ] && eprintln "\033[1;94m==> [Debug:]\033[0m" "\033[1;93m$*\033[0m" + } + debug2() { + [ -n "$SHELL_LIBRARY_DEBUG" ] && eprintln "\033[1;94m -> [Debug:]\033[0m" "\033[1;93m$*\033[0m" + } + msg() { + eprintln "\033[1;96m==>\033[0m" "\033[1;93m$*\033[0m" + } + msg2() { + eprintln "\033[1;96m ->\033[0m" "\033[1;93m$*\033[0m" + } + prompt() { + eprint "\033[1;96m..>\033[0m" "\033[1;93m$*\033[0m" + } +fi +# }}} + +NAME="update-sys" +help() { + cat <<EOF +This is a NixOS System flake update manager. + +USAGE: + $NAME [--branch <branchname>] [--help] + +OPTIONS: + --branch | -b BRANCHNAME + select a branch to update from. + + --mode | -m MODE + select a mode to update with + + --help | -h + output this help. +ARGUMENTS: + BRANCHNAME := [[ git branch --list --format '%(refname:short)' ]] + The name of the branch to deploy the config from + + MODE := switch|boot|test|build|dry-build|dry-activate|edit|repl|build-vm|build-vm-with-bootloader + See the 'nixos-rebuild' manpage for more information about these modes. +EOF + exit "$1" +} +BRANCH="" + +while [ "$#" -gt 0 ]; do + case "$1" in + "--help" | "-h") + help 0 + ;; + "--branch" | "-b") + if [ "${2-unset}" != "unset" ]; then + BRANCH="$2" + else + error "$1 requires an argument" + help 1 + fi + shift 2 + ;; + "--mode" | "-m") + if [ "${2-unset}" != "unset" ]; then + MODE="$2" + else + error "$1 requires an argument" + help 1 + fi + shift 2 + ;; + *) + error "the option $1 does not exist!" + help 1 + ;; + esac +done + +cd /etc/nixos || die "No /etc/nixos" +msg "Starting system update..." +git remote update origin --prune >/dev/null 2>&1 +if ! [ "$BRANCH" = "" ]; then + git switch "$BRANCH" >/dev/null 2>&1 && msg2 "Switched to branch '$BRANCH'" +fi +msg2 "Updating git repository..." +git pull --rebase + +# We use a tempfile, to make this truly async. +default_branch=$(mktemp) +cleanup() { + rm "$default_branch" +} +trap cleanup EXIT + +git remote show origin | grep 'HEAD' | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/ *$//g' >"$default_branch" & + +msg2 "Updating system..." +nixos-rebuild "${MODE-switch}" + +git switch "$(cat "$default_branch")" >/dev/null 2>&1 && msg2 "Switched to branch '$(cat "$default_branch")'" +msg "Finished Update!" + +# vim: ft=sh diff --git a/pkgs/by-name/fu/fupdate-sys/package.nix b/pkgs/by-name/fu/fupdate-sys/package.nix new file mode 100644 index 00000000..7fd4674b --- /dev/null +++ b/pkgs/by-name/fu/fupdate-sys/package.nix @@ -0,0 +1,38 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + writeShellApplication, + # Dependencies + git, + nixos-rebuild, + sudo, + openssh, + coreutils, + mktemp, + gnugrep, + gnused, + systemd, +}: +writeShellApplication { + name = "fupdate-sys"; + text = builtins.readFile ./fupdate-sys.sh; + inheritPath = false; + runtimeInputs = [ + git + nixos-rebuild + sudo + openssh + coreutils + mktemp + gnugrep + gnused + systemd + ]; +} diff --git a/pkgs/by-name/fu/fupdate/.envrc b/pkgs/by-name/fu/fupdate/.envrc new file mode 100644 index 00000000..294de504 --- /dev/null +++ b/pkgs/by-name/fu/fupdate/.envrc @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +use flake diff --git a/pkgs/by-name/fu/fupdate/.gitignore b/pkgs/by-name/fu/fupdate/.gitignore new file mode 100644 index 00000000..f255eebd --- /dev/null +++ b/pkgs/by-name/fu/fupdate/.gitignore @@ -0,0 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +/target +.direnv diff --git a/pkgs/by-name/fu/fupdate/Cargo.lock b/pkgs/by-name/fu/fupdate/Cargo.lock new file mode 100644 index 00000000..934e004b --- /dev/null +++ b/pkgs/by-name/fu/fupdate/Cargo.lock @@ -0,0 +1,310 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +version = 4 + +[[package]] +name = "anstream" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" + +[[package]] +name = "anstyle-parse" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6680de5231bd6ee4c6191b8a1325daa282b415391ec9d3a37bd34f2060dc73fa" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys", +] + +[[package]] +name = "anyhow" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" + +[[package]] +name = "clap" +version = "4.5.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_complete" +version = "4.5.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d2267df7f3c8e74e38268887ea5235d4dfadd39bfff2d56ab82d61776be355e" +dependencies = [ + "clap", + "clap_lex", + "is_executable", + "shlex", +] + +[[package]] +name = "clap_derive" +version = "4.5.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" + +[[package]] +name = "colorchoice" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" + +[[package]] +name = "fupdate" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", + "clap_complete", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "is_executable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a1b5bad6f9072935961dfbf1cced2f3d129963d091b6f69f007fe04e758ae2" +dependencies = [ + "winapi", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" diff --git a/pkgs/by-name/fu/fupdate/Cargo.toml b/pkgs/by-name/fu/fupdate/Cargo.toml new file mode 100644 index 00000000..2412876a --- /dev/null +++ b/pkgs/by-name/fu/fupdate/Cargo.toml @@ -0,0 +1,81 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +[package] +name = "fupdate" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +anyhow = "1.0.98" +clap = { version = "4.5.39", features = ["derive"] } +clap_complete = { version = "4.5.51", features = ["unstable-dynamic"] } + +[profile.release] +lto = true +codegen-units = 1 +panic = "abort" +split-debuginfo = "off" + +[lints.rust] +# rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html +warnings = "warn" +future_incompatible = { level = "warn", priority = -1 } +let_underscore = { level = "warn", priority = -1 } +nonstandard_style = { level = "warn", priority = -1 } +rust_2018_compatibility = { level = "warn", priority = -1 } +rust_2018_idioms = { level = "warn", priority = -1 } +rust_2021_compatibility = { level = "warn", priority = -1 } +unused = { level = "warn", priority = -1 } +# rustc allowed-by-default lints https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html +# missing_docs = "warn" +macro_use_extern_crate = "warn" +meta_variable_misuse = "warn" +missing_abi = "warn" +missing_copy_implementations = "warn" +missing_debug_implementations = "warn" +non_ascii_idents = "warn" +noop_method_call = "warn" +single_use_lifetimes = "warn" +trivial_casts = "warn" +trivial_numeric_casts = "warn" +unreachable_pub = "warn" +unsafe_op_in_unsafe_fn = "warn" +unused_crate_dependencies = "warn" +unused_import_braces = "warn" +unused_lifetimes = "warn" +unused_qualifications = "warn" +variant_size_differences = "warn" + +[lints.rustdoc] +# rustdoc lints https://doc.rust-lang.org/rustdoc/lints.html +broken_intra_doc_links = "warn" +private_intra_doc_links = "warn" +missing_crate_level_docs = "warn" +private_doc_tests = "warn" +invalid_codeblock_attributes = "warn" +invalid_rust_codeblocks = "warn" +bare_urls = "warn" + +[lints.clippy] +# clippy allowed by default +dbg_macro = "warn" +# clippy categories https://doc.rust-lang.org/clippy/ +all = { level = "warn", priority = -1 } +correctness = { level = "warn", priority = -1 } +suspicious = { level = "warn", priority = -1 } +style = { level = "warn", priority = -1 } +complexity = { level = "warn", priority = -1 } +perf = { level = "warn", priority = -1 } +pedantic = { level = "warn", priority = -1 } +missing_panics_doc = "allow" +missing_errors_doc = "allow" diff --git a/pkgs/by-name/fu/fupdate/flake.lock b/pkgs/by-name/fu/fupdate/flake.lock new file mode 100644 index 00000000..280e8a51 --- /dev/null +++ b/pkgs/by-name/fu/fupdate/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1748406211, + "narHash": "sha256-B3BsCRbc+x/d0WiG1f+qfSLUy+oiIfih54kalWBi+/M=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3d1f29646e4b57ed468d60f9d286cde23a8d1707", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/pkgs/by-name/fu/fupdate/flake.lock.license b/pkgs/by-name/fu/fupdate/flake.lock.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/pkgs/by-name/fu/fupdate/flake.lock.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/pkgs/by-name/fu/fupdate/flake.nix b/pkgs/by-name/fu/fupdate/flake.nix new file mode 100644 index 00000000..0ebceece --- /dev/null +++ b/pkgs/by-name/fu/fupdate/flake.nix @@ -0,0 +1,34 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + description = "This is a Nix flake update manager."; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; + + outputs = {nixpkgs, ...}: let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages."${system}"; + in { + devShells."${system}".default = pkgs.mkShell { + packages = with pkgs; [ + cargo + clippy + rustc + rustfmt + + cargo-edit + ]; + }; + }; +} +# vim: ts=2 + diff --git a/pkgs/by-name/fu/fupdate/fupdate.1.md b/pkgs/by-name/fu/fupdate/fupdate.1.md deleted file mode 100644 index 710e8fb7..00000000 --- a/pkgs/by-name/fu/fupdate/fupdate.1.md +++ /dev/null @@ -1,70 +0,0 @@ -% FUPDATE(1) fupdate 1.0.0 -% Soispha -% May 2023 - -# NAME - -fupdate - updates your flake, while checking for common mistakes - -# SYNOPSIS - -**fupdate** list of \[*flake*|*\<some word>*|*--help*|*-h*\] - -# DESCRIPTION - -Argument can be stacked, this makes it possible to specify multiple targets to be updated in succession. See the Examples section for further details. - -No argument or *flake* -: **fupdate**, when executed without arguments or with *flake*, will update your *flake.lock*, check for duplicate flake inputs, i.e., an input has an input declared, which you have also declared as input, and will run a script called *update.sh*, if you allow it. -The allowance for the script is asked, when you run **fupdate** and the found script is not yet allowed. Furthermore, the allowance is based on the concrete sha256 hash of the script, so any changes will require another allowance. - -**\<some word>** as argument -: If the executable **update-\<some word>** is reachable thought the PATH variable, than this is run. Otherwise, the program will exit. - -# OPTIONS - -**--help**, **-h** -: Displays a help message and exit. - -**--version**, **-v** -: Displays the software version and exit. - -# EXAMPLES - -**fupdate** or **fupdate flake** -: Updates your *flake.lock*. See the Description section for further details. - -**fupdate sys** -: Run the executable **update-sys**, if it exists. See the Description section for further details. - -**fupdate flake sys docs** -: First updates your flake, then, if the command succeeded, runs **update-sys**, afterweich **update-docs** is run. - -# FILES - -*update.sh* -: This is supposed to be a shell script located in your flake base directory, i.e., the directory which contains both a *flake.nix* and a *flake.lock* file. - -*~/.local/share/flake-update/* -: **fupdate** will store the hashes to the allowed *update.sh* files here. - -# BUGS - -Report bugs to <https://codeberg.org/soispha/flake_update/issues>. - -# COPYRIGHT - -Copyright (C) 2023 Soispha - -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/>. diff --git a/pkgs/by-name/fu/fupdate/fupdate.sh b/pkgs/by-name/fu/fupdate/fupdate.sh deleted file mode 100755 index 4322610a..00000000 --- a/pkgs/by-name/fu/fupdate/fupdate.sh +++ /dev/null @@ -1,197 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -UPDATE_SCRIPT_NAME="update.sh" -CONFIG_DIRECTORY_PATH="$HOME/.local/share/flake-update" - -# Both are used in version() -# shellcheck disable=SC2034 -AUTHORS="Soispha" -# shellcheck disable=SC2034 -YEARS="2023" - -UPDATE_SCRIPT_NOT_WANTED=false - -# Searches upward for a `UPDATE_SCRIPT_NAME` script -# Returns a path to the script if it exists, otherwise nothing is returned -check_for_update_script() { - dirname="$(search_upward_files "$UPDATE_SCRIPT_NAME")" - if [ "$dirname" ]; then - printf "%s/%s" "$dirname" "$UPDATE_SCRIPT_NAME" - fi -} - -# Checks if a given path to the update script is allowed. -# Takes the path as input -# Return 0, if allowed, 1 if not. -check_for_allowed_update_script() { - update_script="$1" - config_path="${CONFIG_DIRECTORY_PATH}${update_script}" - update_script_hash="$(sha256sum "$update_script")" - if [ -f "$config_path" ]; then - if [ "$(cat "$config_path")" = "$update_script_hash" ]; then - dbg "Recorded hash matches" - return 0 - else - dbg "Recorded hash \'$(cat "$config_path")\' does not match real hash \'$update_script_hash\', assuming not allowed" - return 1 - fi - else - dbg "Path \'$config_path\' does not exist, assuming not allowed" - return 1 - fi -} - -# Asks the user if they want to allow a given script. -# Takes the path as input -ask_to_allow_update_script() { - update_script="$1" - config_path="${CONFIG_DIRECTORY_PATH}${update_script}" - update_script_hash="$(sha256sum "$update_script")" - println "\033[2J" # clear the screen - cat "$update_script" - readp "Do you want to allow this script?[N/y]: " allow - # shellcheck disable=SC2154 - dbg "allow is: $allow" - case "$allow" in - [yY]) - dbg "allowed script" - dbg "storing contents in: $config_path" - mkdir --parents "$(dirname "$config_path")" - print "$update_script_hash" >"$config_path" - ;; - *) - UPDATE_SCRIPT_NOT_ALLOWED=true - ;; - esac -} - -# Runs the provided script and continues to update the nix flake -# Takes the path to the script and the directory to the flake as arguments -# If the path to the update script is empty, it will be ignored -update() { - update_script="$1" - flake_base_dir="$2" - shift 2 - dbg "Provided following args to update script: '$*'" - - cd "$flake_base_dir" || die "Provided dir \'$flake_base_dir\' can not be accessed" - dbg "changed directory to: $flake_base_dir" - - nix flake update - - if ! [ "$update_script" = "" ] && ! [ "$UPDATE_SCRIPT_NOT_WANTED" = "true" ]; then - "$update_script" "$@" - fi - - if grep '[^0-9]_[0-9]' flake.lock >/dev/null; then - batgrep '[^0-9]_[0-9]' flake.lock - die "Your flake.nix contains duplicate inputs!" - fi -} - -help() { - cat <<EOF -This is a Nix flake update manager. - -USAGE: - $NAME [--help | --version] [flake [--no-script] | <some other command>] - -OPTIONS: - --help | -h - Display this help and exit. - - --version | -v - Display version and copyright information and exit. - - --no-script - Avoid running the 'update.sh' script -COMMANDS: - flake - update the flake project - - <some other command> - runs a executable called "update-<some other command>", if it exists -EOF -} - -main() { - if ! [ "$UPDATE_SCRIPT_NOT_ALLOWED" = true ]; then - update_script="$(check_for_update_script)" - flake_base_dir="$(search_flake_base_dir)" # Assume, that the update script is in the base dir - dbg "update_script is: $update_script" - dbg "flake_base_dir is: $flake_base_dir" - - if [ "$update_script" = "" ]; then - update "" "$flake_base_dir" "$@" - elif check_for_allowed_update_script "$update_script" && ! [ "$update_script" = "" ]; then - update "$update_script" "$flake_base_dir" "$@" - else - ask_to_allow_update_script "$update_script" - main "$@" - fi - fi -} - -if [ "$#" -eq 0 ]; then - main - exit 0 -fi - -for input in "$@"; do - case "$input" in - "--help" | "-h") - help - exit 0 - ;; - "--version" | "-v") - version - exit 0 - ;; - "--no-script" | "-n") - UPDATE_SCRIPT_NOT_WANTED=true - ;; - "--") - end_of_cli_options=true - - # Stop processing args after that marker. - break - ;; - esac - [ "$end_of_cli_options" = "true" ] && break -done - -case "$1" in -"flake") - shift 1 - - # Filter out fupdate specific flags - while [ "$1" != "--" ]; do - # FIXME: This check allows to add a flag multiple times, but this should probably - # not be allowed <2024-03-29> - case "$1" in - "--no-script" | "-n") - shift 1 - ;; - *) - break - ;; - esac - done - - [ "$1" = "--" ] && shift 1 - main "$@" - ;; -*) - command="$1" - shift 1 - [ "$1" = "--" ] && shift 1 - if which update-"$command" >/dev/null 2>&1; then - update-"$command" "$@" - else - die "command \"update-$command\" is not executable, or does not exist" - fi - ;; -esac diff --git a/pkgs/by-name/fu/fupdate/package.nix b/pkgs/by-name/fu/fupdate/package.nix index 66372add..86eccaf7 100644 --- a/pkgs/by-name/fu/fupdate/package.nix +++ b/pkgs/by-name/fu/fupdate/package.nix @@ -1,29 +1,41 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - sysLib, - dash, - lix, - gnugrep, - fd, - coreutils, - bat, # used by batgrep - bat-extras, - gnused, # required by batgrep - git, # needed to fetch through git + rustPlatform, + installShellFiles, + makeWrapper, }: -sysLib.writeShellScript { - name = "fupdate"; - src = ./fupdate.sh; - generateCompletions = true; - keepPath = true; - dependencies = [ - dash - lix - gnugrep - fd - coreutils - bat # used by batgrep - bat-extras.batgrep - gnused # required by batgrep - git # needed to fetch through git +rustPlatform.buildRustPackage (finalAttrs: { + pname = "fupdate"; + version = "0.1.0"; + + src = ./.; + cargoLock = { + lockFile = ./Cargo.lock; + }; + + buildInputs = []; + + nativeBuildInputs = [ + installShellFiles + makeWrapper ]; -} + + postInstall = '' + installShellCompletion --cmd fupdate \ + --bash <(COMPLETE=bash $out/bin/fupdate) \ + --fish <(COMPLETE=fish $out/bin/fupdate) \ + --zsh <(COMPLETE=zsh $out/bin/fupdate) + ''; + + meta = { + mainProgram = "fupdate"; + }; +}) diff --git a/pkgs/by-name/fu/fupdate/src/cli.rs b/pkgs/by-name/fu/fupdate/src/cli.rs new file mode 100644 index 00000000..6ebd1bc4 --- /dev/null +++ b/pkgs/by-name/fu/fupdate/src/cli.rs @@ -0,0 +1,56 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +use std::{env, ffi::OsStr, fs::read_dir}; + +use clap::Parser; +use clap_complete::{engine::ArgValueCompleter, CompletionCandidate}; + +/// This is a Nix flake update manager. +#[derive(Parser, Debug)] +#[command(author, version, about)] +pub struct CliArgs { + /// The command to execute. + #[arg(add = ArgValueCompleter::new(get_fupdate_commands))] + pub command: Vec<String>, +} + +fn get_fupdate_commands(current: &OsStr) -> Vec<CompletionCandidate> { + let mut output = vec![]; + let path = env::var("PATH").unwrap_or_default(); + + let Some(current) = current.to_str() else { + return output; + }; + + for directory in path.split(':') { + if let Ok(mut read) = read_dir(directory) { + for value in read.by_ref().flatten() { + let file_name = value.file_name(); + let name = file_name.to_string_lossy(); + let Some(stripped) = name.strip_prefix("fupdate-") else { + continue; + }; + + if stripped.starts_with(current) { + output.push(CompletionCandidate::new( + value + .file_name() + .to_string_lossy() + .strip_prefix("fupdate-") + .expect("Exists"), + )); + } + } + } + } + + output +} diff --git a/pkgs/by-name/fu/fupdate/src/main.rs b/pkgs/by-name/fu/fupdate/src/main.rs new file mode 100644 index 00000000..c73f2777 --- /dev/null +++ b/pkgs/by-name/fu/fupdate/src/main.rs @@ -0,0 +1,52 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +use std::process::Command; + +use anyhow::{bail, Context, Result}; +use clap::{CommandFactory, Parser}; + +pub mod cli; + +use crate::cli::CliArgs; + +fn main() -> Result<(), anyhow::Error> { + clap_complete::CompleteEnv::with_factory(CliArgs::command).complete(); + + let args = CliArgs::parse(); + + let command = args.command.first().map_or("flake", String::as_str); + + { + let args = if args.command.len() > 1 { + &args.command[1..] + } else { + &[] + }; + + // println!("Running: `fupdate-{command} {}`", args.join(" ")); + + let child = Command::new(format!("fupdate-{command}")) + .args(args) + .status() + .with_context(|| format!("Failed to spawn `fupdate-{command}`"))?; + + if !child.success() { + bail!("Command `fupdate-{command} {}` failed!", args.join(" ")); + } + } + + Ok(()) +} + +#[test] +fn verify_cli() { + CliArgs::command().debug_assert(); +} diff --git a/pkgs/by-name/fu/fupdate/update.sh b/pkgs/by-name/fu/fupdate/update.sh new file mode 100755 index 00000000..8e36e13e --- /dev/null +++ b/pkgs/by-name/fu/fupdate/update.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +[ "$1" = "upgrade" ] && cargo upgrade +cargo update diff --git a/pkgs/by-name/ge/generate_moz_extension/.envrc b/pkgs/by-name/ge/generate_moz_extension/.envrc index 2f9f1a81..294de504 100644 --- a/pkgs/by-name/ge/generate_moz_extension/.envrc +++ b/pkgs/by-name/ge/generate_moz_extension/.envrc @@ -1,2 +1,13 @@ #!/usr/bin/env sh + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use flake diff --git a/pkgs/by-name/ge/generate_moz_extension/.gitignore b/pkgs/by-name/ge/generate_moz_extension/.gitignore index f717ddd7..cc03ebd7 100644 --- a/pkgs/by-name/ge/generate_moz_extension/.gitignore +++ b/pkgs/by-name/ge/generate_moz_extension/.gitignore @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + /target /result .direnv diff --git a/pkgs/by-name/ge/generate_moz_extension/Cargo.lock b/pkgs/by-name/ge/generate_moz_extension/Cargo.lock index 10970fa6..dde9f88e 100644 --- a/pkgs/by-name/ge/generate_moz_extension/Cargo.lock +++ b/pkgs/by-name/ge/generate_moz_extension/Cargo.lock @@ -1,5 +1,14 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. version = 4 [[package]] @@ -19,9 +28,9 @@ checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "anyhow" -version = "1.0.97" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "atomic-waker" @@ -37,9 +46,9 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "backtrace" -version = "0.3.74" +version = "0.3.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" dependencies = [ "addr2line", "cfg-if", @@ -58,9 +67,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bitflags" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "bumpalo" @@ -76,9 +85,9 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" -version = "1.2.17" +version = "1.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" +checksum = "16595d3be041c03b09d08d0858631facccee9221e579704070e6e9e4915d3bc7" dependencies = [ "shlex", ] @@ -133,9 +142,9 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.10" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" dependencies = [ "libc", "windows-sys 0.59.0", @@ -280,9 +289,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "libc", @@ -291,9 +300,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", "libc", @@ -309,9 +318,9 @@ checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "h2" -version = "0.4.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5017294ff4bb30944501348f6f8e42e6ad28f42c8bbef7a74029aff064a4e3c2" +checksum = "a9421a676d1b147b16b82c9225157dc629087ef8ec4d5e2960f9437a90dac0a5" dependencies = [ "atomic-waker", "bytes", @@ -328,9 +337,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" [[package]] name = "http" @@ -394,11 +403,10 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.5" +version = "0.27.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" +checksum = "03a01595e11bdcec50946522c32dde3fc6914743000a68b93000965f2f02406d" dependencies = [ - "futures-util", "http", "hyper", "hyper-util", @@ -427,40 +435,48 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.10" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" +checksum = "b1c293b6b3d21eca78250dc7dbebd6b9210ec5530e038cbfe0661b5c47ab06e8" dependencies = [ + "base64", "bytes", "futures-channel", + "futures-core", "futures-util", "http", "http-body", "hyper", + "ipnet", + "libc", + "percent-encoding", "pin-project-lite", "socket2", + "system-configuration", "tokio", "tower-service", "tracing", + "windows-registry", ] [[package]] name = "icu_collections" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" dependencies = [ "displaydoc", + "potential_utf", "yoke", "zerofrom", "zerovec", ] [[package]] -name = "icu_locid" -version = "1.5.0" +name = "icu_locale_core" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" dependencies = [ "displaydoc", "litemap", @@ -470,30 +486,10 @@ dependencies = [ ] [[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d" - -[[package]] name = "icu_normalizer" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" dependencies = [ "displaydoc", "icu_collections", @@ -501,68 +497,55 @@ dependencies = [ "icu_properties", "icu_provider", "smallvec", - "utf16_iter", - "utf8_iter", - "write16", "zerovec", ] [[package]] name = "icu_normalizer_data" -version = "1.5.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" [[package]] name = "icu_properties" -version = "1.5.1" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" dependencies = [ "displaydoc", "icu_collections", - "icu_locid_transform", + "icu_locale_core", "icu_properties_data", "icu_provider", - "tinystr", + "potential_utf", + "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" -version = "1.5.1" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" [[package]] name = "icu_provider" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" dependencies = [ "displaydoc", - "icu_locid", - "icu_provider_macros", + "icu_locale_core", "stable_deref_trait", "tinystr", "writeable", "yoke", "zerofrom", + "zerotrie", "zerovec", ] [[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] name = "idna" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -575,9 +558,9 @@ dependencies = [ [[package]] name = "idna_adapter" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" dependencies = [ "icu_normalizer", "icu_properties", @@ -585,9 +568,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ "equivalent", "hashbrown", @@ -600,6 +583,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] +name = "iri-string" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" +dependencies = [ + "memchr", + "serde", +] + +[[package]] name = "itoa" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -617,21 +610,21 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.171" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "linux-raw-sys" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe7db12097d22ec582439daf8618b8fdd1a7bef6270e9af3b1ebcd30893cf413" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" [[package]] name = "litemap" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" [[package]] name = "log" @@ -653,22 +646,22 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" +checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" dependencies = [ "adler2", ] [[package]] name = "mio" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -705,9 +698,9 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "openssl" -version = "0.10.71" +version = "0.10.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e14130c6a98cd258fdcb0fb6d744152343ff729cbfcb28c656a9d12b999fbcd" +checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" dependencies = [ "bitflags", "cfg-if", @@ -737,9 +730,9 @@ checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "openssl-sys" -version = "0.9.106" +version = "0.9.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bb61ea9811cc39e3c2069f40b8b8e2e70d8569b361f879786cc7ed48b777cdd" +checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" dependencies = [ "cc", "libc", @@ -772,10 +765,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] +name = "potential_utf" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" +dependencies = [ + "zerovec", +] + +[[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -797,15 +799,14 @@ checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" [[package]] name = "reqwest" -version = "0.12.15" +version = "0.12.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb" +checksum = "e98ff6b0dbbe4d5a37318f433d4fc82babd21631f194d370409ceb2e40b2f0b5" dependencies = [ "base64", "bytes", "encoding_rs", "futures-core", - "futures-util", "h2", "http", "http-body", @@ -822,21 +823,20 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", - "system-configuration", "tokio", "tokio-native-tls", "tower", + "tower-http", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "windows-registry", ] [[package]] @@ -847,7 +847,7 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.15", + "getrandom 0.2.16", "libc", "untrusted", "windows-sys 0.52.0", @@ -861,9 +861,9 @@ checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustix" -version = "1.0.3" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e56a18552996ac8d29ecc3b190b4fdbb2d91ca4ec396de7bbffaf43f3d637e96" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" dependencies = [ "bitflags", "errno", @@ -874,9 +874,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.25" +version = "0.23.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "822ee9188ac4ec04a2f0531e55d035fb2de73f18b41a63c70c2712503b6fb13c" +checksum = "730944ca083c1c233a75c09f199e973ca499344a2b7ba9e755c457e86fb4a321" dependencies = [ "once_cell", "rustls-pki-types", @@ -886,25 +886,19 @@ dependencies = [ ] [[package]] -name = "rustls-pemfile" -version = "2.2.0" +name = "rustls-pki-types" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" dependencies = [ - "rustls-pki-types", + "zeroize", ] [[package]] -name = "rustls-pki-types" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" - -[[package]] name = "rustls-webpki" -version = "0.103.1" +version = "0.103.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03" +checksum = "e4a72fe2bcf7a6ac6fd7d0b9e5cb68aeb7d4c0a0271730218b3e92d43b4eb435" dependencies = [ "ring", "rustls-pki-types", @@ -913,9 +907,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" [[package]] name = "ryu" @@ -1016,15 +1010,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" +checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" [[package]] name = "socket2" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" dependencies = [ "libc", "windows-sys 0.52.0", @@ -1044,9 +1038,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.100" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", @@ -1064,9 +1058,9 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", @@ -1096,12 +1090,12 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.19.1" +version = "3.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" +checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" dependencies = [ "fastrand", - "getrandom 0.3.2", + "getrandom 0.3.3", "once_cell", "rustix", "windows-sys 0.59.0", @@ -1109,9 +1103,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.7.6" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" dependencies = [ "displaydoc", "zerovec", @@ -1119,9 +1113,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.44.1" +version = "1.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a" +checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" dependencies = [ "backtrace", "bytes", @@ -1166,9 +1160,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.14" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" +checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" dependencies = [ "bytes", "futures-core", @@ -1193,6 +1187,24 @@ dependencies = [ ] [[package]] +name = "tower-http" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fdb0c213ca27a9f57ab69ddb290fd80d970922355b83ae380b395d3986b8a2e" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] name = "tower-layer" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1253,12 +1265,6 @@ dependencies = [ ] [[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - -[[package]] name = "utf8_iter" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1394,9 +1400,9 @@ dependencies = [ [[package]] name = "windows-result" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ "windows-link", ] @@ -1566,22 +1572,16 @@ dependencies = [ ] [[package]] -name = "write16" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - -[[package]] name = "writeable" -version = "0.5.5" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" +checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" [[package]] name = "yoke" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" dependencies = [ "serde", "stable_deref_trait", @@ -1591,9 +1591,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", @@ -1629,10 +1629,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" [[package]] +name = "zerotrie" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] name = "zerovec" -version = "0.10.4" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" dependencies = [ "yoke", "zerofrom", @@ -1641,9 +1652,9 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.10.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", diff --git a/pkgs/by-name/ge/generate_moz_extension/Cargo.toml b/pkgs/by-name/ge/generate_moz_extension/Cargo.toml index 1b3ff4f0..af970bd4 100644 --- a/pkgs/by-name/ge/generate_moz_extension/Cargo.toml +++ b/pkgs/by-name/ge/generate_moz_extension/Cargo.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [package] name = "generate_extensions" version = "0.1.0" @@ -6,9 +16,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -anyhow = "1.0.97" +anyhow = "1.0.98" futures = "0.3.31" -reqwest = "0.12.15" +reqwest = "0.12.18" serde = { version = "1.0.219", features = ["derive"] } serde_json = "1.0.140" -tokio = { version = "1.44.1", features = ["macros", "rt-multi-thread"] } +tokio = { version = "1.45.1", features = ["macros", "rt-multi-thread"] } diff --git a/pkgs/by-name/ge/generate_moz_extension/examples/generate_extensions.sh b/pkgs/by-name/ge/generate_moz_extension/examples/generate_extensions.sh index 96802992..3e990b6d 100755 --- a/pkgs/by-name/ge/generate_moz_extension/examples/generate_extensions.sh +++ b/pkgs/by-name/ge/generate_moz_extension/examples/generate_extensions.sh @@ -1,5 +1,15 @@ #!/bin/sh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + tmp=$(mktemp) cat <<EOF | awk '!/^\s*#/' >"$tmp" darkreader:navbar diff --git a/pkgs/by-name/ge/generate_moz_extension/flake.lock b/pkgs/by-name/ge/generate_moz_extension/flake.lock index 9d72fb5b..7fe05591 100644 --- a/pkgs/by-name/ge/generate_moz_extension/flake.lock +++ b/pkgs/by-name/ge/generate_moz_extension/flake.lock @@ -2,11 +2,11 @@ "nodes": { "crane": { "locked": { - "lastModified": 1742394900, - "narHash": "sha256-vVOAp9ahvnU+fQoKd4SEXB2JG2wbENkpqcwlkIXgUC0=", + "lastModified": 1748047550, + "narHash": "sha256-t0qLLqb4C1rdtiY8IFRH5KIapTY/n3Lqt57AmxEv9mk=", "owner": "ipetkov", "repo": "crane", - "rev": "70947c1908108c0c551ddfd73d4f750ff2ea67cd", + "rev": "b718a78696060df6280196a6f992d04c87a16aef", "type": "github" }, "original": { @@ -35,11 +35,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1743076231, - "narHash": "sha256-yQugdVfi316qUfqzN8JMaA2vixl+45GxNm4oUfXlbgw=", + "lastModified": 1748406211, + "narHash": "sha256-B3BsCRbc+x/d0WiG1f+qfSLUy+oiIfih54kalWBi+/M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6c5963357f3c1c840201eda129a99d455074db04", + "rev": "3d1f29646e4b57ed468d60f9d286cde23a8d1707", "type": "github" }, "original": { @@ -64,11 +64,11 @@ ] }, "locked": { - "lastModified": 1743215516, - "narHash": "sha256-52qbrkG65U1hyrQWltgHTgH4nm0SJL+9TWv2UDCEPNI=", + "lastModified": 1748486227, + "narHash": "sha256-veMuFa9cq/XgUXp1S57oC8K0TIw3XyZWL2jIyGWlW0c=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "524463199fdee49338006b049bc376b965a2cfed", + "rev": "4bf1892eb81113e868efe67982b64f1da15c8c5a", "type": "github" }, "original": { diff --git a/pkgs/by-name/ge/generate_moz_extension/flake.lock.license b/pkgs/by-name/ge/generate_moz_extension/flake.lock.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/pkgs/by-name/ge/generate_moz_extension/flake.lock.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/pkgs/by-name/ge/generate_moz_extension/flake.nix b/pkgs/by-name/ge/generate_moz_extension/flake.nix index 5575f90b..a7125642 100644 --- a/pkgs/by-name/ge/generate_moz_extension/flake.nix +++ b/pkgs/by-name/ge/generate_moz_extension/flake.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { description = "A simple way to query the mozialla api for extension data"; diff --git a/pkgs/by-name/ge/generate_moz_extension/package.nix b/pkgs/by-name/ge/generate_moz_extension/package.nix index abd95c77..aae5ea6c 100644 --- a/pkgs/by-name/ge/generate_moz_extension/package.nix +++ b/pkgs/by-name/ge/generate_moz_extension/package.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { rustPlatform, openssl, diff --git a/pkgs/by-name/ge/generate_moz_extension/res/generate_extensions.py b/pkgs/by-name/ge/generate_moz_extension/res/generate_extensions.py index ee8cc966..a262ca77 100644 --- a/pkgs/by-name/ge/generate_moz_extension/res/generate_extensions.py +++ b/pkgs/by-name/ge/generate_moz_extension/res/generate_extensions.py @@ -1,4 +1,15 @@ #!/usr/bin/env python + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # source: https://github.com/etu/nixconfig/blob/ba47d577c8bfb4a1c06927c34ece34118f4a0460/modules/graphical/firefox/generate.py from concurrent.futures import ThreadPoolExecutor diff --git a/pkgs/by-name/ge/generate_moz_extension/res/reference.json.license b/pkgs/by-name/ge/generate_moz_extension/res/reference.json.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/pkgs/by-name/ge/generate_moz_extension/res/reference.json.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/pkgs/by-name/ge/generate_moz_extension/res/test.json.license b/pkgs/by-name/ge/generate_moz_extension/res/test.json.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/pkgs/by-name/ge/generate_moz_extension/res/test.json.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/pkgs/by-name/ge/generate_moz_extension/src/main.rs b/pkgs/by-name/ge/generate_moz_extension/src/main.rs index bde986a3..58a19160 100644 --- a/pkgs/by-name/ge/generate_moz_extension/src/main.rs +++ b/pkgs/by-name/ge/generate_moz_extension/src/main.rs @@ -1,3 +1,13 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::env::args; use anyhow::{bail, Context}; diff --git a/pkgs/by-name/ge/generate_moz_extension/src/types.rs b/pkgs/by-name/ge/generate_moz_extension/src/types.rs index b830fe0d..231e747c 100644 --- a/pkgs/by-name/ge/generate_moz_extension/src/types.rs +++ b/pkgs/by-name/ge/generate_moz_extension/src/types.rs @@ -1,3 +1,13 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::fmt::Display; use anyhow::anyhow; diff --git a/pkgs/by-name/ge/generate_moz_extension/update.sh b/pkgs/by-name/ge/generate_moz_extension/update.sh index b9404867..c7c35d39 100755 --- a/pkgs/by-name/ge/generate_moz_extension/update.sh +++ b/pkgs/by-name/ge/generate_moz_extension/update.sh @@ -1,5 +1,15 @@ #!/usr/bin/env sh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [ "$1" = "upgrade" ] && cargo upgrade cargo update diff --git a/pkgs/by-name/gi/git-cm/git-cm.sh b/pkgs/by-name/gi/git-cm/git-cm.sh index 2204e4d6..7ab957df 100755 --- a/pkgs/by-name/gi/git-cm/git-cm.sh +++ b/pkgs/by-name/gi/git-cm/git-cm.sh @@ -1,7 +1,14 @@ #!/usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. ROOT="$(git rev-parse --show-toplevel)" @@ -13,6 +20,6 @@ else fi sed '1d' "$(git config commit.template)" >>"$ROOT/.git/COMMIT_TEMPLATE" -git commit --template "$ROOT/.git/COMMIT_TEMPLATE" --verbose "$@" +git commit --template "$ROOT/.git/COMMIT_TEMPLATE" "$@" # vim: ft=sh diff --git a/pkgs/by-name/gi/git-cm/package.nix b/pkgs/by-name/gi/git-cm/package.nix index a9949783..f124ce90 100644 --- a/pkgs/by-name/gi/git-cm/package.nix +++ b/pkgs/by-name/gi/git-cm/package.nix @@ -1,13 +1,26 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - sysLib, + writeShellApplication, + # Dependencies git, gnused, }: -sysLib.writeShellScript { +writeShellApplication { name = "git-cm"; - src = ./git-cm.sh; - keepPath = true; - dependencies = [ + text = builtins.readFile ./git-cm.sh; + + # We need access to the $EDITOR + inheritPath = true; + + runtimeInputs = [ git gnused ]; diff --git a/pkgs/by-name/gi/git-edit-index/git-edit-index.sh b/pkgs/by-name/gi/git-edit-index/git-edit-index.sh index e73dc53c..46fbc9c5 100755 --- a/pkgs/by-name/gi/git-edit-index/git-edit-index.sh +++ b/pkgs/by-name/gi/git-edit-index/git-edit-index.sh @@ -1,19 +1,20 @@ #!/usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# needed for help() and version -# shellcheck disable=2034 -AUTHORS="Soispha" -# shellcheck disable=2034 -YEARS="2024" -# shellcheck disable=2034 -VERSION="1.0.0" - -# NAME is from the wrapper -# shellcheck disable=SC2269 -NAME="$NAME" +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +NAME="git-edit-index" + +warn() { + echo "WARNING: $1" +} help() { cat <<EOF @@ -55,37 +56,35 @@ materialize_file() { } edit() { - files_to_add="$(mktmp)" - realpath --relative-to=. "$@" >"$files_to_add" + files_to_add="$(mktemp)" + cleanup() { + rm "$files_to_add" + } + trap cleanup EXIT - index_files="$(mktmp)" - git diff --name-only --cached --diff-filter=AM >"$index_files" + realpath --relative-to=. "$@" >"$files_to_add" - while read -r file; do - if grep -q "$file" "$files_to_add"; then - sed -i "s|$file||" "$files_to_add" - materialize_file "$file" + git diff --name-only --cached --diff-filter=AM | while read -r index_file; do + if grep -q "$index_file" "$files_to_add"; then + sed -i "s|$index_file||" "$files_to_add" + materialize_file "$index_file" fi - done <"$index_files" + done - files_to_check="$(mktmp)" - clean "$files_to_add" >"$files_to_check" - if [ "$(wc -l <"$files_to_check")" -gt 0 ]; then - warn "Could not edit every file:" + unedided_files="$(sed '/^\s*$/d' "$files_to_add" | wc -l)" + if [ "$unedided_files" -gt 0 ]; then + warn "Failed to edit $unedided_files file(s):" cat "$files_to_add" fi } +end_of_cli_options=false for arg in "$@"; do case "$arg" in "--help" | "-h") help exit 0 ;; - "--version" | "-v") - version - exit 0 - ;; "--") end_of_cli_options=true ;; diff --git a/pkgs/by-name/gi/git-edit-index/package.nix b/pkgs/by-name/gi/git-edit-index/package.nix index 8ac085bf..5e855b49 100644 --- a/pkgs/by-name/gi/git-edit-index/package.nix +++ b/pkgs/by-name/gi/git-edit-index/package.nix @@ -1,19 +1,29 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - sysLib, + writeShellApplication, + # Dependencies + coreutils, git, gnused, }: -sysLib.writeShellScript { +writeShellApplication { name = "git-edit-index"; - src = ./git-edit-index.sh; - generateCompletions = true; + text = builtins.readFile ./git-edit-index.sh; # `git-edit-index` starts neovim, wich might want to shell out from - keepPath = true; + inheritPath = true; - dependencies = [ + runtimeInputs = [ + coreutils git gnused - # $EDITOR ]; } diff --git a/pkgs/by-name/hi/hibernate/hibernate.sh b/pkgs/by-name/hi/hibernate/hibernate.sh index 30868fd1..4a68e0d7 100755 --- a/pkgs/by-name/hi/hibernate/hibernate.sh +++ b/pkgs/by-name/hi/hibernate/hibernate.sh @@ -1,7 +1,16 @@ #!/usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +# TODO(@bpeetz): This functionality could be moved to `tskm`. <2025-04-14> context="$(task _get rc.context)" [ "$context" ] && task context none diff --git a/pkgs/by-name/hi/hibernate/package.nix b/pkgs/by-name/hi/hibernate/package.nix index 54716606..c2e8c0b6 100644 --- a/pkgs/by-name/hi/hibernate/package.nix +++ b/pkgs/by-name/hi/hibernate/package.nix @@ -1,14 +1,22 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - sysLib, + writeShellApplication, systemd, taskwarrior3, }: -sysLib.writeShellScript { +writeShellApplication { name = "hibernate"; - src = ./hibernate.sh; - generateCompletions = false; - keepPath = false; - dependencies = [ + text = builtins.readFile ./hibernate.sh; + inheritPath = false; + runtimeInputs = [ systemd taskwarrior3 ]; diff --git a/pkgs/by-name/i3/i3bar-river-patched/0001-revert-use-std-io-pipe.patch b/pkgs/by-name/i3/i3bar-river-patched/0001-revert-use-std-io-pipe.patch new file mode 100644 index 00000000..e1564753 --- /dev/null +++ b/pkgs/by-name/i3/i3bar-river-patched/0001-revert-use-std-io-pipe.patch @@ -0,0 +1,67 @@ +From 017ed59239e48ca689af36f1ddaec877a3c86175 Mon Sep 17 00:00:00 2001 +From: Benedikt Peetz <benedikt.peetz@b-peetz.de> +Date: Tue, 20 May 2025 17:10:47 +0200 +Subject: [PATCH] Revert "use std::io::pipe" + +This reverts commit c9cee90d765198cf72c5a5155ee0d8ab566d98a9 as this +commit requires rustc 1.87.0 +--- + src/main.rs | 24 +++++++++++++++++++----- + 1 file changed, 19 insertions(+), 5 deletions(-) + +diff --git a/src/main.rs b/src/main.rs +index 4a86593..2e7aeb2 100644 +--- a/src/main.rs ++++ b/src/main.rs +@@ -18,8 +18,8 @@ mod text; + mod utils; + mod wm_info_provider; + +-use std::io::{self, ErrorKind, Read}; +-use std::os::fd::AsRawFd; ++use std::io::{self, ErrorKind}; ++use std::os::fd::{AsRawFd, RawFd}; + use std::path::PathBuf; + + use clap::Parser; +@@ -40,7 +40,7 @@ struct Cli { + fn main() -> anyhow::Result<()> { + let args = Cli::parse(); + +- let (mut sig_read, sig_write) = io::pipe()?; ++ let [sig_read, sig_write] = pipe(libc::O_NONBLOCK | libc::O_CLOEXEC)?; + signal_hook::low_level::pipe::register(SIGUSR1, sig_write)?; + + let mut conn = Connection::connect()?; +@@ -55,8 +55,12 @@ fn main() -> anyhow::Result<()> { + Ok(event_loop::Action::Keep) + }); + +- el.register_with_fd(sig_read.as_raw_fd(), move |ctx| { +- sig_read.read_exact(&mut [0u8]).unwrap(); ++ el.register_with_fd(sig_read, move |ctx| { ++ let mut buf = [0u8]; ++ assert_eq!( ++ unsafe { libc::read(sig_read, buf.as_mut_ptr().cast(), 1) }, ++ 1 ++ ); + ctx.state.toggle_visibility(ctx.conn); + Ok(event_loop::Action::Keep) + }); +@@ -104,3 +108,13 @@ fn main() -> anyhow::Result<()> { + el.run(&mut conn, &mut state)?; + unreachable!(); + } ++ ++// TODO: remove once Rust 1.87.0 is stable ++fn pipe(flags: libc::c_int) -> io::Result<[RawFd; 2]> { ++ let mut fds = [0; 2]; ++ if unsafe { libc::pipe2(fds.as_mut_ptr(), flags) } == -1 { ++ Err(io::Error::last_os_error()) ++ } else { ++ Ok(fds) ++ } ++} +-- +2.49.0 + diff --git a/pkgs/by-name/i3/i3bar-river-patched/0002-feat-crate-bar-Put-the-leftmost-block-in-the-middle-.patch b/pkgs/by-name/i3/i3bar-river-patched/0002-feat-crate-bar-Put-the-leftmost-block-in-the-middle-.patch new file mode 100644 index 00000000..6f4bd528 --- /dev/null +++ b/pkgs/by-name/i3/i3bar-river-patched/0002-feat-crate-bar-Put-the-leftmost-block-in-the-middle-.patch @@ -0,0 +1,111 @@ +From b8568a2b626bd4d5f50ee24c304d19177bda5d4b Mon Sep 17 00:00:00 2001 +From: Benedikt Peetz <benedikt.peetz@b-peetz.de> +Date: Tue, 20 May 2025 19:58:57 +0200 +Subject: [PATCH] feat(crate::bar): Put the leftmost block in the middle of the + bar + +This is a workaround for the limitation in the i3 blocks protocol, as +this does not allow for centred blocks. +--- + src/bar.rs | 64 ++++++++++++++++++++++++++++++++++++++++++++---------- + 1 file changed, 53 insertions(+), 11 deletions(-) + +diff --git a/src/bar.rs b/src/bar.rs +index fb88150..e66c2cf 100644 +--- a/src/bar.rs ++++ b/src/bar.rs +@@ -344,16 +344,56 @@ impl Bar { + } + + // Display the blocks +- render_blocks( +- &cairo_ctx, +- ss, +- &self.output, +- ss.blocks_cache.get_computed(), +- &mut self.blocks_btns, +- offset_left, +- width_f, +- height_f, +- ); ++ { ++ if !ss.blocks_cache.get_computed().is_empty() { ++ let first_block = &ss.blocks_cache.get_computed()[0]; ++ ++ let blocks = &ss.blocks_cache.get_computed()[1..]; ++ ++ let other_start = render_blocks( ++ &cairo_ctx, ++ ss, ++ &self.output, ++ blocks, ++ &mut self.blocks_btns, ++ offset_left, ++ width_f, ++ height_f, ++ ); ++ ++ // Draw the first block _after_ the other ones, so that we can nudge it more to the ++ // left, if the others are spanning over the middle. ++ let mut start = (width_f / 2.0) - (first_block.full.width / 2.0); ++ if start + first_block.full.width > other_start { ++ start = other_start - first_block.full.width - first_block.block.separator_block_width as f64; ++ } ++ ++ first_block.full.render( ++ &cairo_ctx, ++ RenderOptions { ++ x_offset: start, ++ bar_height: height_f, ++ fg_color: first_block ++ .block ++ .color ++ .unwrap_or(sfo!(ss, &self.output, color)), ++ bg_color: first_block.block.background, ++ r_left: ss.config.blocks_r, ++ r_right: ss.config.blocks_r, ++ overlap: ss.config.blocks_overlap, ++ }, ++ ); ++ ++ self.blocks_btns.push( ++ start, ++ first_block.full.width, ++ ( ++ first_block.block.name.clone(), ++ first_block.block.instance.clone(), ++ ), ++ ); ++ } ++ } + + self.viewport + .set_destination(conn, self.width as i32, self.height as i32); +@@ -428,7 +468,7 @@ fn render_blocks( + offset_left: f64, + full_width: f64, + full_height: f64, +-) { ++) -> f64 { + context.rectangle(offset_left, 0.0, full_width - offset_left, full_height); + context.clip(); + +@@ -513,6 +553,7 @@ fn render_blocks( + } + + // Render blocks ++ let leftmost_start = full_width - blocks_width; + buttons.clear(); + for series in blocks_computed { + let s_len = series.blocks.len(); +@@ -560,6 +601,7 @@ fn render_blocks( + } + + context.reset_clip(); ++ leftmost_start + } + + fn layer_surface_cb(ctx: EventCtx<State, ZwlrLayerSurfaceV1>) { +-- +2.49.0 + diff --git a/pkgs/by-name/i3/i3bar-river-patched/package.nix b/pkgs/by-name/i3/i3bar-river-patched/package.nix new file mode 100644 index 00000000..88af5d8a --- /dev/null +++ b/pkgs/by-name/i3/i3bar-river-patched/package.nix @@ -0,0 +1,66 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + lib, + fetchFromGitHub, + rustPlatform, + pkg-config, + pango, + fetchpatch2, +}: +rustPlatform.buildRustPackage { + pname = "i3bar-river-patched"; + version = "1.1.0-unstable-2025-05-20"; + + src = fetchFromGitHub { + owner = "MaxVerevkin"; + repo = "i3bar-river"; + rev = "73446cac559b10adf4beb5567a816d1be5273457"; + hash = "sha256-NxlFKTnd2erHtSG56aWlZEkWVzBqe2hqQuVAWDdBq2c="; + }; + + useFetchCargoVendor = true; + cargoHash = "sha256-8sub8cXC/1iDY6v/9opO4FiLAo9CFrGJSDPNQydGvhQ="; + + cargoPatches = [ + # Add a separate theme for unfocused outputs. + (fetchpatch2 { + name = "Add support for special theme for unfocused outputs"; + url = "https://patch-diff.githubusercontent.com/raw/MaxVerevkin/i3bar-river/pull/44.patch"; + hash = "sha256-yH3K52kAXGW19maP77gOTHSauqQX7Px8qCZDua6wo4w="; + }) + + # TODO(@bpeetz): Remove this patch once the rustc update hits unstable. <2025-05-20> + ./0001-revert-use-std-io-pipe.patch + + # TODO(@bpeetz): Open an issues, whether something like that could be upstreamed. <2025-05-20> + ./0002-feat-crate-bar-Put-the-leftmost-block-in-the-middle-.patch + ]; + + # Remove the WMs that I don't use. + buildNoDefaultFeatures = true; + buildFeatures = [ + # "hyprland" + # "niri" + "river" + ]; + + nativeBuildInputs = [pkg-config]; + buildInputs = [pango]; + + meta = with lib; { + description = "Port of i3bar for river"; + homepage = "https://github.com/MaxVerevkin/i3bar-river"; + license = licenses.gpl3Only; + maintainers = with maintainers; [nicegamer7]; + mainProgram = "i3bar-river"; + platforms = platforms.linux; + }; +} diff --git a/pkgs/by-name/i3/i3status-rust-patched/package.nix b/pkgs/by-name/i3/i3status-rust-patched/package.nix new file mode 100644 index 00000000..9f172d49 --- /dev/null +++ b/pkgs/by-name/i3/i3status-rust-patched/package.nix @@ -0,0 +1,34 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + i3status-rust, + fetchpatch2, +}: +i3status-rust.overrideAttrs (final: prev: { + pname = "${prev.pname}-patched"; + + patches = + (prev.patches or []) + ++ [ + # Btrfs support for disk_space block. + (fetchpatch2 { + name = "disk_space: Support btrfs backend"; + url = "https://patch-diff.githubusercontent.com/raw/greshake/i3status-rust/pull/2159.patch"; + hash = "sha256-S2/biX6FTLJNfI9QVgwr+V8IGMRnSFIZnTrhc+1LvqQ="; + }) + + # Correctly calculate the used memory. + (fetchpatch2 { + name = "memory: Avoid estimating available memory, use kernel estimate instead"; + url = "https://patch-diff.githubusercontent.com/raw/greshake/i3status-rust/pull/2160.patch"; + hash = "sha256-1wB2KpXhC/UIxAgRioOYj/bnrzRSuaHAdbeoZ2O5E/Y="; + }) + ]; +}) diff --git a/pkgs/by-name/lf/lf-make-map/.envrc b/pkgs/by-name/lf/lf-make-map/.envrc index 2b742cf6..880b1809 100644 --- a/pkgs/by-name/lf/lf-make-map/.envrc +++ b/pkgs/by-name/lf/lf-make-map/.envrc @@ -1,4 +1,15 @@ #!/usr/bin/env sh + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use flake || use nix watch_file flake.nix diff --git a/pkgs/by-name/lf/lf-make-map/.gitignore b/pkgs/by-name/lf/lf-make-map/.gitignore index cb87f36f..8f29eabf 100644 --- a/pkgs/by-name/lf/lf-make-map/.gitignore +++ b/pkgs/by-name/lf/lf-make-map/.gitignore @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # build /target /result diff --git a/pkgs/by-name/lf/lf-make-map/Cargo.lock b/pkgs/by-name/lf/lf-make-map/Cargo.lock index d68f7492..59154d51 100644 --- a/pkgs/by-name/lf/lf-make-map/Cargo.lock +++ b/pkgs/by-name/lf/lf-make-map/Cargo.lock @@ -1,5 +1,14 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. version = 4 [[package]] @@ -58,20 +67,20 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "3.0.7" +version = "3.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +checksum = "6680de5231bd6ee4c6191b8a1325daa282b415391ec9d3a37bd34f2060dc73fa" dependencies = [ "anstyle", - "once_cell", + "once_cell_polyfill", "windows-sys", ] [[package]] name = "anyhow" -version = "1.0.97" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "autocfg" @@ -87,9 +96,9 @@ checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "cc" -version = "1.2.17" +version = "1.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" +checksum = "16595d3be041c03b09d08d0858631facccee9221e579704070e6e9e4915d3bc7" dependencies = [ "shlex", ] @@ -102,9 +111,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" dependencies = [ "android-tzdata", "iana-time-zone", @@ -116,9 +125,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.34" +version = "4.5.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e958897981290da2a852763fe9cdb89cd36977a5d729023127095fa94d95e2ff" +checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f" dependencies = [ "clap_builder", "clap_derive", @@ -126,9 +135,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.34" +version = "4.5.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83b0f35019843db2160b5bb19ae09b4e6411ac33fc6a712003c33e03090e2489" +checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51" dependencies = [ "anstream", "anstyle", @@ -174,15 +183,15 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbd780fe5cc30f81464441920d82ac8740e2e46b29a6fad543ddd075229ce37e" +checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08" [[package]] name = "iana-time-zone" -version = "0.1.62" +version = "0.1.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2fd658b06e56721792c5df4475705b6cda790e9298d19d2f8af083457bcd127" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -230,11 +239,21 @@ dependencies = [ ] [[package]] +name = "keymaps" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a522bbaa39bddd54945580e369ed37113ea96f4cb8f0322be0d5e04aa4d7293" +dependencies = [ + "thiserror", +] + +[[package]] name = "lf-make-map" version = "0.1.0" dependencies = [ "anyhow", "clap", + "keymaps", "log", "stderrlog", "walkdir", @@ -242,9 +261,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.171" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "log" @@ -268,10 +287,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + +[[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -287,9 +312,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" [[package]] name = "same-file" @@ -327,9 +352,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.100" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", @@ -346,6 +371,26 @@ dependencies = [ ] [[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] name = "thread_local" version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -446,11 +491,37 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.52.0" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ - "windows-targets", + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -460,6 +531,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" [[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link", +] + +[[package]] name = "windows-sys" version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" diff --git a/pkgs/by-name/lf/lf-make-map/Cargo.toml b/pkgs/by-name/lf/lf-make-map/Cargo.toml index d2427d73..2adc4797 100644 --- a/pkgs/by-name/lf/lf-make-map/Cargo.toml +++ b/pkgs/by-name/lf/lf-make-map/Cargo.toml @@ -1,14 +1,25 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [package] name = "lf-make-map" description = "An automatic lf cd mapping generator" version = "0.1.0" -edition = "2021" +edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -anyhow = "1.0.97" -clap = { version = "4.5.34", features = ["derive", "env"] } +anyhow = "1.0.98" +clap = { version = "4.5.39", features = ["derive", "env"] } +keymaps = "1.1.1" log = "0.4.27" stderrlog = "0.6.0" walkdir = "2.5.0" diff --git a/pkgs/by-name/lf/lf-make-map/README.md b/pkgs/by-name/lf/lf-make-map/README.md index 0c57cede..4d5dc95c 100644 --- a/pkgs/by-name/lf/lf-make-map/README.md +++ b/pkgs/by-name/lf/lf-make-map/README.md @@ -1,3 +1,15 @@ +<!-- +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +--> + # Lf make map > An automatic lf cd mapping generator diff --git a/pkgs/by-name/lf/lf-make-map/flake.lock b/pkgs/by-name/lf/lf-make-map/flake.lock index c9c523d9..280e8a51 100644 --- a/pkgs/by-name/lf/lf-make-map/flake.lock +++ b/pkgs/by-name/lf/lf-make-map/flake.lock @@ -1,63 +1,12 @@ { "nodes": { - "crane": { - "locked": { - "lastModified": 1742394900, - "narHash": "sha256-vVOAp9ahvnU+fQoKd4SEXB2JG2wbENkpqcwlkIXgUC0=", - "owner": "ipetkov", - "repo": "crane", - "rev": "70947c1908108c0c551ddfd73d4f750ff2ea67cd", - "type": "github" - }, - "original": { - "owner": "ipetkov", - "repo": "crane", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1733328505, - "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-utils": { - "inputs": { - "systems": [ - "systems" - ] - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "nixpkgs": { "locked": { - "lastModified": 1743076231, - "narHash": "sha256-yQugdVfi316qUfqzN8JMaA2vixl+45GxNm4oUfXlbgw=", + "lastModified": 1748406211, + "narHash": "sha256-B3BsCRbc+x/d0WiG1f+qfSLUy+oiIfih54kalWBi+/M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6c5963357f3c1c840201eda129a99d455074db04", + "rev": "3d1f29646e4b57ed468d60f9d286cde23a8d1707", "type": "github" }, "original": { @@ -69,68 +18,7 @@ }, "root": { "inputs": { - "crane": "crane", - "flake-compat": "flake-compat", - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay", - "systems": "systems", - "treefmt-nix": "treefmt-nix" - } - }, - "rust-overlay": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1743215516, - "narHash": "sha256-52qbrkG65U1hyrQWltgHTgH4nm0SJL+9TWv2UDCEPNI=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "524463199fdee49338006b049bc376b965a2cfed", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "systems": { - "locked": { - "lastModified": 1680978846, - "narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=", - "owner": "nix-systems", - "repo": "x86_64-linux", - "rev": "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "x86_64-linux", - "type": "github" - } - }, - "treefmt-nix": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1743081648, - "narHash": "sha256-WRAylyYptt6OX5eCEBWyTwOEqEtD6zt33rlUkr6u3cE=", - "owner": "numtide", - "repo": "treefmt-nix", - "rev": "29a3d7b768c70addce17af0869f6e2bd8f5be4b7", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "treefmt-nix", - "type": "github" + "nixpkgs": "nixpkgs" } } }, diff --git a/pkgs/by-name/lf/lf-make-map/flake.lock.license b/pkgs/by-name/lf/lf-make-map/flake.lock.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/pkgs/by-name/lf/lf-make-map/flake.lock.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/pkgs/by-name/lf/lf-make-map/flake.nix b/pkgs/by-name/lf/lf-make-map/flake.nix index dc8c24cc..20925aca 100644 --- a/pkgs/by-name/lf/lf-make-map/flake.nix +++ b/pkgs/by-name/lf/lf-make-map/flake.nix @@ -1,125 +1,34 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { description = "An automatic lf cd mapping generator"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + }; - treefmt-nix = { - url = "github:numtide/treefmt-nix"; - inputs = { - nixpkgs.follows = "nixpkgs"; - }; - }; - - crane = { - url = "github:ipetkov/crane"; - inputs = { - nixpkgs.follows = "nixpkgs"; - }; - }; - rust-overlay = { - url = "github:oxalica/rust-overlay"; - inputs = { - nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "flake-utils"; - }; - }; - - # inputs for following - systems = { - url = "github:nix-systems/x86_64-linux"; # only evaluate for this system - }; - flake-compat = { - url = "github:edolstra/flake-compat"; - flake = false; - }; - flake-utils = { - url = "github:numtide/flake-utils"; - inputs = { - systems.follows = "systems"; - }; + outputs = {nixpkgs, ...}: let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages."${system}"; + in { + devShells."${system}".default = pkgs.mkShell { + packages = with pkgs; [ + cargo + clippy + rustc + rustfmt + + cargo-edit + ]; }; }; - - outputs = { - self, - nixpkgs, - flake-utils, - treefmt-nix, - crane, - rust-overlay, - ... - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - inherit system; - overlays = [(import rust-overlay)]; - }; - - nightly = false; - rust_minimal = - if nightly - then pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal) - else pkgs.rust-bin.stable.latest.minimal; - rust_default = - if nightly - then pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default) - else pkgs.rust-bin.stable.latest.default; - - cargo_toml = craneLib.cleanCargoToml {cargoToml = ./Cargo.toml;}; - pname = cargo_toml.package.name; - - craneLib = (crane.mkLib pkgs).overrideToolchain rust_minimal; - craneBuild = craneLib.buildPackage { - src = craneLib.cleanCargoSource ./.; - - doCheck = true; - }; - - manual = pkgs.stdenv.mkDerivation { - name = "${pname}-manual"; - inherit (cargo_toml.package) version; - - src = ./docs; - nativeBuildInputs = with pkgs; [pandoc]; - - buildPhase = '' - mkdir --parents $out/docs; - - pandoc "./${pname}.1.md" -s -t man > $out/docs/${pname}.1 - ''; - - installPhase = '' - install -D $out/docs/${pname}.1 $out/share/man/man1/${pname}; - ''; - }; - - treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;}; - in { - packages.default = pkgs.symlinkJoin { - inherit (cargo_toml.package) name; - - paths = [manual craneBuild]; - }; - - checks = { - inherit craneBuild; - formatting = treefmtEval.config.build.check self; - }; - - formatter = treefmtEval.config.build.wrapper; - - devShells.default = pkgs.mkShell { - packages = with pkgs; [ - cocogitto - - rust_default - cargo-edit - - licensure - ]; - }; - }); } # vim: ts=2 diff --git a/pkgs/by-name/lf/lf-make-map/package.nix b/pkgs/by-name/lf/lf-make-map/package.nix index 8404927f..8f77c843 100644 --- a/pkgs/by-name/lf/lf-make-map/package.nix +++ b/pkgs/by-name/lf/lf-make-map/package.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {rustPlatform}: rustPlatform.buildRustPackage { pname = "lf-make-map"; diff --git a/pkgs/by-name/lf/lf-make-map/src/cli.rs b/pkgs/by-name/lf/lf-make-map/src/cli.rs index a398e451..70746984 100644 --- a/pkgs/by-name/lf/lf-make-map/src/cli.rs +++ b/pkgs/by-name/lf/lf-make-map/src/cli.rs @@ -1,3 +1,13 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::path::PathBuf; use clap::{ArgAction, Parser, Subcommand}; diff --git a/pkgs/by-name/lf/lf-make-map/src/main.rs b/pkgs/by-name/lf/lf-make-map/src/main.rs index aaf79b20..d5d934e1 100644 --- a/pkgs/by-name/lf/lf-make-map/src/main.rs +++ b/pkgs/by-name/lf/lf-make-map/src/main.rs @@ -1,13 +1,23 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::path::{Path, PathBuf}; use anyhow::{Context, Result}; use clap::Parser; use cli::{Args, Command}; use log::trace; -use mapping::map_tree::MappingTree; +use mapping::map_key::MapKey; use walkdir::{DirEntry, WalkDir}; -use crate::mapping::MapKey; +use crate::mapping::MappingsTrie; mod cli; mod mapping; @@ -24,7 +34,7 @@ fn main() -> anyhow::Result<()> { .timestamp(stderrlog::Timestamp::Off) .init()?; - let mut mappings = MappingTree::new(); + let mut mappings = MappingsTrie::new(); let relevant_directories = match &args.command { Command::Visualize { options } => &options.relevant_directories, @@ -32,68 +42,62 @@ fn main() -> anyhow::Result<()> { }; for dir in relevant_directories { - trace!("Processing '{}'..", dir.display()); - let path = strip_path(&dir, &args.home_name)?; + trace!("START Processing '{}'..", dir.display()); + let path = strip_path(dir, &args.home_name)?; mappings .include(path_to_str(path)?) .with_context(|| format!("Failed to include path: '{}'", path.display()))?; + trace!("END Finished processing {}.", dir.display()); + } + + trace!("Generated mappings for the relevant directories. Starting expanding to max depth."); + if log::log_enabled!(log::Level::Trace) { + eprintln!("{mappings}"); } let home = path_to_str(&args.home_name)?.to_owned(); let mut current_depth = 1; while current_depth != args.depth { - for (key, value) in mappings.iter(false) { - trace!( - "Adding to child ('{}' -> '{}')", - MapKey::display(&key), - value - ); - - let mut local_mappings = MappingTree::new(); - for dir in WalkDir::new(extend(&home, &value)?) + for (keys, child) in mappings.0.iter().filter(|(_, child)| child.expendable) { + trace!("Adding to child '{}' ('{}')", MapKey::display(&keys), child); + + let mut local_mappings = MappingsTrie::new(); + for dir in WalkDir::new(extend(&home, &child.path)?) .min_depth(1) .max_depth(1) .into_iter() .filter_entry(|e| is_dir(e) && !is_hidden(e)) { - let directory = dir - .with_context(|| format!("Failed to read dir ('{}')", home.clone() + &value))?; - let path_to_strip = &PathBuf::from(extend(&home, &value)?); - let path = strip_path(&directory.path(), &path_to_strip)?; + let directory = dir.with_context(|| { + format!("Failed to read dir ('{}')", home.clone() + &child.path) + })?; + let path_to_strip = &PathBuf::from(extend(&home, &child.path)?); + let path = strip_path(directory.path(), path_to_strip)?; trace!( - "Including: '{}' (after stripping '{}' from '{}' -> '{}' + '/' + '{}')", + "Including: '{}' (after stripping '{}' from '{}')", path.display(), - directory.path().display(), path_to_strip.display(), - home, - value + directory.path().display(), ); let gen_key = MapKey::new_ones_from_path(path_to_str(path)?, 1); local_mappings .insert( &gen_key, - path_to_str(strip_path(&directory.path(), &PathBuf::from(&home))?)?, + path_to_str(strip_path(directory.path(), &PathBuf::from(&home))?)?, ) .with_context(|| format!("Failed to include path: '{}'", path.display()))?; } - trace!("{}", local_mappings); - - trace!( - "'{}' -> '{:#?}'", - MapKey::display(&key), - local_mappings.root_node() - ); - mappings.interleave(&key, local_mappings.root_node().to_owned())?; + mappings.add_trie(&keys, local_mappings)?; } current_depth += 1; } match args.command { - Command::Visualize { .. } => println!("{}", mappings), + Command::Visualize { .. } => println!("{}", mappings.0), Command::Generate { .. } => println!("{}", mappings.to_lf_mappings(args.home_name)), } @@ -120,7 +124,7 @@ fn is_dir(entry: &DirEntry) -> bool { } fn strip_path<'a>(path: &'a Path, to_strip: &Path) -> Result<&'a Path> { - path.strip_prefix(&to_strip).with_context(|| { + path.strip_prefix(to_strip).with_context(|| { format!( "'{}' is not under the specified home path ('{}')!", path.display(), diff --git a/pkgs/by-name/lf/lf-make-map/src/mapping/lf_mapping.rs b/pkgs/by-name/lf/lf-make-map/src/mapping/lf_mapping.rs new file mode 100644 index 00000000..f8a6182e --- /dev/null +++ b/pkgs/by-name/lf/lf-make-map/src/mapping/lf_mapping.rs @@ -0,0 +1,35 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +use std::path::PathBuf; + +use crate::mapping::MapKey; + +use super::MappingsTrie; + +impl MappingsTrie { + pub fn to_lf_mappings(&self, home_path: PathBuf) -> String { + let mut raw = self + .0 + .iter() + .map(|(key, value)| { + format!( + "map g{} cd \"{}\"\n", + MapKey::display(&key), + home_path.join(&value.path).display() + ) + }) + .collect::<Vec<String>>(); + + raw.sort(); + + raw.into_iter().collect() + } +} diff --git a/pkgs/by-name/lf/lf-make-map/src/mapping/map_key.rs b/pkgs/by-name/lf/lf-make-map/src/mapping/map_key.rs new file mode 100644 index 00000000..10b612fd --- /dev/null +++ b/pkgs/by-name/lf/lf-make-map/src/mapping/map_key.rs @@ -0,0 +1,274 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +use std::fmt::Write; + +use anyhow::bail; +use log::debug; + +#[derive(Clone, Debug)] +pub struct MapKey { + pub key: char, + + pub(crate) resolution: usize, + + /// Part of the path, used to derive the key + pub(crate) part_path: String, +} + +impl std::hash::Hash for MapKey { + fn hash<H: std::hash::Hasher>(&self, state: &mut H) { + self.key.hash(state) + } +} + +impl Eq for MapKey {} +impl PartialEq for MapKey { + fn eq(&self, other: &Self) -> bool { + self.key == other.key + } +} + +impl Ord for MapKey { + fn cmp(&self, other: &Self) -> std::cmp::Ordering { + self.key.cmp(&other.key) + } +} +impl PartialOrd for MapKey { + fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { + Some(self.cmp(other)) + } +} + +impl MapKey { + pub fn new_from_part_path(part_path: &str, resolution: usize) -> Vec<Self> { + let key = Self::part_path_to_key(part_path, resolution); + + key.chars() + .map(|ch| Self { + key: ch, + resolution, + part_path: part_path.to_owned(), + }) + .collect() + } + + pub fn new_ones_from_path(path: &str, number_of_chars: usize) -> Vec<Self> { + let key: Vec<MapKey> = path + .split('/') + .flat_map(|part| Self::new_from_part_path(part, number_of_chars)) + .collect(); + + debug!( + "Generated full MapKeys: '{}' -> '{}'", + path, + MapKey::display(&key) + ); + key + } + + pub fn increment(&self, target_resolution: usize) -> Vec<Self> { + let new_resolution = target_resolution; + + // debug!("Incrementing: '{}' ('{}')", &self, &self.part_path); + + let added_chars = if new_resolution < self.part_path.len() { + MapKey::part_path_to_key(&self.part_path, new_resolution) + } else { + let mut generated_chars = + MapKey::part_path_to_key(&self.part_path, self.part_path.len()); + + generated_chars.extend( + (0..(new_resolution - self.part_path.len())) + .into_iter() + .map(|_| self.part_path.chars().last().expect("This will exists")), + ); + + generated_chars + }; + + let part_path = self.part_path.clone(); + let output: Vec<Self> = added_chars + .chars() + .enumerate() + .map(|(res, ch)| MapKey { + key: ch, + resolution: res + 1, + part_path: part_path.clone(), + }) + .collect(); + + // debug!("Finished increment: '{}' ('{}')", MapKey::display(&output), output[0].part_path); + output + } + + pub fn display(values: &[Self]) -> String { + values.iter().map(|value| value.key.clone()).collect() + } + + fn part_path_to_key(part: &str, number_of_chars: usize) -> String { + fn make(pat: char, part: &str, number_of_chars: usize) -> String { + let mut acc = String::new(); + + if !part.split(pat).all(|part| part.len() > 0) { + panic!( + "\ +Can't turn this path '{}' to a mapping. +This should not happen, please report the bug!", + part + ) + } + + let mut last_working = None; + for i in 0..number_of_chars { + for str in part.split(pat) { + if acc.len() != number_of_chars { + acc.push(match str.chars().nth(i) { + Some(ch) => ch, + None => { + if let Some(last) = last_working { + str.chars().nth(last).expect("This should always exist") + } else { + last_working = Some(i - 1); + str.chars().nth(i - 1).expect("This should always exist") + } + } + }) + } + } + } + + acc + } + + let value = if part.contains('_') && !part.starts_with('_') && !part.ends_with('_') { + make('_', part, number_of_chars) + } else if part.contains('-') && !part.starts_with('-') && !part.ends_with('-') { + make('-', part, number_of_chars) + } else { + part.chars().take(number_of_chars).collect::<String>() + }; + + assert_eq!( + value.len(), + number_of_chars, + "'{}' does not have expected length of: {}", + value, + number_of_chars + ); + value + } + + /// Checks whether a tiebreak via the [`Self::increment`] function can result in unique keys. + pub fn can_tiebreak_with(&self, other: &Self) -> anyhow::Result<()> { + /// Check whether the `input` &str is composed of only one character. + /// If so, returns this character, otherwise returns None. + fn reduce_string(input: &str) -> Option<char> { + let first_char = input + .chars() + .take(1) + .last() + .expect("Should contain one char"); + + if input.chars().all(|ch| ch == first_char) { + Some(first_char) + } else { + None + } + } + + /// Check whether `a` is a subset of `b` or `b` is a subset of `a`. + fn is_subset_either(a: &str, b: &str) -> bool { + /// Checks if `subset` is a subset of `set`. + /// + /// # Examples + /// ``` + /// let a = "a"; + /// let b = "aa"; + /// assert!(is_subset(a, b)) + /// ``` + /// + /// ``` + /// let a = "abc"; + /// let b = "def"; + /// assert!(!is_subset(a, b)) + /// ``` + fn is_subset(subset: &str, set: &str) -> bool { + let prefix: String = set.chars().take(subset.len()).collect(); + let suffix: String = set.chars().skip(subset.len()).collect(); + + if prefix == subset { + let clean_suffix = reduce_string(&suffix); + if let Some(ch) = clean_suffix { + ch == subset.chars().last().expect("Will exists") + } else { + false + } + } else { + false + } + } + + match a.len().cmp(&b.len()) { + std::cmp::Ordering::Less => { + // `b` is the longer string. As such we need to check if `a` is a subset of `b`. + is_subset(a, b) + } + std::cmp::Ordering::Greater => { + // `a` is the longer string. As such we need to check if `b` is a subset of `a`. + is_subset(b, a) + } + std::cmp::Ordering::Equal => a == b, + } + } + + if reduce_string(&other.part_path) + .is_some_and(|a| Some(a) == reduce_string(&self.part_path)) + { + bail!( + "\ +The foreign_key ('{}', path_part: '{}' -> '{}') and our_key ('{}', path_part: '{}' -> '{}') \ +have an identical path_part (when duplicated chars are removed)! +I cannot extended them via incrementation. +Please rename the paths to fix this. + ", + other, + &other.part_path, + reduce_string(&other.part_path).expect("Is some here"), + self, + &self.part_path, + reduce_string(&self.part_path).expect("Is some here"), + ); + } + + if is_subset_either(&other.part_path, &self.part_path) { + bail!( + "\ +The foreign_key ('{}', path_part: '{}') and our_key ('{}', path_part: '{}') \ +are subsets of one another! +A discrimination through incrementation will not work! +Please rename the paths to fix this. + ", + other, + &other.part_path, + self, + &self.part_path, + ); + } + + Ok(()) + } +} + +impl std::fmt::Display for MapKey { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_char(self.key) + } +} diff --git a/pkgs/by-name/lf/lf-make-map/src/mapping/map_tree/display.rs b/pkgs/by-name/lf/lf-make-map/src/mapping/map_tree/display.rs deleted file mode 100644 index 65302e1e..00000000 --- a/pkgs/by-name/lf/lf-make-map/src/mapping/map_tree/display.rs +++ /dev/null @@ -1,91 +0,0 @@ -use std::fmt::Display; - -use crate::mapping::{ - map_tree::{Node, NodeValue}, - MapKey, -}; - -use super::MappingTree; - -impl Display for MappingTree { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - fn write_node( - f: &mut std::fmt::Formatter<'_>, - node: &Node, - indention: String, - location: Vec<MapKey>, - is_last: bool, - is_root: bool, - ) -> std::fmt::Result { - let node_value = match &node.value { - NodeValue::Parent { children: _ } => "<Parent>".to_owned(), - NodeValue::Child { path, extandable } => { - path.to_owned() + if *extandable { " [exten.]" } else { " [stop]" } - } - }; - - let new_idention = indention.clone() - + if is_root { - "" - } else { - match is_last { - true => " ", - false => "│ ", - } - }; - - let bullet = match is_last { - true => String::from("└── "), - false => String::from("├── "), - }; - - if is_root { - write!(f, ": {}\n", node_value)?; - } else { - write!( - f, - "{}{}\x1b[1;33m{}\x1b[0m: {}\n", - indention, - bullet, - MapKey::display(&location), - node_value, - )?; - }; - - match &node.value { - NodeValue::Parent { children } => { - let mut children_vec: Vec<(&MapKey, &Node)> = children.iter().collect(); - children_vec.sort_by(|(a, _), (b, _)| a.key.cmp(&b.key)); - - let mut counter = 1; - for (key, child) in &children_vec { - let mut new_location = location.clone(); - new_location.push((*key).to_owned()); - - write_node( - f, - child, - new_idention.clone(), - new_location.clone(), - counter == children_vec.len(), - false, - )?; - counter += 1; - } - } - NodeValue::Child { - path: _, - extandable: _, - } => { - // Do nothing and stop the recursion - } - } - - Ok(()) - } - - write_node(f, &self.root, String::new(), vec![], false, true)?; - - Ok(()) - } -} diff --git a/pkgs/by-name/lf/lf-make-map/src/mapping/map_tree/iterator.rs b/pkgs/by-name/lf/lf-make-map/src/mapping/map_tree/iterator.rs deleted file mode 100644 index 4364bb2b..00000000 --- a/pkgs/by-name/lf/lf-make-map/src/mapping/map_tree/iterator.rs +++ /dev/null @@ -1,53 +0,0 @@ -use crate::mapping::MapKey; - -use super::{MappingTree, Node, NodeValue}; - -pub struct MappingTreeIterator { - children: Vec<(Vec<MapKey>, String)>, -} - -impl MappingTreeIterator { - pub fn new(tree: &MappingTree, ignore_extendable: bool) -> Self { - let children = extract_child(vec![], &tree.root, ignore_extendable); - - Self { children } - } -} - -fn extract_child( - current_key: Vec<MapKey>, - node: &Node, - ignore_extendable: bool, -) -> Vec<(Vec<MapKey>, String)> { - match &node.value { - NodeValue::Parent { children } => children - .iter() - .map(|(key, value)| { - let mut new_key = current_key.clone(); - new_key.push(key.to_owned()); - - extract_child(new_key, value, ignore_extendable) - }) - .flatten() - .collect(), - NodeValue::Child { path, extandable } => { - if ignore_extendable { - vec![(current_key, path.to_string())] - } else { - if *extandable { - vec![(current_key, path.to_string())] - } else { - vec![] - } - } - } - } -} - -impl Iterator for MappingTreeIterator { - type Item = (Vec<MapKey>, String); - - fn next(&mut self) -> Option<Self::Item> { - self.children.pop() - } -} diff --git a/pkgs/by-name/lf/lf-make-map/src/mapping/map_tree/lf_mapping.rs b/pkgs/by-name/lf/lf-make-map/src/mapping/map_tree/lf_mapping.rs deleted file mode 100644 index ba485dc2..00000000 --- a/pkgs/by-name/lf/lf-make-map/src/mapping/map_tree/lf_mapping.rs +++ /dev/null @@ -1,24 +0,0 @@ -use std::path::PathBuf; - -use crate::mapping::MapKey; - -use super::MappingTree; - -impl MappingTree { - pub fn to_lf_mappings(self, home_path: PathBuf) -> String { - let mut raw = self - .iter(true) - .map(|(key, value)| { - format!( - "map g{} cd \"{}\"\n", - MapKey::display(&key), - home_path.join(&value).display() - ) - }) - .collect::<Vec<String>>(); - - raw.sort(); - - raw.into_iter().collect() - } -} diff --git a/pkgs/by-name/lf/lf-make-map/src/mapping/map_tree/mod.rs b/pkgs/by-name/lf/lf-make-map/src/mapping/map_tree/mod.rs deleted file mode 100644 index 35e6d91d..00000000 --- a/pkgs/by-name/lf/lf-make-map/src/mapping/map_tree/mod.rs +++ /dev/null @@ -1,402 +0,0 @@ -use std::{collections::HashMap, mem}; - -use anyhow::{bail, Result}; -use log::debug; - -use self::iterator::MappingTreeIterator; - -use super::MapKey; - -pub mod display; -pub mod iterator; -pub mod lf_mapping; - -/// A prefix tree -#[derive(Debug)] -pub struct MappingTree { - root: Node, -} - -#[derive(Clone, Debug, PartialEq, Eq)] -pub enum NodeValue { - Parent { children: HashMap<MapKey, Node> }, - Child { path: String, extandable: bool }, -} - -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct Node { - value: NodeValue, -} - -impl MappingTree { - pub fn new() -> Self { - Self { - root: Node::new_parent(), - } - } - - pub fn root_node(&self) -> &Node { - &self.root - } - - pub fn iter(&self, ignore_extendable: bool) -> MappingTreeIterator { - MappingTreeIterator::new(&self, ignore_extendable) - } - - /// Returns the node at the key, otherwise None. The node can be changed - pub fn get_mut(&mut self, key: &[MapKey]) -> Option<&mut Node> { - let mut current_node = &mut self.root; - for ch in key.iter() { - if let NodeValue::Parent { children } = &mut current_node.value { - current_node = children.get_mut(&ch)? - } else { - return None; - } - } - - Some(current_node) - } - - /// Returns the node at the key, otherwise the last node that matched. - pub fn try_get(&self, key: &[MapKey]) -> (&Node, Vec<MapKey>) { - let mut current_node = &self.root; - let mut current_key = vec![]; - - for ch in key.iter() { - if let NodeValue::Parent { children } = ¤t_node.value { - current_node = if let Some(node) = children.get(&ch) { - let (key, _value) = children - .get_key_value(&ch) - .expect("This exists, we checked"); - current_key.push(key.clone()); - - node - } else { - return (current_node, current_key); - }; - } else { - return (current_node, current_key); - } - } - - (current_node, current_key) - } - - pub fn include(&mut self, path: &str) -> Result<()> { - let associated_key = MapKey::new_ones_from_path(path, 1); - self.insert(&associated_key, path) - } - - pub fn insert(&mut self, key: &[MapKey], path: &str) -> Result<()> { - self.insert_node(key, Node::new_child(path.to_owned())) - } - - pub fn interleave(&mut self, key: &[MapKey], node: Node) -> Result<()> { - let want_to_be_parent = self.get_mut(&key).expect("This value exists"); - let (parent_value, _parent_children) = if let NodeValue::Parent { children } = node.value { - ( - NodeValue::Parent { - children: children.clone(), - }, - children, - ) - } else { - unreachable!("This value will be a parent") - }; - - let child_value = mem::replace(&mut want_to_be_parent.value, parent_value); - assert!(matches!( - child_value, - NodeValue::Child { - path: _, - extandable: _ - } - )); - - let child_value = if let NodeValue::Child { - path, - extandable: _, - } = child_value - { - NodeValue::Child { - path, - extandable: false, - } - } else { - unreachable!("This is only a child value") - }; - - let child = Node { value: child_value }; - - let mut new_key = key.to_vec(); - new_key.push(MapKey { - key: '.', - part_path: ".".to_owned(), - resolution: 1, - }); - self.insert_node(&new_key, child)?; - Ok(()) - } - - pub fn insert_node(&mut self, key: &[MapKey], node: Node) -> Result<()> { - let (_node, found_key) = self.try_get(key).clone(); - - if found_key != key { - let needed_nodes_key = key - .strip_prefix(&found_key[..]) - .expect("The node's location is a prefix"); - - let needed_nodes_length = needed_nodes_key.iter().count(); - - let mut current_node = self - .get_mut(&found_key[..]) - .expect("This should always exists"); - let mut current_location = found_key.clone(); - let mut counter = 1; - - for ch in needed_nodes_key.iter() { - current_location.push(ch.to_owned()); - - let next_node = if counter == needed_nodes_length { - node.clone() - } else { - Node::new_parent() - }; - - current_node = match ¤t_node.value { - NodeValue::Parent { children } => { - assert_eq!(children.get(&ch), None); - - let children = - if let NodeValue::Parent { children } = &mut current_node.value { - children - } else { - unreachable!("This is a parent, we cheched") - }; - - children.insert(ch.to_owned(), next_node); - children.get_mut(&ch).expect("Was just inserted") - } - NodeValue::Child { - path, - extandable: _, - } => { - // A node that should be a parent was classified - // as child before: - // - // 1. Remove the child node and replace it with a parent one. - // 2. Add the child node to the parent node as child, but with a '.' as MapKey. - // 3. Add the original node also as child to the parent node. - - let mut children = HashMap::new(); - let move_child_node = Node::new_child(path.to_owned()); - - children.insert( - MapKey { - key: '.', - part_path: ".".to_owned(), - resolution: 1, - }, - move_child_node, - ); - children.insert(ch.to_owned(), next_node); - - current_node.value = NodeValue::Parent { children }; - - let children = - if let NodeValue::Parent { children } = &mut current_node.value { - children - } else { - unreachable!("We just inserted the parent value.") - }; - - children.get_mut(&ch).expect("Was just inserted") - } - }; - - counter += 1; - } - } else { - fn reduce_string(a: &str) -> Option<char> { - let first_char = a.chars().take(1).last().expect("Should contain one char"); - - if a.chars().all(|ch| ch == first_char) { - return Some(first_char); - } else { - return None; - } - } - fn check_subset(a: &str, b: &str) -> bool { - if a.len() > b.len() { - let a_prefix: String = a.chars().take(b.len()).collect(); - let a_suffix: String = a.chars().skip(b.len()).collect(); - - if a_prefix == b { - let clean_suffix = reduce_string(&a_suffix); - if let Some(ch) = clean_suffix { - ch == b.chars().last().expect("Will match") - } else { - false - } - } else { - false - } - } else if b.len() > a.len() { - let b_prefix: String = b.chars().take(a.len()).collect(); - let b_suffix: String = b.chars().skip(a.len()).collect(); - - if b_prefix == a { - let clean_suffix = reduce_string(&b_suffix); - if let Some(ch) = clean_suffix { - ch == a.chars().last().expect("Will match") - } else { - false - } - } else { - false - } - } else { - a == b - } - } - - // Another node was already inserted with the same key! - // So we simple increase the resolution of the other node and this node, until their - // keys are not the same anymore. - // This only includes the last segment of the `MapKey` - // - // 1. Change both keys, until they are not equal any more - // 2. Move the wrongly placed node to the new place. - // 3. Insert our node. - let mut foreign_key = vec![found_key.last().expect("This will exist").clone()]; - let mut our_key = vec![key.last().expect("This will exist").clone()]; - - debug!( - "'{}' ('{}') and '{}' ('{}') are the same, try to find a better combination!", - MapKey::display(&our_key), - our_key[0].part_path, - MapKey::display(&foreign_key), - foreign_key[0].part_path, - ); - - // The 'a' and 'b' stuff is here, to ensure that both returning None will not match - // this condition. - if reduce_string(&foreign_key[0].part_path).unwrap_or('a') - == reduce_string(&our_key[0].part_path).unwrap_or('b') - { - bail!( - "\ -The foreign_key ('{}', path_part: '{}' -> '{}') and our_key ('{}', path_part: '{}' -> '{}') \ -have an identical path_part (when duplicated chars are removed)! -I cannot extended them via incrementation. -Please rename the paths to fix this. - ", - MapKey::display(&foreign_key), - &foreign_key[0].part_path, - reduce_string(&foreign_key[0].part_path).expect("Is some here"), - MapKey::display(&our_key), - &our_key[0].part_path, - reduce_string(&our_key[0].part_path).expect("Is some here"), - ); - } - - if check_subset(&foreign_key[0].part_path, &our_key[0].part_path) { - bail!( - "\ -The foreign_key ('{}', path_part: '{}') and our_key ('{}', path_part: '{}') \ -are subsets of one another! -A discrimination through incrementation will not work! -Please rename the paths to fix this. - ", - MapKey::display(&foreign_key), - &foreign_key[0].part_path, - MapKey::display(&our_key), - &our_key[0].part_path, - ); - } - - while our_key == foreign_key { - our_key = our_key[0].increment(our_key[our_key.len() - 1].resolution + 1); - foreign_key = - foreign_key[0].increment(foreign_key[foreign_key.len() - 1].resolution + 1); - debug!( - "Now its: '{}' ('{}') and '{}' ('{}')", - MapKey::display(&our_key), - our_key[0].part_path, - MapKey::display(&foreign_key), - foreign_key[0].part_path, - ); - } - - debug!( - "Found a better one: '{}' ('{}') and '{}' ('{}')", - MapKey::display(&our_key), - our_key[0].part_path, - MapKey::display(&foreign_key), - foreign_key[0].part_path, - ); - - let parent = self - .get_mut(&found_key[..&found_key.len() - 1]) - .expect("This will exist"); - - if let NodeValue::Parent { children } = &mut parent.value { - if let NodeValue::Child { - path: _, - extandable: _, - } = children - .get(found_key.last().expect("Exists")) - .expect("This node also exists") - .value - { - let old = children - .remove(found_key.last().expect("This will exist")) - .expect("This will be there"); - - let full_foreign_key: Vec<_> = found_key - .clone() - .into_iter() - .rev() - .skip(1) - .rev() - .chain(foreign_key.clone().into_iter()) - .collect(); - self.insert_node(&full_foreign_key, old.clone())?; - } - - let full_our_key: Vec<_> = key - .to_vec() - .into_iter() - .rev() - .skip(1) - .rev() - .chain(our_key.clone().into_iter()) - .collect(); - - self.insert_node(&full_our_key, node.clone())?; - } else { - unreachable!("This node will be a parent"); - } - } - - Ok(()) - } -} - -impl Node { - pub fn new_child(path: String) -> Self { - Self { - value: NodeValue::Child { - path, - extandable: true, - }, - } - } - pub fn new_parent() -> Self { - Self { - value: NodeValue::Parent { - children: HashMap::new(), - }, - } - } -} diff --git a/pkgs/by-name/lf/lf-make-map/src/mapping/mod.rs b/pkgs/by-name/lf/lf-make-map/src/mapping/mod.rs index 114fdca0..21392388 100644 --- a/pkgs/by-name/lf/lf-make-map/src/mapping/mod.rs +++ b/pkgs/by-name/lf/lf-make-map/src/mapping/mod.rs @@ -1,156 +1,231 @@ -use std::{ - fmt::{Display, Write}, - hash::Hash, -}; - -use log::debug; - -pub mod map_tree; - -#[derive(Clone, Debug, Eq)] -pub struct MapKey { - pub key: char, +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +use anyhow::Result; +use keymaps::map_tree::{Node, Trie}; +use log::{Level, debug, log_enabled, trace}; +use map_key::MapKey; + +pub mod lf_mapping; +pub mod map_key; + +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] +pub struct MapChild { + pub path: String, + pub expendable: bool, +} - resolution: usize, +impl std::fmt::Display for MapChild { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(&self.path)?; + if !self.expendable { + f.write_str(" [stop]")?; + } - /// Part of the path, used to derive the key - part_path: String, + Ok(()) + } } -impl Hash for MapKey { - fn hash<H: std::hash::Hasher>(&self, state: &mut H) { - self.key.hash(state) +pub struct MappingsTrie(pub Trie<MapKey, MapChild>); +impl std::fmt::Display for MappingsTrie { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.fmt(f) } } -impl PartialEq for MapKey { - fn eq(&self, other: &Self) -> bool { - self.key == other.key +impl MappingsTrie { + pub fn new() -> Self { + Self(Trie::new()) } -} -impl MapKey { - pub fn new_from_part_path(part_path: &str, resolution: usize) -> Vec<Self> { - let key = Self::part_path_to_key(&part_path, resolution); - - key.chars() - .map(|ch| Self { - key: ch, - resolution, - part_path: part_path.to_owned(), - }) - .collect() + pub(crate) fn include(&mut self, path: &str) -> Result<()> { + let associated_key = MapKey::new_ones_from_path(path, 1); + self.insert(&associated_key, path) } - pub fn new_ones_from_path(path: &str, number_of_chars: usize) -> Vec<Self> { - let key: Vec<MapKey> = path - .split('/') - .map(|part| Self::new_from_part_path(part, number_of_chars)) - .flatten() - .collect(); - - debug!( - "Generated full MapKeys: '{}' -> '{}'", - path, - MapKey::display(&key) - ); - key + pub(crate) fn insert(&mut self, keys: &[MapKey], path: &str) -> Result<()> { + let value = Node::new_child(MapChild { + path: path.to_owned(), + expendable: true, + }); + self.insert_node(keys, value) } - pub fn increment(&self, target_resolution: usize) -> Vec<Self> { - let new_resolution = target_resolution; + pub(crate) fn insert_node( + &mut self, + keys: &[MapKey], + node: Node<MapKey, MapChild>, + ) -> Result<()> { + if let Err(err) = self.0.insert_node(keys, &node) { + match err { + keymaps::error::TrieInsert::KeyAlreadySet(found_keys) => { + // Another node was already inserted with the same key! + // So we simple increase the resolution of the other node and this node, until their + // keys are no longer equal. + // This only includes the last segment of the `MapKey` + // + // 1. Change both keys, until they are not equal any more + // 2. Move the wrongly placed node to the new place. + // 3. Insert our node. + assert_eq!(keys, found_keys); + + let mut foreign_keys = + vec![found_keys.last().expect("This will exist").clone()]; + let mut our_keys = vec![keys.last().expect("This will exist").clone()]; + + debug!( + "'{}' ('{}') and '{}' ('{}') are the same, trying to find a better combination!", + MapKey::display(&our_keys), + our_keys[0].part_path, + MapKey::display(&foreign_keys), + foreign_keys[0].part_path, + ); + + our_keys[0].can_tiebreak_with(&foreign_keys[0])?; + + while our_keys == foreign_keys { + our_keys = + our_keys[0].increment(our_keys[our_keys.len() - 1].resolution + 1); + foreign_keys = foreign_keys[0] + .increment(foreign_keys[foreign_keys.len() - 1].resolution + 1); + debug!( + "Now its: '{}' ('{}') and '{}' ('{}')", + MapKey::display(&our_keys), + our_keys[0].part_path, + MapKey::display(&foreign_keys), + foreign_keys[0].part_path, + ); + } + debug!( + "Found a better one: '{}' ('{}') and '{}' ('{}')", + MapKey::display(&our_keys), + our_keys[0].part_path, + MapKey::display(&foreign_keys), + foreign_keys[0].part_path, + ); + + let parent_keys = &found_keys[..&found_keys.len() - 1]; + + { + if self + .0 + .get(&found_keys) + .expect("This will exist") + .value() + .is_some() + { + // This is a child, we must replace it with a parent. + let other_node = self + .0 + .replace_node(&found_keys, Node::new_parent()) + .expect("This node exists"); + + { + let mut full_foreign_keys = parent_keys.to_vec(); + full_foreign_keys.append(&mut foreign_keys); + self.insert_node(&full_foreign_keys, other_node)?; + } + } + } - // debug!("Incrementing: '{}' ('{}')", &self, &self.part_path); + { + let mut full_our_keys = parent_keys.to_vec(); + full_our_keys.append(&mut our_keys); + self.insert_node(&full_our_keys, node)?; + } - let added_chars = if new_resolution < self.part_path.len() { - MapKey::part_path_to_key(&self.part_path, new_resolution) + Ok(()) + } + keymaps::error::TrieInsert::KeyIncludesChild { + child_key: key, + child_value, + } => { + // A node that should be a parent was classified + // as child before: + // + // 1. Remove the child node and replace it with a parent one. + // 2. Add the child node to the parent node as child, but with a '.' as MapKey. + // 3. Add the original node also as child to the parent node. + + assert_eq!(key, keys); + + let (fetched_child_value, mut child_key) = self.0.try_get(keys); + assert_eq!(fetched_child_value.value(), Some(&child_value)); + + trace!( + "Replacing child ('{}') with a parent, so that we can continue from this point.", + MapKey::display(&child_key) + ); + + let child = self + .0 + .replace_node(&child_key, Node::new_parent()) + .expect("Node exists"); + assert_eq!(child.value(), Some(&child_value)); + + child_key.push(MapKey { + key: '.', + part_path: ".".to_owned(), + resolution: 1, + }); + self.0 + .insert_node(&child_key, &child) + .expect("We just created a parent here"); + + // Recursive call, because this key could have hit the previous child directly + // (thus it will now trigger the `KeyAlreadySet` error.) + self.insert_node(keys, node) + } + } } else { - let mut generated_chars = - MapKey::part_path_to_key(&self.part_path, self.part_path.len()); - - generated_chars.extend( - (0..(new_resolution - self.part_path.len())) - .into_iter() - .map(|_| self.part_path.chars().last().expect("This will exists")), - ); - - generated_chars - }; - - let part_path = self.part_path.clone(); - let output: Vec<Self> = added_chars - .chars() - .enumerate() - .map(|(res, ch)| MapKey { - key: ch, - resolution: res + 1, - part_path: part_path.clone(), - }) - .collect(); - - // debug!("Finished increment: '{}' ('{}')", MapKey::display(&output), output[0].part_path); - output + Ok(()) + } } - pub fn display(values: &[Self]) -> String { - values.iter().map(|value| value.key.clone()).collect() - } - fn part_path_to_key(part: &str, number_of_chars: usize) -> String { - fn make(pat: char, part: &str, number_of_chars: usize) -> String { - let mut acc = String::new(); - - if !part.split(pat).all(|part| part.len() > 0) { - panic!( - "\ -Can't turn this path '{}' to a mapping. -This should not happen, please report the bug!", - part - ) - } + /// Add a new [`MappingsTrie`] at the position `keys` into this Trie. + pub(crate) fn add_trie(&mut self, keys: &[MapKey], trie: Self) -> Result<()> { + if log_enabled!(Level::Trace) { + trace!("Adding mappings under '{}':", MapKey::display(keys)); + eprintln!("{trie}"); - let mut last_working = None; - for i in 0..number_of_chars { - for str in part.split(pat) { - if acc.len() != number_of_chars { - acc.push(match str.chars().nth(i) { - Some(ch) => ch, - None => { - if let Some(last) = last_working { - str.chars().nth(last).expect("This should always exist") - } else { - last_working = Some(i - 1); - str.chars().nth(i - 1).expect("This should always exist") - } - } - }) - } - } - } + trace!("Self is:"); + eprintln!("{self}"); + } + + let replaced = self + .0 + .replace_node(keys, trie.0.root_node().to_owned()) + .expect("This value exists"); - acc + if log_enabled!(Level::Trace) { + trace!("After replace adding the new trie"); + eprintln!("{self}"); } - let value = if part.contains('_') && !part.starts_with('_') && !part.ends_with('_') { - make('_', part, number_of_chars) - } else if part.contains('-') && !part.starts_with('-') && !part.ends_with('-') { - make('-', part, number_of_chars) - } else { - part.chars().take(number_of_chars).collect::<String>() - }; - - assert_eq!( - value.len(), - number_of_chars, - "'{}' does not have expected length of: {}", - value, - number_of_chars - ); - value - } -} + { + let mut new_keys = keys.to_vec(); + new_keys.push(MapKey { + key: '.', + part_path: ".".to_owned(), + resolution: 1, + }); + + let mut value = replaced.value().expect("Is a child").clone(); + value.expendable = false; + + trace!("Re-inserting '{}' into self.", MapKey::display(keys)); + self.0 + .insert_node(&new_keys, &Node::new_child(value)) + .expect("This key is not used."); + } -impl Display for MapKey { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.write_char(self.key) + Ok(()) } } diff --git a/pkgs/by-name/lf/lf-make-map/tests/base.sh b/pkgs/by-name/lf/lf-make-map/tests/base.sh new file mode 100755 index 00000000..c7694985 --- /dev/null +++ b/pkgs/by-name/lf/lf-make-map/tests/base.sh @@ -0,0 +1,25 @@ +#! /usr/bin/env sh + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +cd "$(dirname "$0")" || exit 2 + +cargo build +execute_make_maps() { + ../target/debug/lf-make-map "$@" +} + +fd . cases --max-depth 1 --type directory | while read -r case; do + echo "Executing '$case/test.sh'" + + # shellcheck source=/dev/null + LOCATION="$case/test.sh" . "$case/test.sh" +done diff --git a/pkgs/by-name/lf/lf-make-map/tests/cases/child_insert/test.sh b/pkgs/by-name/lf/lf-make-map/tests/cases/child_insert/test.sh new file mode 100755 index 00000000..90ebe1ce --- /dev/null +++ b/pkgs/by-name/lf/lf-make-map/tests/cases/child_insert/test.sh @@ -0,0 +1,27 @@ +#! /usr/bin/env sh + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +test="$(mktemp --directory)" + +cleanup() { + rm --recursive "$test" +} +trap cleanup EXIT + +cat <<EOF | while read -r name; do mkdir --parents "$test/media/books/${name}"; done +Andre A +Anton B +Andon C +Anton D +EOF + +execute_make_maps --home-name "$test" --depth 100 generate "$test"/* >/dev/null diff --git a/pkgs/by-name/lf/lf-make-map/tests/cases/simple/output.old b/pkgs/by-name/lf/lf-make-map/tests/cases/simple/output.old new file mode 100644 index 00000000..90591f16 --- /dev/null +++ b/pkgs/by-name/lf/lf-make-map/tests/cases/simple/output.old @@ -0,0 +1,46 @@ +map gdd. cd "/tmp/tmp.DfcgjemfCG/d" +map gddcc. cd "/tmp/tmp.DfcgjemfCG/d/c" +map gddccb. cd "/tmp/tmp.DfcgjemfCG/d/c/b" +map gddccbc. cd "/tmp/tmp.DfcgjemfCG/d/c/b/c" +map gddccbcf. cd "/tmp/tmp.DfcgjemfCG/d/c/b/c/file.test" +map gddccd. cd "/tmp/tmp.DfcgjemfCG/d/c/d" +map gddccdf. cd "/tmp/tmp.DfcgjemfCG/d/c/d/f" +map gddccdff. cd "/tmp/tmp.DfcgjemfCG/d/c/d/f/file.test2" +map gddcco. cd "/tmp/tmp.DfcgjemfCG/d/c/other" +map gddccof. cd "/tmp/tmp.DfcgjemfCG/d/c/other/file.test3" +map gddct. cd "/tmp/tmp.DfcgjemfCG/d/cll_the-things" +map gddcto. cd "/tmp/tmp.DfcgjemfCG/d/cll_the-things/other" +map gddctof. cd "/tmp/tmp.DfcgjemfCG/d/cll_the-things/other/file.test4" +map gddm. cd "/tmp/tmp.DfcgjemfCG/d/mcybe some whitespcce" +map gddmt. cd "/tmp/tmp.DfcgjemfCG/d/mcybe some whitespcce/test.file5" +map gdi. cd "/tmp/tmp.DfcgjemfCG/dir" +map gdicc. cd "/tmp/tmp.DfcgjemfCG/dir/c" +map gdiccb. cd "/tmp/tmp.DfcgjemfCG/dir/c/b" +map gdiccbc. cd "/tmp/tmp.DfcgjemfCG/dir/c/b/c" +map gdiccbcf. cd "/tmp/tmp.DfcgjemfCG/dir/c/b/c/file.test" +map gdiccd. cd "/tmp/tmp.DfcgjemfCG/dir/c/d" +map gdiccdf. cd "/tmp/tmp.DfcgjemfCG/dir/c/d/f" +map gdiccdff. cd "/tmp/tmp.DfcgjemfCG/dir/c/d/f/file.test2" +map gdicco. cd "/tmp/tmp.DfcgjemfCG/dir/c/other" +map gdiccof. cd "/tmp/tmp.DfcgjemfCG/dir/c/other/file.test3" +map gdict. cd "/tmp/tmp.DfcgjemfCG/dir/cll_the-things" +map gdicto. cd "/tmp/tmp.DfcgjemfCG/dir/cll_the-things/other" +map gdictof. cd "/tmp/tmp.DfcgjemfCG/dir/cll_the-things/other/file.test4" +map gdim. cd "/tmp/tmp.DfcgjemfCG/dir/mcybe some whitespcce" +map gdimt. cd "/tmp/tmp.DfcgjemfCG/dir/mcybe some whitespcce/test.file5" +map gdo. cd "/tmp/tmp.DfcgjemfCG/dor" +map gdocc. cd "/tmp/tmp.DfcgjemfCG/dor/c" +map gdoccb. cd "/tmp/tmp.DfcgjemfCG/dor/c/b" +map gdoccbc. cd "/tmp/tmp.DfcgjemfCG/dor/c/b/c" +map gdoccbcf. cd "/tmp/tmp.DfcgjemfCG/dor/c/b/c/file.test" +map gdoccd. cd "/tmp/tmp.DfcgjemfCG/dor/c/d" +map gdoccdf. cd "/tmp/tmp.DfcgjemfCG/dor/c/d/f" +map gdoccdff. cd "/tmp/tmp.DfcgjemfCG/dor/c/d/f/file.test2" +map gdocco. cd "/tmp/tmp.DfcgjemfCG/dor/c/other" +map gdoccof. cd "/tmp/tmp.DfcgjemfCG/dor/c/other/file.test3" +map gdoct. cd "/tmp/tmp.DfcgjemfCG/dor/cll_the-things" +map gdocto. cd "/tmp/tmp.DfcgjemfCG/dor/cll_the-things/other" +map gdoctof. cd "/tmp/tmp.DfcgjemfCG/dor/cll_the-things/other/file.test4" +map gdom. cd "/tmp/tmp.DfcgjemfCG/dor/mcybe some whitespcce" +map gdomt. cd "/tmp/tmp.DfcgjemfCG/dor/mcybe some whitespcce/test.file5" + diff --git a/pkgs/by-name/lf/lf-make-map/tests/cases/simple/output.old.license b/pkgs/by-name/lf/lf-make-map/tests/cases/simple/output.old.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/pkgs/by-name/lf/lf-make-map/tests/cases/simple/output.old.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/pkgs/by-name/lf/lf-make-map/tests/cases/simple/test.sh b/pkgs/by-name/lf/lf-make-map/tests/cases/simple/test.sh new file mode 100755 index 00000000..6e127d28 --- /dev/null +++ b/pkgs/by-name/lf/lf-make-map/tests/cases/simple/test.sh @@ -0,0 +1,49 @@ +#! /usr/bin/env sh + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +# We need to hard code this, so that our output matches the golden sample. +base="/tmp/tmp.DfcgjemfCG" +test="$(mktemp --directory)" + +[ -d "$base" ] && { + echo "$base already exists!" + exit 1 +} + +mkdir "$base" + +cleanup() { + rm --recursive "$base" "$test" +} +trap cleanup EXIT + +mkdir --parents "$base/dir/c/b/c/file.test" +mkdir --parents "$base/dir/c/d/f/file.test2" +mkdir --parents "$base/dir/c/other/file.test3" +mkdir --parents "$base/dir/cll_the-things/other/file.test4" +mkdir --parents "$base/dir/mcybe some whitespcce/test.file5" + +mkdir --parents "$base/dor/c/b/c/file.test" +mkdir --parents "$base/dor/c/d/f/file.test2" +mkdir --parents "$base/dor/c/other/file.test3" +mkdir --parents "$base/dor/cll_the-things/other/file.test4" +mkdir --parents "$base/dor/mcybe some whitespcce/test.file5" + +mkdir --parents "$base/d/c/b/c/file.test" +mkdir --parents "$base/d/c/d/f/file.test2" +mkdir --parents "$base/d/c/other/file.test3" +mkdir --parents "$base/d/cll_the-things/other/file.test4" +mkdir --parents "$base/d/mcybe some whitespcce/test.file5" + +execute_make_maps --home-name "$base" --depth 100 generate "$base"/* >"$test/output.new" + +diff "$test/output.new" "$(dirname "$LOCATION")/output.old" diff --git a/pkgs/by-name/lf/lf-make-map/update.sh b/pkgs/by-name/lf/lf-make-map/update.sh index 7d517e8b..23d90a86 100755 --- a/pkgs/by-name/lf/lf-make-map/update.sh +++ b/pkgs/by-name/lf/lf-make-map/update.sh @@ -1,4 +1,14 @@ #!/usr/bin/env sh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [ "$1" = "upgrade" ] && cargo upgrade cargo update diff --git a/pkgs/by-name/ll/ll/ll.sh b/pkgs/by-name/ll/ll/ll.sh deleted file mode 100755 index 73328e3e..00000000 --- a/pkgs/by-name/ll/ll/ll.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -last_directory="$(mktemp)" - -command lf -last-dir-path="$last_directory" "$@" - -dir="$(cat "$last_directory")" -if cd "$dir"; then - [ -d "$XDG_RUNTIME_DIR/ll" ] || mkdir "$XDG_RUNTIME_DIR/ll" - echo "$dir" >"$XDG_RUNTIME_DIR/ll/last_directory" -else - die "$dir does not exist!" -fi - -rm "$last_directory" -# vim: ft=sh diff --git a/pkgs/by-name/ll/ll/package.nix b/pkgs/by-name/ll/ll/package.nix deleted file mode 100644 index 4c13b40e..00000000 --- a/pkgs/by-name/ll/ll/package.nix +++ /dev/null @@ -1,9 +0,0 @@ -{sysLib}: -sysLib.writeShellScript { - name = "ll"; - src = ./ll.sh; - generateCompletions = false; - - # `ll` must be able to change the path of the running shell. - wrap = false; -} diff --git a/pkgs/by-name/lm/lm/lm.sh b/pkgs/by-name/lm/lm/lm.sh deleted file mode 100755 index d5fdca10..00000000 --- a/pkgs/by-name/lm/lm/lm.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -if [ -f "$XDG_RUNTIME_DIR/ll/last_directory" ]; then - last_dir="$(cat "$XDG_RUNTIME_DIR/ll/last_directory")" - cd "$last_dir" || die "$last_dir does not exist!" -else - msg "No last directory saved (try using ll instead)." -fi -# vim: ft=sh diff --git a/pkgs/by-name/lm/lm/package.nix b/pkgs/by-name/lm/lm/package.nix deleted file mode 100644 index ef417cd2..00000000 --- a/pkgs/by-name/lm/lm/package.nix +++ /dev/null @@ -1,9 +0,0 @@ -{sysLib}: -sysLib.writeShellScript { - name = "lm"; - src = ./lm.sh; - generateCompletions = false; - - # `ll` must be able to change the path of the running shell. - wrap = false; -} diff --git a/pkgs/by-name/lo/lock/lock.sh b/pkgs/by-name/lo/lock/lock.sh index 4c5e1c01..1c068e57 100755 --- a/pkgs/by-name/lo/lock/lock.sh +++ b/pkgs/by-name/lo/lock/lock.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=bash context="$(task _get rc.context)" diff --git a/pkgs/by-name/lo/lock/package.nix b/pkgs/by-name/lo/lock/package.nix index a59fbdd0..572ebb0b 100644 --- a/pkgs/by-name/lo/lock/package.nix +++ b/pkgs/by-name/lo/lock/package.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { writeShellApplication, taskwarrior3, diff --git a/pkgs/by-name/mp/mpp-beetrm/mpp-beetrm.sh b/pkgs/by-name/mp/mpp-beetrm/mpp-beetrm.sh index 3209503c..83784743 100755 --- a/pkgs/by-name/mp/mpp-beetrm/mpp-beetrm.sh +++ b/pkgs/by-name/mp/mpp-beetrm/mpp-beetrm.sh @@ -1,7 +1,14 @@ #!/usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. beet remove --delete \ title:"$(mpc --format '%title%' current)" \ diff --git a/pkgs/by-name/mp/mpp-beetrm/package.nix b/pkgs/by-name/mp/mpp-beetrm/package.nix index 24b56606..00672838 100644 --- a/pkgs/by-name/mp/mpp-beetrm/package.nix +++ b/pkgs/by-name/mp/mpp-beetrm/package.nix @@ -1,15 +1,24 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - sysLib, + writeShellApplication, + # Dependencies mpc, beets, }: -sysLib.writeShellScript { +writeShellApplication { name = "mpp-beetrm"; - src = ./mpp-beetrm.sh; - generateCompletions = false; - keepPath = false; + text = builtins.readFile ./mpp-beetrm.sh; + inheritPath = false; - dependencies = [ + runtimeInputs = [ mpc beets ]; diff --git a/pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh b/pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh index 004c67c7..fa1cac49 100755 --- a/pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh +++ b/pkgs/by-name/mp/mpp-lyrics/mpp-lyrics.sh @@ -1,11 +1,21 @@ #!/usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -( - cd "%MPD_MUSIC_DIR" || die "No music dir!" - exiftool "$(mpc --format '%file%' current)" -json | jq '.[0].Lyrics' -r | less -) +die() { + echo "Error: $1" + exit 1 +} + +cd "$XDG_MUSIC_DIR/beets" || die "No music dir!" +exiftool "$(mpc --format '%file%' current)" -json | jq '.[0].Lyrics' --raw-output | less # vim: ft=sh diff --git a/pkgs/by-name/mp/mpp-lyrics/package.nix b/pkgs/by-name/mp/mpp-lyrics/package.nix index 76b590c7..0b6d8993 100644 --- a/pkgs/by-name/mp/mpp-lyrics/package.nix +++ b/pkgs/by-name/mp/mpp-lyrics/package.nix @@ -1,23 +1,27 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - sysLib, + writeShellApplication, + # Dependencies exiftool, mpc, jq, less, locale, # dependency of less - mpd_music_dir ? "\${XDG_MUSIC_DIR}", }: -sysLib.writeShellScript { +writeShellApplication { name = "mpp-lyrics"; - src = ./mpp-lyrics.sh; - generateCompletions = false; - keepPath = false; + text = builtins.readFile ./mpp-lyrics.sh; + inheritPath = false; - replacementStrings = { - MPD_MUSIC_DIR = mpd_music_dir; - }; - - dependencies = [ + runtimeInputs = [ exiftool mpc jq diff --git a/pkgs/by-name/mp/mpp-searchadd/mpp-searchadd.sh b/pkgs/by-name/mp/mpp-searchadd/mpp-searchadd.sh index 3fe9a6b6..d76e73b8 100755 --- a/pkgs/by-name/mp/mpp-searchadd/mpp-searchadd.sh +++ b/pkgs/by-name/mp/mpp-searchadd/mpp-searchadd.sh @@ -1,14 +1,18 @@ #!/usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -tracks="$(mktmp)" -beet list "$@" --path >"$tracks" - -while read -r track; do +beet list "$@" --path | while read -r track; do mpc add "$track" -done <"$tracks" +done mpc playlist # vim: ft=sh diff --git a/pkgs/by-name/mp/mpp-searchadd/package.nix b/pkgs/by-name/mp/mpp-searchadd/package.nix index a98472d1..91ff05e9 100644 --- a/pkgs/by-name/mp/mpp-searchadd/package.nix +++ b/pkgs/by-name/mp/mpp-searchadd/package.nix @@ -1,15 +1,24 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - sysLib, + writeShellApplication, + # Dependencies. mpc, beets, }: -sysLib.writeShellScript { +writeShellApplication { name = "mpp-searchadd"; - src = ./mpp-searchadd.sh; - generateCompletions = false; - keepPath = false; + text = builtins.readFile ./mpp-searchadd.sh; + inheritPath = false; - dependencies = [ + runtimeInputs = [ mpc beets ]; diff --git a/pkgs/by-name/mp/mpp/mpp.sh b/pkgs/by-name/mp/mpp/mpp.sh index 538a56ee..3ac98ddb 100755 --- a/pkgs/by-name/mp/mpp/mpp.sh +++ b/pkgs/by-name/mp/mpp/mpp.sh @@ -1,9 +1,16 @@ #!/usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -case "$1" in +case "${1-}" in "searchadd") shift 1 mpp-searchadd "$@" diff --git a/pkgs/by-name/mp/mpp/package.nix b/pkgs/by-name/mp/mpp/package.nix index 9c5315b0..f0e454f7 100644 --- a/pkgs/by-name/mp/mpp/package.nix +++ b/pkgs/by-name/mp/mpp/package.nix @@ -1,20 +1,35 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - sysLib, - mpc, - fd, + writeShellApplication, symlinkJoin, stdenv, + # Dependencies + mpc, + mpp-searchadd, + mpp-lyrics, + mpp-beetrm, + # Build dependencies + fd, zsh, }: let - script = sysLib.writeShellScript { + script = writeShellApplication { name = "mpp"; - src = ./mpp.sh; - generateCompletions = false; - # We source the wrappers from the environment, to ensure that they have the same - # configurations (e.g. MPD_MUSIC_DIR in `mpc-lyrics`) - keepPath = true; - dependencies = [ + text = builtins.readFile ./mpp.sh; + inheritPath = false; + + runtimeInputs = [ mpc + mpp-searchadd + mpp-lyrics + mpp-beetrm ]; }; @@ -55,6 +70,8 @@ fd "." --hidden --type file | while read -r file_path; do sed --in-place 's/mpc/mpp/g' "$file_path" done + + # TODO(@bpeetz): Also change this in man-pages. <2025-05-20> ''; installPhase = '' @@ -64,6 +81,8 @@ }; in symlinkJoin { - name = "mpp-merged"; + name = "mpp"; paths = [script mpcShare]; + + inherit (script) meta; } diff --git a/pkgs/by-name/ri/river-mk-keymap/.envrc b/pkgs/by-name/ri/river-mk-keymap/.envrc index fdd3e9d8..294de504 100644 --- a/pkgs/by-name/ri/river-mk-keymap/.envrc +++ b/pkgs/by-name/ri/river-mk-keymap/.envrc @@ -1,3 +1,13 @@ #!/usr/bin/env sh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use flake diff --git a/pkgs/by-name/ri/river-mk-keymap/.gitignore b/pkgs/by-name/ri/river-mk-keymap/.gitignore index 2d5df85d..f255eebd 100644 --- a/pkgs/by-name/ri/river-mk-keymap/.gitignore +++ b/pkgs/by-name/ri/river-mk-keymap/.gitignore @@ -1,2 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + /target .direnv diff --git a/pkgs/by-name/ri/river-mk-keymap/Cargo.lock b/pkgs/by-name/ri/river-mk-keymap/Cargo.lock index 7fb009ef..129b88b4 100644 --- a/pkgs/by-name/ri/river-mk-keymap/Cargo.lock +++ b/pkgs/by-name/ri/river-mk-keymap/Cargo.lock @@ -1,5 +1,14 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. version = 4 [[package]] @@ -43,26 +52,26 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "3.0.7" +version = "3.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +checksum = "6680de5231bd6ee4c6191b8a1325daa282b415391ec9d3a37bd34f2060dc73fa" dependencies = [ "anstyle", - "once_cell", + "once_cell_polyfill", "windows-sys", ] [[package]] name = "anyhow" -version = "1.0.97" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "clap" -version = "4.5.34" +version = "4.5.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e958897981290da2a852763fe9cdb89cd36977a5d729023127095fa94d95e2ff" +checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f" dependencies = [ "clap_builder", "clap_derive", @@ -70,9 +79,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.34" +version = "4.5.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83b0f35019843db2160b5bb19ae09b4e6411ac33fc6a712003c33e03090e2489" +checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51" dependencies = [ "anstream", "anstyle", @@ -124,9 +133,9 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "keymaps" -version = "1.0.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6cec33e805ecc09c4e4f91ca26e536978ad1ae28f2e1dc02fadafeec6d2f8504" +checksum = "2a522bbaa39bddd54945580e369ed37113ea96f4cb8f0322be0d5e04aa4d7293" dependencies = [ "serde", "thiserror", @@ -139,16 +148,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] -name = "once_cell" -version = "1.21.3" +name = "once_cell_polyfill" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" [[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -219,9 +228,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.100" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", diff --git a/pkgs/by-name/ri/river-mk-keymap/Cargo.toml b/pkgs/by-name/ri/river-mk-keymap/Cargo.toml index f14411f2..583fcb92 100644 --- a/pkgs/by-name/ri/river-mk-keymap/Cargo.toml +++ b/pkgs/by-name/ri/river-mk-keymap/Cargo.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [package] name = "river-mk-keymap" version = "0.1.0" @@ -6,9 +16,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -anyhow = "1.0.97" -clap = { version = "4.5.34", features = ["derive"] } -keymaps = { version = "1.0.0", features = ["serde", "mouse-keys"] } +anyhow = "1.0.98" +clap = { version = "4.5.39", features = ["derive"] } +keymaps = { version = "1.1.1", features = ["serde", "mouse-keys"] } serde = { version = "1.0.219", features = ["derive"] } serde_json = "1.0.140" diff --git a/pkgs/by-name/ri/river-mk-keymap/TODO.license b/pkgs/by-name/ri/river-mk-keymap/TODO.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/pkgs/by-name/ri/river-mk-keymap/TODO.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/pkgs/by-name/ri/river-mk-keymap/contrib/example.json.license b/pkgs/by-name/ri/river-mk-keymap/contrib/example.json.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/pkgs/by-name/ri/river-mk-keymap/contrib/example.json.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/pkgs/by-name/ri/river-mk-keymap/flake.lock b/pkgs/by-name/ri/river-mk-keymap/flake.lock index 82448387..280e8a51 100644 --- a/pkgs/by-name/ri/river-mk-keymap/flake.lock +++ b/pkgs/by-name/ri/river-mk-keymap/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1743076231, - "narHash": "sha256-yQugdVfi316qUfqzN8JMaA2vixl+45GxNm4oUfXlbgw=", + "lastModified": 1748406211, + "narHash": "sha256-B3BsCRbc+x/d0WiG1f+qfSLUy+oiIfih54kalWBi+/M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6c5963357f3c1c840201eda129a99d455074db04", + "rev": "3d1f29646e4b57ed468d60f9d286cde23a8d1707", "type": "github" }, "original": { diff --git a/pkgs/by-name/ri/river-mk-keymap/flake.lock.license b/pkgs/by-name/ri/river-mk-keymap/flake.lock.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/pkgs/by-name/ri/river-mk-keymap/flake.lock.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/pkgs/by-name/ri/river-mk-keymap/flake.nix b/pkgs/by-name/ri/river-mk-keymap/flake.nix index 95a14456..e15e99fa 100644 --- a/pkgs/by-name/ri/river-mk-keymap/flake.nix +++ b/pkgs/by-name/ri/river-mk-keymap/flake.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { description = "A smart way to configure river keybindings"; diff --git a/pkgs/by-name/ri/river-mk-keymap/package.nix b/pkgs/by-name/ri/river-mk-keymap/package.nix index d9519d48..7d6d4f3a 100644 --- a/pkgs/by-name/ri/river-mk-keymap/package.nix +++ b/pkgs/by-name/ri/river-mk-keymap/package.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {rustPlatform}: rustPlatform.buildRustPackage { pname = "river-mk-keymap"; diff --git a/pkgs/by-name/ri/river-mk-keymap/src/cli.rs b/pkgs/by-name/ri/river-mk-keymap/src/cli.rs index 55b87e1a..e3c49310 100644 --- a/pkgs/by-name/ri/river-mk-keymap/src/cli.rs +++ b/pkgs/by-name/ri/river-mk-keymap/src/cli.rs @@ -1,3 +1,13 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::path::PathBuf; use clap::Parser; diff --git a/pkgs/by-name/ri/river-mk-keymap/src/key_map/commands.rs b/pkgs/by-name/ri/river-mk-keymap/src/key_map/commands.rs index a4ac0ebd..e948ccfe 100644 --- a/pkgs/by-name/ri/river-mk-keymap/src/key_map/commands.rs +++ b/pkgs/by-name/ri/river-mk-keymap/src/key_map/commands.rs @@ -1,3 +1,13 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::process::Command; use keymaps::key_repr::{KeyValue, MediaKeyCode, MouseKeyValue}; diff --git a/pkgs/by-name/ri/river-mk-keymap/src/key_map/mod.rs b/pkgs/by-name/ri/river-mk-keymap/src/key_map/mod.rs index 84a16c9d..2c82ee05 100644 --- a/pkgs/by-name/ri/river-mk-keymap/src/key_map/mod.rs +++ b/pkgs/by-name/ri/river-mk-keymap/src/key_map/mod.rs @@ -1,3 +1,13 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::{collections::HashMap, fmt::Display, ops::Deref, str::FromStr}; use anyhow::Context; diff --git a/pkgs/by-name/ri/river-mk-keymap/src/main.rs b/pkgs/by-name/ri/river-mk-keymap/src/main.rs index 5cb99f74..63955f7f 100644 --- a/pkgs/by-name/ri/river-mk-keymap/src/main.rs +++ b/pkgs/by-name/ri/river-mk-keymap/src/main.rs @@ -1,3 +1,13 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::fs; use anyhow::Context; diff --git a/pkgs/by-name/ri/river-mk-keymap/update.sh b/pkgs/by-name/ri/river-mk-keymap/update.sh index 9268caf2..8e36e13e 100755 --- a/pkgs/by-name/ri/river-mk-keymap/update.sh +++ b/pkgs/by-name/ri/river-mk-keymap/update.sh @@ -1,3 +1,14 @@ #!/bin/sh -cargo update && cargo upgrade +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +[ "$1" = "upgrade" ] && cargo upgrade +cargo update diff --git a/pkgs/by-name/ri/river-start/package.nix b/pkgs/by-name/ri/river-start/package.nix deleted file mode 100644 index ab986708..00000000 --- a/pkgs/by-name/ri/river-start/package.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - writeShellApplication, - river, -}: -writeShellApplication { - name = "river-start"; - text = builtins.readFile ./river-start.sh; - runtimeInputs = [ - river - ]; - meta = { - mainProgram = "river-start"; - }; -} diff --git a/pkgs/by-name/ri/river-start/river-start.sh b/pkgs/by-name/ri/river-start/river-start.sh deleted file mode 100755 index 4587ff96..00000000 --- a/pkgs/by-name/ri/river-start/river-start.sh +++ /dev/null @@ -1,10 +0,0 @@ -#! /usr/bin/env sh - -# NOTE: Keep this in sync with the file from `base_init.sh` <2025-02-03> -RIVER_LOG_FILE="$HOME/.local/share/river/log" - -[ -d "$(dirname "$RIVER_LOG_FILE")" ] || mkdir --parents "$(dirname "$RIVER_LOG_FILE")" - -exec river -log-level info >"$RIVER_LOG_FILE" 2>&1 - -# vim: ft=sh diff --git a/pkgs/by-name/sc/screenshot_persistent/package.nix b/pkgs/by-name/sc/screenshot_persistent/package.nix index 12bb3968..34054b0f 100644 --- a/pkgs/by-name/sc/screenshot_persistent/package.nix +++ b/pkgs/by-name/sc/screenshot_persistent/package.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { writeShellApplication, grim, diff --git a/pkgs/by-name/sc/screenshot_persistent/screenshot_persistent.sh b/pkgs/by-name/sc/screenshot_persistent/screenshot_persistent.sh index 2bea69e3..0eeb75c0 100755 --- a/pkgs/by-name/sc/screenshot_persistent/screenshot_persistent.sh +++ b/pkgs/by-name/sc/screenshot_persistent/screenshot_persistent.sh @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + # shellcheck shell=bash tmp="$(mktemp)" diff --git a/pkgs/by-name/sc/screenshot_temporary/package.nix b/pkgs/by-name/sc/screenshot_temporary/package.nix index f3739b01..49bbeeb7 100644 --- a/pkgs/by-name/sc/screenshot_temporary/package.nix +++ b/pkgs/by-name/sc/screenshot_temporary/package.nix @@ -1,15 +1,24 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - sysLib, + writeShellApplication, + # Dependencies grim, slurp, wl-clipboard, }: -sysLib.writeShellScript { +writeShellApplication { name = "screenshot_temporary"; - src = ./screenshot_temporary.sh; - generateCompletions = false; - keepPath = false; - dependencies = [ + text = builtins.readFile ./screenshot_temporary.sh; + inheritPath = false; + runtimeInputs = [ grim slurp wl-clipboard diff --git a/pkgs/by-name/sc/screenshot_temporary/screenshot_temporary.sh b/pkgs/by-name/sc/screenshot_temporary/screenshot_temporary.sh index 8968ca79..db1a79b7 100755 --- a/pkgs/by-name/sc/screenshot_temporary/screenshot_temporary.sh +++ b/pkgs/by-name/sc/screenshot_temporary/screenshot_temporary.sh @@ -1,7 +1,14 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. grim -g "$(slurp)" | wl-copy diff --git a/pkgs/by-name/sn/snap-sync-forked/package.nix b/pkgs/by-name/sn/snap-sync-forked/package.nix deleted file mode 100644 index b3f40b24..00000000 --- a/pkgs/by-name/sn/snap-sync-forked/package.nix +++ /dev/null @@ -1,36 +0,0 @@ -{ - sysLib, - bash, - btrfs-progs, - coreutils, - gawk, - gnugrep, - snapper, - util-linux, - # optional - libnotify, - openssh, - pv, - rsync, - sudo, -}: -sysLib.writeShellScript { - name = "snap-sync-forked"; - src = ./snap-sync-forked.sh; - dependencies = [ - bash - btrfs-progs - coreutils - gawk - gnugrep - snapper - util-linux - - # optional: - libnotify - openssh - pv - rsync - sudo - ]; -} diff --git a/pkgs/by-name/sn/snap-sync-forked/snap-sync-forked.sh b/pkgs/by-name/sn/snap-sync-forked/snap-sync-forked.sh deleted file mode 100755 index 3d9c1ac9..00000000 --- a/pkgs/by-name/sn/snap-sync-forked/snap-sync-forked.sh +++ /dev/null @@ -1,534 +0,0 @@ -#!/usr/bin/env bash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# -# snap-sync -# https://github.com/wesbarnett/snap-sync -# Copyright (C) 2016-2021 Wes Barnett - -# 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 2 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, write to the Free Software Foundation, Inc., - -# ------------------------------------------------------------------------- - -# Takes snapshots of each snapper configuration. It then sends the snapshot to -# a location on an external drive. After the initial transfer, it does -# incremental snapshots on later calls. It's important not to delete the -# snapshot created on your system since that will be used to determine the -# difference for the next incremental snapshot. - -set -o errtrace - -version="0.7" -name="snap-sync" - -printf "\nsnap-sync version %s, Copyright (C) 2016-2021 Wes Barnett\n" "$version" -printf "snap-sync comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the license for more information. \n\n" - -# The following line is modified by the Makefile or -# find_snapper_config script -SNAPPER_CONFIG=/etc/sysconfig/snapper - -donotify=0 -if ! command -v notify-send &>/dev/null; then - donotify=1 -fi - -doprogress=0 -if ! command -v pv &>/dev/null; then - doprogress=1 -fi - -error() { - printf "==> ERROR: %s\n" "$@" - notify_error 'Error' 'Check journal for more information.' -} >&2 - -die() { - error "$@" - exit 1 -} - -traperror() { - printf "Exited due to error on line %s.\n" "$1" - printf "exit status: %s\n" "$2" - printf "command: %s\n" "$3" - printf "bash line: %s\n" "$4" - printf "function name: %s\n" "$5" - exit 1 -} - -trapkill() { - die "Exited due to user intervention." -} - -trap 'traperror ${LINENO} $? "$BASH_COMMAND" $BASH_LINENO "${FUNCNAME[@]}"' ERR -trap trapkill SIGTERM SIGINT - -usage() { - cat <<EOF -$name $version -Usage: $name [options] - -Options: - -c, --config <config> snapper configuration to backup - -d, --description <desc> snapper description - -h, --help print this message - -n, --noconfirm do not ask for confirmation - -k, --keepold keep old incremental snapshots instead of deleting them - after backup is performed - -p, --port <port> remote port; used with '--remote'. - -q, --quiet do not send notifications; instead print them. - -r, --remote <address> ip address of a remote machine to backup to - --sudo use sudo on the remote machine - -s, --subvolid <subvlid> subvolume id of the mounted BTRFS subvolume to back up to - -u, --UUID <UUID> UUID of the mounted BTRFS subvolume to back up to - -See 'man snap-sync' for more details. -EOF -} - -ssh="" -sudo=0 -while [[ $# -gt 0 ]]; do - key="$1" - case $key in - -d | --description) - description="$2" - shift 2 - ;; - -c | --config) - selected_configs="$2" - shift 2 - ;; - -u | --UUID) - uuid_cmdline="$2" - shift 2 - ;; - -s | --subvolid) - subvolid_cmdline="$2" - shift 2 - ;; - -k | --keepold) - keep="yes" - shift - ;; - -n | --noconfirm) - noconfirm="yes" - shift - ;; - -h | --help) - usage - exit 1 - ;; - -q | --quiet) - donotify=1 - shift - ;; - -r | --remote) - remote=$2 - shift 2 - ;; - -p | --port) - port=$2 - shift 2 - ;; - --sudo) - sudo=1 - shift - ;; - *) - die "Unknown option: '$key'. Run '$name -h' for valid options." - ;; - esac -done - -notify() { - for u in $(users | tr ' ' '\n' | sort -u); do - sudo -u "$u" DISPLAY=:0 \ - DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$(sudo -u "$u" id -u)/bus" \ - notify-send -a $name "$1" "$2" --icon="dialog-$3" - done -} - -notify_info() { - if [[ $donotify -eq 0 ]]; then - notify "$1" "$2" "information" - else - printf '%s\n' "$1: $2" - fi -} - -notify_error() { - if [[ $donotify -eq 0 ]]; then - notify "$1" "$2" "error" - else - printf '%s\n' "$1: $2" - fi -} - -[[ $EUID -ne 0 ]] && die "Script must be run as root. See '$name -h' for a description of options" -! [[ -f $SNAPPER_CONFIG ]] && die "$SNAPPER_CONFIG does not exist." - -description=${description:-"latest incremental backup"} -uuid_cmdline=${uuid_cmdline:-"none"} -subvolid_cmdline=${subvolid_cmdline:-"5"} -noconfirm=${noconfirm:-"no"} - -if [[ -z $remote ]]; then - if ! command -v rsync &>/dev/null; then - die "--remote specified but rsync command not found" - fi -fi - -if [[ $uuid_cmdline != "none" ]]; then - if [[ -z $remote ]]; then - notify_info "Backup started" "Starting backups to $uuid_cmdline subvolid=$subvolid_cmdline..." - else - notify_info "Backup started" "Starting backups to $uuid_cmdline subvolid $subvolid_cmdline at $remote..." - fi -else - if [[ -z $remote ]]; then - notify_info "Backup started" "Starting backups. Use command line menu to select disk." - else - notify_info "Backup started" "Starting backups. Use command line menu to select disk on $remote." - fi -fi - -if [[ -n $remote ]]; then - ssh="ssh $remote" - if [[ -n $port ]]; then - ssh="$ssh -p $port" - fi - if [[ $sudo -eq 1 ]]; then - ssh="$ssh sudo" - fi -fi - -if [[ "$($ssh findmnt -n -v --target / -o FSTYPE)" == "btrfs" ]]; then - EXCLUDE_UUID=$($ssh findmnt -n -v -t btrfs --target / -o UUID) - TARGETS=$($ssh findmnt -n -v -t btrfs -o UUID,TARGET --list | grep -v "$EXCLUDE_UUID" | awk '{print $2}') - UUIDS=$($ssh findmnt -n -v -t btrfs -o UUID,TARGET --list | grep -v "$EXCLUDE_UUID" | awk '{print $1}') -else - TARGETS=$($ssh findmnt -n -v -t btrfs -o TARGET --list) - UUIDS=$($ssh findmnt -n -v -t btrfs -o UUID --list) -fi - -declare -a TARGETS_ARRAY -declare -a UUIDS_ARRAY -declare -a SUBVOLIDS_ARRAY - -i=0 -for x in $TARGETS; do - SUBVOLIDS_ARRAY[i]=$($ssh btrfs subvolume show "$x" | awk '/Subvolume ID:/ { print $3 }') - TARGETS_ARRAY[i]=$x - i=$((i + 1)) -done - -i=0 -disk=-1 -disk_count=0 -for x in $UUIDS; do - UUIDS_ARRAY[i]=$x - if [[ $x == "$uuid_cmdline" && ${SUBVOLIDS_ARRAY[$((i))]} == "$subvolid_cmdline" ]]; then - disk=$i - disk_count=$((disk_count + 1)) - fi - i=$((i + 1)) -done - -if [[ ${#UUIDS_ARRAY[$@]} -eq 0 ]]; then - die "No external btrfs subvolumes found to backup to. Run '$name -h' for more options." -fi - -if [[ $disk_count -gt 1 ]]; then - printf "Multiple mount points were found with UUID %s and subvolid %s.\n" "$uuid_cmdline" "$subvolid_cmdline" - disk="-1" -fi - -if [[ $disk == -1 ]]; then - if [[ $disk_count == 0 && $uuid_cmdline != "none" ]]; then - error "A device with UUID $uuid_cmdline and subvolid $subvolid_cmdline was not found to be mounted, or it is not a BTRFS device." - fi - if [[ -z $ssh ]]; then - printf "Select a mounted BTRFS device on your local machine to backup to.\nFor more options, exit and run '%s -h'.\n" "$name" - else - printf "Select a mounted BTRFS device on %s to backup to.\nFor more options, exit and run '%s -h'.\n" "$remote" "$name" - fi - while [[ $disk -lt 0 || $disk -gt $i ]]; do - for x in "${!TARGETS_ARRAY[@]}"; do - printf "%4s) %s (uuid=%s, subvolid=%s)\n" "$((x + 1))" "${TARGETS_ARRAY[$x]}" "${UUIDS_ARRAY[$x]}" "${SUBVOLIDS_ARRAY[$x]}" - done - printf "%4s) Exit\n" "0" - read -e -r -p "Enter a number: " disk - if ! [[ $disk == ?(-)+([0-9]) ]] || [[ $disk -lt 0 || $disk -gt $i ]]; then - printf "\nNo disk selected. Select a disk to continue.\n" - disk=-1 - fi - done - if [[ $disk == 0 ]]; then - exit 0 - fi - disk=$((disk - 1)) -fi - -selected_subvolid="${SUBVOLIDS_ARRAY[$((disk))]}" -selected_uuid="${UUIDS_ARRAY[$((disk))]}" -selected_mnt="${TARGETS_ARRAY[$((disk))]}" -printf "\nYou selected the disk with uuid=%s, subvolid=%s.\n" "$selected_uuid" "$selected_subvolid" -if [[ -z $ssh ]]; then - printf "The disk is mounted at '%s'.\n" "$selected_mnt" -else - printf "The disk is mounted at '%s:%s'.\n" "$remote" "$selected_mnt" -fi - -# shellcheck source=/dev/null -source "$SNAPPER_CONFIG" - -if [[ -z $selected_configs ]]; then - printf "\nInteractively cycling through all snapper configurations...\n" -fi -selected_configs=${selected_configs:-$SNAPPER_CONFIGS} - -declare -a BACKUPDIRS_ARRAY -declare -a MYBACKUPDIR_ARRAY -declare -a OLD_NUM_ARRAY -declare -a OLD_SNAP_ARRAY -declare -a NEW_NUM_ARRAY -declare -a NEW_SNAP_ARRAY -declare -a NEW_INFO_ARRAY -declare -a BACKUPLOC_ARRAY -declare -a CONT_BACKUP_ARRAY - -# Initial configuration of where backup directories are -i=0 -for x in $selected_configs; do - - if [[ "$(snapper -c "$x" list --disable-used-space -t single | awk '/'"subvolid=$selected_subvolid, uuid=$selected_uuid"'/ {cnt++} END {print cnt}')" -gt 1 ]]; then - error "More than one snapper entry found with UUID $selected_uuid subvolid $selected_subvolid for configuration $x. Skipping configuration $x." - continue - fi - - if [[ "$(snapper -c "$x" list --disable-used-space -t single | awk '/'$name' backup in progress/ {cnt++} END {print cnt}')" -gt 0 ]]; then - printf "\nNOTE: Previous failed %s backup snapshots found for '%s'.\n" "$name" "$x" - if [[ $noconfirm == "yes" ]]; then - printf "'noconfirm' option passed. Failed backups will not be deleted.\n" - else - read -e -r -p "Delete failed backup snapshot(s)? (These local snapshots from failed backups are not used.) [y/N]? " delete_failed - while [[ -n $delete_failed && $delete_failed != [Yy]"es" && - $delete_failed != [Yy] && $delete_failed != [Nn]"o" && - $delete_failed != [Nn] ]]; do - read -e -r -p "Delete failed backup snapshot(s)? (These local snapshots from failed backups are not used.) [y/N] " delete_failed - if [[ -n $delete_failed && $delete_failed != [Yy]"es" && - $delete_failed != [Yy] && $delete_failed != [Nn]"o" && - $delete_failed != [Nn] ]]; then - printf "Select 'y' or 'N'.\n" - fi - done - if [[ $delete_failed == [Yy]"es" || $delete_failed == [Yy] ]]; then - # explicit split list of snapshots (on whitespace) into multiple arguments - # shellcheck disable=SC2046 - snapper -c "$x" delete $(snapper -c "$x" list --disable-used-space | awk '/'$name' backup in progress/ {print $1}') - fi - fi - fi - - SNAP_SYNC_EXCLUDE=no - - if [[ -f "/etc/snapper/configs/$x" ]]; then - # shellcheck source=/dev/null - source "/etc/snapper/configs/$x" - else - die "Selected snapper configuration $x does not exist." - fi - - if [[ $SNAP_SYNC_EXCLUDE == "yes" ]]; then - continue - fi - - printf "\n" - - old_num=$(snapper -c "$x" list --disable-used-space -t single | awk '/'"subvolid=$selected_subvolid, uuid=$selected_uuid"'/ {print $1}') - old_snap=$SUBVOLUME/.snapshots/$old_num/snapshot - - OLD_NUM_ARRAY[i]=$old_num - OLD_SNAP_ARRAY[i]=$old_snap - - if [[ -z $old_num ]]; then - printf "No backups have been performed for '%s' on this disk.\n" "$x" - read -e -r -p "Enter name of subvolume to store backups, relative to $selected_mnt (to be created if not existing): " mybackupdir - printf "This will be the initial backup for snapper configuration '%s' to this disk. This could take awhile.\n" "$x" - BACKUPDIR="$selected_mnt/$mybackupdir" - $ssh test -d "$BACKUPDIR" || $ssh btrfs subvolume create "$BACKUPDIR" - else - mybackupdir=$(snapper -c "$x" list --disable-used-space -t single | awk -F"|" '/'"subvolid=$selected_subvolid, uuid=$selected_uuid"'/ {print $5}' | awk -F "," '/backupdir/ {print $1}' | awk -F"=" '{print $2}') - BACKUPDIR="$selected_mnt/$mybackupdir" - $ssh test -d "$BACKUPDIR" || die "%s is not a directory on %s.\n" "$BACKUPDIR" "$selected_uuid" - fi - BACKUPDIRS_ARRAY[i]="$BACKUPDIR" - MYBACKUPDIR_ARRAY[i]="$mybackupdir" - - printf "Creating new local snapshot for '%s' configuration...\n" "$x" - new_num=$(snapper -c "$x" create --print-number -d "$name backup in progress") - new_snap=$SUBVOLUME/.snapshots/$new_num/snapshot - new_info=$SUBVOLUME/.snapshots/$new_num/info.xml - sync - backup_location=$BACKUPDIR/$x/$new_num/ - if [[ -z $ssh ]]; then - printf "Will backup %s to %s\n" "$new_snap" "$backup_location/snapshot" - else - printf "Will backup %s to %s\n" "$new_snap" "$remote":"$backup_location/snapshot" - fi - - if ($ssh test -d "$backup_location/snapshot"); then - printf "WARNING: Backup directory '%s' already exists. This configuration will be skipped!\n" "$backup_location/snapshot" - printf "Move or delete destination directory and try backup again.\n" - fi - - NEW_NUM_ARRAY[i]="$new_num" - NEW_SNAP_ARRAY[i]="$new_snap" - NEW_INFO_ARRAY[i]="$new_info" - BACKUPLOC_ARRAY[i]="$backup_location" - - cont_backup="K" - CONT_BACKUP_ARRAY[i]="yes" - if [[ $noconfirm == "yes" ]]; then - cont_backup="yes" - else - while [[ -n $cont_backup && $cont_backup != [Yy]"es" && - $cont_backup != [Yy] && $cont_backup != [Nn]"o" && - $cont_backup != [Nn] ]]; do - read -e -r -p "Proceed with backup of '$x' configuration [Y/n]? " cont_backup - if [[ -n $cont_backup && $cont_backup != [Yy]"es" && - $cont_backup != [Yy] && $cont_backup != [Nn]"o" && - $cont_backup != [Nn] ]]; then - printf "Select 'Y' or 'n'.\n" - fi - done - fi - - if [[ $cont_backup != [Yy]"es" && $cont_backup != [Yy] && -n $cont_backup ]]; then - CONT_BACKUP_ARRAY[i]="no" - printf "Not backing up '%s' configuration.\n" "$x" - snapper -c "$x" delete "$new_num" - fi - - i=$((i + 1)) - -done - -# Actual backing up -printf "\nPerforming backups...\n" -i=-1 -for x in $selected_configs; do - - i=$((i + 1)) - - SNAP_SYNC_EXCLUDE=no - - if [[ -f "/etc/snapper/configs/$x" ]]; then - # shellcheck source=/dev/null - source "/etc/snapper/configs/$x" - else - die "Selected snapper configuration $x does not exist." - fi - - cont_backup=${CONT_BACKUP_ARRAY[$i]} - if [[ $cont_backup == "no" || $SNAP_SYNC_EXCLUDE == "yes" ]]; then - notify_info "Backup in progress" "NOTE: Skipping $x configuration." - continue - fi - - notify_info "Backup in progress" "Backing up $x configuration." - - printf "\n" - - old_num="${OLD_NUM_ARRAY[$i]}" - old_snap="${OLD_SNAP_ARRAY[$i]}" - BACKUPDIR="${BACKUPDIRS_ARRAY[$i]}" - mybackupdir="${MYBACKUPDIR_ARRAY[$i]}" - new_num="${NEW_NUM_ARRAY[$i]}" - new_snap="${NEW_SNAP_ARRAY[$i]}" - new_info="${NEW_INFO_ARRAY[$i]}" - backup_location="${BACKUPLOC_ARRAY[$i]}" - - if ($ssh test -d "$backup_location/snapshot"); then - printf "ERROR: Backup directory '%s' already exists. Skipping backup of this configuration!\n" "$backup_location/snapshot" - continue - fi - - $ssh mkdir -p "$backup_location" - - if [[ -z $old_num ]]; then - printf "Sending first snapshot for '%s' configuration...\n" "$x" - if [[ $doprogress -eq 0 ]]; then - btrfs send "$new_snap" | pv | $ssh btrfs receive "$backup_location" &>/dev/null - else - btrfs send "$new_snap" | $ssh btrfs receive "$backup_location" &>/dev/null - fi - else - - printf "Sending incremental snapshot for '%s' configuration...\n" "$x" - # Sends the difference between the new snapshot and old snapshot to the - # backup location. Using the -c flag instead of -p tells it that there - # is an identical subvolume to the old snapshot at the receiving - # location where it can get its data. This helps speed up the transfer. - - if [[ $doprogress -eq 0 ]]; then - btrfs send -c "$old_snap" "$new_snap" | pv | $ssh btrfs receive "$backup_location" - else - btrfs send -c "$old_snap" "$new_snap" | $ssh btrfs receive "$backup_location" - fi - - if [[ $keep == "yes" ]]; then - printf "Modifying data for old local snapshot for '%s' configuration...\n" "$x" - snapper -v -c "$x" modify -d "old snap-sync snapshot (you may remove)" -u "backupdir=,subvolid=,uuid=" -c "number" "$old_num" - else - printf "Deleting old snapshot for %s...\n" "$x" - snapper -c "$x" delete "$old_num" - fi - - fi - - if [[ -z $remote ]]; then - cp "$new_info" "$backup_location" - else - if [[ -z $port ]]; then - rsync -avzq "$new_info" "$remote":"$backup_location" - else - rsync -avzqe "ssh -p $port" "$new_info" "$remote":"$backup_location" - fi - fi - - # It's important not to change this userdata in the snapshots, since that's how - # we find the previous one. - - userdata="backupdir=$mybackupdir, subvolid=$selected_subvolid, uuid=$selected_uuid" - - # Tag new snapshot as the latest - printf "Tagging local snapshot as latest backup for '%s' configuration...\n" "$x" - snapper -v -c "$x" modify -d "$description" -u "$userdata" "$new_num" - - printf "Backup complete for '%s' configuration.\n" "$x" - -done - -printf "\nDone!\n" - -if [[ $uuid_cmdline != "none" ]]; then - notify_info "Finished" "Backups to $uuid_cmdline complete!" -else - notify_info "Finished" "Backups complete!" -fi diff --git a/pkgs/by-name/st/stamp/package.nix b/pkgs/by-name/st/stamp/package.nix index 703f73e3..871d531c 100644 --- a/pkgs/by-name/st/stamp/package.nix +++ b/pkgs/by-name/st/stamp/package.nix @@ -1,20 +1,29 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { - sysLib, - findutils, + writeShellApplication, + # Dependencies + coreutils, fd, - reuse, git, + reuse, }: -sysLib.writeShellScript { +writeShellApplication { name = "stamp"; - src = ./stamp.sh; - generateCompletions = false; - keepPath = false; + text = builtins.readFile ./stamp.sh; + inheritPath = false; - dependencies = [ - findutils + runtimeInputs = [ + coreutils fd - reuse git + reuse ]; } diff --git a/pkgs/by-name/st/stamp/stamp.sh b/pkgs/by-name/st/stamp/stamp.sh index 0aa6c281..5f17b2aa 100755 --- a/pkgs/by-name/st/stamp/stamp.sh +++ b/pkgs/by-name/st/stamp/stamp.sh @@ -1,7 +1,19 @@ #!/usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +die() { + echo "Error: $1" + exit 1 +} help() { cat <<EOF diff --git a/pkgs/by-name/tr/tree-sitter-yts/package.nix b/pkgs/by-name/tr/tree-sitter-yts/package.nix index 3a97530d..62ecf063 100644 --- a/pkgs/by-name/tr/tree-sitter-yts/package.nix +++ b/pkgs/by-name/tr/tree-sitter-yts/package.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. # taken from nixpgks: pkgs/development/tools/parsing/tree-sitter/grammar.nix { yt, diff --git a/pkgs/by-name/ts/tskm/.envrc b/pkgs/by-name/ts/tskm/.envrc index d21a17fc..2c7bb7c9 100644 --- a/pkgs/by-name/ts/tskm/.envrc +++ b/pkgs/by-name/ts/tskm/.envrc @@ -1,7 +1,14 @@ #!/usr/bin/env sh -SHELL_COMPLETION_DIR="$(pwd)/target/shell" -export SHELL_COMPLETION_DIR +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. export TSKM_PROJECT_FILE=/home/soispha/repos/nix/config/modules/common/projects.json diff --git a/pkgs/by-name/ts/tskm/.gitignore b/pkgs/by-name/ts/tskm/.gitignore index 2d5df85d..f255eebd 100644 --- a/pkgs/by-name/ts/tskm/.gitignore +++ b/pkgs/by-name/ts/tskm/.gitignore @@ -1,2 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + /target .direnv diff --git a/pkgs/by-name/ts/tskm/Cargo.lock b/pkgs/by-name/ts/tskm/Cargo.lock index 68823d3c..0c339a9a 100644 --- a/pkgs/by-name/ts/tskm/Cargo.lock +++ b/pkgs/by-name/ts/tskm/Cargo.lock @@ -1,5 +1,14 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. version = 4 [[package]] @@ -10,9 +19,9 @@ checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "ahash" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", "once_cell", @@ -76,20 +85,20 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "3.0.7" +version = "3.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +checksum = "6680de5231bd6ee4c6191b8a1325daa282b415391ec9d3a37bd34f2060dc73fa" dependencies = [ "anstyle", - "once_cell", + "once_cell_polyfill", "windows-sys", ] [[package]] name = "anyhow" -version = "1.0.97" +version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" [[package]] name = "autocfg" @@ -99,9 +108,9 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "bumpalo" @@ -117,9 +126,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cc" -version = "1.2.17" +version = "1.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" +checksum = "16595d3be041c03b09d08d0858631facccee9221e579704070e6e9e4915d3bc7" dependencies = [ "shlex", ] @@ -132,9 +141,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" dependencies = [ "android-tzdata", "iana-time-zone", @@ -147,9 +156,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.34" +version = "4.5.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e958897981290da2a852763fe9cdb89cd36977a5d729023127095fa94d95e2ff" +checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f" dependencies = [ "clap_builder", "clap_derive", @@ -157,9 +166,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.34" +version = "4.5.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83b0f35019843db2160b5bb19ae09b4e6411ac33fc6a712003c33e03090e2489" +checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51" dependencies = [ "anstream", "anstyle", @@ -169,11 +178,14 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.47" +version = "4.5.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06f5378ea264ad4f82bbc826628b5aad714a75abf6ece087e923010eb937fb6" +checksum = "8d2267df7f3c8e74e38268887ea5235d4dfadd39bfff2d56ab82d61776be355e" dependencies = [ "clap", + "clap_lex", + "is_executable", + "shlex", ] [[package]] @@ -280,9 +292,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", "libc", @@ -291,9 +303,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", "libc", @@ -327,15 +339,15 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbd780fe5cc30f81464441920d82ac8740e2e46b29a6fad543ddd075229ce37e" +checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08" [[package]] name = "iana-time-zone" -version = "0.1.62" +version = "0.1.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2fd658b06e56721792c5df4475705b6cda790e9298d19d2f8af083457bcd127" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -357,21 +369,22 @@ dependencies = [ [[package]] name = "icu_collections" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" dependencies = [ "displaydoc", + "potential_utf", "yoke", "zerofrom", "zerovec", ] [[package]] -name = "icu_locid" -version = "1.5.0" +name = "icu_locale_core" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" dependencies = [ "displaydoc", "litemap", @@ -381,30 +394,10 @@ dependencies = [ ] [[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d" - -[[package]] name = "icu_normalizer" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" dependencies = [ "displaydoc", "icu_collections", @@ -412,68 +405,55 @@ dependencies = [ "icu_properties", "icu_provider", "smallvec", - "utf16_iter", - "utf8_iter", - "write16", "zerovec", ] [[package]] name = "icu_normalizer_data" -version = "1.5.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" [[package]] name = "icu_properties" -version = "1.5.1" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" dependencies = [ "displaydoc", "icu_collections", - "icu_locid_transform", + "icu_locale_core", "icu_properties_data", "icu_provider", - "tinystr", + "potential_utf", + "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" -version = "1.5.1" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" [[package]] name = "icu_provider" -version = "1.5.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" dependencies = [ "displaydoc", - "icu_locid", - "icu_provider_macros", + "icu_locale_core", "stable_deref_trait", "tinystr", "writeable", "yoke", "zerofrom", + "zerotrie", "zerovec", ] [[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] name = "idna" version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -486,9 +466,9 @@ dependencies = [ [[package]] name = "idna_adapter" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" dependencies = [ "icu_normalizer", "icu_properties", @@ -506,6 +486,15 @@ dependencies = [ ] [[package]] +name = "is_executable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4a1b5bad6f9072935961dfbf1cced2f3d129963d091b6f69f007fe04e758ae2" +dependencies = [ + "winapi", +] + +[[package]] name = "is_terminal_polyfill" version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -529,9 +518,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.171" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "libredox" @@ -555,9 +544,9 @@ dependencies = [ [[package]] name = "litemap" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" [[package]] name = "log" @@ -570,9 +559,6 @@ name = "lz4_flex" version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75761162ae2b0e580d7e7c390558127e5f01b4194debd6221fd8c207fc80e3f5" -dependencies = [ - "twox-hash", -] [[package]] name = "memchr" @@ -582,9 +568,9 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "miniz_oxide" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff70ce3e48ae43fa075863cef62e8b43b71a4f2382229920e0df362592919430" +checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" dependencies = [ "adler2", ] @@ -605,6 +591,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + +[[package]] name = "option-ext" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -623,10 +615,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] +name = "potential_utf" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" +dependencies = [ + "zerovec", +] + +[[package]] name = "proc-macro2" -version = "1.0.94" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -652,7 +653,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.2.16", "libredox", "thiserror", ] @@ -673,9 +674,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" [[package]] name = "ryu" @@ -732,9 +733,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "smallvec" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" +checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" [[package]] name = "stable_deref_trait" @@ -743,18 +744,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] name = "stderrlog" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c910772f992ab17d32d6760e167d2353f4130ed50e796752689556af07dc6b" dependencies = [ - "chrono", "is-terminal", "log", "termcolor", @@ -788,9 +782,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.100" +version = "2.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" dependencies = [ "proc-macro2", "quote", @@ -799,9 +793,9 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", @@ -869,9 +863,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.7.6" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" dependencies = [ "displaydoc", "zerovec", @@ -896,16 +890,6 @@ dependencies = [ ] [[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if", - "static_assertions", -] - -[[package]] name = "unicode-ident" version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -924,12 +908,6 @@ dependencies = [ ] [[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - -[[package]] name = "utf8_iter" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -943,12 +921,14 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" +checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" dependencies = [ - "getrandom 0.3.2", + "getrandom 0.3.3", + "js-sys", "serde", + "wasm-bindgen", ] [[package]] @@ -1047,6 +1027,22 @@ dependencies = [ ] [[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] name = "winapi-util" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1056,12 +1052,44 @@ dependencies = [ ] [[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] name = "windows-core" -version = "0.52.0" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ - "windows-targets", + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1071,6 +1099,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" [[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link", +] + +[[package]] name = "windows-sys" version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1153,22 +1199,16 @@ dependencies = [ ] [[package]] -name = "write16" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - -[[package]] name = "writeable" -version = "0.5.5" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" +checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" [[package]] name = "yoke" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" dependencies = [ "serde", "stable_deref_trait", @@ -1178,9 +1218,9 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.5" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", @@ -1190,18 +1230,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.7.35" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" dependencies = [ "proc-macro2", "quote", @@ -1230,10 +1270,21 @@ dependencies = [ ] [[package]] +name = "zerotrie" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] name = "zerovec" -version = "0.10.4" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" dependencies = [ "yoke", "zerofrom", @@ -1242,9 +1293,9 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.10.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", diff --git a/pkgs/by-name/ts/tskm/Cargo.toml b/pkgs/by-name/ts/tskm/Cargo.toml index 41fc5888..413530eb 100644 --- a/pkgs/by-name/ts/tskm/Cargo.toml +++ b/pkgs/by-name/ts/tskm/Cargo.toml @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + [package] name = "tskm" version = "0.1.0" @@ -6,17 +16,18 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -anyhow = "1.0.97" -clap = { version = "4.5.34", features = ["derive"] } -dirs = "6.0.0" -log = "0.4.27" -lz4_flex = "0.11.3" -serde = { version = "1.0.219", features = ["derive"] } -serde_json = "1.0.140" -stderrlog = "0.6.0" +anyhow = { version = "1.0.98", default-features = false } +clap = { version = "4.5.39", features = [ "derive", "std", "color", "help", "usage", "error-context", "suggestions", ], default-features = false } +clap_complete = { version = "4.5.51", features = ["unstable-dynamic"] } +dirs = { version = "6.0.0", default-features = false } +log = { version = "0.4.27", default-features = false } +lz4_flex = { version = "0.11.3", features = ["std"], default-features = false } +serde = { version = "1.0.219", features = ["derive"], default-features = false } +serde_json = { version = "1.0.140", default-features = false } +stderrlog = { version = "0.6.0", default-features = false } taskchampion = { version = "2.0.3", default-features = false } -url = { version = "2.5.4", features = ["serde"] } -walkdir = "2.5.0" +url = { version = "2.5.4", features = ["serde"], default-features = false } +walkdir = { version = "2.5.0", default-features = false } [profile.release] lto = true @@ -77,15 +88,3 @@ perf = { level = "warn", priority = -1 } pedantic = { level = "warn", priority = -1 } missing_panics_doc = "allow" missing_errors_doc = "allow" - -[build-dependencies] -anyhow = "1.0.97" -clap = { version = "4.5.34", features = ["derive"] } -clap_complete = "4.5.47" -dirs = "6.0.0" -log = "0.4.27" -serde = { version = "1.0.219", features = ["derive"] } -serde_json = "1.0.140" -taskchampion = { version = "2.0.3", default-features = false } -url = "2.5.4" -walkdir = "2.5.0" diff --git a/pkgs/by-name/ts/tskm/build.rs b/pkgs/by-name/ts/tskm/build.rs deleted file mode 100644 index e3b60bb9..00000000 --- a/pkgs/by-name/ts/tskm/build.rs +++ /dev/null @@ -1,52 +0,0 @@ -use anyhow::{Context, Result}; -use clap::{CommandFactory, ValueEnum}; -use clap_complete::generate_to; -use clap_complete::Shell; - -use std::env; -use std::fs; -use std::path::PathBuf; - -use crate::cli::CliArgs; - -pub mod task { - include!("src/task/mod.rs"); -} -pub mod state { - include!("src/state.rs"); -} - -pub mod interface { - pub mod input { - include!("src/interface/input/mod.rs"); - } - pub mod project { - include!("src/interface/project/mod.rs"); - } -} - -pub mod cli { - include!("src/cli.rs"); -} - -fn main() -> Result<()> { - let outdir = match env::var_os("SHELL_COMPLETION_DIR") { - None => return Ok(()), - Some(outdir) => outdir, - }; - - if !PathBuf::from(&outdir).exists() { - fs::create_dir_all(&outdir)?; - } - - let mut cmd = CliArgs::command(); - - for &shell in Shell::value_variants() { - let path = generate_to(shell, &mut cmd, "tskm", &outdir).with_context(|| { - format!("Failed to output shell completion for {shell} to {outdir:?}") - })?; - println!("cargo:warning=completion file for {shell} is generated at: {path:?}"); - } - - Ok(()) -} diff --git a/pkgs/by-name/ts/tskm/flake.lock b/pkgs/by-name/ts/tskm/flake.lock index 82448387..280e8a51 100644 --- a/pkgs/by-name/ts/tskm/flake.lock +++ b/pkgs/by-name/ts/tskm/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1743076231, - "narHash": "sha256-yQugdVfi316qUfqzN8JMaA2vixl+45GxNm4oUfXlbgw=", + "lastModified": 1748406211, + "narHash": "sha256-B3BsCRbc+x/d0WiG1f+qfSLUy+oiIfih54kalWBi+/M=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6c5963357f3c1c840201eda129a99d455074db04", + "rev": "3d1f29646e4b57ed468d60f9d286cde23a8d1707", "type": "github" }, "original": { diff --git a/pkgs/by-name/ts/tskm/flake.lock.license b/pkgs/by-name/ts/tskm/flake.lock.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/pkgs/by-name/ts/tskm/flake.lock.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/pkgs/by-name/ts/tskm/flake.nix b/pkgs/by-name/ts/tskm/flake.nix index 5a5f628b..583d4923 100644 --- a/pkgs/by-name/ts/tskm/flake.nix +++ b/pkgs/by-name/ts/tskm/flake.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { description = "This is the core interface to the system-integrated task management"; diff --git a/pkgs/by-name/ts/tskm/package.nix b/pkgs/by-name/ts/tskm/package.nix index 3d320772..d75afe6e 100644 --- a/pkgs/by-name/ts/tskm/package.nix +++ b/pkgs/by-name/ts/tskm/package.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { rustPlatform, installShellFiles, @@ -19,10 +28,6 @@ rustPlatform.buildRustPackage (finalAttrs: { lockFile = ./Cargo.lock; }; - env = { - SHELL_COMPLETION_DIR = "./shell"; - }; - buildInputs = [ taskwarrior3 git @@ -38,9 +43,9 @@ rustPlatform.buildRustPackage (finalAttrs: { postInstall = '' installShellCompletion --cmd tskm \ - --bash ./shell/tskm.bash \ - --fish ./shell/tskm.fish \ - --zsh ./shell/_tskm + --bash <(COMPLETE=bash $out/bin/tskm) \ + --fish <(COMPLETE=fish $out/bin/tskm) \ + --zsh <(COMPLETE=zsh $out/bin/tskm) # NOTE: We cannot clear the path, because we need access to the $EDITOR. <2025-04-04> wrapProgram $out/bin/tskm \ diff --git a/pkgs/by-name/ts/tskm/src/cli.rs b/pkgs/by-name/ts/tskm/src/cli.rs index 1c72b3c2..ac8f8ee9 100644 --- a/pkgs/by-name/ts/tskm/src/cli.rs +++ b/pkgs/by-name/ts/tskm/src/cli.rs @@ -1,13 +1,26 @@ -use std::path::PathBuf; +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +use std::{ffi::OsStr, path::PathBuf}; use anyhow::{bail, Result}; -use clap::{ArgAction, Parser, Subcommand}; +use clap::{builder::StyledStr, ArgAction, Parser, Subcommand}; +use clap_complete::{ArgValueCompleter, CompletionCandidate}; use url::Url; use crate::{ - interface::{input::Input, project::ProjectName}, - state::State, - task, + interface::{ + input::{Input, Tag}, + project::ProjectName, + }, + state, task, }; #[derive(Parser, Debug)] @@ -17,8 +30,10 @@ use crate::{ /// `tskm` effectively combines multiple applications together: /// - `taskwarrior` projects are raised connected to `firefox` profiles, making it possible to “open” /// a project. +/// /// - Every `taskwarrior` project has a determined `neorg` path, so that extra information for a /// `project` can be stored in this `norg` file. +/// /// - `tskm` can track inputs for you. These are URLs with optional tags which you can that /// “review” to open tasks based on them. pub struct CliArgs { @@ -79,14 +94,14 @@ pub enum NeorgCommand { /// Open the `neorg` project associated with id of the task. Task { /// The working set id of the task - #[arg(value_parser = task_from_working_set_id)] + #[arg(value_parser = task_from_working_set_id, add = ArgValueCompleter::new(complete_task_id))] id: task::Task, }, } fn task_from_working_set_id(id: &str) -> Result<task::Task> { let id: usize = id.parse()?; - let mut state = State::new_ro()?; + let mut state = state::State::new_ro()?; let Some(task) = task::Task::from_working_set(id, &mut state)? else { bail!("Working set id '{id}' is not valid!") @@ -104,7 +119,7 @@ pub enum OpenCommand { /// Opens Firefox with either the supplied project or the currently active project profile. Project { /// The project to open. - #[arg(value_parser = task::Project::from_project_string)] + #[arg(value_parser = task::Project::from_project_string, add = ArgValueCompleter::new(complete_project))] project: task::Project, /// The URL to open. @@ -123,7 +138,7 @@ pub enum OpenCommand { /// List all open tabs in the project. ListTabs { /// The project to open. - #[arg(value_parser = task::Project::from_project_string)] + #[arg(value_parser = task::Project::from_project_string, add = ArgValueCompleter::new(complete_project))] project: Option<task::Project>, }, } @@ -133,21 +148,161 @@ pub enum InputCommand { /// Add URLs as inputs to be categorized. Add { inputs: Vec<Input> }, /// Remove URLs - Remove { inputs: Vec<Input> }, + Remove { + #[arg(add = ArgValueCompleter::new(complete_input_url))] + inputs: Vec<Input>, + }, /// Add all URLs in the file as inputs to be categorized. /// /// This expects each line to contain one URL. - File { file: PathBuf }, + File { + /// The file to read from. + file: PathBuf, + + /// Additional tags to apply to every read URL in the file. + #[arg(add = ArgValueCompleter::new(complete_tag))] + tags: Vec<Tag>, + }, /// Like 'review', but for the inputs that have previously been added. /// It takes a project in which to open the URLs. Review { /// Opens all the URLs in this project. - #[arg(value_parser = task::Project::from_project_string)] + #[arg(value_parser = task::Project::from_project_string, add = ArgValueCompleter::new(complete_project))] project: task::Project, }, /// List all the previously added inputs. List, } + +fn complete_task_id(current: &OsStr) -> Vec<CompletionCandidate> { + fn format_task( + task: task::Task, + current: &str, + state: &mut state::State, + ) -> Option<CompletionCandidate> { + let id = { + let Ok(base) = task.working_set_id(state) else { + return None; + }; + base.to_string() + }; + + if !id.starts_with(current) { + return None; + } + + let description = { + let Ok(base) = task.description(state) else { + return None; + }; + StyledStr::from(base) + }; + + Some(CompletionCandidate::new(id).help(Some(description))) + } + + let mut output = vec![]; + + let Some(current) = current.to_str() else { + return output; + }; + + let Ok(mut state) = state::State::new_ro() else { + return output; + }; + + let Ok(pending) = state.replica().pending_tasks() else { + return output; + }; + + let Ok(current_project) = task::Project::get_current() else { + return output; + }; + + if let Some(current_project) = current_project { + for t in pending { + let task = task::Task::from(&t); + if let Ok(project) = task.project(&mut state) { + if project == current_project { + if let Some(out) = format_task(task, current, &mut state) { + output.push(out); + } + } + } + } + } else { + for t in pending { + let task = task::Task::from(&t); + if let Some(out) = format_task(task, current, &mut state) { + output.push(out); + } + } + } + + output +} +fn complete_project(current: &OsStr) -> Vec<CompletionCandidate> { + let mut output = vec![]; + + let Some(current) = current.to_str() else { + return output; + }; + + let Ok(all) = task::Project::all() else { + return output; + }; + + for a in all { + if a.to_project_display().starts_with(current) { + output.push(CompletionCandidate::new(a.to_project_display())); + } + } + + output +} +fn complete_input_url(current: &OsStr) -> Vec<CompletionCandidate> { + let mut output = vec![]; + + let Some(current) = current.to_str() else { + return output; + }; + + let Ok(all) = Input::all() else { + return output; + }; + + for a in all { + if a.to_string().starts_with(current) { + output.push(CompletionCandidate::new(a.to_string())); + } + } + + output +} +fn complete_tag(current: &OsStr) -> Vec<CompletionCandidate> { + let mut output = vec![]; + + let Some(current) = current.to_str() else { + return output; + }; + + if !current.starts_with('+') { + output.push(CompletionCandidate::new(format!("+{current}"))); + } + + output +} + +#[cfg(test)] +mod test { + use clap::CommandFactory; + + use super::CliArgs; + #[test] + fn verify_cli() { + CliArgs::command().debug_assert(); + } +} diff --git a/pkgs/by-name/ts/tskm/src/interface/input/handle.rs b/pkgs/by-name/ts/tskm/src/interface/input/handle.rs index 0ff0e56e..09827fca 100644 --- a/pkgs/by-name/ts/tskm/src/interface/input/handle.rs +++ b/pkgs/by-name/ts/tskm/src/interface/input/handle.rs @@ -1,4 +1,15 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::{ + collections::HashSet, fs, process, str::FromStr, thread::{self, sleep}, @@ -33,10 +44,23 @@ pub fn handle(command: InputCommand) -> Result<()> { })?; } } - InputCommand::File { file } => { - let file = fs::read_to_string(file)?; - for line in file.lines() { - let input = Input::from_str(line)?; + InputCommand::File { file, tags } => { + let file = fs::read_to_string(&file) + .with_context(|| format!("Failed to read input file '{}'", file.display()))?; + + let mut tag_set = HashSet::with_capacity(tags.len()); + for tag in tags { + tag_set.insert(tag); + } + + for line in file.lines().map(str::trim) { + if line.is_empty() { + continue; + } + + let mut input = Input::from_str(line)?; + input.tags = input.tags.union(&tag_set).cloned().collect(); + input.commit().with_context(|| { format!("Failed to add input ('{input}') to the input storage.") })?; diff --git a/pkgs/by-name/ts/tskm/src/interface/input/mod.rs b/pkgs/by-name/ts/tskm/src/interface/input/mod.rs index 9ece7a3a..747ba349 100644 --- a/pkgs/by-name/ts/tskm/src/interface/input/mod.rs +++ b/pkgs/by-name/ts/tskm/src/interface/input/mod.rs @@ -1,10 +1,15 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::{ - collections::HashSet, - fmt::Display, - fs::{self, read_to_string, File}, - io::Write, - path::PathBuf, - process::Command, + collections::HashSet, fmt::Display, fs, io::Write, path::PathBuf, process::Command, str::FromStr, }; @@ -16,28 +21,37 @@ pub mod handle; pub use handle::handle; #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] -pub struct NoWhitespaceString(String); +pub struct Tag(String); -impl NoWhitespaceString { - /// # Panics - /// If the input contains whitespace. - #[must_use] - pub fn new(input: String) -> Self { - if input.contains(' ') { - panic!("Your input '{input}' contains whitespace. I did not expect that.") +impl Tag { + pub fn new(input: &str) -> Result<Self> { + Self::from_str(input) + } +} + +impl FromStr for Tag { + type Err = anyhow::Error; + + fn from_str(s: &str) -> std::result::Result<Self, Self::Err> { + if let Some(tag) = s.strip_prefix('+') { + if tag.contains(' ') { + bail!("Your tag '{s}' should not whitespace.") + } + + Ok(Self(tag.to_owned())) } else { - Self(input) + bail!("Your tag '{s}' does not start with the required '+'"); } } } -impl Display for NoWhitespaceString { +impl Display for Tag { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - self.0.fmt(f) + write!(f, "+{}", self.0) } } -impl NoWhitespaceString { +impl Tag { #[must_use] pub fn as_str(&self) -> &str { &self.0 @@ -47,7 +61,7 @@ impl NoWhitespaceString { #[derive(Debug, Clone)] pub struct Input { url: Url, - tags: HashSet<NoWhitespaceString>, + tags: HashSet<Tag>, } impl FromStr for Input { @@ -61,13 +75,7 @@ impl FromStr for Input { tags: { tags.trim() .split(' ') - .map(|tag| { - if let Some(tag) = tag.strip_prefix('+') { - Ok(NoWhitespaceString::new(tag.to_owned())) - } else { - bail!("Your tag '{tag}' does not start with the required '+'"); - } - }) + .map(Tag::new) .collect::<Result<_, _>>()? }, }) @@ -91,13 +99,9 @@ impl Display for Input { self.url, self.tags .iter() - .fold(String::new(), |mut acc, tag| { - acc.push('+'); - acc.push_str(tag.as_str()); - acc.push(' '); - acc - }) - .trim() + .map(ToString::to_string) + .collect::<Vec<_>>() + .join(" ") ) } } @@ -113,7 +117,10 @@ impl Input { fn url_path(url: &Url) -> Result<PathBuf> { let base_path = Self::base_path(); - let url_path = base_path.join(url.to_string()); + let url_path = base_path + .join(url.scheme()) + .join(url.host_str().unwrap_or("<No Host>")) + .join(url.path().trim_matches('/')); fs::create_dir_all(&url_path) .with_context(|| format!("Failed to open file: '{}'", url_path.display()))?; @@ -132,17 +139,12 @@ impl Input { pub fn commit(&self) -> Result<()> { let url_path = Self::url_path(&self.url)?; - let url_content = { - if url_path.exists() { - read_to_string(&url_path)? - } else { - String::new() - } - }; - - let mut file = File::create(&url_path) + let mut file = fs::OpenOptions::new() + .create(true) + .append(true) + .open(&url_path) .with_context(|| format!("Failed to open file: '{}'", url_path.display()))?; - writeln!(file, "{url_content}{self}")?; + writeln!(file, "{self}")?; Self::git_commit(&format!("Add new url: '{self}'"))?; @@ -173,27 +175,6 @@ impl Input { Ok(()) } - /// Commit your changes - fn git_commit(message: &str) -> Result<()> { - let status = Command::new("git") - .args(["add", "."]) - .current_dir(Self::base_path()) - .status()?; - if !status.success() { - bail!("Git add . failed!"); - } - - let status = Command::new("git") - .args(["commit", "--message", message, "--no-gpg-sign"]) - .current_dir(Self::base_path()) - .status()?; - if !status.success() { - bail!("Git commit failed!"); - } - - Ok(()) - } - /// Get all previously [`Self::commit`]ed inputs. /// /// # Errors @@ -217,41 +198,51 @@ impl Input { continue; } - let url_value_file = entry - .path() - .to_str() - .expect("All of these should be URLs and thus valid strings"); - assert!(url_value_file.ends_with("/url_value")); + let url_value_file = entry.path(); + assert!(url_value_file.ends_with("url_value")); - let url = { - let base = url_value_file - .strip_prefix(&format!("{}/", Self::base_path().display())) - .expect("This will exist"); + let url_values = fs::read_to_string(PathBuf::from(url_value_file))?; - let (proto, path) = base.split_once(':').expect("This will countain a :"); - - let path = path.strip_suffix("/url_value").expect("Will exist"); - - Url::from_str(&format!("{proto}:/{path}")) - .expect("This was a URL, it should still be one") - }; - let tags = { - let url_values = read_to_string(PathBuf::from(url_value_file))?; + output.extend( url_values .lines() - .map(|line| { - let input = Self::from_str(line)?; - Ok::<_, anyhow::Error>(input.tags) - }) - .collect::<Result<Vec<HashSet<NoWhitespaceString>>, _>>()? - .into_iter() - .flatten() - .collect() - }; - - output.push(Self { url, tags }); + .map(Self::from_str) + .collect::<Result<Vec<Self>, _>>()? + .into_iter(), + ); } Ok(output) } + + /// Commit your changes + fn git_commit(message: &str) -> Result<()> { + if !Self::base_path().join(".git").exists() { + let status = Command::new("git") + .args(["init"]) + .current_dir(Self::base_path()) + .status()?; + if !status.success() { + bail!("Git init failed!"); + } + } + + let status = Command::new("git") + .args(["add", "."]) + .current_dir(Self::base_path()) + .status()?; + if !status.success() { + bail!("Git add . failed!"); + } + + let status = Command::new("git") + .args(["commit", "--message", message, "--no-gpg-sign"]) + .current_dir(Self::base_path()) + .status()?; + if !status.success() { + bail!("Git commit failed!"); + } + + Ok(()) + } } diff --git a/pkgs/by-name/ts/tskm/src/interface/mod.rs b/pkgs/by-name/ts/tskm/src/interface/mod.rs index 1a0d934c..513ca317 100644 --- a/pkgs/by-name/ts/tskm/src/interface/mod.rs +++ b/pkgs/by-name/ts/tskm/src/interface/mod.rs @@ -1,3 +1,13 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + pub mod input; pub mod neorg; pub mod open; diff --git a/pkgs/by-name/ts/tskm/src/interface/neorg/handle.rs b/pkgs/by-name/ts/tskm/src/interface/neorg/handle.rs index 577de02c..194e3926 100644 --- a/pkgs/by-name/ts/tskm/src/interface/neorg/handle.rs +++ b/pkgs/by-name/ts/tskm/src/interface/neorg/handle.rs @@ -1,11 +1,21 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::{ env, - fs::{self, read_to_string, File, OpenOptions}, + fs::{self, File, OpenOptions, read_to_string}, io::Write, process::Command, }; -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use crate::{cli::NeorgCommand, state::State}; @@ -13,10 +23,10 @@ pub fn handle(command: NeorgCommand, state: &mut State) -> Result<()> { match command { NeorgCommand::Task { id } => { let project = id.project(state)?; - let path = dirs::data_local_dir() + let base = dirs::data_local_dir() .expect("This should exists") - .join("tskm/notes") - .join(project.get_neorg_path()?); + .join("tskm/notes"); + let path = base.join(project.get_neorg_path()?); fs::create_dir_all(path.parent().expect("This should exist"))?; @@ -69,11 +79,7 @@ pub fn handle(command: NeorgCommand, state: &mut State) -> Result<()> { .args([ "commit", "--message", - format!( - "chore({}): Update", - path.parent().expect("Should have a parent").display() - ) - .as_str(), + format!("chore({}): Update", project.get_neorg_path()?.display()).as_str(), "--no-gpg-sign", ]) .current_dir(path.parent().expect("Will exist")) diff --git a/pkgs/by-name/ts/tskm/src/interface/neorg/mod.rs b/pkgs/by-name/ts/tskm/src/interface/neorg/mod.rs index dc5cdf19..6bed1e39 100644 --- a/pkgs/by-name/ts/tskm/src/interface/neorg/mod.rs +++ b/pkgs/by-name/ts/tskm/src/interface/neorg/mod.rs @@ -1,18 +1,35 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::path::PathBuf; use anyhow::Result; -use crate::task::{run_task, Project}; +use crate::task::{Project, run_task}; pub mod handle; pub use handle::handle; impl Project { + /// Return the stored neorg path of this project. + /// The returned path will never start with a slash (/). pub(super) fn get_neorg_path(&self) -> Result<PathBuf> { let project_path = run_task(&[ "_get", format!("rc.context.{}.rc.neorg_path", self.to_context_display()).as_str(), ])?; - Ok(PathBuf::from(project_path.as_str())) + + let final_path = project_path + .strip_prefix('/') + .unwrap_or(project_path.as_str()); + + Ok(PathBuf::from(final_path)) } } diff --git a/pkgs/by-name/ts/tskm/src/interface/open/handle.rs b/pkgs/by-name/ts/tskm/src/interface/open/handle.rs index 15c7ac4d..82f468b3 100644 --- a/pkgs/by-name/ts/tskm/src/interface/open/handle.rs +++ b/pkgs/by-name/ts/tskm/src/interface/open/handle.rs @@ -1,3 +1,13 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::{ fs, net::{IpAddr, Ipv4Addr}, @@ -5,8 +15,8 @@ use std::{ process, }; -use anyhow::{bail, Context, Result}; -use log::{error, info}; +use anyhow::{Context, Result, bail}; +use log::{error, info, warn}; use url::Url; use crate::{cli::OpenCommand, rofi, state::State, task}; @@ -159,35 +169,45 @@ fn open_in_browser( if let Some(url) = url { args.push(url.to_string()); } else { - let (ip, pid): (IpAddr, u32) = { - let link = fs::read_link( - dirs::home_dir() - .expect("Exists") - .join(".mozilla/firefox") - .join(selected_project.to_project_display()) - .join("lock"), - )?; - let (ip, pid) = link - .to_str() - .expect("Should work") - .split_once(':') - .expect("The split works"); - - ( - ip.parse().expect("Should be a valid ip address"), - pid.parse().expect("Should be a valid pid"), - ) - }; + let lock_file = dirs::home_dir() + .expect("Exists") + .join(".mozilla/firefox") + .join(selected_project.to_project_display()) + .join("lock"); + + if lock_file.exists() { + let (ip, pid): (IpAddr, u32) = { + let link = fs::read_link(&lock_file).with_context(|| { + format!("Failed to readlink lock at '{}'", lock_file.display()) + })?; + + let (ip, pid) = link + .to_str() + .expect("Should work") + .split_once(':') + .expect("The split works"); - assert_eq!(ip, Ipv4Addr::new(127, 0, 0, 1)); - if PathBuf::from("/proc").join(pid.to_string()).exists() { - // Another Firefox instance has already been started for this project - // Add a buffer URL to force Firefox to open it in the already open instance - args.push("about:newtab".to_owned()); + ( + ip.parse().expect("Should be a valid ip address"), + pid.parse().expect("Should be a valid pid"), + ) + }; + + if ip != Ipv4Addr::new(127, 0, 0, 2) { + warn!("Your ip is weird.."); + } + + if PathBuf::from("/proc").join(pid.to_string()).exists() { + // Another Firefox instance has already been started for this project + // Add a buffer URL to force Firefox to open it in the already open instance + args.push("about:newtab".to_owned()); + } else { + // This project does not yet have another Firefox instance + // We do not need to add anything to the arguments, Firefox will open a new + // instance. + } } else { - // This project does not yet have another Firefox instance - // We do not need to add anything to the arguments, Firefox will open a new - // instance. + // There is no lock file and thus no instance already open. } }; diff --git a/pkgs/by-name/ts/tskm/src/interface/open/mod.rs b/pkgs/by-name/ts/tskm/src/interface/open/mod.rs index 2dc75957..a4060fa3 100644 --- a/pkgs/by-name/ts/tskm/src/interface/open/mod.rs +++ b/pkgs/by-name/ts/tskm/src/interface/open/mod.rs @@ -1,3 +1,13 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::{collections::HashMap, fs::File, io}; use anyhow::{Context, Result}; diff --git a/pkgs/by-name/ts/tskm/src/interface/project/handle.rs b/pkgs/by-name/ts/tskm/src/interface/project/handle.rs index 2b01f5d1..6d44b340 100644 --- a/pkgs/by-name/ts/tskm/src/interface/project/handle.rs +++ b/pkgs/by-name/ts/tskm/src/interface/project/handle.rs @@ -1,6 +1,16 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::{env, fs::File, io::Write}; -use anyhow::{anyhow, Context, Result}; +use anyhow::{Context, Result, anyhow}; use log::trace; use crate::{cli::ProjectCommand, task}; @@ -60,10 +70,12 @@ pub fn handle(command: ProjectCommand) -> Result<()> { let new_definition = ProjectDefinition::default(); - assert!(definition - .subprojects - .insert(segment.clone(), new_definition) - .is_none()); + assert!( + definition + .subprojects + .insert(segment.clone(), new_definition) + .is_none() + ); definition = definition .subprojects diff --git a/pkgs/by-name/ts/tskm/src/interface/project/mod.rs b/pkgs/by-name/ts/tskm/src/interface/project/mod.rs index 62069746..8a7fa1b0 100644 --- a/pkgs/by-name/ts/tskm/src/interface/project/mod.rs +++ b/pkgs/by-name/ts/tskm/src/interface/project/mod.rs @@ -1,3 +1,13 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::collections::HashMap; use anyhow::Result; diff --git a/pkgs/by-name/ts/tskm/src/main.rs b/pkgs/by-name/ts/tskm/src/main.rs index f4416c6d..dc425dcc 100644 --- a/pkgs/by-name/ts/tskm/src/main.rs +++ b/pkgs/by-name/ts/tskm/src/main.rs @@ -1,8 +1,21 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use anyhow::Result; -use clap::Parser; -use state::State; +use clap::{CommandFactory, Parser}; -use crate::interface::{input, neorg, open, project}; +use crate::{ + cli::{CliArgs, Command}, + interface::{input, neorg, open, project}, + state::State, +}; pub mod cli; pub mod interface; @@ -10,38 +23,9 @@ pub mod rofi; pub mod state; pub mod task; -use crate::cli::{CliArgs, Command}; - fn main() -> Result<(), anyhow::Error> { - // TODO: Support these completions for the respective types <2025-04-04> - // - // ID_GENERATION_FUNCTION - // ```sh - // context="$(task _get rc.context)" - // if [ "$context" ]; then - // filter="project:$context" - // else - // filter="0-10000" - // fi - // tasks="$(task "$filter" _ids)" - // - // if [ "$tasks" ]; then - // echo "$tasks" | xargs task _zshids | awk -F: -v q="'" '{gsub(/'\''/, q "\\" q q ); print $1 ":" q $2 q}' - // fi - // ``` - // - // ARGUMENTS: - // ID | *([0-9]) := [[%ID_GENERATION_FUNCTION]] - // The function displays all possible IDs of the eligible tasks. - // - // WS := %ALL_WORKSPACES - // All possible workspaces. - // - // P := %ALL_PROJECTS_PIPE - // The possible project. - // - // F := [[fd . --max-depth 3]] - // A URL-Input file to use as source. + clap_complete::CompleteEnv::with_factory(CliArgs::command).complete(); + let args = CliArgs::parse(); stderrlog::new() @@ -50,7 +34,6 @@ fn main() -> Result<(), anyhow::Error> { .show_module_names(true) .color(stderrlog::ColorChoice::Auto) .verbosity(usize::from(args.verbosity)) - .timestamp(stderrlog::Timestamp::Off) .init() .expect("Let's just hope that this does not panic"); diff --git a/pkgs/by-name/ts/tskm/src/rofi/mod.rs b/pkgs/by-name/ts/tskm/src/rofi/mod.rs index a0591b7f..37c2eafa 100644 --- a/pkgs/by-name/ts/tskm/src/rofi/mod.rs +++ b/pkgs/by-name/ts/tskm/src/rofi/mod.rs @@ -1,3 +1,13 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::{ io::Write, process::{Command, Stdio}, diff --git a/pkgs/by-name/ts/tskm/src/state.rs b/pkgs/by-name/ts/tskm/src/state.rs index 175a7f03..ae71764e 100644 --- a/pkgs/by-name/ts/tskm/src/state.rs +++ b/pkgs/by-name/ts/tskm/src/state.rs @@ -1,7 +1,17 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::path::PathBuf; use anyhow::Result; -use taskchampion::{storage::AccessMode, Replica, StorageConfig}; +use taskchampion::{Replica, StorageConfig, storage::AccessMode}; pub struct State { replica: Replica, diff --git a/pkgs/by-name/ts/tskm/src/task/mod.rs b/pkgs/by-name/ts/tskm/src/task/mod.rs index 03a12faa..04efbec5 100644 --- a/pkgs/by-name/ts/tskm/src/task/mod.rs +++ b/pkgs/by-name/ts/tskm/src/task/mod.rs @@ -1,13 +1,23 @@ +// nixos-config - My current NixOS configuration +// +// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +// SPDX-License-Identifier: GPL-3.0-or-later +// +// This file is part of my nixos-config. +// +// You should have received a copy of the License along with this program. +// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + use std::{ fmt::Display, - fs::{self, read_to_string, File}, + fs::{self, File, read_to_string}, path::PathBuf, process::Command, str::FromStr, sync::OnceLock, }; -use anyhow::{bail, Context, Result}; +use anyhow::{Context, Result, bail}; use log::{debug, info, trace}; use taskchampion::Tag; @@ -66,6 +76,14 @@ impl Task { pub fn uuid(&self) -> &taskchampion::Uuid { &self.uuid } + #[must_use] + pub fn working_set_id(&self, state: &mut State) -> Result<usize> { + Ok(state + .replica() + .working_set()? + .by_uuid(self.uuid) + .expect("The task should be in the working set")) + } fn as_task(&self, state: &mut State) -> Result<taskchampion::Task> { Ok(state @@ -121,7 +139,7 @@ impl Task { .expect("Every task should have a project") .to_owned() }; - let project = Project::from_project_string(output.as_str()) + let project = Project::from_project_string(output.as_str().trim()) .expect("This comes from tw, it should be valid"); Ok(project) } diff --git a/pkgs/by-name/ts/tskm/update.sh b/pkgs/by-name/ts/tskm/update.sh index 9268caf2..8e36e13e 100755 --- a/pkgs/by-name/ts/tskm/update.sh +++ b/pkgs/by-name/ts/tskm/update.sh @@ -1,3 +1,14 @@ #!/bin/sh -cargo update && cargo upgrade +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + +[ "$1" = "upgrade" ] && cargo upgrade +cargo update diff --git a/pkgs/by-name/up/update-sys/package.nix b/pkgs/by-name/up/update-sys/package.nix deleted file mode 100644 index 8777f82d..00000000 --- a/pkgs/by-name/up/update-sys/package.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - sysLib, - git, - nixos-rebuild, - sudo, - openssh, - coreutils, - mktemp, - gnugrep, - gnused, - systemd, -}: -sysLib.writeShellScript { - name = "update-sys"; - src = ./update-sys.sh; - generateCompletions = true; - keepPath = false; - dependencies = [ - git - nixos-rebuild - sudo - openssh - coreutils - mktemp - gnugrep - gnused - systemd - ]; -} diff --git a/pkgs/by-name/up/update-sys/update-sys.sh b/pkgs/by-name/up/update-sys/update-sys.sh deleted file mode 100755 index d28247f6..00000000 --- a/pkgs/by-name/up/update-sys/update-sys.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -help() { - cat <<EOF -This is a NixOS System flake update manager. - -USAGE: - $NAME [--branch <branchname>] [--help] - -OPTIONS: - --branch | -b BRANCHNAME - select a branch to update from. - - --mode | -m MODE - select a mode to update with - - --help | -h - output this help. -ARGUMENTS: - BRANCHNAME := [[ git branch --list --format '%(refname:short)' ]] - The name of the branch to deploy the config from - - MODE := switch|boot|test|build|dry-build|dry-activate|edit|repl|build-vm|build-vm-with-bootloader - See the 'nixos-rebuild' manpage for more information about these modes. -EOF - exit "$1" -} -default_branch=$(mktmp) -BRANCH="" - -while [ "$#" -gt 0 ]; do - case "$1" in - "--help" | "-h") - help 0 - ;; - "--branch" | "-b") - if [ -n "$2" ]; then - BRANCH="$2" - else - error "$1 requires an argument" - help 1 - fi - shift 2 - ;; - "--mode" | "-m") - if [ -n "$2" ]; then - MODE="$2" - else - error "$1 requires an argument" - help 1 - fi - shift 2 - ;; - *) - error "the option $1 does not exist!" - help 1 - ;; - esac -done - -cd /etc/nixos || die "No /etc/nixos" -msg "Starting system update..." -git remote update origin --prune >/dev/null 2>&1 -if ! [ "$BRANCH" = "" ]; then - git switch "$BRANCH" >/dev/null 2>&1 && msg2 "Switched to branch '$BRANCH'" -fi -msg2 "Updating git repository..." -git pull --rebase - -git remote show origin | grep 'HEAD' | cut -d':' -f2 | sed -e 's/^ *//g' -e 's/ *$//g' >"$default_branch" & - -msg2 "Updating system..." -if [ -n "$MODE" ]; then - nixos-rebuild "$MODE" -else - nixos-rebuild switch -fi - -git switch "$(cat "$default_branch")" >/dev/null 2>&1 && msg2 "Switched to branch '$(cat "$default_branch")'" -msg "Finished Update!" - -# vim: ft=sh diff --git a/pkgs/by-name/ya/yambar-modules/.envrc b/pkgs/by-name/ya/yambar-modules/.envrc deleted file mode 100644 index 2f9f1a81..00000000 --- a/pkgs/by-name/ya/yambar-modules/.envrc +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env sh -use flake diff --git a/pkgs/by-name/ya/yambar-modules/.gitignore b/pkgs/by-name/ya/yambar-modules/.gitignore deleted file mode 100644 index ea8c4bf7..00000000 --- a/pkgs/by-name/ya/yambar-modules/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/target diff --git a/pkgs/by-name/ya/yambar-modules/Cargo.lock b/pkgs/by-name/ya/yambar-modules/Cargo.lock deleted file mode 100644 index 6b689d29..00000000 --- a/pkgs/by-name/ya/yambar-modules/Cargo.lock +++ /dev/null @@ -1,131 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" - -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - -[[package]] -name = "libc" -version = "0.2.167" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" - -[[package]] -name = "ntapi" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4" -dependencies = [ - "winapi", -] - -[[package]] -name = "once_cell" -version = "1.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" - -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "sysinfo" -version = "0.28.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c2f3ca6693feb29a89724516f016488e9aafc7f37264f898593ee4b942f31b" -dependencies = [ - "cfg-if", - "core-foundation-sys", - "libc", - "ntapi", - "once_cell", - "rayon", - "winapi", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "yambar-modules" -version = "0.1.0" -dependencies = [ - "sysinfo", -] diff --git a/pkgs/by-name/ya/yambar-modules/Cargo.toml b/pkgs/by-name/ya/yambar-modules/Cargo.toml deleted file mode 100644 index 8e3995fe..00000000 --- a/pkgs/by-name/ya/yambar-modules/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "yambar-modules" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -sysinfo = "0.28.4" diff --git a/pkgs/by-name/ya/yambar-modules/flake.lock b/pkgs/by-name/ya/yambar-modules/flake.lock deleted file mode 100644 index 8043448e..00000000 --- a/pkgs/by-name/ya/yambar-modules/flake.lock +++ /dev/null @@ -1,61 +0,0 @@ -{ - "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1732617236, - "narHash": "sha256-PYkz6U0bSEaEB1al7O1XsqVNeSNS+s3NVclJw7YC43w=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "af51545ec9a44eadf3fe3547610a5cdd882bc34e", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/pkgs/by-name/ya/yambar-modules/flake.nix b/pkgs/by-name/ya/yambar-modules/flake.nix deleted file mode 100644 index e3d0cd49..00000000 --- a/pkgs/by-name/ya/yambar-modules/flake.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - description = "Extension modules for yambar(1)"; - - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - flake-utils.url = "github:numtide/flake-utils"; - }; - - outputs = { - nixpkgs, - flake-utils, - ... - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = nixpkgs.legacyPackages."${system}"; - in { - devShells.default = pkgs.mkShell { - packages = with pkgs; [ - # rust stuff - cargo - clippy - rustc - rustfmt - - cargo-edit - cargo-expand - ]; - }; - }); -} -# vim: ts=2 - diff --git a/pkgs/by-name/ya/yambar-modules/package.nix b/pkgs/by-name/ya/yambar-modules/package.nix deleted file mode 100644 index 79281429..00000000 --- a/pkgs/by-name/ya/yambar-modules/package.nix +++ /dev/null @@ -1,14 +0,0 @@ -{rustPlatform}: -rustPlatform.buildRustPackage { - pname = "yambar-modules"; - version = "0.1.0"; - - src = ./.; - cargoLock = { - lockFile = ./Cargo.lock; - }; - - meta = { - mainProgram = "yambar-modules"; - }; -} diff --git a/pkgs/by-name/ya/yambar-modules/src/cpu.rs b/pkgs/by-name/ya/yambar-modules/src/cpu.rs deleted file mode 100644 index 5a6dd084..00000000 --- a/pkgs/by-name/ya/yambar-modules/src/cpu.rs +++ /dev/null @@ -1,21 +0,0 @@ -use std::{thread, time::Duration}; - -use sysinfo::{CpuExt, System, SystemExt}; - -pub fn cpu() { - let mut sys = System::new(); - - loop { - sys.refresh_cpu(); - let cpu_usage: f32 = sys.cpus().iter().map(|cpu| cpu.cpu_usage()).sum(); - println!( - "cpu|range:0-100|{:.0}", - cpu_usage / sys.cpus().iter().count() as f32 - ); - println!(); - - // Sleeping to give the system time to run for long - // enough to have useful information. - thread::sleep(Duration::from_secs(3)); - } -} diff --git a/pkgs/by-name/ya/yambar-modules/src/main.rs b/pkgs/by-name/ya/yambar-modules/src/main.rs deleted file mode 100644 index 315c3be7..00000000 --- a/pkgs/by-name/ya/yambar-modules/src/main.rs +++ /dev/null @@ -1,26 +0,0 @@ -use std::{env::args, process}; - -mod cpu; -mod memory; - -fn main() { - let args: Vec<String> = args().collect(); - - if args.len() != 2 { - eprintln!("Usage: yambar-modules cpu|memory"); - process::exit(1); - } - - match args[1].as_str() { - "cpu" => { - cpu::cpu(); - } - "memory" => { - memory::memory(); - } - other => { - eprintln!("'{other}' is not a valid command. Only 'cpu' or 'memory'."); - process::exit(1); - } - } -} diff --git a/pkgs/by-name/ya/yambar-modules/src/memory.rs b/pkgs/by-name/ya/yambar-modules/src/memory.rs deleted file mode 100644 index 6da714cc..00000000 --- a/pkgs/by-name/ya/yambar-modules/src/memory.rs +++ /dev/null @@ -1,29 +0,0 @@ -use std::{thread, time::Duration}; - -use sysinfo::{System, SystemExt}; - -pub fn memory() { - let mut sys = System::new(); - - loop { - sys.refresh_memory(); - - let memory_percentage: f64 = - 100 as f64 * (sys.used_memory() as f64 / sys.total_memory() as f64); - - println!("memperc|string|{:.0}", memory_percentage); - if sys.total_swap() > 0 { - let swap_percentage: f64 = - 100 as f64 * (sys.used_swap() as f64 / sys.total_swap() as f64); - println!("swapperc|string|{:.0}", swap_percentage); - println!("swapstate|bool|true"); - } else { - println!("swapstate|bool|false"); - } - println!(""); - - // Sleeping to give the system time to run for long - // enough to have useful information. - thread::sleep(Duration::from_secs(3)); - } -} diff --git a/pkgs/by-name/yt/yt/package.nix b/pkgs/by-name/yt/yt/package.nix index 3c780374..d73776c5 100644 --- a/pkgs/by-name/yt/yt/package.nix +++ b/pkgs/by-name/yt/yt/package.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { fetchgit, ffmpeg, diff --git a/pkgs/default.nix b/pkgs/default.nix index 41bb654f..9a3ac842 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,23 +1,21 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, - sysLib, - nixLib, + libraries, }: let inherit (pkgs) lib; - maybeMergeMessage = "the ./pkgs/by-name set"; - mMM = maybeMergeMessage; - callPackage = - lib.callPackageWith - (nixLib.warnMerge - (nixLib.warnMerge - pkgs - myPkgs - mMM) - {inherit sysLib;} - mMM); + callPackage = lib.callPackageWith (libraries.extra.warnMerge pkgs myPkgs "the ./pkgs/by-name set"); - myPkgs = nixLib.mkByName { + myPkgs = libraries.extra.mkByName { baseDirectory = ./by-name; fileName = "package.nix"; finalizeFunction = name: value: callPackage value {}; diff --git a/pkgs/update_pkgs.sh b/pkgs/update_pkgs.sh index 3e33b720..d046ee76 100755 --- a/pkgs/update_pkgs.sh +++ b/pkgs/update_pkgs.sh @@ -1,5 +1,15 @@ #!/usr/bin/env sh +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + die() { printf "\033[31;1mError: \033[0m%s\n" "$1" exit 1 diff --git a/secrets.nix b/secrets.nix index d64f99c3..fc5a9249 100644 --- a/secrets.nix +++ b/secrets.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. let soispha = "age1mshh4ynzhhzhff25tqwkg4j054g3xwrfznh98ycchludj9wjj48qn2uffn"; @@ -6,11 +15,12 @@ let in { "modules/by-name/at/atuin/secrets/encryption_key.age".publicKeys = [soispha tiamat apzu]; + "modules/by-name/ta/taskwarrior/secrets/sync_server_encryption_key.age".publicKeys = [soispha tiamat apzu]; + + "modules/by-name/ba/backup/secrets/storagebox/ssh_key.age".publicKeys = [soispha tiamat apzu]; + "modules/by-name/ba/backup/secrets/storagebox/repository_password.age".publicKeys = [soispha tiamat apzu]; + "modules/by-name/ba/backup/secrets/local/repository_password.age".publicKeys = [soispha tiamat apzu]; + "modules/by-name/se/serverphone/private_keys/ca.key".publicKeys = [soispha tiamat apzu]; "modules/by-name/se/serverphone/private_keys/server.key".publicKeys = [soispha tiamat apzu]; - - "modules/by-name/ta/taskwarrior/secrets/private.key".publicKeys = [soispha tiamat apzu]; - "modules/by-name/ta/taskwarrior/secrets/public.cert".publicKeys = [soispha tiamat apzu]; - "modules/by-name/ta/taskwarrior/secrets/ca.cert".publicKeys = [soispha tiamat apzu]; - "modules/by-name/ta/taskwarrior/secrets/credentials".publicKeys = [soispha tiamat apzu]; } diff --git a/tests/README.md b/tests/README.md index f789c990..34dc9255 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,6 +1,18 @@ +<!-- +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +--> + # How to write a test -Test are simple derivations, put into the `by-name` directory. As you +Test are simple derivations, put into the `by-name` directory. As you often want to test configuration, the 'standard' nixos-vm-test function starts a vm with the specified configuration and lets you run a python test script. @@ -78,7 +90,7 @@ Sleep for `ARGS` seconds. #### `Expect` -Grep the currently visible screen for the regex `ARGS`. This regex +Grep the currently visible screen for the regex `ARGS`. This regex must match. #### `ExpectNot` diff --git a/tests/by-name/le/less/data/test.file.license b/tests/by-name/le/less/data/test.file.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/tests/by-name/le/less/data/test.file.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/tests/by-name/le/less/test.desc.license b/tests/by-name/le/less/test.desc.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/tests/by-name/le/less/test.desc.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/tests/by-name/le/less/test.nix b/tests/by-name/le/less/test.nix index cdd8209c..c9716ffc 100644 --- a/tests/by-name/le/less/test.nix +++ b/tests/by-name/le/less/test.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {mkTest, ...}: mkTest { name = "less"; diff --git a/tests/by-name/nv/nvim-checkhealth/test.desc.license b/tests/by-name/nv/nvim-checkhealth/test.desc.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/tests/by-name/nv/nvim-checkhealth/test.desc.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/tests/by-name/nv/nvim-checkhealth/test.nix b/tests/by-name/nv/nvim-checkhealth/test.nix index 399a25ff..cb04e758 100644 --- a/tests/by-name/nv/nvim-checkhealth/test.nix +++ b/tests/by-name/nv/nvim-checkhealth/test.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { mkTest, extraModules, diff --git a/tests/by-name/nv/nvim-neorg/data/index.norg.license b/tests/by-name/nv/nvim-neorg/data/index.norg.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/tests/by-name/nv/nvim-neorg/data/index.norg.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/tests/by-name/nv/nvim-neorg/data/reference.norg.license b/tests/by-name/nv/nvim-neorg/data/reference.norg.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/tests/by-name/nv/nvim-neorg/data/reference.norg.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/tests/by-name/nv/nvim-neorg/test.desc.license b/tests/by-name/nv/nvim-neorg/test.desc.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/tests/by-name/nv/nvim-neorg/test.desc.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/tests/by-name/nv/nvim-neorg/test.nix b/tests/by-name/nv/nvim-neorg/test.nix index ee0e1b52..9f160df5 100644 --- a/tests/by-name/nv/nvim-neorg/test.nix +++ b/tests/by-name/nv/nvim-neorg/test.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { mkTest, extraModules, diff --git a/tests/by-name/ya/yambar/test.desc.license b/tests/by-name/ya/yambar/test.desc.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/tests/by-name/ya/yambar/test.desc.license @@ -0,0 +1,9 @@ +nixos-config - My current NixOS configuration + +Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +SPDX-License-Identifier: GPL-3.0-or-later + +This file is part of my nixos-config. + +You should have received a copy of the License along with this program. +If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/tests/by-name/ya/yambar/test.nix b/tests/by-name/ya/yambar/test.nix index c0e94110..0e4d0033 100644 --- a/tests/by-name/ya/yambar/test.nix +++ b/tests/by-name/ya/yambar/test.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. {mkTest, ...}: mkTest { name = "yambar"; diff --git a/tests/default.nix b/tests/default.nix index af004feb..d13723b4 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, nixLib, diff --git a/tests/infrastructure/clean.awk b/tests/infrastructure/clean.awk index 1208b1ef..0362d38b 100644 --- a/tests/infrastructure/clean.awk +++ b/tests/infrastructure/clean.awk @@ -1,3 +1,13 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + { # Shell like comments gsub(/^#.*$/, "", $0) diff --git a/tests/infrastructure/default.nix b/tests/infrastructure/default.nix index 9e6ab08c..cd21198c 100644 --- a/tests/infrastructure/default.nix +++ b/tests/infrastructure/default.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, myPkgs, diff --git a/tests/infrastructure/driver.sh b/tests/infrastructure/driver.sh index 4992b5bc..a8b241d2 100644 --- a/tests/infrastructure/driver.sh +++ b/tests/infrastructure/driver.sh @@ -1,4 +1,15 @@ #! /usr/bin/env bash + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + set -e msg() { diff --git a/tests/infrastructure/run.nix b/tests/infrastructure/run.nix index 5bab3dc4..3148a2d9 100644 --- a/tests/infrastructure/run.nix +++ b/tests/infrastructure/run.nix @@ -1,3 +1,12 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, lib, diff --git a/update.sh b/update.sh index b4408bea..ff10f870 100755 --- a/update.sh +++ b/update.sh @@ -1,18 +1,33 @@ #!/usr/bin/env sh + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. + __update_sh_run() { __update_sh_command="$1" shift 1 - printf "\033[35;1m> \033[0m\033[35;1m%s\033[0m\n" "Running '$(basename "$__update_sh_command")' .." + printf "\033[35;1m> \033[0m\033[35;1m%s\033[0m\n" "Running '$(basename "$__update_sh_command") $*' .." "$__update_sh_command" "$@" unset __update_sh_command } +__update_sh_run nix flake update __update_sh_run ./modules/by-name/fi/firefox/update_extensions.sh "$@" __update_sh_run ./pkgs/update_pkgs.sh "$@" -echo "Also update out-of tree dependencies, like yt!" 2>&1 +# __update_sh_run nix flake check +__update_sh_run ./build.sh + +printf "\033[31;1m%s\033[0m\033[33;1m%s\033[0m\n" "Also update out-of-tree dependencies, like " "yt" 2>&1 # vim: ft=sh |