wrapper-manager-fds: use updated repo source

This commit is contained in:
Gabriel Arazas 2024-11-13 13:18:10 +08:00
parent 55cf85509a
commit 7875b055bd
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
68 changed files with 22 additions and 4945 deletions

View File

@ -13,7 +13,6 @@
# Subprojects.
./bahaghari.nix
./wrapper-manager-fds.nix
];
_module.args = {

View File

@ -32,7 +32,7 @@
modules = [
inputs.nur.hmModules.nur
inputs.sops-nix.homeManagerModules.sops
inputs.self.homeModules.wrapper-manager
inputs.wrapper-manager-fds.homeModules.wrapper-manager
];
nixvim = {
instance = "fiesta";

View File

@ -21,7 +21,7 @@ in
inputs.disko.nixosModules.disko
inputs.sops-nix.nixosModules.sops
inputs.self.nixosModules.wrapper-manager
inputs.wrapper-manager-fds.nixosModules.wrapper-manager
{
documentation.nixos.extraModules = [
../../modules/nixos

View File

@ -1,10 +0,0 @@
{ lib, ... }:
{
flake = {
wrapperManagerLib = ../../subprojects/wrapper-manager-fds/lib;
wrapperManagerModules = ../../subprojects/wrapper-manager-fds/modules/wrapper-manager;
homeModules.wrapper-manager = ../../subprojects/wrapper-manager-fds/modules/env/home-manager;
nixosModules.wrapper-manager = ../../subprojects/wrapper-manager-fds/modules/env/nixos;
};
}

18
flake.lock generated
View File

@ -1078,7 +1078,8 @@
"nixvim-stable": "nixvim-stable",
"nixvim-unstable": "nixvim-unstable",
"nur": "nur",
"sops-nix": "sops-nix"
"sops-nix": "sops-nix",
"wrapper-manager-fds": "wrapper-manager-fds"
}
},
"rust-overlay": {
@ -1257,6 +1258,21 @@
"repo": "flake-utils",
"type": "github"
}
},
"wrapper-manager-fds": {
"locked": {
"lastModified": 1731406631,
"narHash": "sha256-dra1yDPFNgxMQCRKkWgwEhr2iQlv506hZeEsK7F4U9w=",
"owner": "foo-dogsquared",
"repo": "nix-module-wrapper-manager-fds",
"rev": "94b07876c5b7e69b3e2e83538da72c692f228818",
"type": "github"
},
"original": {
"owner": "foo-dogsquared",
"repo": "nix-module-wrapper-manager-fds",
"type": "github"
}
}
},
"root": "root",

View File

@ -51,6 +51,9 @@
nixvim-unstable.inputs.nixpkgs.follows = "nixos-unstable";
nixvim-unstable.inputs.home-manager.follows = "home-manager-unstable";
# Make a wrapper.
wrapper-manager-fds.url = "github:foo-dogsquared/nix-module-wrapper-manager-fds";
# This is what AUR strives to be.
nur.url = "github:nix-community/NUR";

View File

@ -1,6 +0,0 @@
# The typical output name for Nix builds.
result*
### direnv ###
.direnv
.envrc

View File

@ -1,23 +0,0 @@
Copyright (c) 2024 Gabriel Arazas <foodogsquared@foodogsquared.one>
Program uses the following files/implementations from other authors;
see their respective license headers for more details:
flake.nix, specifically the eachSystem which is taken directly from flake-utils: Copyright (c) 2020 zimbatm
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:
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.

View File

@ -1,18 +0,0 @@
.PHONY: docs-serve
docs-serve:
hugo -s docs/website serve
.PHONY: docs-build
docs-build:
hugo -s docs/website
# Ideally, this should be done only in the remote CI environment with a certain
# update cadence/rhythm.
.PHONY: update
update:
npins update
# Ideally this should be done before committing.
.PHONY: format
format:
treefmt

View File

@ -1 +0,0 @@
docs/website/content/en/project-overview.adoc

View File

@ -1,35 +0,0 @@
# The user entrypoint which makes it especially important to be maintained.
#
# Anyways, we just keep this attribute set for forward compatability in case it
# became required for users to pass something like the nixpkgs instance.
{ }:
{
# Self-explanatory attributes, yeah? These are just integration modules for
# the select environments...
# ...such as for NixOS, ...
nixosModules = rec {
default = wrapper-manager;
wrapper-manager = ./modules/env/nixos;
};
# ...and for home-manager.
homeModules = rec {
default = wrapper-manager;
wrapper-manager = ./modules/env/home-manager;
};
# The main library interface that can be used for immediate consumption.
lib = import ./lib/env.nix;
# This is intended to be imported by the user in case they want to initialize
# their own wrapper-manager library for whatever reason.
wrapperManagerLib = ./lib;
# The overlay that can be included in the nixpkgs instance which includes
# only the wrapper-manager library set for now (and pretty much in the
# distant future).
overlays.default = final: prev: {
wrapperManagerLib = import ./lib { pkgs = final; };
};
}

View File

@ -1,58 +0,0 @@
### Ruby ###
*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/
# Used by dotenv library to load environment variables.
# .env
# Ignore Byebug command history file.
.byebug_history
## Specific to RubyMotion:
.dat*
.repl_history
build/
*.bridgesupport
build-iPhoneOS/
build-iPhoneSimulator/
## Specific to RubyMotion (use of CocoaPods):
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# vendor/Pods/
## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/
## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/
# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
# .rubocop-https?--*

View File

@ -1,20 +0,0 @@
# frozen_string_literal: true
source 'https://rubygems.org'
gem 'asciidoctor'
gem 'asciidoctor-diagram'
gem 'asciidoctor-foodogsquared-extensions'
gem 'concurrent-ruby'
gem 'open-uri-cached'
gem 'rouge'
gem 'slim'
gem 'tilt'
group :development do
gem 'rake'
gem 'ruby-lsp', require: false
end
group :lint do
gem 'rubocop', require: false
end

View File

@ -1,84 +0,0 @@
GEM
remote: https://rubygems.org/
specs:
asciidoctor (2.0.23)
asciidoctor-diagram (2.3.1)
asciidoctor (>= 1.5.7, < 3.x)
asciidoctor-diagram-ditaamini (~> 1.0)
asciidoctor-diagram-plantuml (~> 1.2021)
rexml
asciidoctor-diagram-batik (1.17)
asciidoctor-diagram-ditaamini (1.0.3)
asciidoctor-diagram-plantuml (1.2024.5)
asciidoctor-diagram-batik (~> 1.17)
asciidoctor-foodogsquared-extensions (1.2.1)
asciidoctor (~> 2.0)
rugged (~> 1.0)
ast (2.4.2)
concurrent-ruby (1.3.3)
json (2.7.2)
language_server-protocol (3.17.0.3)
logger (1.6.0)
open-uri-cached (1.0.0)
parallel (1.25.1)
parser (3.3.4.0)
ast (~> 2.4.1)
racc
prism (0.30.0)
racc (1.8.0)
rainbow (3.1.1)
rake (13.2.1)
rbs (3.5.2)
logger
regexp_parser (2.9.2)
rexml (3.3.1)
strscan
rouge (4.3.0)
rubocop (1.65.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.31.3)
parser (>= 3.3.1.0)
ruby-lsp (0.17.7)
language_server-protocol (~> 3.17.0)
prism (>= 0.29.0, < 0.31)
rbs (>= 3, < 4)
sorbet-runtime (>= 0.5.10782)
ruby-progressbar (1.13.0)
rugged (1.7.2)
slim (5.2.1)
temple (~> 0.10.0)
tilt (>= 2.1.0)
sorbet-runtime (0.5.11481)
strscan (3.1.0)
temple (0.10.3)
tilt (2.4.0)
unicode-display_width (2.5.0)
PLATFORMS
ruby
x86_64-linux
DEPENDENCIES
asciidoctor
asciidoctor-diagram
asciidoctor-foodogsquared-extensions
concurrent-ruby
open-uri-cached
rake
rouge
rubocop
ruby-lsp
slim
tilt
BUNDLED WITH
2.5.11

View File

@ -1,450 +0,0 @@
GNU Free Documentation License
Version 1.3, 3 November 2008
Copyright (C) 2000, 2001, 2002, 2007, 2008 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.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other
functional and useful document "free" in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of "copyleft", which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The "Document", below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as "you". You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A "Modified Version" of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of
the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall
subject (or to related matters) and contains nothing that could fall
directly within that overall subject. (Thus, if the Document is in
part a textbook of mathematics, a Secondary Section may not explain
any mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The "Invariant Sections" are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The "Cover Texts" are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, SGML
or XML using a publicly available DTD, and standard-conforming simple
HTML, PostScript or PDF designed for human modification. Examples of
transparent image formats include PNG, XCF and JPG. Opaque formats
include proprietary formats that can be read and edited only by
proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the
machine-generated HTML, PostScript or PDF produced by some word
processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, "Title Page" means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
The "publisher" means any person or entity that distributes copies of
the Document to the public.
A section "Entitled XYZ" means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as "Acknowledgements",
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
of such a section when you modify the Document means that it remains a
section "Entitled XYZ" according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no
other conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to
give them a chance to provide you with an updated version of the
Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
C. State on the Title page the name of the publisher of the
Modified Version, as the publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
F. Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
H. Include an unaltered copy of this License.
I. Preserve the section Entitled "History", Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled "History" in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the "History" section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
K. For any section Entitled "Acknowledgements" or "Dedications",
Preserve the Title of the section, and preserve in the section all
the substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
M. Delete any section Entitled "Endorsements". Such a section
may not be included in the Modified Version.
N. Do not retitle any existing section to be Entitled "Endorsements"
or to conflict in title with any Invariant Section.
O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled "Endorsements", provided it contains
nothing but endorsements of your Modified Version by various
parties--for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled "History"
in the various original documents, forming one section Entitled
"History"; likewise combine any sections Entitled "Acknowledgements",
and any sections Entitled "Dedications". You must delete all sections
Entitled "Endorsements".
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other
documents released under this License, and replace the individual
copies of this License in the various documents with a single copy
that is included in the collection, provided that you follow the rules
of this License for verbatim copying of each of the documents in all
other respects.
You may extract a single document from such a collection, and
distribute it individually under this License, provided you insert a
copy of this License into the extracted document, and follow this
License in all other respects regarding verbatim copying of that
document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an "aggregate" if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled "Acknowledgements",
"Dedications", or "History", the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense, or distribute it is void, and
will automatically terminate your rights under this License.
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, receipt of a copy of some or all of the same material does
not give you any rights to use it.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions of the
GNU Free Documentation 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. See
https://www.gnu.org/licenses/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation. If the Document
specifies that a proxy can decide which future versions of this
License can be used, that proxy's public statement of acceptance of a
version permanently authorizes you to choose that version for the
Document.
11. RELICENSING
"Massive Multiauthor Collaboration Site" (or "MMC Site") means any
World Wide Web server that publishes copyrightable works and also
provides prominent facilities for anybody to edit those works. A
public wiki that anybody can edit is an example of such a server. A
"Massive Multiauthor Collaboration" (or "MMC") contained in the site
means any set of copyrightable works thus published on the MMC site.
"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
license published by Creative Commons Corporation, a not-for-profit
corporation with a principal place of business in San Francisco,
California, as well as future copyleft versions of that license
published by that same organization.
"Incorporate" means to publish or republish a Document, in whole or in
part, as part of another Document.
An MMC is "eligible for relicensing" if it is licensed under this
License, and if all works that were first published under this License
somewhere other than this MMC, and subsequently incorporated in whole or
in part into the MMC, (1) had no cover texts or invariant sections, and
(2) were thus incorporated prior to November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site
under CC-BY-SA on the same site at any time before August 1, 2009,
provided the MMC is eligible for relicensing.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
Copyright (c) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the "with...Texts." line with this:
with the Invariant Sections being LIST THEIR TITLES, with the
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.

View File

@ -1,11 +0,0 @@
= Documentation
:toc:
This is where the documentation is created, namely both the website and the manual page.
* The website is powered by Hugo and it is pretty much what makes most of the files here.
It requires Hugo and whatever Hugo module feature requires so it isn't possible to build it offline.
For now, we rely on the remote CI having network access for it (which is pretty much the standard for the most part so no worries there).
* The manual page is powered by some under-documented tool in the Nix ecosystem (as is tradition) called https://github.com/NixOS/nixpkgs/tree/de19b7eaffd1ec24c50a6a257f3674a841ab1221/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs[nixos-render-docs].
The adjacent tools in the Nix-module-options-doc-generation ecosystem are also what makes the (autogenerated) Nix module options pages found in the website.

View File

@ -1,192 +0,0 @@
let
sources = import ../npins;
in
{
pkgs ? import sources.nixos-unstable { },
extraModules ? [ ],
}:
let
inherit (pkgs) nixosOptionsDoc lib;
src = builtins.toString ../.;
# Pretty much inspired from home-manager's documentation build process.
evalDoc =
args@{
modules,
includeModuleSystemOptions ? false,
...
}:
let
options =
(pkgs.lib.evalModules {
modules = modules ++ [
{
_module.check = false;
_module.args.pkgs = pkgs;
}
];
class = "wrapperManager";
}).options;
# Based from nixpkgs' and home-manager's code.
gitHubDeclaration = user: repo: subpath:
{
url = "https://github.com/${user}/${repo}/blob/master/${subpath}";
name = "<${repo}/${subpath}>";
};
in
nixosOptionsDoc (
{
options =
if includeModuleSystemOptions then options else builtins.removeAttrs options [ "_module" ];
transformOptions = opt:
opt // {
declarations = map (decl:
if lib.hasPrefix src (toString decl) then
gitHubDeclaration "foo-dogsquared" "wrapper-manager-fds"
(lib.removePrefix "/" (lib.removePrefix src (toString decl)))
else if decl == "lib/modules.nix" then
gitHubDeclaration "NixOS" "nixpkgs" decl
else
decl) opt.declarations;
};
}
// builtins.removeAttrs args [
"modules"
"includeModuleSystemOptions"
]
);
releaseConfig = lib.importJSON ../release.json;
wrapperManagerLib = (import ../. { }).lib;
wmOptionsDoc = evalDoc {
modules = [ ../modules/wrapper-manager ] ++ extraModules;
includeModuleSystemOptions = true;
};
wmNixosDoc = evalDoc { modules = [ ../modules/env/nixos ]; };
wmHmDoc = evalDoc { modules = [ ../modules/env/home-manager ]; };
gems = pkgs.bundlerEnv {
name = "wrapper-manager-fds-gem-env";
ruby = pkgs.ruby_3_1;
gemdir = ./.;
};
in
{
# I forgot about the fact Hugo also uses Go modules for its Hugo modules
# feature. For now, this is considered broken up until that is working and I
# know squat about Go build system. Also, Hugo has several features such as
# embedding metadata from VCS which doesn't play well with Nix that is
# requiring a clean source.
#
# For now, we're just relying on nix-shell to build it for us.
website =
let
buildHugoSite = pkgs.callPackage ./hugo-build-module.nix { };
# Now this is some dogfooding.
asciidoctorWrapped = wrapperManagerLib.build {
inherit pkgs;
modules = [
(
{
config,
lib,
pkgs,
...
}:
{
wrappers.asciidoctor = {
arg0 = lib.getExe' gems "asciidoctor";
appendArgs = [
"-T"
"${sources.website}/templates"
];
};
}
)
];
};
in
buildHugoSite {
pname = "wrapper-manager-docs";
version = "2024-07-13";
src = lib.fileset.toSource {
root = ./website;
fileset = lib.fileset.unions [
./website/assets
./website/config
./website/content
./website/layouts
./website/go.mod
./website/go.sum
];
};
vendorHash = "sha256-W0PJdS9C8Qz9jU5zRmfwBshsCK8BJFIYBFVstpfZEUI=";
buildInputs = with pkgs; [
asciidoctorWrapped
git
gems
gems.wrappedRuby
];
preBuild = ''
install -Dm0644 ${wmOptionsDoc.optionsAsciiDoc} ./content/en/wrapper-manager-env-options.adoc
install -Dm0644 ${wmNixosDoc.optionsAsciiDoc} ./content/en/wrapper-manager-nixos-module.adoc
install -Dm0644 ${wmHmDoc.optionsAsciiDoc} ./content/en/wrapper-manager-home-manager-module.adoc
'';
meta = with lib; {
description = "wrapper-manager-fds documentation";
homepage = "https://github.com/foo-dogsquared/wrapper-manager-fds";
license = with licenses; [
mit
fdl13Only
];
platforms = platforms.all;
};
};
inherit wmOptionsDoc wmHmDoc wmNixosDoc;
inherit releaseConfig;
outputs = {
manpage =
pkgs.runCommand "wrapper-manager-reference-manpage"
{
nativeBuildInputs = with pkgs; [
nixos-render-docs
gems
gems.wrappedRuby
];
}
''
mkdir -p $out/share/man/man5
asciidoctor --attribute is-wider-scoped --backend manpage \
${./manpages/header.adoc} --out-file header.5
nixos-render-docs options manpage --revision ${releaseConfig.version} \
--header ./header.5 --footer ${./manpages/footer.5} \
${wmOptionsDoc.optionsJSON}/share/doc/nixos/options.json \
$out/share/man/man5/wrapper-manager.nix.5
'';
html =
pkgs.runCommand "wrapper-manager-reference-html"
{
nativeBuildInputs = [
gems
gems.wrappedRuby
];
}
''
mkdir -p $out/share/wrapper-manager
asciidoctor --backend html ${wmOptionsDoc.optionsAsciiDoc} --attribute toc --out-file $out/share/wrapper-manager/options-reference.html
'';
};
}

View File

@ -1,424 +0,0 @@
{
asciidoctor = {
groups = [ "default" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "1wyxgwmnz9bw377r3lba26b090hbsq9qnbw8575a1prpy83qh82j";
type = "gem";
};
version = "2.0.23";
};
asciidoctor-diagram = {
dependencies = [
"asciidoctor"
"asciidoctor-diagram-ditaamini"
"asciidoctor-diagram-plantuml"
"rexml"
];
groups = [ "default" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "1214scxm36k409gfy3wilfqx3akrm52r530zmra6cmmf6d22c5q4";
type = "gem";
};
version = "2.3.1";
};
asciidoctor-diagram-batik = {
groups = [ "default" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "0220xqxmkmimxmhsqhlbr0hslijvnhzdds3s6h6fxbxqrrmm0jrl";
type = "gem";
};
version = "1.17";
};
asciidoctor-diagram-ditaamini = {
groups = [ "default" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "13h65bfbq7hc7z3kqn0m28w9c6ap7fikpjcvsdga6jg01slb4c56";
type = "gem";
};
version = "1.0.3";
};
asciidoctor-diagram-plantuml = {
dependencies = [ "asciidoctor-diagram-batik" ];
groups = [ "default" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "1ppl5nsq40x11731ciahi89k5yvszlm12pml1pqaj0lwbi7ww6x0";
type = "gem";
};
version = "1.2024.5";
};
asciidoctor-foodogsquared-extensions = {
dependencies = [
"asciidoctor"
"rugged"
];
groups = [ "default" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "0fm6shyysj51wi4s7nnb643j2mphp68fh44gmr83x8n613hg9a4l";
type = "gem";
};
version = "1.2.1";
};
ast = {
groups = [
"default"
"lint"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "04nc8x27hlzlrr5c2gn7mar4vdr0apw5xg22wp6m8dx3wqr04a0y";
type = "gem";
};
version = "2.4.2";
};
concurrent-ruby = {
groups = [ "default" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "0skwdasxq7mnlcccn6aqabl7n9r3jd7k19ryzlzzip64cn4x572g";
type = "gem";
};
version = "1.3.3";
};
json = {
groups = [
"default"
"lint"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "0b4qsi8gay7ncmigr0pnbxyb17y3h8kavdyhsh7nrlqwr35vb60q";
type = "gem";
};
version = "2.7.2";
};
language_server-protocol = {
groups = [
"default"
"development"
"lint"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "0gvb1j8xsqxms9mww01rmdl78zkd72zgxaap56bhv8j45z05hp1x";
type = "gem";
};
version = "3.17.0.3";
};
logger = {
groups = [
"default"
"development"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "0gpg8gzi0xwymw4aaq2iafcbx31i3xzkg3fb30mdxn1d4qhc3dqa";
type = "gem";
};
version = "1.6.0";
};
open-uri-cached = {
groups = [ "default" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "03v0if3jlvbclnd6jgjk94fbhf0h2fq1wxr0mbx7018sxzm0biwr";
type = "gem";
};
version = "1.0.0";
};
parallel = {
groups = [
"default"
"lint"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "145bn5q7ysnjj02jdf1x4nc1f0xxrv7ihgz9yr1j7sinmawqkq0j";
type = "gem";
};
version = "1.25.1";
};
parser = {
dependencies = [
"ast"
"racc"
];
groups = [
"default"
"lint"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "10ly2wind06nylyqa5724ld2l0l46d3ag4fm04ifjgw7qdlpf94d";
type = "gem";
};
version = "3.3.4.0";
};
prism = {
groups = [
"default"
"development"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "05j9bcxdz6wfnrjn32zvdwj1qsbp88mwx3rv7g256gziya6avc2r";
type = "gem";
};
version = "0.30.0";
};
racc = {
groups = [
"default"
"lint"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "021s7maw0c4d9a6s07vbmllrzqsj2sgmrwimlh8ffkvwqdjrld09";
type = "gem";
};
version = "1.8.0";
};
rainbow = {
groups = [
"default"
"lint"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "0smwg4mii0fm38pyb5fddbmrdpifwv22zv3d3px2xx497am93503";
type = "gem";
};
version = "3.1.1";
};
rake = {
groups = [ "development" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "17850wcwkgi30p7yqh60960ypn7yibacjjha0av78zaxwvd3ijs6";
type = "gem";
};
version = "13.2.1";
};
rbs = {
dependencies = [ "logger" ];
groups = [
"default"
"development"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "1fzk0a3d68fglnkwpaz07npi929y1kh2hh1j63y04943vvshyjmc";
type = "gem";
};
version = "3.5.2";
};
regexp_parser = {
groups = [
"default"
"lint"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "0ik40vcv7mqigsfpqpca36hpmnx0536xa825ai5qlkv3mmkyf9ss";
type = "gem";
};
version = "2.9.2";
};
rexml = {
dependencies = [ "strscan" ];
groups = [
"default"
"lint"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "09f3sw7f846fpcpwdm362ylqldwqxpym6z0qpld4av7zisrrzbrl";
type = "gem";
};
version = "3.3.1";
};
rouge = {
groups = [ "default" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "072qvvrcqj0yfr3b0j932mlhvn41i38bq37z7z07i3ikagndkqwy";
type = "gem";
};
version = "4.3.0";
};
rubocop = {
dependencies = [
"json"
"language_server-protocol"
"parallel"
"parser"
"rainbow"
"regexp_parser"
"rexml"
"rubocop-ast"
"ruby-progressbar"
"unicode-display_width"
];
groups = [ "lint" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "18g462bccr0rvszc7kirr89laggdf6254p7pqsckk3izg901chv2";
type = "gem";
};
version = "1.65.0";
};
rubocop-ast = {
dependencies = [ "parser" ];
groups = [
"default"
"lint"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "063qgvqbyv354icl2sgx758z22wzq38hd9skc3n96sbpv0cdc1qv";
type = "gem";
};
version = "1.31.3";
};
ruby-lsp = {
dependencies = [
"language_server-protocol"
"prism"
"rbs"
"sorbet-runtime"
];
groups = [ "development" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "1kvyk0cald1cw6fqxy5w68la1gnc1nv2mqx8myijjsbcf9npjbp8";
type = "gem";
};
version = "0.17.7";
};
ruby-progressbar = {
groups = [
"default"
"lint"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "0cwvyb7j47m7wihpfaq7rc47zwwx9k4v7iqd9s1xch5nm53rrz40";
type = "gem";
};
version = "1.13.0";
};
rugged = {
groups = [ "default" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "1sccng15h8h3mcjxfgvxy85lfpswbj0nhmzwwsqdffbzqgsb2jch";
type = "gem";
};
version = "1.7.2";
};
slim = {
dependencies = [
"temple"
"tilt"
];
groups = [ "default" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "1rqk7jn66wgx50b18ndhbppjq55rbcwgqg1rbhnhxwiggvzisdbj";
type = "gem";
};
version = "5.2.1";
};
sorbet-runtime = {
groups = [
"default"
"development"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "122702d5cmrbaydcqfjksh1d78g0mq69h77zd4yljwjrc50jz70b";
type = "gem";
};
version = "0.5.11481";
};
strscan = {
groups = [
"default"
"lint"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "0mamrl7pxacbc79ny5hzmakc9grbjysm3yy6119ppgsg44fsif01";
type = "gem";
};
version = "3.1.0";
};
temple = {
groups = [ "default" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "0fwia5hvc1xz9w7vprzjnsym3v9j5l9ggdvy70jixbvpcpz4acfz";
type = "gem";
};
version = "0.10.3";
};
tilt = {
groups = [ "default" ];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "0kds7wkxmb038cwp6ravnwn8k65ixc68wpm8j5jx5bhx8ndg4x6z";
type = "gem";
};
version = "2.4.0";
};
unicode-display_width = {
groups = [
"default"
"lint"
];
platforms = [ ];
source = {
remotes = [ "https://rubygems.org" ];
sha256 = "1d0azx233nags5jx3fqyr23qa2rhgzbhv8pxp46dgbg1mpf82xky";
type = "gem";
};
version = "2.5.0";
};
}

View File

