mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:
nix-build ci -A fmt.check
This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).
This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).
Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase
).
If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
This commit is contained in:
parent
2140bf39e4
commit
374e6bcc40
1523 changed files with 986047 additions and 513621 deletions
245
flake.nix
245
flake.nix
|
@ -3,17 +3,21 @@
|
|||
{
|
||||
description = "A collection of packages for the Nix package manager";
|
||||
|
||||
outputs = { self }:
|
||||
outputs =
|
||||
{ self }:
|
||||
let
|
||||
libVersionInfoOverlay = import ./lib/flake-version-info.nix self;
|
||||
lib = (import ./lib).extend libVersionInfoOverlay;
|
||||
|
||||
forAllSystems = lib.genAttrs lib.systems.flakeExposed;
|
||||
|
||||
jobs = forAllSystems (system: import ./pkgs/top-level/release.nix {
|
||||
nixpkgs = self;
|
||||
inherit system;
|
||||
});
|
||||
jobs = forAllSystems (
|
||||
system:
|
||||
import ./pkgs/top-level/release.nix {
|
||||
nixpkgs = self;
|
||||
inherit system;
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
/**
|
||||
|
@ -26,112 +30,142 @@
|
|||
*/
|
||||
# DON'T USE lib.extend TO ADD NEW FUNCTIONALITY.
|
||||
# THIS WAS A MISTAKE. See the warning in lib/default.nix.
|
||||
lib = lib.extend (final: prev: {
|
||||
lib = lib.extend (
|
||||
final: prev: {
|
||||
|
||||
/**
|
||||
Other NixOS-provided functionality, such as [`runTest`](https://nixos.org/manual/nixos/unstable/#sec-call-nixos-test-outside-nixos).
|
||||
See also `lib.nixosSystem`.
|
||||
*/
|
||||
nixos = import ./nixos/lib { lib = final; };
|
||||
/**
|
||||
Other NixOS-provided functionality, such as [`runTest`](https://nixos.org/manual/nixos/unstable/#sec-call-nixos-test-outside-nixos).
|
||||
See also `lib.nixosSystem`.
|
||||
*/
|
||||
nixos = import ./nixos/lib { lib = final; };
|
||||
|
||||
/**
|
||||
Create a NixOS system configuration.
|
||||
/**
|
||||
Create a NixOS system configuration.
|
||||
|
||||
Example:
|
||||
Example:
|
||||
|
||||
lib.nixosSystem {
|
||||
modules = [ ./configuration.nix ];
|
||||
lib.nixosSystem {
|
||||
modules = [ ./configuration.nix ];
|
||||
}
|
||||
|
||||
Inputs:
|
||||
|
||||
- `modules` (list of paths or inline modules): The NixOS modules to include in the system configuration.
|
||||
|
||||
- `specialArgs` (attribute set): Extra arguments to pass to all modules, that are available in `imports` but can not be extended or overridden by the `modules`.
|
||||
|
||||
- `modulesLocation` (path): A default location for modules that aren't passed by path, used for error messages.
|
||||
|
||||
Legacy inputs:
|
||||
|
||||
- `system`: Legacy alias for `nixpkgs.hostPlatform`, but this is already set in the generated `hardware-configuration.nix`, included by `configuration.nix`.
|
||||
- `pkgs`: Legacy alias for `nixpkgs.pkgs`; use `nixpkgs.pkgs` and `nixosModules.readOnlyPkgs` instead.
|
||||
*/
|
||||
nixosSystem =
|
||||
args:
|
||||
import ./nixos/lib/eval-config.nix (
|
||||
{
|
||||
lib = final;
|
||||
# Allow system to be set modularly in nixpkgs.system.
|
||||
# We set it to null, to remove the "legacy" entrypoint's
|
||||
# non-hermetic default.
|
||||
system = null;
|
||||
|
||||
modules = args.modules ++ [
|
||||
# This module is injected here since it exposes the nixpkgs self-path in as
|
||||
# constrained of contexts as possible to avoid more things depending on it and
|
||||
# introducing unnecessary potential fragility to changes in flakes itself.
|
||||
#
|
||||
# See: failed attempt to make pkgs.path not copy when using flakes:
|
||||
# https://github.com/NixOS/nixpkgs/pull/153594#issuecomment-1023287913
|
||||
(
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
config.nixpkgs.flake.source = self.outPath;
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
||||
// builtins.removeAttrs args [ "modules" ]
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
Inputs:
|
||||
|
||||
- `modules` (list of paths or inline modules): The NixOS modules to include in the system configuration.
|
||||
|
||||
- `specialArgs` (attribute set): Extra arguments to pass to all modules, that are available in `imports` but can not be extended or overridden by the `modules`.
|
||||
|
||||
- `modulesLocation` (path): A default location for modules that aren't passed by path, used for error messages.
|
||||
|
||||
Legacy inputs:
|
||||
|
||||
- `system`: Legacy alias for `nixpkgs.hostPlatform`, but this is already set in the generated `hardware-configuration.nix`, included by `configuration.nix`.
|
||||
- `pkgs`: Legacy alias for `nixpkgs.pkgs`; use `nixpkgs.pkgs` and `nixosModules.readOnlyPkgs` instead.
|
||||
*/
|
||||
nixosSystem = args:
|
||||
import ./nixos/lib/eval-config.nix (
|
||||
checks = forAllSystems (
|
||||
system:
|
||||
{
|
||||
tarball = jobs.${system}.tarball;
|
||||
}
|
||||
//
|
||||
lib.optionalAttrs
|
||||
(
|
||||
self.legacyPackages.${system}.stdenv.hostPlatform.isLinux
|
||||
# Exclude power64 due to "libressl is not available on the requested hostPlatform" with hostPlatform being power64
|
||||
&& !self.legacyPackages.${system}.targetPlatform.isPower64
|
||||
)
|
||||
{
|
||||
lib = final;
|
||||
# Allow system to be set modularly in nixpkgs.system.
|
||||
# We set it to null, to remove the "legacy" entrypoint's
|
||||
# non-hermetic default.
|
||||
system = null;
|
||||
|
||||
modules = args.modules ++ [
|
||||
# This module is injected here since it exposes the nixpkgs self-path in as
|
||||
# constrained of contexts as possible to avoid more things depending on it and
|
||||
# introducing unnecessary potential fragility to changes in flakes itself.
|
||||
#
|
||||
# See: failed attempt to make pkgs.path not copy when using flakes:
|
||||
# https://github.com/NixOS/nixpkgs/pull/153594#issuecomment-1023287913
|
||||
({ config, pkgs, lib, ... }: {
|
||||
config.nixpkgs.flake.source = self.outPath;
|
||||
})
|
||||
];
|
||||
} // builtins.removeAttrs args [ "modules" ]
|
||||
);
|
||||
});
|
||||
|
||||
checks = forAllSystems (system: {
|
||||
tarball = jobs.${system}.tarball;
|
||||
} // lib.optionalAttrs
|
||||
(
|
||||
self.legacyPackages.${system}.stdenv.hostPlatform.isLinux
|
||||
# Exclude power64 due to "libressl is not available on the requested hostPlatform" with hostPlatform being power64
|
||||
&& !self.legacyPackages.${system}.targetPlatform.isPower64
|
||||
)
|
||||
{
|
||||
# Test that ensures that the nixosSystem function can accept a lib argument
|
||||
# Note: prefer not to extend or modify `lib`, especially if you want to share reusable modules
|
||||
# alternatives include: `import` a file, or put a custom library in an option or in `_module.args.<libname>`
|
||||
nixosSystemAcceptsLib = (self.lib.nixosSystem {
|
||||
pkgs = self.legacyPackages.${system};
|
||||
lib = self.lib.extend (final: prev: {
|
||||
ifThisFunctionIsMissingTheTestFails = final.id;
|
||||
});
|
||||
modules = [
|
||||
./nixos/modules/profiles/minimal.nix
|
||||
({ lib, ... }: lib.ifThisFunctionIsMissingTheTestFails {
|
||||
# Define a minimal config without eval warnings
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
boot.loader.grub.enable = false;
|
||||
fileSystems."/".device = "nodev";
|
||||
# See https://search.nixos.org/options?show=system.stateVersion&query=stateversion
|
||||
system.stateVersion = lib.trivial.release; # DON'T do this in real configs!
|
||||
})
|
||||
];
|
||||
}).config.system.build.toplevel;
|
||||
});
|
||||
# Test that ensures that the nixosSystem function can accept a lib argument
|
||||
# Note: prefer not to extend or modify `lib`, especially if you want to share reusable modules
|
||||
# alternatives include: `import` a file, or put a custom library in an option or in `_module.args.<libname>`
|
||||
nixosSystemAcceptsLib =
|
||||
(self.lib.nixosSystem {
|
||||
pkgs = self.legacyPackages.${system};
|
||||
lib = self.lib.extend (
|
||||
final: prev: {
|
||||
ifThisFunctionIsMissingTheTestFails = final.id;
|
||||
}
|
||||
);
|
||||
modules = [
|
||||
./nixos/modules/profiles/minimal.nix
|
||||
(
|
||||
{ lib, ... }:
|
||||
lib.ifThisFunctionIsMissingTheTestFails {
|
||||
# Define a minimal config without eval warnings
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
boot.loader.grub.enable = false;
|
||||
fileSystems."/".device = "nodev";
|
||||
# See https://search.nixos.org/options?show=system.stateVersion&query=stateversion
|
||||
system.stateVersion = lib.trivial.release; # DON'T do this in real configs!
|
||||
}
|
||||
)
|
||||
];
|
||||
}).config.system.build.toplevel;
|
||||
}
|
||||
);
|
||||
|
||||
htmlDocs = {
|
||||
nixpkgsManual = builtins.mapAttrs (_: jobSet: jobSet.manual) jobs;
|
||||
nixosManual = (import ./nixos/release-small.nix {
|
||||
nixpkgs = self;
|
||||
}).nixos.manual;
|
||||
nixosManual =
|
||||
(import ./nixos/release-small.nix {
|
||||
nixpkgs = self;
|
||||
}).nixos.manual;
|
||||
};
|
||||
|
||||
devShells = forAllSystems (system:
|
||||
{ } // lib.optionalAttrs
|
||||
(
|
||||
# Exclude armv6l-linux because "Package ‘ghc-9.6.6’ in .../pkgs/development/compilers/ghc/common-hadrian.nix:579 is not available on the requested hostPlatform"
|
||||
system != "armv6l-linux"
|
||||
# Exclude riscv64-linux because "Package ‘ghc-9.6.6’ in .../pkgs/development/compilers/ghc/common-hadrian.nix:579 is not available on the requested hostPlatform"
|
||||
&& system != "riscv64-linux"
|
||||
# Exclude FreeBSD because "Package ‘ghc-9.6.6’ in .../pkgs/development/compilers/ghc/common-hadrian.nix:579 is not available on the requested hostPlatform"
|
||||
&& !self.legacyPackages.${system}.stdenv.hostPlatform.isFreeBSD
|
||||
)
|
||||
{
|
||||
/** A shell to get tooling for Nixpkgs development. See nixpkgs/shell.nix. */
|
||||
default = import ./shell.nix { inherit system; };
|
||||
});
|
||||
devShells = forAllSystems (
|
||||
system:
|
||||
{ }
|
||||
//
|
||||
lib.optionalAttrs
|
||||
(
|
||||
# Exclude armv6l-linux because "Package ‘ghc-9.6.6’ in .../pkgs/development/compilers/ghc/common-hadrian.nix:579 is not available on the requested hostPlatform"
|
||||
system != "armv6l-linux"
|
||||
# Exclude riscv64-linux because "Package ‘ghc-9.6.6’ in .../pkgs/development/compilers/ghc/common-hadrian.nix:579 is not available on the requested hostPlatform"
|
||||
&& system != "riscv64-linux"
|
||||
# Exclude FreeBSD because "Package ‘ghc-9.6.6’ in .../pkgs/development/compilers/ghc/common-hadrian.nix:579 is not available on the requested hostPlatform"
|
||||
&& !self.legacyPackages.${system}.stdenv.hostPlatform.isFreeBSD
|
||||
)
|
||||
{
|
||||
/**
|
||||
A shell to get tooling for Nixpkgs development. See nixpkgs/shell.nix.
|
||||
*/
|
||||
default = import ./shell.nix { inherit system; };
|
||||
}
|
||||
);
|
||||
|
||||
formatter = forAllSystems (system: (import ./ci { inherit system; }).fmt.pkg);
|
||||
|
||||
|
@ -154,10 +188,13 @@
|
|||
evaluation. Evaluating the attribute value tends to require a significant
|
||||
amount of computation, even considering lazy evaluation.
|
||||
*/
|
||||
legacyPackages = forAllSystems (system:
|
||||
(import ./. { inherit system; }).extend (final: prev: {
|
||||
lib = prev.lib.extend libVersionInfoOverlay;
|
||||
})
|
||||
legacyPackages = forAllSystems (
|
||||
system:
|
||||
(import ./. { inherit system; }).extend (
|
||||
final: prev: {
|
||||
lib = prev.lib.extend libVersionInfoOverlay;
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -176,7 +213,7 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
*/
|
||||
*/
|
||||
nixosModules = {
|
||||
notDetected = ./nixos/modules/installer/scan/not-detected.nix;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue