Skip to content

Commit

Permalink
treewide: format all inactive Nix files
Browse files Browse the repository at this point in the history
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/76d7ed74cc8d258925cb5f7765cd9ec3ca80a358.tar.gz \
      --argstr baseRev 59f1eaf
    result/bin/apply-formatting $NIXPKGS_PATH
  • Loading branch information
infinisil committed Dec 10, 2024
1 parent 59f1eaf commit 46463e1
Show file tree
Hide file tree
Showing 21,389 changed files with 712,065 additions and 435,542 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
61 changes: 35 additions & 26 deletions nixos/lib/test-driver/default.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
{ lib
, python3Packages
, enableOCR ? false
, qemu_pkg ? qemu_test
, coreutils
, imagemagick_light
, netpbm
, qemu_test
, socat
, ruff
, tesseract4
, vde2
, extraPythonPackages ? (_ : [])
, nixosTests
{
lib,
python3Packages,
enableOCR ? false,
qemu_pkg ? qemu_test,
coreutils,
imagemagick_light,
netpbm,
qemu_test,
socat,
ruff,
tesseract4,
vde2,
extraPythonPackages ? (_: [ ]),
nixosTests,
}:
let
fs = lib.fileset;
Expand All @@ -29,17 +30,21 @@ python3Packages.buildPythonApplication {
};
pyproject = true;

propagatedBuildInputs = [
coreutils
netpbm
python3Packages.colorama
python3Packages.junit-xml
python3Packages.ptpython
qemu_pkg
socat
vde2
]
++ (lib.optionals enableOCR [ imagemagick_light tesseract4 ])
propagatedBuildInputs =
[
coreutils
netpbm
python3Packages.colorama
python3Packages.junit-xml
python3Packages.ptpython
qemu_pkg
socat
vde2
]
++ (lib.optionals enableOCR [
imagemagick_light
tesseract4
])
++ extraPythonPackages python3Packages;

nativeBuildInputs = [
Expand All @@ -51,7 +56,11 @@ python3Packages.buildPythonApplication {
};

doCheck = true;
nativeCheckInputs = with python3Packages; [ mypy ruff black ];
nativeCheckInputs = with python3Packages; [
mypy
ruff
black
];
checkPhase = ''
echo -e "\x1b[32m## run mypy\x1b[0m"
mypy test_driver extract-docstrings.py
Expand Down
7 changes: 6 additions & 1 deletion nixos/modules/config/vte.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let

vteInitSnippet = ''
Expand Down
39 changes: 23 additions & 16 deletions nixos/modules/config/xdg/icons.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
{
meta = {
maintainers = lib.teams.freedesktop.members;
Expand All @@ -15,7 +20,7 @@
};
xdg.icons.fallbackCursorThemes = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [];
default = [ ];
description = ''
Names of the fallback cursor themes, in order of preference, to be used when no other icon source can be found.
Set to `[]` to disable the fallback entirely.
Expand All @@ -29,20 +34,22 @@
"/share/pixmaps"
];

environment.systemPackages = [
# Empty icon theme that contains index.theme file describing directories
# where toolkits should look for icons installed by apps.
pkgs.hicolor-icon-theme
] ++ lib.optionals (config.xdg.icons.fallbackCursorThemes != []) [
(pkgs.writeTextFile {
name = "fallback-cursor-theme";
text = ''
[Icon Theme]
Inherits=${lib.concatStringsSep "," config.xdg.icons.fallbackCursorThemes}
'';
destination = "/share/icons/default/index.theme";
})
];
environment.systemPackages =
[
# Empty icon theme that contains index.theme file describing directories
# where toolkits should look for icons installed by apps.
pkgs.hicolor-icon-theme
]
++ lib.optionals (config.xdg.icons.fallbackCursorThemes != [ ]) [
(pkgs.writeTextFile {
name = "fallback-cursor-theme";
text = ''
[Icon Theme]
Inherits=${lib.concatStringsSep "," config.xdg.icons.fallbackCursorThemes}
'';
destination = "/share/icons/default/index.theme";
})
];

# libXcursor looks for cursors in XCURSOR_PATH
# it mostly follows the spec for icons
Expand Down
47 changes: 34 additions & 13 deletions nixos/modules/config/xdg/portal.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:

let
inherit (lib)
Expand All @@ -8,17 +13,22 @@ let
mkRenamedOptionModule
mkRemovedOptionModule
teams
types;
types
;

associationOptions = with types; attrsOf (
coercedTo (either (listOf str) str) (x: lib.concatStringsSep ";" (lib.toList x)) str
);
associationOptions =
with types;
attrsOf (coercedTo (either (listOf str) str) (x: lib.concatStringsSep ";" (lib.toList x)) str);
in

{
imports = [
(mkRenamedOptionModule [ "services" "flatpak" "extraPortals" ] [ "xdg" "portal" "extraPortals" ])
(mkRemovedOptionModule [ "xdg" "portal" "gtkUsePortal" ] "This option has been removed due to being unsupported and discouraged by the GTK developers.")
(mkRemovedOptionModule [
"xdg"
"portal"
"gtkUsePortal"
] "This option has been removed due to being unsupported and discouraged by the GTK developers.")
];

meta = {
Expand All @@ -27,7 +37,8 @@ in

options.xdg.portal = {
enable =
mkEnableOption ''[xdg desktop integration](https://github.com/flatpak/xdg-desktop-portal)'' // {
mkEnableOption ''[xdg desktop integration](https://github.com/flatpak/xdg-desktop-portal)''
// {
default = false;
};

Expand Down Expand Up @@ -60,10 +71,16 @@ in
default = { };
example = {
x-cinnamon = {
default = [ "xapp" "gtk" ];
default = [
"xapp"
"gtk"
];
};
pantheon = {
default = [ "pantheon" "gtk" ];
default = [
"pantheon"
"gtk"
];
"org.freedesktop.impl.portal.Secret" = [ "gnome-keyring" ];
};
common = {
Expand Down Expand Up @@ -136,11 +153,15 @@ in
NIX_XDG_DESKTOP_PORTAL_DIR = "/run/current-system/sw/share/xdg-desktop-portal/portals";
};

etc = lib.concatMapAttrs
(desktop: conf: lib.optionalAttrs (conf != { }) {
"xdg/xdg-desktop-portal/${lib.optionalString (desktop != "common") "${desktop}-"}portals.conf".text =
etc = lib.concatMapAttrs (
desktop: conf:
lib.optionalAttrs (conf != { }) {
"xdg/xdg-desktop-portal/${
lib.optionalString (desktop != "common") "${desktop}-"
}portals.conf".text =
lib.generators.toINI { } { preferred = conf; };
}) cfg.config;
}
) cfg.config;
};
};
}
20 changes: 13 additions & 7 deletions nixos/modules/config/xdg/portals/lxqt.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let
cfg = config.xdg.portal.lxqt;

Expand All @@ -19,12 +24,13 @@ in

styles = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [];
example = lib.literalExpression ''[
pkgs.libsForQt5.qtstyleplugin-kvantum
pkgs.breeze-qt5
pkgs.qtcurve
];
default = [ ];
example = lib.literalExpression ''
[
pkgs.libsForQt5.qtstyleplugin-kvantum
pkgs.breeze-qt5
pkgs.qtcurve
];
'';
description = ''
Extra Qt styles that will be available to the
Expand Down
7 changes: 6 additions & 1 deletion nixos/modules/config/xdg/portals/wlr.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let
cfg = config.xdg.portal.wlr;
package = pkgs.xdg-desktop-portal-wlr;
Expand Down
7 changes: 6 additions & 1 deletion nixos/modules/config/xdg/sounds.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
{
meta = {
maintainers = lib.teams.freedesktop.members;
Expand Down
13 changes: 11 additions & 2 deletions nixos/modules/config/xdg/terminal-exec.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@

let
cfg = config.xdg.terminal-exec;
inherit (lib) mkIf mkEnableOption mkOption mkPackageOption types;
inherit (lib)
mkIf
mkEnableOption
mkOption
mkPackageOption
types
;
in
{
meta.maintainers = with lib.maintainers; [ Cryolitia ];
Expand All @@ -30,7 +36,10 @@ in
'';
example = {
default = [ "kitty.desktop" ];
GNOME = [ "com.raggesilver.BlackBox.desktop" "org.gnome.Terminal.desktop" ];
GNOME = [
"com.raggesilver.BlackBox.desktop"
"org.gnome.Terminal.desktop"
];
};
};
};
Expand Down
7 changes: 6 additions & 1 deletion nixos/modules/hardware/acpilight.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
cfg = config.hardware.acpilight;
in
Expand Down
Loading

0 comments on commit 46463e1

Please sign in to comment.