@ -1,320 +0,0 @@
# Copyright (c) 2003-2024 Eelco Dolstra and the Nixpkgs/NixOS contributors
#
# 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:
#
# 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.
{
hugo,
go,
cacert,
git,
lib,
stdenv,
}:
{
name ? "${args'.pname}-${args'.version}",
nativeBuildInputs ? [ ],
passthru ? { },
# A function to override the goModules derivation
overrideModAttrs ? (_oldAttrs: { }),
# path to go.mod and go.sum directory
modRoot ? "./",
# vendorHash is the SRI hash of the vendored dependencies
#
# if vendorHash is null, then we won't fetch any dependencies and
# rely on the vendor folder within the source.
vendorHash ? throw (
if args' ? vendorSha256 then
"buildGoModule: Expect vendorHash instead of vendorSha256"
else
"buildGoModule: vendorHash is missing"
),
# Whether to delete the vendor folder supplied with the source.
deleteVendor ? false,
# Whether to fetch (go mod download) and proxy the vendor directory.
# This is useful if your code depends on c code and go mod tidy does not
# include the needed sources to build or if any dependency has case-insensitive
# conflicts which will produce platform dependant `vendorHash` checksums.
proxyVendor ? false,
# We want parallel builds by default
enableParallelBuilding ? true,
# Do not enable this without good reason
# IE: programs coupled with the compiler
allowGoReference ? false,
CGO_ENABLED ? go.CGO_ENABLED,
meta ? { },
ldflags ? [ ],
GOFLAGS ? [ ],
...
}@args':
let
args = removeAttrs args' [
"overrideModAttrs"
"vendorSha256"
"vendorHash"
];
GO111MODULE = "on";
GOTOOLCHAIN = "local";
hugoModules =
if (vendorHash == null) then
""
else
(stdenv.mkDerivation {
name = "${name}-hugo-modules";
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [
hugo
go
git
cacert
];
inherit (args) src;
inherit (go) GOOS GOARCH;
inherit GO111MODULE GOTOOLCHAIN;
# The following inheritence behavior is not trivial to expect, and some may
# argue it's not ideal. Changing it may break vendor hashes in Nixpkgs and
# out in the wild. In anycase, it's documented in:
# doc/languages-frameworks/go.section.md
prePatch = args.prePatch or "";
patches = args.patches or [ ];
patchFlags = args.patchFlags or [ ];
postPatch = args.postPatch or "";
preBuild = args.preBuild or "";
postBuild = args.modPostBuild or "";
sourceRoot = args.sourceRoot or "";
setSourceRoot = args.setSourceRoot or "";
env = args.env or { };
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
"GIT_PROXY_COMMAND"
"SOCKS_SERVER"
"GOPROXY"
];
configurePhase =
args.modConfigurePhase or ''
runHook preConfigure
export GOCACHE=$TMPDIR/go-cache
export GOPATH="$TMPDIR/go"
cd "${modRoot}"
runHook postConfigure
'';
buildPhase =
args.modBuildPhase or (
''
runHook preBuild
''
+ lib.optionalString deleteVendor ''
if [ ! -d _vendor ]; then
echo "_vendor folder does not exist, 'deleteVendor' is not needed"
exit 10
else
rm -rf _vendor
fi
''
+ ''
if [ -d _vendor ]; then
echo "_vendor folder exists, please set 'vendorHash = null;' in your expression"
exit 10
fi
${
if proxyVendor then
''
mkdir -p "''${GOPATH}/pkg/mod/cache/download"
hugo mod vendor
''
else
''
if (( "''${NIX_DEBUG:-0}" >= 1 )); then
hugoModVendorFlags+=(-v)
fi
hugo mod vendor "''${hugoModVendorFlags[@]}"
''
}
mkdir -p _vendor
runHook postBuild
''
);
installPhase =
args.modInstallPhase or ''
runHook preInstall
${
if proxyVendor then
''
rm -rf "''${GOPATH}/pkg/mod/cache/download/sumdb"
cp -r --reflink=auto "''${GOPATH}/pkg/mod/cache/download" $out
''
else
''
cp -r --reflink=auto _vendor $out
''
}
if ! [ "$(ls -A $out)" ]; then
echo "_vendor folder is empty, please set 'vendorHash = null;' in your expression"
exit 10
fi
runHook postInstall
'';
dontFixup = true;
outputHashMode = "recursive";
outputHash = vendorHash;
# Handle empty vendorHash; avoid
# error: empty hash requires explicit hash algorithm
outputHashAlgo = if vendorHash == "" then "sha256" else null;
}).overrideAttrs
overrideModAttrs;
package = stdenv.mkDerivation (
args
// {
nativeBuildInputs = [
hugo
git
go
] ++ nativeBuildInputs;
inherit (go) GOOS GOARCH;
GOFLAGS =
GOFLAGS
++
lib.warnIf (lib.any (lib.hasPrefix "-mod=") GOFLAGS)
"use `proxyVendor` to control Go module/vendor behavior instead of setting `-mod=` in GOFLAGS"
(lib.optional (!proxyVendor) "-mod=vendor")
++
lib.warnIf (builtins.elem "-trimpath" GOFLAGS)
"`-trimpath` is added by default to GOFLAGS by buildGoModule when allowGoReference isn't set to true"
(lib.optional (!allowGoReference) "-trimpath");
inherit
CGO_ENABLED
enableParallelBuilding
GO111MODULE
GOTOOLCHAIN
;
# If not set to an explicit value, set the buildid empty for reproducibility.
ldflags = ldflags ++ lib.optional (!lib.any (lib.hasPrefix "-buildid=") ldflags) "-buildid=";
configurePhase =
args.configurePhase or (
''
runHook preConfigure
export GOCACHE=$TMPDIR/go-cache
export GOPATH="$TMPDIR/go"
export GOPROXY=off
export GOSUMDB=off
cd "$modRoot"
''
+ lib.optionalString (vendorHash != null) ''
${
if proxyVendor then
''
export GOPROXY=file://${hugoModules}
''
else
''
rm -rf _vendor
cp -r --reflink=auto ${hugoModules} _vendor
''
}
''
+ ''
# currently pie is only enabled by default in pkgsMusl
# this will respect the `hardening{Disable,Enable}` flags if set
if [[ $NIX_HARDENING_ENABLE =~ "pie" ]]; then
export GOFLAGS="-buildmode=pie $GOFLAGS"
fi
runHook postConfigure
''
);
buildPhase =
args.buildPhase or ''
runHook preBuild
hugo "''${buildFlags[@]}" --destination public
runHook postBuild
'';
doCheck = args.doCheck or true;
checkPhase =
args.checkPhase or ''
runHook preCheck
runHook postCheck
'';
installPhase =
args.installPhase or ''
runHook preInstall
mkdir -p $out
cp -r public/* $out
runHook postInstall
'';
strictDeps = true;
disallowedReferences = lib.optional (!allowGoReference) go;
passthru = passthru // {
inherit
go
hugo
hugoModules
vendorHash
;
};
meta = {
# Add default meta information
platforms = go.meta.platforms or lib.platforms.all;
} // meta;
}
);
in
package

View File

@ -1,3 +0,0 @@
.SH "AUTHORS"
.PP
foodogsquared

View File

@ -1,30 +0,0 @@
= wrapper-manager-configuration(5)
:doctype: manpage
:mantitle: WRAPPER-MANAGER-CONFIGURATION.NIX(5)
:manmanual: wrapper-manager configuration
:mansource: wrapper-manager configuration
:man-linkstyle: pass:[blue R < >]
== Name
wrapper-manager-configuration.nix - wrapper-manager configuration specification
ifdef::is-wider-scoped[]
== Additional notes
If you've included env-specific integration wrapper-manager modules (e.g., NixOS, home-manager), there are additional things that are included.
* The wider-scoped environment configuration is included as a module argument in each wrapper-manager package (i.e., `wrapper-manager.packages`).
This is mainly useful to create a dynamic wrapper-manager package with different parameters when in NixOS, home-manager, or as standalone package.
+
--
* For NixOS integration, the NixOS configuration is available as `nixosConfig`.
* For home-manager integration, `hmConfig` stores the home-manager configuration.
--
* Additional wrapper-manager documentation can be deployed with the wider environment.
So far, there should be a manpage or an HTML document that can be enabled with `wrapper-manager.documentation.{manpage,html}.enable`.
endif::[]
== Options

View File

@ -1,17 +0,0 @@
# All of the generated assets.
/content/**/wrapper-manager-*.adoc
### Hugo ###
# Generated files by hugo
/public/
/resources/_gen/
/assets/jsconfig.json
hugo_stats.json
# Executable may be added to repository
hugo.exe
hugo.darwin
hugo.linux
# Temporary lock file while building
/.hugo_build.lock

View File

@ -1,49 +0,0 @@
(function() {
// Set up shop for QoL code listing features.
var codeListings = document.querySelectorAll("main .listingblock > .content, main .literalblock > .content");
for (elem of codeListings) {
var parent = elem.parentElement;
var fullscreenButton = document.createElement("button");
fullscreenButton.classList.add("listingblock__fullscreen-btn");
fullscreenButton.ariaLabel = "{{ T "fullscreenButtonAriaLabel" }}";
fullscreenButton.title = "{{ T "fullscreenButtonLabel" }}";
fullscreenButton.ariaDescription = "{{ T "fullscreenButtonDescription" }}";
fullscreenButton.innerHTML = `{{- partial "components/heroicon.html" (dict "id" "arrows-pointing-out") | safeHTML }}`;
fullscreenButton.addEventListener("click", (event) => {
const { target } = event;
const parent = target.closest(".listingblock") || target.closest(".literalblock");
if (!document.fullscreenElement) {
parent.requestFullscreen();
} else if (document.exitFullscreen) {
document.exitFullscreen();
}
});
var copyButton = document.createElement("button");
copyButton.classList.add("listingblock__copy-btn");
copyButton.ariaLabel = "{{ T "copyButtonAriaLabel" }}";
copyButton.title = "{{ T "copyButtonLabel" }}";
copyButton.ariaDescription = "{{ T "copyButtonDescription" }}";
copyButton.innerHTML = `{{- partial "components/heroicon.html" (dict "id" "clipboard") }}`;
copyButton.addEventListener("click", (event) => {
const { target } = event;
const parent = target.closest(".listingblock");
const codeListing = parent.querySelector(".content");
navigator.clipboard.writeText(codeListing.textContent.trim());
});
var buttonRow = document.createElement("div");
buttonRow.classList.add("listingblock__btn-row");
if (parent.classList.contains("listingblock")) {
buttonRow.appendChild(copyButton);
}
buttonRow.appendChild(fullscreenButton);
parent.appendChild(buttonRow);
}
})()

View File

@ -1,24 +0,0 @@
baseURL = 'https://foo-dogsquared.github.io/wrapper-manager-fds'
defaultContentLanguage = 'en'
title = "wrapper-manager-fds"
timeZone = "UTC"
[params]
toc = true
[security.exec]
allow = [
"^go$",
"^asciidoctor$",
]
osEnv = [
'^LAST_COMMIT_DATE$',
'^PATH$',
'^GOPATH$',
'^GOPROXY$',
'^HTTP_PROXY$',
'^HTTPS_PROXY$',
]
[security.funcs]
getenv = [ "^LAST_COMMIT_DATE$" ]

View File

@ -1,4 +0,0 @@
[en]
languageName = "English"
languageCode = "en"
contentDir = "content/en"

View File

@ -1,27 +0,0 @@
[asciidocExt]
extensions = [
"asciidoctor-diagram",
"asciidoctor-foodogsquared-extensions",
]
trace = true
workingFolderCurrent = true
[asciidocExt.attributes]
toc = true
sectanchors = true
"figure-caption!" = true
source-highlighter = "rouge"
allow-uri-read = true
experimental = true
linkcss = true
cache-uri = true
reproducible = true
stem = "latexmath"
env-hugo = true
avatarsdir = "/wrapper-manager-fds/icons/avatars"
avatarstype = "svg"
icons = "image"
iconsdir = "/wrapper-manager-fds/icons/asciidoctor"
icontype = "svg"

View File

@ -1,26 +0,0 @@
[[main]]
identifier = "user-guide"
name = "User guide"
url = "user-guide"
weight = 1
[[main]]
identifier = "nix-module-options"
name = "Module options"
url = "wrapper-manager-env-options/"
weight = 2
[[main]]
identifier = "source-code"
name = "Source code"
url = "https://github.com/foo-dogsquared/wrapper-manager-fds"
[[main]]
identifier = "wrapper-manager-nixos"
name = "NixOS module"
url = "wrapper-manager-nixos-module/"
[[main]]
identifier = "wrapper-manager-home-manager"
name = "home-manager module"
url = "wrapper-manager-home-manager-module/"

View File

@ -1,36 +0,0 @@
[[imports]]
path = "github.com/foo-dogsquared/website"
[[imports.mounts]]
source = "assets/scss/"
target = "assets/scss/"
[[imports.mounts]]
source = "assets/css/"
target = "assets/css/"
[[imports.mounts]]
source = "layouts/partials"
target = "layouts/partials"
excludeFiles = [ "footer.html" ]
[[imports.mounts]]
source = "layouts/_default"
target = "layouts/_default"
includeFiles = [ "baseof.html" ]
[[imports.mounts]]
source = "assets/svg/avatars/"
target = "static/icons/avatars/"
[[imports.mounts]]
source = "assets/svg/avatars/"
target = "assets/svg/avatars/"
[[imports.mounts]]
source = "i18n/"
target = "i18n/"
[[imports.mounts]]
source = "data/more-contentful/themes/"
target = "data/more-contentful/themes/"

View File

@ -1,585 +0,0 @@
---
title: Project overview
---
= nix-wrapper-manager-fds
:toc:
:current-version: 0.1.0
:github-repo: nix-module-wrapper-manager-fds
:github-full: foo-dogsquared/{github-repo}
:remote-git-repo: https://github.com/{github-full}
:docs-site: https://foo-dogsquared.github.io/{github-repo}
wrapper-manager-fds is foodogsquared's reimagining of https://github.com/viperML/wrapper-manager/[wrapper-manager].
[CAUTION]
====
wrapper-manager-fds is considered unstable and the author is still freely experimenting with various aspects of the project including the module options, library set API, and ease of use for third-partyuse.
Expect constant breakages here and put on a hard hat before exploring this part of the town.
====
As a recap, the aim of wrapper-manager is to pave a way of configuring Nix environments through wrappers.
There has been https://discourse.nixos.org/t/declarative-wrappers/1775[interest on] https://github.com/NixOS/rfcs/pull/75[this feature] footnote:[I mean, a part of the nixpkgs package set has dedicated wrappers for some packages such as GIMP, Inkscape, and Blender.] and I sometimes configure programs through wrappers instead of the typical module system.
It has its use cases such as quickly creating variants of the same program for specific reasons (for example, creating specialized versions of yt-dlp for downloading audio, video, and more).
But why not create something more than that?
And that's how wrapper-manager-fds came to be.
[#installation]
== Installation
[#installation-channels]
=== Channels
You can install wrapper-manager-fds with https://zero-to-nix.com/concepts/channels[Nix channels].
[source, shell, subs=attributes]
----
nix-channel --add {remote-git-repo}/archive/master.tar.gz wrapper-manager-fds
nix-channel --update
----
Then in your environment configuration, you'll have to import the user entrypoint.
For more details, see <<user-entrypoint>>.
[#installation-pinning-tool]
=== Pinning tool
A recommended (non-flakes) way to install Nix dependencies is to use a pinning tool.
There are a handful of pinning tool out there but in this case, we'll use https://github.com/andir/npins[npins] as our tool of choice.
Assuming you have already initialized npins, you can simply add wrapper-manager-fds to your Nix project with the following command.
[source, shell, subs="attributes+"]
----
npins add --name wrapper-manager github foo-dogsquared {github-repo} --at {current-version}
----
Similar to channels installation, you'll have to import the <<user-entrypoint>> object.
[#installation-manual-pinning]
=== Manual pinning
Though not recommended, you could manually pin the Nix library yourself and then import the <<user-entrypoint, user entrypoint>> like in the following code.
[source, nix, subs="attributes+"]
----
{ pkgs, ... }:
let
wrapper-manager-fds-src = builtins.fetchTarball "{remote-git-repo}/archive/{current-version}.tar.gz";
wrapper-manager = import wrapper-manager-fds-src { };
wrapperManagerLib = import wrapper-manager.wrapperManagerLib { inherit pkgs; }
in
wrapperManagerLib.env.build { }
----
[#installation-flakes]
=== Flakes
This project also has a https://zero-to-nix.com/concepts/flakes[flake object].
In your flake definition, just import it as one of the inputs.
Unlike the other methods, the flake output is the user entrypoint so no need to import it or anything.
[source, nix, subs="attributes+"]
----
{
inputs.wrapper-manager-fds.url = "github:{github-full}/{current-version}";
outputs = { nixpkgs, ... }@inputs: {
nixosConfigurations.desktop = nixpkgs.lib.nixosSystem {
modules = [
./hosts/desktop.nix
inputs.wrapper-manager-fds.nixosModules.default
];
};
};
}
----
[#user-entrypoint]
=== User entrypoint
Most of the things you need from the project are all retrieveable from the entrypoint of this project (`default.nix` in project root) which is an attribute set closely structured from a typical Nix flake that you see.
For example, if you want the NixOS module for wrapper-manager, you could refer to `nixosModules.default`.
Here's the breakdown of the attrset entries in the entrypoint.
* `lib` is an attribute set containing the main functions: `eval` and `build`.
(More details to use them are in <<as-a-library>>.)
* `nixosModules` contains a set of NixOS modules for wrapper-manager-fds integration.
You could get the main module with the `default` attribute.
* `homeModules` are for home-manager modules and similarly structured to `nixosModules` attribute.
* `wrapperManagerLib` contains a path intended to be imported within your Nix code.
It simply contains the library set that can be used outside of the wrapper-manager-fds module environment.
To use it, it only requires a nixpkgs instance like in the following code.
+
[source, nix, subs="attributes+"]
----
{ pkgs, ... }:
let
wrapper-manager-fds-src = builtins.fetchTarball "{remote-git-repo}/archive/master.tar.gz";
wrapper-manager = import wrapper-manager-fds-src { };
wrapperManagerLib = import wrapper-manager.wrapperManagerLib { inherit pkgs; }
in
wrapperManagerLib.env.build { }
----
* `overlays` is a set of nixpkgs overlays to be applied by the user.
So far, there's only one overlay called `default` containing the wrapper-manager library set.
[#getting-started]
== Getting started
Now that you have wrapper-manager-fds on the go, let's have a breakdown of what it is, exactly.
The project itself is made of different parts which you can use for different purposes.
[#the-module-environment]
=== The module environment
One part of the project is the module environment.
Just like https://github.com/nix-community/home-manager[home-manager] and https://github.com/nix-community/disko[disko] and https://github.com/viperML/wrapper-manager[the original source], wrapper-manager-fds comes with its own module environment.
Instead of a home environment from home-manager, an entire operating system from NixOS, or an installation script from disko, wrapper-manager-fds module environment evaluates to a package similar to how certain environments treats them (e.g., `environment.systemPackages` for NixOS, `home.packages` for home-manager).
Much of the module environment relies on `makeWrapper`.
In fact, this can be thought of as a declarative layer over `makeWrapper` with some other integrations.
If you want to view the module options, you can see it in
ifdef::env-hugo[link:./wrapper-manager-env-options/[wrapper-manager module options].]
ifndef::env-hugo[{docs-site}/wrapper-manager-env-options[wrapper-manager documentation site].]
Here's a very simple example of a wrapper for Neofetch.
[source, nix]
----
{ lib, pkgs, ... }:
{
wrappers.neofetch = {
arg0 = lib.getExe' pkgs.neofetch "neofetch";
appendArgs = [
"--ascii_distro" "guix"
"--title_fqdn" "off"
"--os_arch" "off"
];
};
}
----
Or if you want fastfetch...
[source, nix]
----
{ lib, pkgs, ... }:
{
wrappers.fastfetch = {
arg0 = lib.getExe' pkgs.fastfetch "fastfetch";
appendArgs = [ "--logo" "Guix" ];
env.NO_COLOR.value = "1";
};
}
----
Or even both in the same configuration (which you can do).
If evaluated, this should result in a single derivation that contains two executables in `$out/bin/{fastfetch, neofetch}`.
[source, nix]
----
{
imports = [
./fastfetch.nix
./neofetch.nix
];
}
----
You could even create https://specifications.freedesktop.org/desktop-entry-spec/latest/[XDG desktop entry] files useful for the application to be launched through an application launcher/menu.
For example, you could create an executable and a desktop entry to launch a custom Firefox profile in your home-manager configuration.
.Creating a custom Firefox desktop entry launching a custom profile
[source, nix]
----
{ config, lib, pkgs, ... }:
{
programs.firefox.profiles.custom-profile = {
# Put some profile-specific settings here.
};
wrapper-manager.packages.browsers = {
wrappers.firefox-custom-profile = {
arg0 = lib.getExe' config.programs.firefox.package "firefox";
prependArgs = [
"-P" "custom-profile"
];
xdg.desktopEntry = {
enable = true;
settings = {
desktopName = "Firefox (custom-profile)";
startupNotify = true;
startupWMClass = "firefox";
icon = "firefox";
mimeTypes = [
"text/html"
"application/xhtml+xml"
"application/vnd.mozilla.xul+xml"
"x-scheme-handler/http"
"x-scheme-handler/https"
];
};
};
};
};
}
----
[#as-a-library]
=== As a library
wrapper-manager also comes with a library set which you can use to evaluate and build wrapper-manager packages yourself.
This is found in the `wrapperManagerLib` attribute from the user entrypoint where it needs an attribute set containing a nixpkgs instance in `pkgs`.
[#src:example-lib-build]
.An example of importing wrapper-manager library
[source, nix]
----
{ pkgs }:
let
wrapper-manager = import (builtins.fetchgit { }) { };
wmLib = import wrapper-manager.wrapperManagerLib { inherit pkgs; };
in
wmLib.env.build {
inherit pkgs;
modules = [ ./fastfetch.nix ];
specialArgs.yourMomName = "Joe Mama";
}
----
Here's a quick rundown of what you can do with the library.
* Evaluate a wrapper-manager module with `env.eval` where it accepts an attrset similar to the <<src:example-lib-build, previous code listing>> containing a list of additional modules, the nixpkgs instance to be used, and `specialArgs` to be passed on to the `lib.evalModules` from nixpkgs.
* Build a wrapper through `env.build` returning a derivation of the wrapper.
It accepts the same arguments as `env.eval`.
There is also `lib` attribute if all you want to do is to build and/or evaluate a wrapper-manager configuration.
It only contains the function from `env` subset which contains `build` and `eval`.
[#as-a-composable-module]
=== As a composable module
The most user-friendly way of using wrapper-manager would be as a composable nixpkgs module of an existing environment.
wrapper-manager provides a Nix module specifically for NixOS and home-manager environment. footnote:[Any other environments are basically unsupported and if you like to use it outside of NixOS and home-manager, you're on your own.]
You can import them through the `{nixos,home}Modules.default` from the user entrypoint of the project.
You can view the module options for each environment.
* For NixOS, you can view it in
ifdef::env-hugo[link:./wrapper-manager-nixos-module/[NixOS module integration options].]
ifndef::env-hugo[{docs-site}/wrapper-manager-nixos-module/[documentation site].]
* For home-manager, you can view it in
ifdef::env-hugo[link:./wrapper-manager-home-manager-module/[home-manager module integration options].]
ifndef::env-hugo[{docs-site}/wrapper-manager-home-manager-module/[documentation site].]
Most of the things set up here are implemented to make declaring wrappers ergonomic with the environment.
For a start, wrapper-manager-fds sets up a module namespace in `wrapper-manager`.
Here's a quick breakdown of the features that the module has.
* Passes the wrapper-manager library through `wrapperManagerLib` module argument.
This is nice if you want to only use wrapper-manager to quickly create wrappers inside of the configuration without using the wrapper-manager NixOS/home-manager integration module.
* You could declare wrappers through `wrapper-manager.packages.<name>` where each of the attribute value is expected to be a wrapper-manager configuration to be added in its respective wider-scope environment.
* You could include other modules through `wrapper-manager.sharedModules`.
This is useful for extending wrapper-manager inside of the configuration environment.
Here's an example of adding wrappers through wrapper-manager inside of a home-manager configuration.
The following configuration will create a wrapped package for yt-dlp with an additional wrapper script named `yt-dlp-audio` and `yt-dlp-video`.
.Installing yt-dlp with custom variants of it inside of a home-manager configuration
[source, nix]
----
{ config, lib, pkgs, ... }:
{
home.packages = with pkgs; [
flowtime
blanket
];
wrapper-manager.packages = {
music-setup = {
basePackages = [ pkgs.yt-dlp ];
wrappers.yt-dlp-audio = {
arg0 = lib.getExe' pkgs.yt-dlp "yt-dlp";
prependArgs = [
"--config-location" ./config/yt-dlp/audio.conf
];
};
wrappers.yt-dlp-video = {
arg0 = lib.getExe' pkgs.yt-dlp "yt-dlp";
prependArgs = [
"--config-location" ./config/yt-dlp/video.conf
];
};
};
};
}
----
[#development]
== Development
If you want to hack this hack, you'll need either Nix with flakes enabled (`experimental-features = nix-command flakes` in `nix.conf`) or not.
Either way, this should be enough to cater to both flake- and non-flake users.
This project supports the current stable and unstable version of NixOS.
Specifically, we're looking out for the nixpkgs instance both of these versions has.
As an implementation detail, we pin these branches through https://github.com/andir/npins[npins] which both flakes- and non-flake-based setups uses.
Just be familiar with it and you'll be fine for the most part.
Most likely, you don't even need to interact with it since handling update cadence is handled automatically through the remote CI.
Setting up the development environment should be easy enough.
* For flake users, you can just reproduce the development environment with `nix develop`.
* For non-flake users, you can do the same with `nix-shell`.
As an additional note, it is recommended to use something like direnv with `use flake` or `use nix` depending on your personal preferences to use flake or not.
Take note there is a `Makefile` full of commands intended for easily interacting with the project but it is heavily assumed you're in the development environment of the project.
[#development-library-set-and-modules]
=== Library set and modules
This Nix project has a test infrastructure set up at
ifdef::env-hugo[github:{github-full}[test directory, rev=main, path=tests]]
ifndef::env-hugo[link:./tests[`./tests`]]
covering the library set and the wrapper-manager module environment.
For its library set, it makes use of the nixpkgs library and a JSON schema to validate if it passes the whole test suite.
To make use of it, just run the following commands.
* For flake users, you can run `nix flake check`.
* For non-flake users, you can do the same with `nix-build tests/ -A lib` or `nix build -f tests/ lib`.
There is also a test suite for different types of wrapper-manager configurations at
ifdef::env-hugo[github:{github-full}[test directory, rev=main, path=tests/configs]]
ifndef::env-hugo[link:./tests/configs[`./tests/configs`]]
from the source code.
You can check them the same way as before (e.g., it's the same for flake-using contributors, `nix-build tests/ -A configs` for non-flake-using contributors).
The derivation output should be successfully built if all of the tests in the suite passes.
Otherwise, it should fail and you'll have to see the build log containing all of the tests that failed.
On another note, there is a quicker way of checking the test suite with `nix eval -f tests lib` (or `nix-instantiate --eval --strict tests/ -A lib`) where it contains the raw test data which is useful if you don't want to essentially build a new derivation each time.
It is also quicker to eyeball results in this way especially if you're always working with the tests anyways.
[#development-website]
=== Website
This project also has a website set up with https://gohugo.io/[Hugo].
The files that you need to see are in
ifdef::env-hugo[github:{github-full}[`docs/website`, rev=main, path=docs/website]]
ifndef::env-hugo[link:./docs/website[`./docs/website`]]
directory.
* For flake users, you can build the website with `nix build .#devPackages.${SYSTEM}.website`.
* For non-flake users, you can do the same with `nix-build docs/ -A website`.
There is also a dedicated development environment placed in `docs/website/shell.nix` but this should be a part of the primary development environment already.
You can enter it with `nix develop .#devPackages.${SYSTEM}.website` or `nix-shell docs/website`.
Just take note that the website also requires the NixOS options which comes in a JSON file.
This should be already taken care of in the package definition of the website but otherwise it is something that you'll have to be aware of.
The more important task to developing this part of the project is continuously getting feedback from it.
You can do so simply with the following commands:
* For flake users, `nix develop --command hugo -s ./docs serve`.
* For non-flake users, `nix-shell docs --command hugo -s ./docs serve`.
* If you're using `Makefile` of this project, `make docs-serve`.
[#development-nix]
=== Nix environment
As for developing the environment with Nix itself, it is very much preferred to make wrapper-manager-fds work with non-flake setups.
This also includes the workflow of the development itself for the purpose of easier time bootstrapping wrapper-manager-fds.
Due to the unfortunate situation with flakes as an experimental feature, it is more like a second-class citizen in terms of support.
This is because it is pretty easy to make a flake with non-flake tools compared to vice versa. footnote:[flake-compat is great and all but it holds back wrapper-manager-fds in making it easy to bootstrap if we rely on it.]
Here's an exhaustive guidelines that you have to keep in mind when developing related files within the project:
* This project uses https://calver.org/[calendar versioning].
* Only the unstable branch of NixOS is currently supported.
Support for the stable versions are unfortunately secondary and more incidental (at least at the moment).
* There shouldn't be any user consumables that requires anything from the npins sources.
[#goals-and-non-goals]
== Goals and non-goals
As a Nix project, wrapper-manager-fds aims for the following goals.
* Create an ecosystem of creating them wrappers, mainly through its library set and the module environment.
* Make creating wrappers ergonomic for its users.
Not necessarily user-friendly but it should easy enough to get started while allowing some flexibility, yeah?
* Make a nice environment for creating custom wrappers which is already quite possible thanks to the heavy lifting of the nixpkgs module system.
For now, wrapper-manager-fds does not focus on the following ideas;
the main focus for now (as of 2024-07-31) is the core attributes needed to make wrapper-manager extensible for third-party module authors.
Take note, these are all ideas that are considered but may or may not be out of the blacklisted ideas at some point in the future for a variety of reasons.
Think of them as a list of possibilities for what may come within wrapper-manager-fds.
* Create an environment similar to NixOS and home-manager.
wrapper-manager-fds' endgoal is to create a derivation typically composed as part of an environment (e.g., `mkShell` for devshells, `environment.systemPackages` for NixOS, `home.packages` for home-manager).
Otherwise, we're creating a poor man's version of them and it'll quickly creep in scope.
* Support for multiple nixpkgs releases.
Up until I put some elbow grease for release engineering and to make testing between multiple branches easy, only the unstable branch of nixpkgs is officially supported for now.
* Integrating with sandboxing frameworks such as https://github.com/containers/bubblewrap[Bubblewrap] and https://github.com/queer/boxxy[Boxxy]. footnote:[That said, the author does have custom wrapper-manager modules that does exactly that so this being ruled out may be ruled out in the future ;p]
This is too big of a task so it isn't considered for now.
Plus, having this would now require creating additional support which the author does not have time for it.
* Create an ecosystem of modules that would allow to create quick configurations for different programs similarly found on other module environments such as in NixOS and home-manager.
Specifically, we're talking about modules in `programs` namespace (e.g., `programs.kitty`, `programs.alacritty`, `programs.nixvim`).
This would also require having a support cadence so not much is going to happen here.
Instead, I would encourage to have a separately-maintained project containing those for now.
* Focus on hardware-related configuration for the wrappers.
For now, it isn't possible within wrapper-manager (or Nix, really).
Some possible ideas include creating our own version of nixpkgs' `makeWrapper`, creating a specialized launcher for it, or something in the middle.
Would be a fun idea to make though. :)
[#faq]
== Frequently asked questions (FAQ)
[qanda]
Is this compatible with the original wrapper-manager?::
Nope.
It is a reimagining with a completely different way of using it so it won't be fully compatible with it from the start.
Why reimplement this anyways?::
For funsies and also because there are some things I find not so great with using the project.
https://github.com/viperML/wrapper-manager/tree/307eb5c38c8b5102c39617a59b63929efac7b1a7[As of this writing], using wrapper-manager to simply create wrappers anywhere is a pain.
+
--
To put it in more details, here are my complaints from using the original version:
* First and foremost, for whatever reason, the original version revolves around `wrapProgram` instead of the generalized `makeWrapper`.
This decision bled into the module environment with unnecessary options such as https://viperml.github.io/wrapper-manager/docs/module/#wrappersnamerenames[renaming binaries] from a https://viperml.github.io/wrapper-manager/docs/module/#wrappersnamebasepackage[given base package] which hurts the user experience of configuring these wrappers.
* There's no option to create other types of wrappers, only shell-based wrappers is supported.
* It is impossible to create a derivation consisting of only wrappers which is useful for installing wrappers in an environment alongside its original version.
An example would be installing yt-dlp alongside its variants that are configured through wrapper-manager.
In the original wrapper-manager, each of these wrapper would require a base package which will be included in the output.
* No integration with NixOS/home-manager.
--
Why not just incorporate the wanted changes into the original implementation?::
While it could be done, there will be some unwanted major changes into the project which would cause inconvenience to its users anyways so it isn't a good idea.
Plus it also justifies me implementing a bunch of features that would otherwise be deemed inconsistent with the project.
Can't you just create a wrapper with `pkgs.makeWrapper` and such from nixpkgs?::
Yeah, you can.
There's nobody stopping you from doing so and surely there's no hitman preparing to assissinate right behind you as you about to deny wrapper-manager-fds and smugly type `make` in `makeWrapper`.
In fact, wrapper-manager uses `makeWrapper` as the main ingredient.
Just think of wrapper-manager as a declarative version of that among the bajillion ways of making wrappers in the Nix ecosystem plus some other integrations (e.g., XDG).
+
As an additional point, there are still use cases for it even with a simple `pkgs.writeShellScriptBin`.
In fact, if you have a situation like say having to create a one-off wrapper script to be added in a NixOS system, you can simply do the following:
+
[source, nix]
----
let
ytdlpAudio = pkgs.writeScriptBin "yt-dlp-audio" ''
${pkgs.yt-dlp}/bin/yt-dlp --config-location "${../../config/yt-dlp/audio.conf}" $@
'';
in
{
environment.systemPackages = [ ytdlpAudio ];
}
----
+
BAM!
No need for wrapper-manager!
Why use the module system?::
Because screw you, that's why!!!
Am I stupid and lazy for basically using a battle-hardened configuration system library such as nixpkgs module system? footnote:[The answer is yes to both!]
+
Seriously though, the main reason is pretty simple: it is quite established and a battle-hardened part in the Nix ecosystem.
It has gone through the test of time and the numerous 339 users of the entire Nix ecosystem are quite adamant in the declarative aspect of the Nix thingy.
So... why not use it.
Any problems (and impending explosions) when using this project?::
As far as I can tell, not much (especially explosions) but there are a few caveats you need to know.
Just know this is something the author is trying to resolve.
+
--
* wrapper-manager-fds is not great at handling double wrappers.
It just naively wraps a package and goes on its merry way.
* wrapper-manager-fds is strongly biased towards Linux (and Unix-adjacent) ecosystem.
* wrapper-manager-fds doesn't handle any replacement for the related files very well.
This is especially noticeable in large desktop-adjacent packages such as Inkscape, Firefox, and Blender with a bunch of plugins and whatnot where they have their own wrappers.
This means you cannot set `programs.NAME.package` or something similar with it.
* The build step isn't enough to completely let the user replace the arguments found in `programs.<name>.package` (e.g., `programs.kitty.package = wrapperManagerLib.env.build { }`).
Right now, wrapper-manager-fds can rebuild the package if the `basePackage` module value is a bare package instead of the typical list of package but at the cost of an entire rebuild of that package.
Not a great experience to have especially if you're making a wrapper for larger applications.
There's no in-betweensies for this unfortunately (at least until I can think of a solution).
+
With all that said, the project exclusively (and currently) focuses on making a nice declarative environment allowing the user to create a wrapper meant to work without adding configuration files into arbitrary locations in the filesystem (e.g., `$XDG_CONFIG_HOME`).
--
[#acknowledgements]
== Acknowledgements
I found a bunch of things for inspiration (READ: to steal ideas from).
Here's a list of resources I've found.
* The original source of the reimagining, of course: https://github.com/viperML/wrapper-manager[wrapper-manager].
* https://github.com/NixOS/rfcs/pull/75[Nix RFC 75] which also comes https://github.com/NixOS/nixpkgs/pull/85103[with its implementation and discussion around what works and whatnot].
* https://discourse.nixos.org/t/pre-rfc-module-system-for-wrappers-in-nixpkgs/42281[This NixOS Discourse post loudly thinking about the same idea.]
Aside from the listed resources, here's more unrelated resources I've found that can/would've/doesn't/you-get-what-I-mean-right influence the project.
* https://git.auxolotl.org/auxolotl/labs/src/commit/cadfaabc853d20f2bc20bad794fcbe520ea48f13/tidepool/README.md[Aux Tidepool] seems to be interesting by applying the module system in package definitions.
[#copyright]
== Copyright
This project is licensed under MIT License (SPDX identifier: https://spdx.org/licenses/MIT.html[`MIT`]).
Just see
ifdef::env-hugo[github:{github-full}[license file, rev=main, path=LICENSE]]
ifndef::env-hugo[link:./LICENSE[`./LICENSE`]]
for full text and details and whatnot.
The documentation (except for the code examples), on the other hand, is licensed under https://www.gnu.org/licenses/fdl-1.3.txt[GNU Free Documentation License] v1.3 only with no "Invariants" section (SPDX identifier: https://spdx.org/licenses/GFDL-1.3-no-invariants-only[`GFDL-1.3-no-invariants-only`])
You can see either the link or
ifdef::env-hugo[github:{github-full}[license file, rev=main, path=docs/LICENSE]]
ifndef::env-hugo[link:./docs/LICENSE[`./docs/LICENSE`]]
for more info.
The code examples, similar to the project codebase, are licensed under MIT with the same conditions apply and all that jazz.

View File

@ -1,565 +0,0 @@
---
title: User guide
---
= User guide
:module_options_link: ../wrapper-manager-env-options#_
While the link:./project-overview.adoc[project overview] should be enough to get you started, this document contain all of the information you may need to make full use of wrapper-manager.
[#what-is-wrapper-manager]
== What is wrapper-manager?
Simply put, this is a declarative interface built on top of https://nixos.org/manual/nixpkgs/stable/#fun-makeWrapper[`makeWrapper` and company] plus some other integrations as we'll explore in this document.
It is comparable to NixOS and home-manager in a way that it compiles into an operating system and a home environment respectively, wrapper-manager compiles the module environment into a package.
Speaking of which, wrapper-manager is meant to be composed in larger-scoped environments such as NixOS and home-manager, mainly by including wrapper-manager packages in `environment.systemPackages` and `home.packages` but you could also make them as a standalone package.
[#getting-started]
== Getting started
But first, we'll have to have wrapper-manager in our configuration.
There are multiple ways to do so as already shown from the link:../project-overview#installation[Project overview] so we'll go ahead with what should you do after it.
There are multiple ways to build a wrapper-manager package:
* You can manually build one with `wrapperManagerLib.env.build`.
It needs a nixpkgs instance (`pkgs`) and a list of additional modules (`modules`) with an optional attrset of static of module arguments (`specialArgs`).
+
--
Here's an example of using the function.
[source, nix]
----
{ pkgs ? import <nixpkgs> { } }:
let
wrapper-manager = import <wrapper-manager-fds> { };
wrapperManagerLib = import wrapper-manager.wrapperManagerLib { inherit pkgs; };
in
wrapperManagerLib.env.build {
inherit pkgs;
modules = [ ./config/wrapper.nix ];
specialArgs = { hello = "WORLD"; };
}
----
--
[#using-wrapper-manager]
== Using wrapper-manager
The module environment of wrapper-manager is the main interface of the project.
In the following code, we'll define two wrappers around github:yt-dlp/yt-dlp[opts=repo].
.A package containing two wrapper scripts for yt-dlp
[source, nix]
----
{ lib, pkgs, ... }:
{
wrappers.yt-dlp-audio = {
arg0 = lib.getExe' pkgs.yt-dlp "yt-dlp";
prependArgs = [
"--no-overwrite"
"--extract-audio"
"--format" "bestaudio"
"--audio-format" "opus"
"--output" "'%(album_artists.0,artists.0)s/%(album,playlist)s/%(track_number,playlist_index)d-%(track,title)s.%(ext)s'"
"--download-archive" "archive"
"--embed-thumbnail"
"--add-metadata"
];
};
# You could also lessen the code above by passing `--config-location` to
# yt-dlp and move them into a separate file. This is what wrapper-manager is
# made for, after all.
wrappers.yt-dlp-video = {
arg0 = lib.getExe' pkgs.yt-dlp "yt-dlp";
prependArgs = [
"--config-location" ../../config/yt-dlp/video.conf
];
};
}
----
If we build the configuration, it should result in a derivation containing two executables.
[source, shell]
----
$ ls ./result/bin
yt-dlp-audio yt-dlp-video
----
By default, these wrappers are compiled with `makeBinaryWrapper`.
You could make into a shell-based wrapper by changing `build.variant` value into `shell`.
If you want to include the original yt-dlp package as part of the standalone package, just pass the package as part of `basePackages`.
[CAUTION]
====
By evaluating the following code, you'll be losing metadata for the `yt-dlp` package (e.g., `version`, `meta`, `src`) since it is linked together through `symlinkJoin`.
wrapper-manager also has a way to make overridden packages by passing `basePackages` with a bare package instead of a list of packages (e.g., `basePackages = pkgs.yt-dlp;` instead of `basePackages = [ pkgs.yt-dlp ];`).
This method makes it suitable to pass `programs.<name>.package` module options typically found from NixOS and home-manager but at the cost of a rebuild and may interfere with the build steps already defined from its package authors.
====
[source, nix]
----
{ lib, pkgs, ... }:
{
# ...
basePackages = [ pkgs.yt-dlp ];
}
----
Another thing to keep in mind is wrapper-manager packages have the library set available as `wrapperManagerLib` module argument.
This is mainly useful for setting values within the configuration.
.Some uses of the wrapper-manager library set
[source, nix]
----
{ config, lib, pkgs, wrapperManagerLib, ... }:
{
# It is used for setting values in certain modules options.
wrappers.yt-dlp-video = {
xdg.dataDirs = wrapperManagerLib.getXdgDataDirs [
pkgs.emacs
pkgs.neovim
];
pathAdd = wrapperManagerLib.getBin (with pkgs; [
yt-dlp
gallery-dl
]);
};
# Another nicety is to create a wraparound wrapper like in the following code
# where we wrap tmux to be used with boxxy.
wrappers.tmux = wrapperManagerLib.makeWraparound {
arg0 = lib.getExe' pkgs.tmux "tmux";
under = lib.getExe' pkgs.boxxy "boxxy";
underFlags = [ "--rule" "~/.tmux.conf:~/.config/tmux/tmux.conf" ];
underSeparator = "--";
};
}
----
One of the typical thing to set in a wrapper script is the environment variables.
You could set them from link:{module_options_link}environment_variables[`environment.variables`] to set it for all of the wrappers.
For wrapper-specific values, just go for link:{module_options_link}wrappers_name_env[`wrappers.<name>.env`].
[source, nix]
----
{ config, lib, pkgs, wrapperManagerLib, ... }: {
# Set a envvar and its value.
environment.variables.LOG_STYLE.value = "systemd";
# By default, the values are forcibly set. You could set as the default value
# if unset by setting the action to `set-default`.
environment.variables.LOG_STYLE.action = "set-default";
# Unset an environment variable. Its value will be ignored.
environment.variables.MODS_DIR.action = "unset";
# Set a list of separator-delimited values, typically for PATH,
# XDG_CONFIG_DIRS, XDG_DATA_DIRS, and the like.
environment.variables.PATH = {
action = "prefix";
separator = ":";
value = wrapperManagerLib.getBin (with pkgs; [
yt-dlp
neofetch
]);
};
# For wrapper-specific values, it has the same interface, just different attribute.
wrappers.name.env.LOG_STYLE.value = "systemd";
}
----
[#xdg-integration]
=== XDG integration
This environment comes with various features for XDG desktop integrations.
These does not necessarily implements the feature itself but rather creates the files typically recognized with the wider-scoped list of packages (e.g., `home.packages` for home-manager, `environment.systemPackages` for NixOS).
As one of those features, you can create https://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/[XDG desktop entries] to be exported to `$out/share/applications/$NAME.desktop` in the output path.
This uses the `makeDesktopItem` builder from nixpkgs so the settings should be the same with those.
Here's an example of creating a wrapper-manager package with a sole desktop entry for Firefox with the additional configuration to be opened within GNOME Shell.
[source, nix]
----
{ config, lib, pkgs, ... }: {
xdg.desktopEntries.firefox = {
name = "Firefox";
genericName = "Web browser";
exec = "firefox %u";
terminal = false;
categories = [ "Application" "Network" "WebBrowser" ];
mimeTypes = [ "text/html" "text/xml" ];
extraConfig."X-GNOME-Autostart-Phase" = "WindowManager";
keywords = [ "Web" "Browser" ];
startupNotify = false;
startupWMClass = "MyOwnClass";
};
}
----
You could also automatically create a desktop entry for one of your wrappers by setting link:{module_options_link}wrappers_name_xdg_desktopentry_enable[`wrappers.<name>.xdg.desktopEntry.enable`] to `true` and configuring the entry with link:{module_options_link}wrappers_name_xdg_desktopentry_settings[`wrappers.<name>.xdg.desktopEntry.settings`].
It simply sets some of those settings automatically for you such as the `Name=`, `DesktopName=`, and `Exec=` but you'll have to set the rest of it yourself for full control what's in there.
[source, nix]
----
{ lib, pkgs, ... }: {
wrappers.nvim = {
arg0 = lib.getExe' pkgs.neovim "nvim";
xdg.desktopEntry = {
enable = true;
settings = {
terminal = true;
extraConfig."X-GNOME-Autostart-Phase" = "WindowManager";
keywords = [ "Text editor" ];
startupNotify = false;
startupWMClass = "MyOwnClass";
};
};
};
}
----
Another XDG-related feature for wrapper-manager is adding paths to a couple of https://specifications.freedesktop.org/basedir-spec/latest/[XDG search paths] including for `XDG_CONFIG_DIRS` and `XDG_DATA_DIRS`.
You can either add them for all wrappers or set them per-wrapper.
[source, nix]
----
{ config, lib, pkgs, wrapperManagerLib, ... }: let
inherit (wrapperManagerLib) getXdgDataDirs getXdgConfigDirs;
searchPaths = with pkgs; [ yt-dlp neofetch ];
in {
xdg.configDirs = getXdgConfigDirs searchPaths;
xdg.dataDirs = getXdgDataDirs searchPaths;
wrappers.nvim.xdg.configDirs = getXdgConfigDirs searchPaths;
wrappers.emacs.xdg.dataDirs = getXdgDataDirs searchPaths;
}
----
[#some-more-other-integrations]
=== Some more other integrations
Being a module environment specializing on creating wrappers, there are some other integrations that you could use.
One of them is setting arbitrary files within the output path of the derivation with link:{module_options_link}files[`files`].
The interface should be similar to NixOS' `environment.etc` or home-manager's `home.file` module option.
[source, nix]
----
{ config, lib, ... }: {
files."etc/xdg/custom-application".text = ''
HELLO=WORLD
LOCATION=Inside of your house
'';
# Just take note any files in `$out/bin` will be overridden by the wrappers
# if they have the same name.
files."bin/what" = {
text = "echo WHAT $@";
mode = "0755";
};
files."share/example".source = ./docs/example;
}
----
One of them is the setting the locale archive which is practically required for every Nix-built applications.
To enable them, you'll have to set link:{module_options_link}locale_enable[`locale.enable`] to `true` to set it for all wrappers but you can specifically set them with link:{module_options_link}wrappers_name_locale_enable[`wrappers.<name>.locale.enable`].
You could also change the locale archive package with link:{module_options_link}locale_package[`locale.package`].
[#as-a-standalone-package]
=== As a standalone package
wrapper-manager packages can be compiled as a standalone package to be included as part of the typical Nix operations (e.g., `makeShell`, as part of `packages` flake output, as part of `environment.systemPackages` in NixOS).
That part is easy, just build it with wrapper-manager `build` function located at its library set.
The following code listing shows an example of it including a wrapper-manager config as part of the devshell.
Just remember that wrapper-manager configurations primarily ends as a package.
[source, nix]
----
{ pkgs ? import <nixpkgs> { }, wrapperManager ? import <wrapper-manager-fds> { } }:
let
inherit (pkgs) lib;
gems = pkgs.bundlerEnv {
name = "wrapper-manager-fds-gem-env";
ruby = pkgs.ruby_3_1;
gemdir = ./.;
};
asciidoctorWrapped = wrapperManager.lib.build {
inherit pkgs;
modules = lib.singleton {
wrappers.asciidoctor = {
arg0 = lib.getExe' gems "asciidoctor";
prependArgs = [ "-r" "asciidoctor-diagram" "-T" ./templates ];
};
};
};
in
pkgs.mkShell {
packages = with pkgs; [
asciidoctorWrapped
treefmt
gems
gems.wrappedRuby
];
}
----
[#with-nixos-and-home-manager]
=== With NixOS and home-manager
wrapper-manager also comes with integrations for NixOS and home-manager.
You'll have to import the respective environment modules for them somewhere in your configuration.
Here's an example of importing it into a NixOS and home-manager config with flakes.
.Importing wrapper-manager integration modules
[source, nix]
----
{
# ...
inputs.wrapper-manager.url = "github:foo-dogsquared/nix-wrapper-manager";
outputs = inputs:
let
inherit (inputs.nixpkgs) lib;
inherit (lib) nixosSystem;
inherit (inputs.home-manager.lib) homeManagerConfiguration;
in
{
nixosConfigurations.desktop = nixosSystem {
modules = [
inputs.wrapper-manager.nixosModules.wrapper-manager
];
};
homeConfigurations.user = homeManagerConfiguration {
modules = [
inputs.wrapper-manager.homeModules.wrapper-manager
];
};
};
}
----
For the most part, the integration modules are mostly the same.
As an example, you can create wrappers through `wrapper-manager.packages` where it is expected to be an attribute set of wrapper-manager configurations.
[NOTE]
====
Any wrapper-manager packages declared through it are automatically added as part of their respective list of packages (e.g., `home.packages` for home-manager, `environment.systemPackages` for NixOS).
====
[source, nix]
----
{ lib, config, ... }:
{
wrapper-manager.packages.writing.imports = [
../configs/wrapper-manager/writing
];
wrapper-manager.packages.music-setup = {
wrappers.beets = {
arg0 = lib.getExe' pkgs.beets "beet";
prependArgs = [ "--config" ./config/beets/config.yml ];
};
};
wrapper-manager.packages.archive-setup = { lib, pkgs, ... }: {
wrappers.gallery-dl = {
arg0 = lib.getExe' pkgs.gallery-dl "gallery-dl";
prependArgs = [ ];
};
wrappers.yt-dlp-audio = {
arg0 = lib.getExe' pkgs.yt-dlp "yt-dlp";
prependArgs = [
"--config-location" ./configs/yt-dlp/audio.conf
];
};
};
}
----
Aside from an easy way to create wrappers instead of manually invoking the building function from wrapper-manager, there's also another nicety with the integration module.
The wrapper-manager configuration will have an additional module argument depending on the environment: `nixosConfig` for NixOS and `hmConfig` for home-manager.
This is useful for dynamic and conditional configurations with the wider-scoped environment.
Additionally, with documentation packages alongside the environment similar to NixOS and home-manager.
* There is a manpage which you can install by setting `wrapper-manager.documentation.manpage.enable` to `true`.
It is available to be viewed as `wrapper-manager.nix(5)` (i.e., `man 5 wrapper-manager.nix`).
* An HTML manual can be brought over by setting `wrapper-manager.documentation.html.enable` to `true`.
The HTML manual package has a desktop entry file titled `wrapper-manager manual` in the common application launchers (e.g., rofi, GNOME Shell app launcher).
You can also set additional modules to be included with `wrapper-manager.documentation.extraModules` in case you have custom wrapper-manager modules that you want to be nicely integrated.
[#differences-from-original-wrapper-manager]
== Differences from original wrapper-manager
Being a reimagining of wrapper-manager, there are some major differences between them.
[NOTE]
====
The recorded differences are noted as of github:viperML/wrapper-manager[this commit, rev=c936f9203217e654a6074d206505c16432edbc70, opts=repo].
It may be revised that renders part of the following list to be outdated.
Feel free to correct them in the source code repo.
====
The main difference is the way how the final output is built.
In the original version, each of the specified wrappers under `wrappers` are individually built.
In the reimagined version, these are consolidated into one build step since `makeWrapper` allows us to do so.
As a side effect, there's no options that could require to be built individually such as `wrappers.<name>.basePackage`, `wrappers.<name>.renames`, `wrappers.<name>.overrideAttrs`, and `wrappers.<name>.extraPackages`.
Another difference is the original version also handles some cases of fixing XDG desktop entries in the final output.
In wrapper-manager-fds, this case is absent since its maintainer at the time (foo-dogsquared) deemed it "a pain in the ass" to handle especially that...
* There are more use cases to handle such as multiple desktop entries for multiple reasons.
* Most desktop metadata is pretty much usable even with the custom wrapper without cleaning them.
* This need is less emphasized since wrapper-manager-fds also allows you to make XDG desktop entries in the config itself anyways.
[NOTE]
====
A possible consideration is to make a build option toggle to handle this but it would involve "cleaning" the `Exec=` desktop entry directive to use the executable name instead of the full path.
====
If you're interested in migrating to this version, here's a quicktable of individual differences that might interest you.
[discrete]
=== How `arg0` is set per-wrapper
.In the original version...
[source, nix]
----
{ lib, pkgs, ... }:
{
wrappers.hello.basePackage = pkgs.hello;
}
----
.And in wrapper-manager-fds.
[source, nix]
----
{ lib, pkgs, ... }:
{
wrappers.hello.arg0 = lib.getExe' pkgs.hello "hello";
}
----
[discrete]
=== Renaming executables per-wrapper
.In the original version...
[source, nix]
----
{ lib, pkgs, ... }:
{
wrappers.hello.renames.hello = "hello-customized";
}
----
In wrapper-manager-fds, there's no renaming step as we already let the user name the executable.
.And in wrapper-manager-fds.
[source, nix]
----
{ lib, pkgs, ... }:
{
wrappers.hello.executableName = "hello-customized";
# You could also change the attrname.
wrappers.hello-customized.arg0 = "${pkgs.hello}/bin/hello";
}
----
[discrete]
=== Setting (and unsetting) environment variables per-wrapper
.In the original version...
[source, nix]
----
{ lib, pkgs, ... }:
{
# The default action is to set the value if not yet set.
wrappers.hello.env.CUSTOM_ENV_VAR.value = "HELLO";
# You can force it with the following.
wrappers.hello.env.CUSTOM_ENV_VAR.force = true;
# You can also unset it by setting the value to null.
wrappers.hello.env.CUSTOM_ENV_VAR.value = lib.mkForce null;
}
----
.And for wrapper-manager-fds.
[source, nix]
----
{ lib, pkgs, ... }:
{
# On the other hand, wrapper-manager-fds forces it by default.
wrappers.hello.env.CUSTOM_ENV_VAR.value = "HELLO";
# But you can conditionally set it with...
wrappers.hello.env.CUSTOM_ENV_VAR.action = "set-default";
# If you want to unset it, set the following code.
wrappers.hello.env.CUSTOM_ENV_VAR.action = lib.mkForce "unset";
}
----
[discrete]
=== Adding PATH env values
.In the original version...
[source, nix]
----
{ config, lib, pkgs, ... }:
{
wrappers.hello.pathAdd = with pkgs; [
yt-dlp
gallery-dl
];
}
----
.And for wrapper-manager-fds.
[source, nix]
----
{ config, lib, pkgs, wrapperManagerLib, ... }:
{
wrappers.hello.pathAdd = wrapperManagerLib.getBin (with pkgs; [
yt-dlp
gallery-dl
]);
}
----

View File

@ -1,8 +0,0 @@
module github.com/foo-dogsquared/wrapper-manager-fds
go 1.22.3
require (
github.com/foo-dogsquared/hugo-theme-more-contentful v0.7.1-0.20240518105144-dd35649b15e2 // indirect
github.com/foo-dogsquared/website v0.0.0-20240714011201-799cfa313e36 // indirect
)

View File

@ -1,16 +0,0 @@
github.com/foo-dogsquared/hugo-mod-simple-icons v0.0.0-20230426231746-ef27600d22f3/go.mod h1:11iN6ArO6sro187xxOeDYAFMENfUNd+Vopn+qqVkCbw=
github.com/foo-dogsquared/hugo-mod-simple-icons v0.0.0-20231025231637-36998f86bbf2/go.mod h1:8HnVc0SlzI7LCEU4sITYS5MQTq0Bct/nFr/7LdsHYVQ=
github.com/foo-dogsquared/hugo-mod-web-feeds v0.0.3-0.20220613123653-e0bc8e58159d/go.mod h1:V7UXom6wuFrWj1lBUCXQA3HguwfDhQA+tQNxyRxdClk=
github.com/foo-dogsquared/hugo-theme-contentful v1.2.1-0.20220513103455-d83c3f8c6954/go.mod h1:BL7L5CENEhUx+miRRaOZ9SVC92j9MAMztirBWtTpiPc=
github.com/foo-dogsquared/hugo-theme-more-contentful v0.7.0 h1:N+U5CshaEko6batgTHa6GBfl2bg/1RbG1dAX6EkndVM=
github.com/foo-dogsquared/hugo-theme-more-contentful v0.7.0/go.mod h1:BpUC3zBnnsil2SkU6bULvcDvAEs6FdDDEM8uB0oCpho=
github.com/foo-dogsquared/hugo-theme-more-contentful v0.7.1-0.20231028090155-ee19cd7714b4 h1:wpeb4k29ZbQirMIWtCkitTrLERHvztJUSLsTYi3gOmM=
github.com/foo-dogsquared/hugo-theme-more-contentful v0.7.1-0.20231028090155-ee19cd7714b4/go.mod h1:RgD3YpinFJyZhtn0iVLNs8eRa0nSs2VA+o1jBpe4zBs=
github.com/foo-dogsquared/hugo-theme-more-contentful v0.7.1-0.20240518105144-dd35649b15e2 h1:BvkVSiI6jXUhUyuRnBY6gSnmb2Th/7FaEwBStbw36Qk=
github.com/foo-dogsquared/hugo-theme-more-contentful v0.7.1-0.20240518105144-dd35649b15e2/go.mod h1:RgD3YpinFJyZhtn0iVLNs8eRa0nSs2VA+o1jBpe4zBs=
github.com/foo-dogsquared/website v0.0.0-20240714011201-799cfa313e36 h1:/NBeAydxYqmnPpyDP4kEzdPSHOZVMEK2W1vFcjZ8uPU=
github.com/foo-dogsquared/website v0.0.0-20240714011201-799cfa313e36/go.mod h1:zJw9MC6Ajnx5Bom/52LR9Xib40toK9d2tG9FeVqJN3U=
github.com/refactoringui/heroicons v2.0.17+incompatible/go.mod h1:82HsLWQga7MkEl5aK8TctxPPIBlXrsyWcVTB57uipuk=
github.com/refactoringui/heroicons v2.0.18+incompatible/go.mod h1:82HsLWQga7MkEl5aK8TctxPPIBlXrsyWcVTB57uipuk=
github.com/simple-icons/simple-icons v0.0.0-20230423030844-cd4f7d2bf53c/go.mod h1:oOgUUt8yVYOso/wEBi2ojfZP2MU/xxiNccIpaE+jCvE=
github.com/simple-icons/simple-icons v0.0.0-20231022005333-fdbaaa2d5f99/go.mod h1:oOgUUt8yVYOso/wEBi2ojfZP2MU/xxiNccIpaE+jCvE=

View File

@ -1 +0,0 @@
{{ with .GetPage "/project-overview" }}{{ .Render "single" }}{{ end }}

View File

@ -1,24 +0,0 @@
let
sources = import ../../npins;
in
{
pkgs ? import sources.nixos-unstable { },
}:
let
docs = import ../. { inherit pkgs; };
in
pkgs.mkShell {
inputsFrom = [ docs.website ];
packages = with pkgs; [
nodePackages.prettier
vscode-langservers-extracted
];
shellHook = ''
install -Dm0644 ${docs.wmOptionsDoc.optionsAsciiDoc} ./content/en/wrapper-manager-env-options.adoc
install -Dm0644 ${docs.wmNixosDoc.optionsAsciiDoc} ./content/en/wrapper-manager-nixos-module.adoc
install -Dm0644 ${docs.wmHmDoc.optionsAsciiDoc} ./content/en/wrapper-manager-home-manager-module.adoc
'';
}

View File

@ -1,69 +0,0 @@
# As a design restriction, this flake shouldn't have any inputs whatsoever.
# We're already using the Nix projects through pinning with npins.
{
description = "wrapper-manager-fds flake";
outputs =
{ ... }:
let
sources = import ./npins;
systems = [
"x86_64-linux"
"aarch64-linux"
];
eachSystem =
systems: f:
let
# Merge together the outputs for all systems.
op =
attrs: system:
let
ret = f system;
op =
attrs: key:
attrs
// {
${key} = (attrs.${key} or { }) // {
${system} = ret.${key};
};
};
in
builtins.foldl' op attrs (builtins.attrNames ret);
in
builtins.foldl' op { } (
systems
# add the current system if --impure is used
++ (
if builtins ? currentSystem then
if builtins.elem builtins.currentSystem systems then [ ] else [ builtins.currentSystem ]
else
[ ]
)
);
in
import ./. { }
// (eachSystem systems (
system:
let
pkgs = import sources.nixos-unstable { inherit system; };
inherit (pkgs) lib;
tests = import ./tests { inherit pkgs; };
docs = import ./docs { inherit pkgs; };
in
{
devShells = {
default = import ./shell.nix { inherit pkgs; };
website = import ./docs/website/shell.nix { inherit pkgs; };
};
devPackages = {
manpage-reference = docs.outputs.manpage;
html-reference = docs.outputs.html;
website = docs.website;
};
checks =
{ inherit (tests) lib; }
// lib.mapAttrs' (n: v: lib.nameValuePair "config-test-${n}" v) tests.configs;
}
));
}

View File

@ -1,31 +0,0 @@
# The wrapper-manager library set. It should only require a nixpkgs instance to
# make initializing this set easier. This what makes it possible to be used as
# part of the module environments and as a standalone library.
#
# Since this library set is typically modularly set in nixpkgs module
# environments, we'll have to make sure it doesn't contain any functions that
# should return a nixpkgs module or anything of the sort. Basically, this
# should remain as a utility function that is usable outside of the nixpkgs
# module.
{ pkgs }:
pkgs.lib.makeExtensible (
self:
let
callLibs =
file:
import file {
inherit (pkgs) lib;
inherit pkgs self;
};
in
{
env = import ./env.nix;
utils = callLibs ./utils.nix;
modules = callLibs ./modules.nix;
inherit (self.env) build eval;
inherit (self.utils) getBin getLibexec getXdgDataDirs getXdgConfigDirs;
inherit (self.modules) makeWraparound;
}
)

View File

@ -1,34 +0,0 @@
rec {
/*
Given the attrset for evaluating a wrapper-manager module, return a
derivation containing the wrapper.
*/
build = args: (eval args).config.build.toplevel;
# Evaluate a wrapper-manager configuration.
eval =
{
pkgs,
lib ? pkgs.lib,
modules ? [ ],
specialArgs ? { },
}:
lib.evalModules {
specialArgs = specialArgs // {
modulesPath = builtins.toString ../modules/wrapper-manager;
};
modules = [
../modules/wrapper-manager
# Setting pkgs modularly. This would make setting up wrapper-manager
# with different nixpkgs instances possible but it isn't something that
# is explicitly supported.
(
{ lib, ... }:
{
config._module.args.pkgs = lib.mkDefault pkgs;
}
)
] ++ modules;
};
}

View File

@ -1,52 +0,0 @@
# These are functions that are only meant to be invoked inside of a
# wrapper-manager environment.
#
# On a note for wrapper-manager developer(s), due to how tedious it can be to
# test library functions like that, we're putting them inside of the test
# configs instead of the typical library test suite.
{
pkgs,
lib,
self,
}:
rec {
/*
Make a wrapper-manager wrapper config containing a sub-wrapper that wraps
another program. Several examples of this includes sudo, Bubblewrap, and
Gamescope.
*/
makeWraparound = {
arg0,
under,
underFlags ? [ ],
underSeparator ? "",
...
}@module:
let
# These are the attrnames that would be overtaken with the function and
# will be merged anyways so...
functionArgs = builtins.functionArgs makeWraparound;
module' = lib.removeAttrs module (lib.attrNames functionArgs);
in
lib.mkMerge [
{
arg0 = under;
# This should be the very first things to be in the arguments so
# we're just making sure that it is the case. The priority is chosen
# arbitrarily just in case the user already has `prependArgs` values
# with `lib.mkBefore` for the original arg0.
prependArgs = lib.mkOrder 250 (
underFlags
++ lib.optionals (underSeparator != "") [ underSeparator ]
++ [ arg0 ]
);
}
# It's constructed like this to make it ergonomic to use. The user can
# simply delete the makeWraparound exclusive arguments and still work
# normally.
module'
];
}

View File

@ -1,31 +0,0 @@
{
pkgs,
lib,
self,
}:
rec {
/*
Given a list of derivations, return a list of the store path with the `bin`
output (or at least with "/bin" in each of the paths).
*/
getBin = drvs: builtins.map (v: lib.getBin v) drvs;
/*
Given a list of derivations, return a list of the store paths with the
`libexec` appended.
*/
getLibexec = drvs: builtins.map (v: "${v}/libexec") drvs;
/*
Given a list of derivations, return a list of the store paths appended with
`/etc/xdg` suitable as part of the XDG_CONFIG_DIRS environment variable.
*/
getXdgConfigDirs = drvs: builtins.map (v: "${v}/etc/xdg") drvs;
/*
Given a list of derivations, return a list of store paths appended with
`/share` suitable as part of the XDG_DATA_DIRS environment variable.
*/
getXdgDataDirs = drvs: builtins.map (v: "${v}/share") drvs;
}

View File

@ -1,154 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.wrapper-manager;
wrapperManagerModule = lib.types.submoduleWith {
description = "wrapper-manager module";
class = "wrapperManager";
specialArgs = cfg.extraSpecialArgs;
modules = [
../wrapper-manager
(
{ lib, ... }:
{
config._module.args.pkgs = lib.mkDefault pkgs;
}
)
] ++ cfg.sharedModules;
};
in
{
imports = [
# Bringing all of the arguments from the wrapper-manager environment for
# convenience. It would also allow its users for full control without using
# the integration module itself.
../wrapper-manager/extra-args.nix
];
options.wrapper-manager = {
sharedModules = lib.mkOption {
type = with lib.types; listOf deferredModule;
default = [ ];
example = lib.literalExpression ''
[
{
config.build = {
variant = "shell";
};
}
]
'';
description = ''
Extra modules to be added to all of the wrapper-manager configurations.
'';
};
packages = lib.mkOption {
type = lib.types.attrsOf wrapperManagerModule;
description = ''
A set of wrappers to be added into the environment configuration.
'';
default = { };
visible = "shallow";
example = lib.literalExpression ''
{
custom-ricing = { lib, pkgs, ... }: {
wrappers.neofetch = {
arg0 = lib.getExe' pkgs.neofetch "neofetch";
appendArgs = [
"--ascii-distro" "guix"
"--config" ./config/neofetch/config
];
};
wrappers.fastfetch = {
arg0 = lib.getExe' pkgs.fastfetch "fastfetch";
appendArgs = [
"--config" ./config/fastfetch/config
"--logo" "Guix"
];
env.NO_COLOR = 1;
};
};
music-setup = { lib, pkgs, ... }: {
wrappers.yt-dlp-audio = {
arg0 = lib.getExe' pkgs.yt-dlp "yt-dlp";
prependArgs = [
"--config-location" ./config/yt-dlp/audio.conf
];
};
wrappers.yt-dlp-video = {
arg0 = lib.getExe' pkgs.yt-dlp "yt-dlp";
prependArgs = [
"--config-location" ./config/yt-dlp/video.conf
];
};
wrappers.beets-fds = {
arg0 = lib.getExe' pkgs.beet "beet";
prependArgs = [
"--config" ./config/beets/config
];
};
};
writing = { lib, pkgs, ... }: {
wrappers.asciidoctor-fds = {
arg = lib.getExe' pkgs.asciidoctor-with-extensions "asciidoctor";
executableName = "asciidoctor";
prependArgs =
builtins.map (v: "-r ''${v}") [
"asciidoctor-diagram"
"asciidoctor-bibtex"
];
};
};
}
'';
};
extraSpecialArgs = lib.mkOption {
type = with lib.types; attrsOf anything;
default = { };
description = ''
Additional set of module arguments to be passed to `specialArgs` of
the wrapper module evaluation.
'';
example = {
yourMomName = "Joe Mama";
};
};
# They're all disabled by default to let wrapper-manager not get out of the
# way. wrapper-manager configurations are meant to be a part of other
# environments and we're trying not to make a spotlight for wrapper-manager
# in whatever form including exporting the documentation.
documentation = {
manpage.enable = lib.mkEnableOption "manpage output";
html.enable = lib.mkEnableOption "HTML output";
extraModules = lib.mkOption {
type = with lib.types; listOf deferredModule;
description = ''
List of extra wrapper-manager modules to be included as part of the
documentation.
'';
default = [ ];
example = lib.literalExpression ''
[
./modules/wrapper-manager
]
'';
};
};
};
}

View File

@ -1,41 +0,0 @@
{
config,
lib,
pkgs,
...
}@moduleArgs:
let
cfg = config.wrapper-manager;
wmDocs = import ../../../docs { inherit pkgs; inherit (cfg.documentation) extraModules; };
in
{
imports = [ ../common.nix ];
config = lib.mkMerge [
{
home.packages =
lib.optionals cfg.documentation.manpage.enable [ wmDocs.outputs.manpage ]
++ lib.optionals cfg.documentation.html.enable [ wmDocs.outputs.html ];
wrapper-manager.extraSpecialArgs.hmConfig = config;
}
(lib.mkIf (moduleArgs ? nixosConfig) {
wrapper-manager.sharedModules = [
(
{ lib, ... }:
{
# NixOS already has the option to set the locale so we don't need to
# have this.
config.locale.enable = lib.mkDefault false;
}
)
];
})
(lib.mkIf (cfg.packages != { }) {
home.packages = lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) cfg.packages;
})
];
}

View File

@ -1,40 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.wrapper-manager;
wmDocs = import ../../../docs { inherit pkgs; inherit (cfg.documentation) extraModules; };
in
{
imports = [ ../common.nix ];
config = lib.mkMerge [
{
environment.systemPackages =
lib.optionals cfg.documentation.manpage.enable [ wmDocs.outputs.manpage ]
++ lib.optionals cfg.documentation.html.enable [ wmDocs.outputs.html ];
wrapper-manager.extraSpecialArgs.nixosConfig = config;
wrapper-manager.sharedModules = [
(
{ lib, ... }:
{
# NixOS already has the option to set the locale so we don't need to
# have this.
config.locale.enable = lib.mkDefault false;
}
)
];
}
(lib.mkIf (cfg.packages != { }) {
environment.systemPackages =
lib.mapAttrsToList (_: wrapper: wrapper.build.toplevel) cfg.packages;
})
];
}

View File

@ -1,17 +0,0 @@
= wrapper-manager modules
:toc:
This is the module set of the wrapper-manager module environment.
Just take note that we're following the runtime shell of nixpkgs which is GNU Bash as of 2024-06-30.
Also, take note of several design decisions when making the modules.
* Typically, several options are designed around one option.
The most prominent example of this is `wrappers.<name>.makeWrapperArgs` where we basically create those `makeWrapper` arguments from other options.
* Another common design here is most of the interaction happens around in individual wrappers so individual-wrapper-wide options are typically accompanied with a environment-wide version of that option.
An example of that is `environment.variables` and `environment.pathAdd` where it's basically a global set/list of variables and search paths to be put in each wrapper (that is, `wrappers.<name>.env` and `wrappers.<name>.pathAdd`).
* When constructing modules with a `listOf <type>` that is going to be set some other options, typically it is better to have them set in the individual wrapper and nothing else.
An example of that can be seen in `xdg.dataDirs` and `wrappers.<name>.xdg.dataDirs` implementation.
This is designed like that so the user can override the entire thing if they choose.

View File

@ -1,282 +0,0 @@
{
config,
lib,
options,
...
}:
let
envConfig = config;
toStringType = (with lib.types; coercedTo (oneOf [str path int float bool]) (x: "${x}") str) // {
description = "string and select types (numbers, boolean, and path) convertible to it";
};
envSubmodule =
{
config,
lib,
name,
...
}:
{
options = {
action = lib.mkOption {
type = lib.types.enum [
"unset"
"set"
"set-default"
"prefix"
"suffix"
];
description = ''
Sets the appropriate action for the environment variable.
* `unset`... unsets the given variable.
* `set-default` only sets the variable with the given value if
not already set.
* `set` forcibly sets the variable with given value.
* `prefix` and `suffix` prepends and appends the environment
variable containing a given separator-delimited list of values
respectively. It requires the `value` to be a list of string and a
`separator` value.
'';
default = "set";
example = "unset";
};
value = lib.mkOption {
type = with lib.types; either toStringType (listOf toStringType);
description = ''
The value of the variable that is holding.
::: {.note}
It accepts a list of values only for `prefix` and `suffix` action.
:::
'';
example = "HELLO THERE";
};
separator = lib.mkOption {
type = lib.types.str;
description = ''
Separator used to create a character-delimited list of the
environment variable holding a list of values.
::: {.note}
Only used for `prefix` and `suffix` action.
:::
'';
default = ":";
example = ";";
};
};
};
wrapperType =
{
name,
lib,
config,
pkgs,
...
}:
let
flagType = with lib.types; listOf toStringType;
in
{
options = {
prependArgs = lib.mkOption {
type = flagType;
description = ''
A list of arguments to be prepended to the user-given argument for the
wrapper script.
'';
default = [ ];
example = lib.literalExpression ''
[
"--config" ./config.conf
]
'';
};
appendArgs = lib.mkOption {
type = flagType;
description = ''
A list of arguments to be appended to the user-given argument for the
wrapper script.
'';
default = [ ];
example = lib.literalExpression ''
[
"--name" "doggo"
"--location" "Your mom's home"
]
'';
};
arg0 = lib.mkOption {
type = lib.types.str;
description = ''
The first argument of the wrapper script.
'';
example = lib.literalExpression "lib.getExe' pkgs.neofetch \"neofetch\"";
};
executableName = lib.mkOption {
type = lib.types.nonEmptyStr;
description = "The name of the executable.";
default = name;
example = "custom-name";
};
env = options.environment.variables;
pathAdd = options.environment.pathAdd;
preScript = lib.mkOption {
type = lib.types.lines;
description = ''
Script fragments to run before the main executable.
::: {.note}
This option is only used when {option}`build.variant` is set to
`shell`.
:::
'';
default = "";
example = lib.literalExpression ''
echo "HELLO WORLD!"
'';
};
# makeWrapperArgs are unescaped, a third-party module author can take
# advantage of that with runtime expansion values (if using the shell
# wrapper).
makeWrapperArgs = lib.mkOption {
type = with lib.types; listOf str;
description = ''
A list of extra arguments to be passed as part of `makeWrapper`
build step.
'';
example = [ "--inherit-argv0" ];
};
};
config = lib.mkMerge [
{
env = envConfig.environment.variables;
pathAdd = envConfig.environment.pathAdd;
makeWrapperArgs =
lib.mapAttrsToList (
n: v:
if v.action == "unset" then
"--${v.action} ${lib.escapeShellArg n}"
else if lib.elem v.action [ "prefix" "suffix" ] then
"--${v.action} ${lib.escapeShellArg n} ${lib.escapeShellArg v.separator} ${lib.escapeShellArg (lib.concatStringsSep v.separator v.value)}"
else
"--${v.action} ${lib.escapeShellArg n} ${lib.escapeShellArg v.value}"
) config.env
++ (builtins.map (v: "--add-flags ${lib.escapeShellArg v}") config.prependArgs)
++ (builtins.map (v: "--append-flags ${lib.escapeShellArg v}") config.appendArgs)
++ (lib.optionals (envConfig.build.variant == "shell" && config.preScript != "") (
let
preScript =
pkgs.runCommand "wrapper-script-prescript-${config.executableName}" { }
config.preScript;
in
[
"--run"
preScript
]
));
}
(lib.mkIf (config.pathAdd != [ ]) {
env.PATH.value = lib.lists.map builtins.toString config.pathAdd;
env.PATH.action = "prefix";
})
];
};
in
{
options = {
wrappers = lib.mkOption {
type = with lib.types; attrsOf (submodule wrapperType);
description = ''
A set of wrappers to be included in the resulting derivation from
wrapper-manager evaluation.
'';
default = { };
example = lib.literalExpression ''
{
yt-dlp-audio = {
arg0 = lib.getExe' pkgs.yt-dlp "yt-dlp";
prependArgs = [
"--config-location" ./config/yt-dlp/audio.conf
];
};
}
'';
};
basePackages = lib.mkOption {
type = with lib.types; either package (listOf package);
description = ''
Packages to be included in the wrapper package. However, there are
differences in behavior when given certain values.
* When the value is a bare package, the build process will use
`$PACKAGE.overrideAttrs` to create the package. This makes it suitable
to be used as part of `programs.<name>.package` typically found on
other environments (e.g., NixOS). Take note this means a rebuild of the
package.
* When the value is a list of packages, the build process will use
`symlinkJoin` as the builder to create the derivation.
'';
default = [ ];
example = lib.literalExpression ''
with pkgs; [
yt-dlp
]
'';
};
environment.variables = lib.mkOption {
type = with lib.types; attrsOf (submodule envSubmodule);
description = ''
A global set of environment variables and their actions to be applied
per-wrapper.
'';
default = { };
example = lib.literalExpression ''
{
"FOO_TYPE".value = "custom";
"FOO_LOG_STYLE" = {
action = "set-default";
value = "systemd";
};
"USELESS_VAR".action = "unset";
}
'';
};
environment.pathAdd = lib.mkOption {
type = with lib.types; listOf path;
description = ''
A global list of paths to be added per-wrapper as part of the `PATH`
environment variable.
'';
default = [ ];
example = lib.literalExpression ''
wrapperManagerLib.getBin (with pkgs; [
yt-dlp
gallery-dl
])
'';
};
};
}

View File

@ -1,100 +0,0 @@
{
config,
lib,
pkgs,
...
}:
{
options.build = {
variant = lib.mkOption {
type = lib.types.enum [ "binary" "shell" ];
description = ''
Indicates the type of wrapper to be made. By default, wrapper-manager
sets this to `binary`.
'';
default = "binary";
example = "shell";
};
extraSetup = lib.mkOption {
type = lib.types.lines;
description = ''
Additional script for setting up the wrapper script derivation.
'';
default = "";
};
extraPassthru = lib.mkOption {
type = with lib.types; attrsOf anything;
description = ''
Set of data to be passed through `passthru` of the resulting
derivation.
'';
default = { };
};
toplevel = lib.mkOption {
type = lib.types.package;
readOnly = true;
internal = true;
description = "A derivation containing the wrapper script.";
};
};
config = {
build = {
toplevel =
let
inherit (config.build) variant;
makeWrapperArg0 =
if variant == "binary" then "makeBinaryWrapper"
else if variant == "shell" then "makeShellWrapper"
else "makeWrapper";
mkWrapBuild =
wrappers:
lib.concatMapStrings (v: ''
${makeWrapperArg0} "${v.arg0}" "${builtins.placeholder "out"}/bin/${v.executableName}" ${lib.concatStringsSep " " v.makeWrapperArgs}
'') wrappers;
mkDesktopEntries = desktopEntries: builtins.map (entry: pkgs.makeDesktopItem entry) desktopEntries;
desktopEntries = mkDesktopEntries (lib.attrValues config.xdg.desktopEntries);
in
if lib.isList config.basePackages then
pkgs.symlinkJoin {
passthru = config.build.extraPassthru;
name = "wrapper-manager-fds-wrapped-package";
paths = desktopEntries ++ config.basePackages;
nativeBuildInputs =
if variant == "binary" then [ pkgs.makeBinaryWrapper ]
else if variant == "shell" then [ pkgs.makeShellWrapper ]
else [ ];
postBuild = ''
${config.build.extraSetup}
${mkWrapBuild (lib.attrValues config.wrappers)}
'';
}
else
config.basePackages.overrideAttrs (final: prev: {
nativeBuildInputs =
(prev.nativeBuildInputs or [ ])
++ (
if variant == "binary" then [ pkgs.makeBinaryWrapper ]
else if variant == "shell" then [ pkgs.makeShellWrapper ]
else [ ]
)
++ lib.optionals (config.xdg.desktopEntries != { }) [ pkgs.copyDesktopItems ];
desktopItems = (prev.desktopItems or [ ]) ++ desktopEntries;
postFixup = ''
${prev.postFixup or ""}
${mkWrapBuild (lib.attrValues config.wrappers)}
'';
passthru = lib.recursiveUpdate (prev.passthru or { }) (config.build.extraPassthru // {
unwrapped = config.basePackages;
});
});
};
};
}

View File

@ -1,11 +0,0 @@
{
imports = [
./base.nix
./files.nix
./xdg-desktop-entries.nix
./xdg-dirs.nix
./locale.nix
./build.nix
./extra-args.nix
];
}

View File

@ -1,7 +0,0 @@
{ pkgs, ... }:
{
_module.args = {
wrapperManagerLib = import ../../lib { inherit pkgs; };
};
}

View File

@ -1,105 +0,0 @@
{ config, lib, pkgs, ... }:
let
cfg = config.files;
filesModule = { name, lib, config, options, ... }: {
options = {
target = lib.mkOption {
type = lib.types.nonEmptyStr;
description = ''
Path of the file relative to the derivation output path.
'';
default = name;
example = "share/applications/org.example.App1.desktop";
};
source = lib.mkOption {
type = lib.types.path;
description = "Path of the file to be linked.";
};
text = lib.mkOption {
type = with lib.types; nullOr lines;
description = ''
Text content of the given filesystem path.
'';
default = null;
example = ''
key=value
hello=world
'';
};
mode = lib.mkOption {
type = lib.types.strMatching "[0-7]{0,4}";
default = "0644";
example = "0600";
description = ''
Permissions to be given to the file. By default, it is given with a
symlink.
'';
};
};
config = {
source = lib.mkIf (config.text != null) (
let
name' = "wrapper-manager-filesystem-${lib.replaceStrings ["/"] ["-"] name}";
in lib.modules.mkDerivedConfig options.text (pkgs.writeText name')
);
};
};
in
{
options.files = lib.mkOption {
type = with lib.types; attrsOf (submodule filesModule);
description = ''
Extra set of files to be exported within the derivation.
::: {.caution}
Be careful when placing executables in `$out/bin` as it is handled by
wrapper-manager build step. Any files in `$out/bin` that have a
configured wrapper will be overwritten since building the wrapper comes
after installing the files.
:::
'';
default = { };
example = lib.literalExpression ''
{
"share/example-app/docs".source = ./docs;
"etc/xdg".source = ./config;
"share/example-app/example-config".text = ''''
hello=world
location=INSIDE OF YOUR WALLS
'''';
}
'';
};
config = lib.mkIf (cfg != { }) {
build.extraSetup = let
installFiles = acc: n: v: let
source = lib.escapeShellArg v.source;
target = lib.escapeShellArg v.target;
target' = "$out/${target}";
installFile = let
type = lib.filesystem.pathType v.source;
in
if type == "directory" then ''
mkdir -p $(basename ${target'}) && cp --recursive ${source} ${target'}
'' else if type == "symlink" then ''
ln --symbolic --force ${source} ${target'}
'' else ''
install -D --mode=${v.mode} ${source} ${target'}
'';
in ''
${acc}
${installFile}
'';
in lib.mkBefore ''
${lib.foldlAttrs installFiles "" cfg}
'';
};
}

View File

@ -1,66 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.locale;
localeModuleFactory =
{
isGlobal ? false,
}:
{
enable = lib.mkOption {
type = lib.types.bool;
default = if isGlobal then true else cfg.enable;
example = false;
description =
if isGlobal then
''
Whether to enable explicit glibc locale support. This is recommended
for Nix-built applications.
''
else
''
Whether to enable locale support for this wrapper. Recommended for
Nix-built applications.
'';
};
package = lib.mkOption {
type = lib.types.package;
default = if isGlobal then (pkgs.glibcLocales.override { allLocales = true; }) else cfg.package;
description = ''
The package containing glibc locales.
'';
};
};
in
{
options.locale = localeModuleFactory { isGlobal = true; };
options.wrappers =
let
localeSubmodule =
{
config,
lib,
name,
...
}:
let
submoduleCfg = config.locale;
in
{
options.locale = localeModuleFactory { isGlobal = false; };
config = lib.mkIf submoduleCfg.enable {
env.LOCALE_ARCHIVE.value = "${submoduleCfg.package}/lib/locale/locale-archive";
};
};
in
lib.mkOption { type = with lib.types; attrsOf (submodule localeSubmodule); };
}

View File

@ -1,164 +0,0 @@
{
config,
lib,
pkgs,
...
}:
let
# We're only setting up options for the most common keys typically used to
# set up a desktop entry. Everything else is acceptable under a freeform
# module anyways.
xdgDesktopEntry =
{
name,
lib,
pkgs,
...
}:
{
freeformType = with lib.types; attrsOf anything;
options = {
name = lib.mkOption {
type = lib.types.nonEmptyStr;
description = "The name of the desktop file.";
default = name;
example = "firefox";
};
desktopName = lib.mkOption {
type = lib.types.nonEmptyStr;
description = "Specific name of the application.";
default = name;
example = "Firefox";
};
exec = lib.mkOption {
type = with lib.types; nullOr nonEmptyStr;
description = "Program with execute along with its arguments.";
default = null;
example = "firefox %U";
};
genericName = lib.mkOption {
type = with lib.types; nullOr nonEmptyStr;
description = "Generic name of the application.";
default = null;
example = "Web browser";
};
terminal = lib.mkOption {
type = lib.types.bool;
description = "Whether the program runs in a terminal window.";
default = false;
example = true;
};
categories = lib.mkOption {
type = with lib.types; listOf nonEmptyStr;
description = "List of categories should the application be shown in a menu.";
default = [ ];
example = [
"Applications"
"Network"
];
};
mimeTypes = lib.mkOption {
type = with lib.types; listOf nonEmptyStr;
description = "The MIME types supported by the application.";
default = [ ];
example = [
"text/html"
"text/xml"
];
};
};
};
in
{
options.xdg.desktopEntries = lib.mkOption {
type = with lib.types; attrsOf (submodule xdgDesktopEntry);
description = ''
A set of desktop entries to be exported along with the wrapped package.
The attribute name will be used as the filename of the generated desktop
entry file.
'';
default = { };
example = lib.literalExpression ''
{
firefox = {
name = "Firefox";
genericName = "Web browser";
exec = "firefox %u";
terminal = false;
categories = [ "Application" "Network" "WebBrowser" ];
mimeTypes = [ "text/html" "text/xml" ];
extraConfig."X-GNOME-Autostart-Phase" = "WindowManager";
keywords = [ "Web" "Browser" ];
startupNotify = false;
startupWMClass = "MyOwnClass";
};
}
'';
};
options.wrappers = lib.mkOption {
type =
let
xdgDesktopEntryWrapperSubmodule =
{
name,
config,
lib,
...
}:
{
options.xdg.desktopEntry = {
enable = lib.mkEnableOption "automatic creation of a desktop entry for the wrapper";
settings = lib.mkOption {
type = lib.types.submodule xdgDesktopEntry;
description = ''
Settings to be passed to the `makeDesktopItem` builder.
'';
example = lib.literalExpression ''
{
mimeTypes = [ "text/html" "text/xml" ];
categories = [ "Applications" "Network" ];
}
'';
};
};
config.xdg.desktopEntry.settings = lib.mkIf config.xdg.desktopEntry.enable {
name = lib.mkDefault config.executableName;
desktopName = lib.mkDefault name;
type = lib.mkDefault "Application";
# Welp, we could set it to the absolute location of the wrapper
# executable in the final output but it's a big pain the ass to do
# so we're opting to the executable name instead. This current
# way of doing it is simply the next best (and the simplest) thing.
# We just have to make sure the build step for the wrapper script
# is consistent throughout the entire module environment.
#
# Besides, if the user wants a desktop entry along with the wrapper
# script, it will be included alongside in whatever environment
# they are using it for anyways.
exec = config.executableName;
};
};
in
with lib.types;
attrsOf (submodule xdgDesktopEntryWrapperSubmodule);
};
config = {
xdg.desktopEntries =
let
wrappersWithDesktopEntries = lib.filterAttrs (_: v: v.xdg.desktopEntry.enable) config.wrappers;
in
lib.mapAttrs (_: v: v.xdg.desktopEntry.settings) wrappersWithDesktopEntries;
};
}

View File

@ -1,76 +0,0 @@
{ config, lib, ... }:
let
cfg = config.xdg;
xdgDirsOption = {
configDirs = lib.mkOption {
type = with lib.types; listOf str;
description = ''
A list of paths to be appended as part of the `XDG_CONFIG_DIRS`
environment to be applied per-wrapper.
'';
default = [ ];
example = lib.literalExpression ''
wrapperManagerLib.getXdgConfigDirs (with pkgs; [
yt-dlp
neofetch
])
'';
};
dataDirs = lib.mkOption {
type = with lib.types; listOf str;
description = ''
A list of paths to be appended as part of the `XDG_DATA_DIRS`
environment to be applied per-wrapper.
'';
default = [ ];
example = lib.literalExpression ''
wrapperManagerLib.getXdgDataDirs (with pkgs; [
yt-dlp
neofetch
])
'';
};
};
in
{
options.xdg = xdgDirsOption;
options.wrappers = lib.mkOption {
type =
let
xdgDirsType =
{
name,
lib,
config,
...
}:
{
options.xdg = xdgDirsOption;
config = lib.mkMerge [
{
# When set this way, we could allow the user to override everything.
xdg.configDirs = cfg.configDirs;
xdg.dataDirs = cfg.dataDirs;
}
(lib.mkIf (config.xdg.configDirs != [ ]) {
env.XDG_CONFIG_DIRS.value = lib.lists.map builtins.toString config.xdg.configDirs;
env.XDG_CONFIG_DIRS.action = "prefix";
})
(lib.mkIf (config.xdg.dataDirs != [ ]) {
env.XDG_DATA_DIRS.value = lib.lists.map builtins.toString config.xdg.dataDirs;
env.XDG_DATA_DIRS.action = "prefix";
})
];
};
in
with lib.types;
attrsOf (submodule xdgDirsType);
};
}

View File

@ -1,80 +0,0 @@
# Generated by npins. Do not modify; will be overwritten regularly
let
data = builtins.fromJSON (builtins.readFile ./sources.json);
version = data.version;
mkSource =
spec:
assert spec ? type;
let
path =
if spec.type == "Git" then
mkGitSource spec
else if spec.type == "GitRelease" then
mkGitSource spec
else if spec.type == "PyPi" then
mkPyPiSource spec
else if spec.type == "Channel" then
mkChannelSource spec
else
builtins.throw "Unknown source type ${spec.type}";
in
spec // { outPath = path; };
mkGitSource =
{
repository,
revision,
url ? null,
hash,
branch ? null,
...
}:
assert repository ? type;
# At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
# In the latter case, there we will always be an url to the tarball
if url != null then
(builtins.fetchTarball {
inherit url;
sha256 = hash; # FIXME: check nix version & use SRI hashes
})
else
assert repository.type == "Git";
let
urlToName =
url: rev:
let
matched = builtins.match "^.*/([^/]*)(\\.git)?$" repository.url;
short = builtins.substring 0 7 rev;
appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else "";
in
"${if matched == null then "source" else builtins.head matched}${appendShort}";
name = urlToName repository.url revision;
in
builtins.fetchGit {
url = repository.url;
rev = revision;
inherit name;
# hash = hash;
};
mkPyPiSource =
{ url, hash, ... }:
builtins.fetchurl {
inherit url;
sha256 = hash;
};
mkChannelSource =
{ url, hash, ... }:
builtins.fetchTarball {
inherit url;
sha256 = hash;
};
in
if version == 3 then
builtins.mapAttrs (_: mkSource) data.pins
else
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"

View File

@ -1,65 +0,0 @@
{
"pins": {
"home-manager-stable": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "nix-community",
"repo": "home-manager"
},
"branch": "release-24.05",
"revision": "e1391fb22e18a36f57e6999c7a9f966dc80ac073",
"url": "https://github.com/nix-community/home-manager/archive/e1391fb22e18a36f57e6999c7a9f966dc80ac073.tar.gz",
"hash": "0c83di08nhkzq0cwc3v7aax3x8y5m7qahyzxppinzwxi3r8fnjq3"
},
"home-manager-unstable": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "nix-community",
"repo": "home-manager"
},
"branch": "master",
"revision": "471e3eb0a114265bcd62d11d58ba8d3421ee68eb",
"url": "https://github.com/nix-community/home-manager/archive/471e3eb0a114265bcd62d11d58ba8d3421ee68eb.tar.gz",
"hash": "1smfj6fb3jc80gbavdf603nz782fb96d9k5w36g61zliw5g2qfvz"
},
"nixos-stable": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "NixOS",
"repo": "nixpkgs"
},
"branch": "nixos-24.05",
"revision": "6e99f2a27d600612004fbd2c3282d614bfee6421",
"url": "https://github.com/NixOS/nixpkgs/archive/6e99f2a27d600612004fbd2c3282d614bfee6421.tar.gz",
"hash": "1qwbrn2cb1x9clkhqmdnx5r8v11168p3nx14h3r9wcml0bgblpvr"
},
"nixos-unstable": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "NixOS",
"repo": "nixpkgs"
},
"branch": "nixos-unstable",
"revision": "12228ff1752d7b7624a54e9c1af4b222b3c1073b",
"url": "https://github.com/NixOS/nixpkgs/archive/12228ff1752d7b7624a54e9c1af4b222b3c1073b.tar.gz",
"hash": "1dmng7f5rv4hgd0b61chqx589ra7jajsrzw21n8gp8makw5khvb2"
},
"website": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "foo-dogsquared",
"repo": "website"
},
"branch": "master",
"revision": "1195855a64b2fe010caad45fe518af986db7afb7",
"url": "https://github.com/foo-dogsquared/website/archive/1195855a64b2fe010caad45fe518af986db7afb7.tar.gz",
"hash": "1dhai90in478d2ax2s927nsf95cf7xngkmfy55ws3hl2pfycan5f"
}
},
"version": 3
}

View File

@ -1,3 +0,0 @@
{
"version": "0.1.0"
}

View File

@ -1,23 +0,0 @@
let
sources = import ./npins;
in
{
pkgs ? import sources.nixos-unstable { },
}:
let
docs = import ./docs { inherit pkgs; };
in
pkgs.mkShell {
inputsFrom = [ docs.website ];
packages = with pkgs; [
npins
treefmt
nixfmt-rfc-style
# For easy validation of the test suite.
yajsv
jq
];
}

View File

@ -1,22 +0,0 @@
let
sources = import ../../npins;
in
{
pkgs ? import sources.nixos-unstable { },
}:
let
wmLib = (import ../../. { }).lib;
build = args: wmLib.build (args // { inherit pkgs; });
in
{
fastfetch = build { modules = [ ./wrapper-fastfetch.nix ]; };
neofetch = build {
modules = [ ./wrapper-neofetch.nix ];
specialArgs.yourMomName = "Yor mom";
};
xdg-desktop-entry = build { modules = [ ./xdg-desktop-entry.nix ]; };
single-basepackage = build { modules = [ ./single-basepackage.nix ]; };
neofetch-with-additional-files = build { modules = [ ./neofetch-with-additional-files.nix ]; };
lib-modules-make-wraparound = build { modules = [ ./lib-modules-subset/make-wraparound.nix ]; };
}

View File

@ -1,26 +0,0 @@
{ config, lib, pkgs, wrapperManagerLib, ... }:
let
inherit (wrapperManagerLib) makeWraparound;
in
{
build.variant = "shell";
wrappers.tmux = makeWraparound {
under = lib.getExe' pkgs.boxxy "boxxy";
underFlags = [ "--rule" "~/.tmux.conf:~/.config/tmux/tmux.conf" ];
underSeparator = "--";
arg0 = lib.getExe' pkgs.tmux "tmux";
};
build.extraPassthru.wrapperManagerTests = {
actuallyBuilt =
let
wrapper = config.build.toplevel;
tmux = lib.getExe' wrapper "tmux";
in
pkgs.runCommand "wrapper-manager-tmux-actually-built" { } ''
[ -x "${tmux}" ] && touch $out
'';
};
}

View File

@ -1,55 +0,0 @@
{ config, lib, pkgs, ... }:
{
wrappers.neofetch = {
arg0 = lib.getExe' pkgs.neofetch "neofetch";
appendArgs = [
"--ascii_distro"
"guix"
"--title_fqdn"
"off"
"--os_arch"
"off"
];
};
# Testing out a simple file.
files."share/nix/hello".text = ''
WHOA THERE!
'';
# A file target with an "absolute" path.
files."/absolute/path".text = ''
WHAAAAAAAT!
'';
# Testing out source.
files."share/nix/aloha".source = config.files."share/nix/hello".source;
# Testing out an executable file.
files."share/nix/example" = {
text = "WHOA";
mode = "0755";
};
# Testing out a directory.
files."share/whoa".source = pkgs.writeTextDir "/what/is/this.txt" ''
WHAT
'';
build.extraPassthru.wrapperManagerTests = {
actuallyBuilt =
let
wrapper = config.build.toplevel;
in
pkgs.runCommand "wrapper-manager-neofetch-actually-built" { } ''
[ -x "${wrapper}/bin/${config.wrappers.neofetch.executableName}" ] \
&& [ -f "${wrapper}/share/nix/hello" ] \
&& [ -f "${wrapper}/share/nix/aloha" ] \
&& [ -x "${wrapper}/share/nix/example" ] \
&& [ -d "${wrapper}/share/whoa" ] \
&& [ -f "${wrapper}/absolute/path" ] \
&& touch $out
'';
};
}

View File

@ -1,25 +0,0 @@
{ config, lib, pkgs, ... }:
{
basePackages = pkgs.fastfetch;
wrappers.fastfetch-guix = {
arg0 = lib.getExe' pkgs.fastfetch "fastfetch";
appendArgs = [
"--logo"
"Guix"
];
env.NO_COLOR.value = "1";
xdg.desktopEntry.enable = true;
};
build.extraPassthru.wrapperManagerTests = {
singleBasePackage =
let
wrapper = config.build.toplevel;
in
pkgs.runCommand "wrapper-manager-fastfetch-actually-built" { } ''
[ -e "${wrapper}/share/applications/fastfetch-guix.desktop" ] && [ -x "${wrapper}/bin/${config.wrappers.fastfetch-guix.executableName}" ] && touch $out
'';
};
}

View File

@ -1,35 +0,0 @@
{
config,
lib,
pkgs,
wrapperManagerLib,
...
}:
{
build.variant = "shell";
wrappers.fastfetch = {
arg0 = lib.getExe' pkgs.fastfetch "fastfetch";
appendArgs = [
"--logo"
"Guix"
];
env.NO_COLOR.value = "1";
xdg.desktopEntry.enable = true;
};
environment.pathAdd = wrapperManagerLib.getBin (with pkgs; [
hello
]);
build.extraPassthru.wrapperManagerTests = {
actuallyBuilt =
let
wrapper = config.build.toplevel;
in
pkgs.runCommand "wrapper-manager-fastfetch-actually-built" { } ''
[ -e "${wrapper}/share/applications/fastfetch.desktop" ] && [ -x "${wrapper}/bin/${config.wrappers.fastfetch.executableName}" ] && touch $out
'';
};
}

View File

@ -1,32 +0,0 @@
{
config,
lib,
pkgs,
yourMomName,
...
}:
{
wrappers.neofetch = {
arg0 = lib.getExe' pkgs.neofetch "neofetch";
executableName = yourMomName;
appendArgs = [
"--ascii_distro"
"guix"
"--title_fqdn"
"off"
"--os_arch"
"off"
];
};
build.extraPassthru.wrapperManagerTests = {
actuallyBuilt =
let
wrapper = config.build.toplevel;
in
pkgs.runCommand "wrapper-manager-neofetch-actually-built" { } ''
[ -x "${wrapper}/bin/${config.wrappers.neofetch.executableName}" ] && touch $out
'';
};
}

View File

@ -1,42 +0,0 @@
{
config,
lib,
pkgs,
...
}:
{
wrappers.nvim = {
arg0 = lib.getExe' pkgs.neovim "nvim";
xdg.desktopEntry = {
enable = true;
settings = {
terminal = true;
extraConfig."X-GNOME-Autostart-Phase" = "WindowManager";
keywords = [ "Text editor" ];
startupNotify = false;
startupWMClass = "MyOwnClass";
};
};
};
xdg.desktopEntries.nvim-custom = {
name = "nvim-custom";
genericName = "Text editor";
terminal = true;
exec = "nvim";
};
build.extraPassthru.wrapperManagerTests = {
actuallyBuilt =
let
wrapper = config.build.toplevel;
in
pkgs.runCommand "wrapper-manager-xdg-desktop-entry-actually-built" { } ''
[ -e "${wrapper}/share/applications/nvim-custom.desktop" ] \
&& [ -e "${wrapper}/share/applications/nvim.desktop" ] \
&& [ -x "${wrapper}/bin/${config.wrappers.nvim.executableName}" ] && touch $out
'';
};
}

View File

@ -1,32 +0,0 @@
let
sources = import ../npins;
in
{
pkgs ? import sources.nixos-unstable { },
}:
let
wrapperManagerLibTests = import ./lib { inherit pkgs; };
inherit (pkgs) lib;
in
{
configs = let
configs' = import ./configs { inherit pkgs; };
updateTestName = configName: package: lib.mapAttrs' (n: v: lib.nameValuePair "${configName}-${n}" v) package.wrapperManagerTests;
in
lib.concatMapAttrs updateTestName configs';
lib =
pkgs.runCommand "wrapper-manager-fds-lib-test"
{
testData = builtins.toJSON wrapperManagerLibTests;
passAsFile = [ "testData" ];
nativeBuildInputs = with pkgs; [
yajsv
jq
];
}
''
yajsv -s "${./lib/tests.schema.json}" "$testDataPath" && touch $out || jq . "$testDataPath"
'';
}

View File

@ -1,16 +0,0 @@
{ pkgs }:
let
lib = import ../../lib { inherit pkgs; };
callLib =
file:
import file {
inherit (pkgs) lib;
inherit pkgs;
self = lib;
};
in
{
env = callLib ./env;
utils = callLib ./utils.nix;
}

View File

@ -1,63 +0,0 @@
{
pkgs,
lib,
self,
}:
let
neofetchWrapper = ../../configs/wrapper-neofetch.nix;
fastfetchWrapper = ../../configs/wrapper-fastfetch.nix;
in
lib.runTests {
testsEvaluateSampleConfiguration = {
expr =
let
sampleConf = self.env.eval {
inherit pkgs;
modules = [ neofetchWrapper ];
specialArgs.yourMomName = "Joe Mama";
};
in
lib.isDerivation sampleConf.config.build.toplevel;
expected = true;
};
testsEvaluateSampleConfiguration2 = {
expr =
let
sampleConf = self.env.eval {
inherit pkgs;
modules = [ fastfetchWrapper ];
specialArgs.yourMomName = "Joe Mama";
};
in
lib.isDerivation sampleConf.config.build.toplevel;
expected = true;
};
testsBuildSampleConfiguration = {
expr =
let
sampleConf = self.env.build {
inherit pkgs;
modules = [ neofetchWrapper ];
specialArgs.yourMomName = "Joe Mama";
};
in
lib.isDerivation sampleConf;
expected = true;
};
testsBuildSampleConfiguration2 = {
expr =
let
sampleConf = self.env.build {
inherit pkgs;
modules = [ fastfetchWrapper ];
specialArgs.yourMomName = "Joe Mama";
};
in
lib.isDerivation sampleConf;
expected = true;
};
}

View File

@ -1,16 +0,0 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "wrapper-manager-fds Nix test object",
"type": "object",
"patternProperties": {
"^\\w+$": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 0,
"maxItems": 0
},
"required": true
}
}

View File

@ -1,51 +0,0 @@
{
pkgs,
lib,
self,
}:
lib.runTests {
testsUtilsGetBin = {
expr = self.utils.getBin [
../../lib
../../modules
];
expected = [
(lib.getBin ../../lib)
(lib.getBin ../../modules)
];
};
testsUtilsGetLibexec = {
expr = self.utils.getLibexec [
../../lib
../../modules
];
expected = [
"${../../lib}/libexec"
"${../../modules}/libexec"
];
};
testsUtilsGetXdgConfigDirs = {
expr = self.utils.getXdgConfigDirs [
../../lib
../../modules
];
expected = [
"${../../lib}/etc/xdg"
"${../../modules}/etc/xdg"
];
};
testsUtilsGetXdgDataDirs = {
expr = self.utils.getXdgDataDirs [
../../lib
../../modules
];
expected = [
"${../../lib}/share"
"${../../modules}/share"
];
};
}

View File

@ -1,8 +0,0 @@
[global]
excludes = [
"npins/default.nix"
]
[formatter.nix]
command = "nixfmt"
includes = [ "*.nix" ]