4f0dadbf38
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
--argstr baseRev b32a094368
result/bin/apply-formatting $NIXPKGS_PATH
72 lines
1.5 KiB
Nix
72 lines
1.5 KiB
Nix
{
|
|
buildDhallPackage,
|
|
fetchFromGitHub,
|
|
lib,
|
|
}:
|
|
|
|
# This function is used by `dhall-to-nixpkgs` when given a GitHub repository
|
|
lib.makePackageOverridable (
|
|
{
|
|
# Arguments passed through to `buildDhallPackage`
|
|
name,
|
|
dependencies ? [ ],
|
|
source ? false,
|
|
|
|
# The directory containing the Dhall files, if other than the root of the
|
|
# repository
|
|
directory ? "",
|
|
# The file to import, relative to the above directory
|
|
file ? "package.dhall",
|
|
# Set to `true` to generate documentation for the package
|
|
document ? false,
|
|
|
|
# Arguments passed through to `fetchFromGitHub`
|
|
owner,
|
|
repo,
|
|
rev,
|
|
# Extra arguments passed through to `fetchFromGitHub`, such as the hash
|
|
# or `fetchSubmodules`
|
|
...
|
|
}@args:
|
|
|
|
let
|
|
versionedName = "${name}-${rev}";
|
|
|
|
src = fetchFromGitHub (
|
|
{
|
|
name = "${versionedName}-source";
|
|
|
|
inherit owner repo rev;
|
|
}
|
|
// removeAttrs args [
|
|
"name"
|
|
"dependencies"
|
|
"document"
|
|
"source"
|
|
"directory"
|
|
"file"
|
|
"owner"
|
|
"repo"
|
|
"rev"
|
|
]
|
|
);
|
|
|
|
prefix = lib.optionalString (directory != "") "/${directory}";
|
|
|
|
in
|
|
buildDhallPackage (
|
|
{
|
|
inherit dependencies source;
|
|
|
|
name = versionedName;
|
|
|
|
code = "${src}${prefix}/${file}";
|
|
}
|
|
// lib.optionalAttrs document {
|
|
documentationRoot = "${src}/${prefix}";
|
|
|
|
baseImportUrl = "https://raw.githubusercontent.com/${owner}/${repo}/${rev}${prefix}";
|
|
}
|
|
)
|
|
)
|