Merge branch 'main' into refactor-ci

This commit is contained in:
raf 2025-03-25 10:25:02 +00:00 committed by GitHub
commit 6095ccfff8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 254 additions and 39 deletions

6
.github/CODEOWNERS vendored
View file

@ -1 +1,5 @@
* @NotAShelf
# Codeowners should be used to distinguish the maintainers of the project
# and not contributors of specific modules to nvf. While adding a new module
# please consider adding yourself to 'meta.maintainers' in the module instead
# of CODEOWNERS here.
* @NotAShelf @horriblename @Soliprem

20
.github/README.md vendored
View file

@ -246,14 +246,15 @@ Neovim's behaviour with Nix.
### Co-Maintainers
Alongside myself, nvf is developed by those talented folk:
Alongside [myself](https://github.com/notashelf), nvf is developed by those
talented folk. nvf would not be what it is today without their invaluable
contributions.
- [**@horriblename**](https://github.com/horriblename)
([Liberapay](https://liberapay.com/horriblename/))- For actively implementing
planned features and quality of life updates.
- [**@Diniamo**](https://github.com/Diniamo)
([Liberapay](https://en.liberapay.com/diniamo/)) - For actively submitting
pull requests, issues and assistance with maintenance of nvf.
- [**@Soliprem**](https://github.com/soliprem) - For rigorously implementing
missing features and excellent work on new language modules.
Please do remember to extend your thanks (financially or otherwise) if this
project has been helpful to you.
@ -270,14 +271,14 @@ heart-felt thanks to
- [**@FlafyDev**](https://github.com/FlafyDev) - For getting Home-Manager module
to work and Nix assistance.
- [**@n3oney**](https://github.com/n3oney) - For making custom keybinds finally
possible, and other module additions.
possible, great ideas and module additions.
- [**@Yavko**](https://github.com/Yavko) - For the amazing **nvf** logo
- [**@FrothyMarrow**](https://github.com/FrothyMarrow) - For seeing mistakes
that I could not.
that I could not and contributing good ideas & code.
- [**@Gerg-l**](https://github.com/gerg-l) 🐸 - For the modern Neovim wrapper,
[mnw], and occasional code improvements.
- [**@Soliprem**](https://github.com/soliprem) - Rigorously implementing missing
features and excellent work on new language modules.
[mnw], and occasional improvements to the codebase.
- [**@Diniamo**](https://github.com/Diniamo) - For actively submitting pull
requests, issues and assistance with co-maintenance of nvf.
and everyone who has submitted issues or pull requests!
@ -301,7 +302,6 @@ including:
I am grateful for their previous work and inspiration, and I wholeheartedly
recommend checking their work out.
<br/>
## License

View file

@ -5,8 +5,8 @@ options will include useful comments, warnings or setup tips on how a module
option is meant to be used as well as examples in complex cases.
An offline version of this page is bundled with nvf as a part of the manpages
which you can access with `man 5 nvf`. Please us know if you believe any of the
options below are missing useful examples.
which you can access with `man 5 nvf`. Please let us know if you believe any of
the options below are missing useful examples.
<!--
In the manual, individual options may be referenced in Hyperlinks as follows:

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,3 @@
# Based off of:
# https://github.com/NixOS/nixpkgs/blob/776c3bee4769c616479393aeefceefeda16b6fcb/pkgs/tools/nix/npins/source.nix
{
lib,
fetchurl,
@ -8,7 +6,16 @@
}:
builtins.mapAttrs
(
_: let
name: let
getUrl = {
url,
hash,
...
}:
fetchurl {
inherit url;
sha256 = hash;
};
getZip = {
url,
hash,
@ -23,19 +30,29 @@ builtins.mapAttrs
repository,
revision,
url ? null,
submodules,
hash,
...
} @ attrs:
assert repository ? type;
if url != null
if url != null && !submodules
then getZip attrs
else
assert repository.type == "Git"; let
urlToName = url: rev: let
matched = builtins.match "^.*/([^/]*)(\\.git)?$" repository.url;
short = builtins.substring 0 7 rev;
url' =
if repository.type == "Git"
then repository.url
else if repository.type == "GitHub"
then "https://github.com/${repository.owner}/${repository.repo}.git"
else if repository.type == "GitLab"
then "${repository.server}/${repository.repo_path}.git"
else throw "Unrecognized repository type ${repository.type}";
name = let
matched = builtins.match "^.*/([^/]*)(\\.git)?$" url';
short = builtins.substring 0 7 revision;
appendShort =
if (builtins.match "[a-f0-9]*" rev) != null
if (builtins.match "[a-f0-9]*" revision) != null
then "-${short}"
else "";
in "${
@ -43,43 +60,53 @@ builtins.mapAttrs
then "source"
else builtins.head matched
}${appendShort}";
name = urlToName repository.url revision;
in
fetchgit {
inherit name;
inherit (repository) url;
url = url';
rev = revision;
sha256 = hash;
fetchSubmodules = submodules;
};
mkPyPiSource = {
url,
hash,
...
}:
fetchurl {
inherit url;
sha256 = hash;
};
in
spec:
assert spec ? type; let
mayOverride = path: let
envVarName = "NPINS_OVERRIDE_${saneName}";
saneName = lib.stringAsChars (c:
if (builtins.match "[a-zA-Z0-9]" c) == null
then "_"
else c)
name;
ersatz = builtins.getEnv envVarName;
in
if ersatz == ""
then path
else
# this turns the string into an actual Nix path (for both absolute and
# relative paths)
builtins.trace "Overriding path of \"${name}\" with \"${ersatz}\" due to set \"${envVarName}\"" (
if builtins.substring 0 1 ersatz == "/"
then /. + ersatz
else /. + builtins.getEnv "PWD" + "/${ersatz}"
);
func =
{
Git = mkGitSource;
GitRelease = mkGitSource;
PyPi = mkPyPiSource;
PyPi = getUrl;
Channel = getZip;
Tarball = getUrl;
}
.${spec.type}
or (builtins.throw "Unknown source type ${spec.type}");
in
spec // {outPath = func spec;}
spec // {outPath = mayOverride (func spec);}
)
(
let
json = lib.importJSON ./sources.json;
in
assert lib.assertMsg (json.version == 3) "Npins version mismatch!";
assert lib.assertMsg (json.version == 5) "Npins version mismatch!";
json.pins
)