treewide: format all inactive Nix files

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
This commit is contained in:
Silvan Mosberger
2024-12-10 20:26:33 +01:00
parent b32a094368
commit 4f0dadbf38
21293 changed files with 701276 additions and 428232 deletions
+8 -1
View File
@@ -1,4 +1,11 @@
{ lib, stdenv, fetchurl, texinfo, texLive, perl }:
{
lib,
stdenv,
fetchurl,
texinfo,
texLive,
perl,
}:
stdenv.mkDerivation rec {
pname = "asdf";
+8 -1
View File
@@ -1,4 +1,11 @@
{ lib, stdenv, fetchurl, texinfo, texLive, perl }:
{
lib,
stdenv,
fetchurl,
texinfo,
texLive,
perl,
}:
stdenv.mkDerivation rec {
pname = "asdf";
+9 -1
View File
@@ -1,4 +1,12 @@
{ lib, stdenv, fetchurl, fetchpatch, texinfo, texLive, perl }:
{
lib,
stdenv,
fetchurl,
fetchpatch,
texinfo,
texLive,
perl,
}:
stdenv.mkDerivation rec {
pname = "asdf";
@@ -1,4 +1,11 @@
{ lib, stdenv, fetchurl, texinfo, texLive, perl }:
{
lib,
stdenv,
fetchurl,
texinfo,
texLive,
perl,
}:
stdenv.mkDerivation rec {
pname = "asdf";
File diff suppressed because it is too large Load Diff
+241 -154
View File
@@ -10,10 +10,12 @@
# - figure out a less awkward way to patch sources
# (have to build from src directly for SLIME to work, so can't just patch sources in place)
{ pkgs
, lib
, stdenv
, ... }:
{
pkgs,
lib,
stdenv,
...
}:
let
@@ -46,35 +48,52 @@ let
makeLibraryPath
makeSearchPath
recurseIntoAttrs
;
;
inherit (builtins)
head
tail
elem
split
storeDir;
storeDir
;
inherit (pkgs)
substituteAll;
substituteAll
;
# Stolen from python-packages.nix
# Actually no idea how this works
makeOverridableLispPackage = f: origArgs:
makeOverridableLispPackage =
f: origArgs:
let
ff = f origArgs;
overrideWith = newArgs: origArgs // (if pkgs.lib.isFunction newArgs then newArgs origArgs else newArgs);
overrideWith =
newArgs: origArgs // (if pkgs.lib.isFunction newArgs then newArgs origArgs else newArgs);
in
if builtins.isAttrs ff then (ff // {
overrideLispAttrs = newArgs: makeOverridableLispPackage f (overrideWith newArgs);
})
else if builtins.isFunction ff then {
if builtins.isAttrs ff then
(
ff
// {
overrideLispAttrs = newArgs: makeOverridableLispPackage f (overrideWith newArgs);
}
)
else if builtins.isFunction ff then
{
overrideLispAttrs = newArgs: makeOverridableLispPackage f (overrideWith newArgs);
__functor = self: ff;
}
else ff;
else
ff;
buildAsdf = { asdf, pkg, program, flags, faslExt }:
buildAsdf =
{
asdf,
pkg,
program,
flags,
faslExt,
}:
stdenv.mkDerivation {
inherit (asdf) pname version;
dontUnpack = true;
@@ -88,26 +107,26 @@ let
'';
};
#
# Wrapper around stdenv.mkDerivation for building ASDF systems.
#
build-asdf-system = makeOverridableLispPackage (
{ pname,
{
pname,
version,
src ? null,
patches ? [],
patches ? [ ],
# Native libraries, will be appended to the library path
nativeLibs ? [],
nativeLibs ? [ ],
# Java libraries for ABCL, will be appended to the class path
javaLibs ? [],
javaLibs ? [ ],
# Lisp dependencies
# these should be packages built with `build-asdf-system`
# TODO(kasper): use propagatedBuildInputs
lispLibs ? [],
lispLibs ? [ ],
# Derivation containing the CL implementation package
pkg,
@@ -116,7 +135,7 @@ let
program ? pkg.meta.mainProgram or pkg.pname,
# General flags to the Lisp executable
flags ? [],
flags ? [ ],
# Extension for implementation-dependent FASL files
faslExt,
@@ -143,117 +162,147 @@ let
# Other args to mkDerivation
...
} @ args:
}@args:
(stdenv.mkDerivation (rec {
inherit
version nativeLibs javaLibs lispLibs systems asds
pkg program flags faslExt
;
(
stdenv.mkDerivation (
rec {
inherit
version
nativeLibs
javaLibs
lispLibs
systems
asds
pkg
program
flags
faslExt
;
# When src is null, we are building a lispWithPackages and only
# want to make use of the dependency environment variables
# generated by build-asdf-system
dontUnpack = src == null;
# When src is null, we are building a lispWithPackages and only
# want to make use of the dependency environment variables
# generated by build-asdf-system
dontUnpack = src == null;
# Portable script to build the systems.
#
# `lisp` must evaluate this file then exit immediately. For
# example, SBCL's --script flag does just that.
#
# NOTE:
# Every other library worked fine with asdf:compile-system in
# buildScript.
#
# cl-syslog, for some reason, signals that CL-SYSLOG::VALID-SD-ID-P
# is undefined with compile-system, but works perfectly with
# load-system. Strange.
# Portable script to build the systems.
#
# `lisp` must evaluate this file then exit immediately. For
# example, SBCL's --script flag does just that.
#
# NOTE:
# Every other library worked fine with asdf:compile-system in
# buildScript.
#
# cl-syslog, for some reason, signals that CL-SYSLOG::VALID-SD-ID-P
# is undefined with compile-system, but works perfectly with
# load-system. Strange.
# TODO(kasper) portable quit
asdfFasl = buildAsdf { inherit asdf pkg program flags faslExt; };
# TODO(kasper) portable quit
asdfFasl = buildAsdf {
inherit
asdf
pkg
program
flags
faslExt
;
};
buildScript = substituteAll {
src = ./builder.lisp;
asdf = "${asdfFasl}/asdf.${faslExt}";
};
buildScript = substituteAll {
src = ./builder.lisp;
asdf = "${asdfFasl}/asdf.${faslExt}";
};
configurePhase = ''
runHook preConfigure
configurePhase = ''
runHook preConfigure
source ${./setup-hook.sh}
buildAsdfPath
source ${./setup-hook.sh}
buildAsdfPath
runHook postConfigure
'';
runHook postConfigure
'';
buildPhase = optionalString (src != null) ''
runHook preBuild
buildPhase = optionalString (src != null) ''
runHook preBuild
export CL_SOURCE_REGISTRY=$CL_SOURCE_REGISTRY:$src//
export ASDF_OUTPUT_TRANSLATIONS="$src:$(pwd):${storeDir}:${storeDir}"
${pkg}/bin/${program} ${toString flags} < $buildScript
export CL_SOURCE_REGISTRY=$CL_SOURCE_REGISTRY:$src//
export ASDF_OUTPUT_TRANSLATIONS="$src:$(pwd):${storeDir}:${storeDir}"
${pkg}/bin/${program} ${toString flags} < $buildScript
runHook postBuild
'';
runHook postBuild
'';
# Copy compiled files to store
#
# Make sure to include '$' in regex to prevent skipping
# stuff like 'iolib.asdf.asd' for system 'iolib.asd'
#
# Same with '/': `local-time.asd` for system `cl-postgres+local-time.asd`
installPhase =
let
mkSystemsRegex = systems:
concatMapStringsSep "\\|" (replaceStrings ["." "+"] ["[.]" "[+]"]) systems;
in
''
runHook preInstall
# Copy compiled files to store
#
# Make sure to include '$' in regex to prevent skipping
# stuff like 'iolib.asdf.asd' for system 'iolib.asd'
#
# Same with '/': `local-time.asd` for system `cl-postgres+local-time.asd`
installPhase =
let
mkSystemsRegex =
systems: concatMapStringsSep "\\|" (replaceStrings [ "." "+" ] [ "[.]" "[+]" ]) systems;
in
''
runHook preInstall
mkdir -pv $out
cp -r * $out
mkdir -pv $out
cp -r * $out
# Remove all .asd files except for those in `systems`.
find $out -name "*.asd" \
| grep -v "/\(${mkSystemsRegex systems}\)\.asd$" \
| xargs rm -fv || true
# Remove all .asd files except for those in `systems`.
find $out -name "*.asd" \
| grep -v "/\(${mkSystemsRegex systems}\)\.asd$" \
| xargs rm -fv || true
runHook postInstall
'';
runHook postInstall
'';
dontPatchShebangs = true;
dontPatchShebangs = true;
# Not sure if it's needed, but caused problems with SBCL
# save-lisp-and-die binaries in the past
dontStrip = true;
# Not sure if it's needed, but caused problems with SBCL
# save-lisp-and-die binaries in the past
dontStrip = true;
} // (args // (let
isJVM = args.pkg.pname == "abcl";
javaLibs = lib.optionals isJVM args.javaLibs or [];
in {
pname = "${args.pkg.pname}-${args.pname}";
src = if args?patches || args?postPatch
then pkgs.applyPatches {
inherit (args) src;
patches = args.patches or [];
postPatch = args.postPatch or "";
}
// (
args
// (
let
isJVM = args.pkg.pname == "abcl";
javaLibs = lib.optionals isJVM args.javaLibs or [ ];
in
{
pname = "${args.pkg.pname}-${args.pname}";
src =
if args ? patches || args ? postPatch then
pkgs.applyPatches {
inherit (args) src;
patches = args.patches or [ ];
postPatch = args.postPatch or "";
}
else
args.src;
patches = [ ];
inherit javaLibs;
propagatedBuildInputs = args.propagatedBuildInputs or [ ] ++ lispLibs ++ javaLibs ++ nativeLibs;
meta = (args.meta or { }) // {
maintainers = args.meta.maintainers or lib.teams.lisp.members;
};
}
else args.src;
patches = [];
inherit javaLibs;
propagatedBuildInputs = args.propagatedBuildInputs or []
++ lispLibs ++ javaLibs ++ nativeLibs;
meta = (args.meta or {}) // {
maintainers = args.meta.maintainers or lib.teams.lisp.members;
};
}))) // {
# Useful for overriding
# Overriding code would prefer to use pname from the attribute set
# However, pname is extended with the implementation name
# Moreover, it is used in the default list of systems to load
# So we pass the original pname
pname = args.pname;
}));
)
)
)
// {
# Useful for overriding
# Overriding code would prefer to use pname from the attribute set
# However, pname is extended with the implementation name
# Moreover, it is used in the default list of systems to load
# So we pass the original pname
pname = args.pname;
}
)
);
# Build the set of lisp packages using `lisp`
# These packages are defined manually for one reason or another:
@@ -266,19 +315,23 @@ let
#
# E.g if a QL package depends on cl-unicode it won't build out of
# the box.
commonLispPackagesFor = spec:
commonLispPackagesFor =
spec:
let
build-asdf-system' = body: build-asdf-system (body // spec);
in pkgs.callPackage ./packages.nix {
in
pkgs.callPackage ./packages.nix {
inherit spec quicklispPackagesFor;
build-asdf-system = build-asdf-system';
};
# Build the set of packages imported from quicklisp using `lisp`
quicklispPackagesFor = spec:
quicklispPackagesFor =
spec:
let
build-asdf-system' = body: build-asdf-system (body // spec);
in pkgs.callPackage ./ql.nix {
in
pkgs.callPackage ./ql.nix {
build-asdf-system = build-asdf-system';
};
@@ -288,55 +341,89 @@ let
# packages - as argument and returns the list of packages to be
# installed
# TODO(kasper): assert each package has the same lisp and asdf?
lispWithPackages = clpkgs: packages:
let first = head (lib.attrValues clpkgs); in
lispWithPackages =
clpkgs: packages:
let
first = head (lib.attrValues clpkgs);
in
(build-asdf-system {
inherit (first) pkg program flags faslExt asdf;
inherit (first)
pkg
program
flags
faslExt
asdf
;
# See dontUnpack in build-asdf-system
src = null;
pname = "with";
version = "packages";
lispLibs = packages clpkgs;
systems = [];
}).overrideAttrs(o: {
nativeBuildInputs = [ pkgs.makeBinaryWrapper ];
installPhase = ''
mkdir -pv $out/bin
makeWrapper \
${o.pkg}/bin/${o.program} \
$out/bin/${o.program} \
--add-flags "${toString o.flags}" \
--set ASDF "${o.asdfFasl}/asdf.${o.faslExt}" \
--prefix CL_SOURCE_REGISTRY : "$CL_SOURCE_REGISTRY''${CL_SOURCE_REGISTRY:+:}" \
--prefix ASDF_OUTPUT_TRANSLATIONS : "$(echo $CL_SOURCE_REGISTRY | sed s,//:,::,g):" \
--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH" \
--prefix DYLD_LIBRARY_PATH : "$DYLD_LIBRARY_PATH" \
--prefix CLASSPATH : "$CLASSPATH" \
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
--prefix PATH : "${makeBinPath (o.propagatedBuildInputs or [])}"
'';
});
systems = [ ];
}).overrideAttrs
(o: {
nativeBuildInputs = [ pkgs.makeBinaryWrapper ];
installPhase = ''
mkdir -pv $out/bin
makeWrapper \
${o.pkg}/bin/${o.program} \
$out/bin/${o.program} \
--add-flags "${toString o.flags}" \
--set ASDF "${o.asdfFasl}/asdf.${o.faslExt}" \
--prefix CL_SOURCE_REGISTRY : "$CL_SOURCE_REGISTRY''${CL_SOURCE_REGISTRY:+:}" \
--prefix ASDF_OUTPUT_TRANSLATIONS : "$(echo $CL_SOURCE_REGISTRY | sed s,//:,::,g):" \
--prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH" \
--prefix DYLD_LIBRARY_PATH : "$DYLD_LIBRARY_PATH" \
--prefix CLASSPATH : "$CLASSPATH" \
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
--prefix PATH : "${makeBinPath (o.propagatedBuildInputs or [ ])}"
'';
});
wrapLisp = {
pkg
, faslExt
, program ? pkg.meta.mainProgram or pkg.pname
, flags ? []
, asdf ? pkgs.asdf_3_3
, packageOverrides ? (self: super: {})
}:
wrapLisp =
{
pkg,
faslExt,
program ? pkg.meta.mainProgram or pkg.pname,
flags ? [ ],
asdf ? pkgs.asdf_3_3,
packageOverrides ? (self: super: { }),
}:
let
spec = { inherit pkg faslExt program flags asdf; };
spec = {
inherit
pkg
faslExt
program
flags
asdf
;
};
pkgs = (commonLispPackagesFor spec).overrideScope packageOverrides;
withPackages = lispWithPackages pkgs;
withOverrides = packageOverrides:
withOverrides =
packageOverrides:
wrapLisp {
inherit pkg faslExt program flags asdf;
inherit
pkg
faslExt
program
flags
asdf
;
inherit packageOverrides;
};
buildASDFSystem = args: build-asdf-system (args // spec);
in pkg // {
inherit pkgs withPackages withOverrides buildASDFSystem;
in
pkg
// {
inherit
pkgs
withPackages
withOverrides
buildASDFSystem
;
};
in wrapLisp
in
wrapLisp
+7 -5
View File
@@ -1,9 +1,10 @@
let
pkgs = import ../../../. {};
in pkgs.mkShell {
pkgs = import ../../../. { };
in
pkgs.mkShell {
nativeBuildInputs = [
(pkgs.sbcl.withPackages
(ps: with ps; [
(pkgs.sbcl.withPackages (
ps: with ps; [
alexandria
str
dexador
@@ -11,6 +12,7 @@ in pkgs.mkShell {
sqlite
arrow-macros
jzon
]))
]
))
];
}