From e6c84d0f29eba5af269252cc8e27cd7e8d7d6cc0 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 22 Jul 2024 00:32:54 +0300 Subject: [PATCH] alejandra: remove spaced elements patch --- .../0002-spaced-elements.patch | 520 ------------------ pkgs/alejandra-custom/package.nix | 5 +- 2 files changed, 1 insertion(+), 524 deletions(-) delete mode 100644 pkgs/alejandra-custom/0002-spaced-elements.patch diff --git a/pkgs/alejandra-custom/0002-spaced-elements.patch b/pkgs/alejandra-custom/0002-spaced-elements.patch deleted file mode 100644 index 64f2a63..0000000 --- a/pkgs/alejandra-custom/0002-spaced-elements.patch +++ /dev/null @@ -1,520 +0,0 @@ -From 0fdb0c51c1de1ceafcfdbbc3d339434b3a667095 Mon Sep 17 00:00:00 2001 -From: Sofi -Date: Mon, 10 Jun 2024 16:28:23 +0200 -Subject: [PATCH 1/2] feat: spaces around inline attr-sets - ---- - src/alejandra/src/rules/attr_set.rs | 4 ++++ - src/alejandra/tests/cases/apply/out.nix | 16 ++++++++-------- - src/alejandra/tests/cases/attr_set/out.nix | 8 ++++---- - src/alejandra/tests/cases/idioms_nixos_1/out.nix | 4 ++-- - src/alejandra/tests/cases/idioms_pkgs_2/out.nix | 4 ++-- - src/alejandra/tests/cases/idioms_pkgs_3/out.nix | 4 ++-- - src/alejandra/tests/cases/inherit/out.nix | 2 +- - src/alejandra/tests/cases/inherit_from/out.nix | 2 +- - src/alejandra/tests/cases/key_value/out.nix | 6 +++--- - src/alejandra/tests/cases/with/out.nix | 8 ++++---- - 10 files changed, 31 insertions(+), 27 deletions(-) - -diff --git a/src/alejandra/src/rules/attr_set.rs b/src/alejandra/src/rules/attr_set.rs -index 9459977..8b637a1 100644 ---- a/src/alejandra/src/rules/attr_set.rs -+++ b/src/alejandra/src/rules/attr_set.rs -@@ -62,6 +62,8 @@ pub(crate) fn rule( - steps.push_back(crate::builder::Step::Format(child)); - if vertical { - steps.push_back(crate::builder::Step::Indent); -+ } else if items_count >= 1 { -+ steps.push_back(crate::builder::Step::Whitespace); - } - - let mut item_index: usize = 0; -@@ -120,6 +122,8 @@ pub(crate) fn rule( - steps.push_back(crate::builder::Step::Dedent); - steps.push_back(crate::builder::Step::NewLine); - steps.push_back(crate::builder::Step::Pad); -+ } else if items_count >= 1 { -+ steps.push_back(crate::builder::Step::Whitespace); - } - steps.push_back(crate::builder::Step::Format(child)); - -diff --git a/src/alejandra/tests/cases/apply/out.nix b/src/alejandra/tests/cases/apply/out.nix -index 77a7d97..7a0bd11 100644 ---- a/src/alejandra/tests/cases/apply/out.nix -+++ b/src/alejandra/tests/cases/apply/out.nix -@@ -41,19 +41,19 @@ - name1 = - function - arg -- {asdf = 1;}; -+ { asdf = 1; }; - - name2 = - function - arg -- {asdf = 1;} -+ { asdf = 1; } - argument; - - name3 = - function - arg -- {asdf = 1;} -- {qwer = 12345;} -+ { asdf = 1; } -+ { qwer = 12345; } - argument; - } - { -@@ -79,7 +79,7 @@ - name4 = - function - arg -- {asdf = 1;} -+ { asdf = 1; } - { - qwer = 12345; - qwer2 = 54321; -@@ -88,21 +88,21 @@ - } - { - option1 = -- function arg {asdf = 1;} { -+ function arg { asdf = 1; } { - qwer = 12345; - qwer2 = 54321; - } - lastArg; - - option2 = -- function arg {asdf = 1;} { -+ function arg { asdf = 1; } { - qwer = 12345; - qwer2 = 54321; - } - lastArg; - - option3 = -- function arg {asdf = 1;} -+ function arg { asdf = 1; } - { - qwer = 12345; - qwer2 = 54321; -diff --git a/src/alejandra/tests/cases/attr_set/out.nix b/src/alejandra/tests/cases/attr_set/out.nix -index 18e6026..e5ac999 100644 ---- a/src/alejandra/tests/cases/attr_set/out.nix -+++ b/src/alejandra/tests/cases/attr_set/out.nix -@@ -5,12 +5,12 @@ - a - */ - } -- {a = 1;} -+ { a = 1; } - { - a = 1; - } - -- {b = 1;} -+ { b = 1; } - { - b = 1; - /* -@@ -33,7 +33,7 @@ - */ - } - -- rec {c = 1;} -+ rec { c = 1; } - rec { - c = 1; - /* -@@ -101,7 +101,7 @@ - a = { - a = rec { - a = { -- a = rec {a = {a = rec {a = {a = rec {a = {};};};};};}; -+ a = rec { a = { a = rec { a = { a = rec { a = {}; }; }; }; }; }; - }; - }; - }; -diff --git a/src/alejandra/tests/cases/idioms_nixos_1/out.nix b/src/alejandra/tests/cases/idioms_nixos_1/out.nix -index ae087c2..b2f555c 100644 ---- a/src/alejandra/tests/cases/idioms_nixos_1/out.nix -+++ b/src/alejandra/tests/cases/idioms_nixos_1/out.nix -@@ -33,7 +33,7 @@ in { - - boot.kernelPackages = mkOption { - default = pkgs.linuxPackages; -- type = types.unspecified // {merge = mergeEqualOption;}; -+ type = types.unspecified // { merge = mergeEqualOption; }; - apply = kernelPackages: - kernelPackages.extend (self: super: { - kernel = super.kernel.override (originalArgs: { -@@ -263,7 +263,7 @@ in { - }) - - (mkIf (!config.boot.isContainer) { -- system.build = {inherit kernel;}; -+ system.build = { inherit kernel; }; - - system.modulesTree = [kernel] ++ config.boot.extraModulePackages; - -diff --git a/src/alejandra/tests/cases/idioms_pkgs_2/out.nix b/src/alejandra/tests/cases/idioms_pkgs_2/out.nix -index dd0a2b5..befac3b 100644 ---- a/src/alejandra/tests/cases/idioms_pkgs_2/out.nix -+++ b/src/alejandra/tests/cases/idioms_pkgs_2/out.nix -@@ -19,13 +19,13 @@ stdenv.mkDerivation rec { - doCheck = true; - - passthru.tests = { -- version = testVersion {package = hello;}; -+ version = testVersion { package = hello; }; - - invariant-under-noXlibs = - testEqualDerivation - "hello must not be rebuilt when environment.noXlibs is set." - hello -- (nixos {environment.noXlibs = true;}).pkgs.hello; -+ (nixos { environment.noXlibs = true; }).pkgs.hello; - }; - - meta = with lib; { -diff --git a/src/alejandra/tests/cases/idioms_pkgs_3/out.nix b/src/alejandra/tests/cases/idioms_pkgs_3/out.nix -index ae087c2..b2f555c 100644 ---- a/src/alejandra/tests/cases/idioms_pkgs_3/out.nix -+++ b/src/alejandra/tests/cases/idioms_pkgs_3/out.nix -@@ -33,7 +33,7 @@ in { - - boot.kernelPackages = mkOption { - default = pkgs.linuxPackages; -- type = types.unspecified // {merge = mergeEqualOption;}; -+ type = types.unspecified // { merge = mergeEqualOption; }; - apply = kernelPackages: - kernelPackages.extend (self: super: { - kernel = super.kernel.override (originalArgs: { -@@ -263,7 +263,7 @@ in { - }) - - (mkIf (!config.boot.isContainer) { -- system.build = {inherit kernel;}; -+ system.build = { inherit kernel; }; - - system.modulesTree = [kernel] ++ config.boot.extraModulePackages; - -diff --git a/src/alejandra/tests/cases/inherit/out.nix b/src/alejandra/tests/cases/inherit/out.nix -index c3b983d..65da28b 100644 ---- a/src/alejandra/tests/cases/inherit/out.nix -+++ b/src/alejandra/tests/cases/inherit/out.nix -@@ -7,7 +7,7 @@ - aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa - ; - } -- {inherit b d;} -+ { inherit b d; } - { - inherit - b -diff --git a/src/alejandra/tests/cases/inherit_from/out.nix b/src/alejandra/tests/cases/inherit_from/out.nix -index 0155df5..7252bc4 100644 ---- a/src/alejandra/tests/cases/inherit_from/out.nix -+++ b/src/alejandra/tests/cases/inherit_from/out.nix -@@ -1,5 +1,5 @@ - [ -- {inherit (c) f h;} -+ { inherit (c) f h; } - { - inherit - (c) -diff --git a/src/alejandra/tests/cases/key_value/out.nix b/src/alejandra/tests/cases/key_value/out.nix -index af2f520..f817892 100644 ---- a/src/alejandra/tests/cases/key_value/out.nix -+++ b/src/alejandra/tests/cases/key_value/out.nix -@@ -4,7 +4,7 @@ rec - a = 4; - a = a: b; - -- a = {a = 1;}; -+ a = { a = 1; }; - - b = { - a = -@@ -79,7 +79,7 @@ rec - */ - ; - }; -- j = a: {b = 1;}; -+ j = a: { b = 1; }; - k = a: { - b = 1; - c = 2; -@@ -88,7 +88,7 @@ rec - /* - b - */ -- {b = 1;}; -+ { b = 1; }; - m = a: - /* - b -diff --git a/src/alejandra/tests/cases/with/out.nix b/src/alejandra/tests/cases/with/out.nix -index cd15509..b31b2f0 100644 ---- a/src/alejandra/tests/cases/with/out.nix -+++ b/src/alejandra/tests/cases/with/out.nix -@@ -21,9 +21,9 @@ - c) - (with b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc) - (with b; cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc) -- {a = with b; 1;} -- {a = with b; 1 + 1;} -- {a = with b; {c = 1;};} -+ { a = with b; 1; } -+ { a = with b; 1 + 1; } -+ { a = with b; { c = 1; }; } - { - a = with b; { - c = 1; -@@ -40,7 +40,7 @@ - a = with b; 1; - # comment - } -- (with a; with b; with c; {a = 1;}) -+ (with a; with b; with c; { a = 1; }) - (with a; - with b; - with c; { - -From 694fe8098f97c7ff313087ca138f9da06718d978 Mon Sep 17 00:00:00 2001 -From: Sofi -Date: Mon, 10 Jun 2024 16:36:28 +0200 -Subject: [PATCH 2/2] feat: spaces around inline lists - ---- - src/alejandra/src/rules/list.rs | 6 +++++- - src/alejandra/tests/cases/idioms_lib_2/out.nix | 6 +++--- - src/alejandra/tests/cases/idioms_nixos_1/out.nix | 16 ++++++++-------- - src/alejandra/tests/cases/idioms_pkgs_1/out.nix | 2 +- - src/alejandra/tests/cases/idioms_pkgs_2/out.nix | 2 +- - src/alejandra/tests/cases/idioms_pkgs_3/out.nix | 16 ++++++++-------- - src/alejandra/tests/cases/lists/out.nix | 4 ++-- - src/alejandra/tests/cases/monsters_3/out.nix | 4 ++-- - 8 files changed, 30 insertions(+), 26 deletions(-) - -diff --git a/src/alejandra/src/rules/list.rs b/src/alejandra/src/rules/list.rs -index 3e33e14..df9b9e6 100644 ---- a/src/alejandra/src/rules/list.rs -+++ b/src/alejandra/src/rules/list.rs -@@ -23,7 +23,9 @@ pub(crate) fn rule( - steps.push_back(crate::builder::Step::Format(child)); - if vertical { - steps.push_back(crate::builder::Step::Indent); -- } -+ } else if items_count >= 1 { -+ steps.push_back(crate::builder::Step::Whitespace); -+ } - - let mut item_index: usize = 0; - let mut inline_next_comment = false; -@@ -90,6 +92,8 @@ pub(crate) fn rule( - steps.push_back(crate::builder::Step::Dedent); - steps.push_back(crate::builder::Step::NewLine); - steps.push_back(crate::builder::Step::Pad); -+ } else if items_count >= 1 { -+ steps.push_back(crate::builder::Step::Whitespace); - } - steps.push_back(crate::builder::Step::Format(child)); - -diff --git a/src/alejandra/tests/cases/idioms_lib_2/out.nix b/src/alejandra/tests/cases/idioms_lib_2/out.nix -index 9911edf..2a3b2d8 100644 ---- a/src/alejandra/tests/cases/idioms_lib_2/out.nix -+++ b/src/alejandra/tests/cases/idioms_lib_2/out.nix -@@ -387,7 +387,7 @@ - Type: string -> a -> a - */ - warn = -- if lib.elem (builtins.getEnv "NIX_ABORT_ON_WARN") ["1" "true" "yes"] -+ if lib.elem (builtins.getEnv "NIX_ABORT_ON_WARN") [ "1" "true" "yes" ] - then msg: builtins.trace "[1;31mwarning: ${msg}[0m" (abort "NIX_ABORT_ON_WARN=true; warnings are treated as unrecoverable errors.") - else msg: builtins.trace "[1;31mwarning: ${msg}[0m"; - -@@ -526,12 +526,12 @@ - toBaseDigits = base: i: let - go = i: - if i < base -- then [i] -+ then [ i ] - else let - r = i - ((i / base) * base); - q = (i - r) / base; - in -- [r] ++ go q; -+ [ r ] ++ go q; - in - assert (base >= 2); - assert (i >= 0); -diff --git a/src/alejandra/tests/cases/idioms_nixos_1/out.nix b/src/alejandra/tests/cases/idioms_nixos_1/out.nix -index b2f555c..27f0329 100644 ---- a/src/alejandra/tests/cases/idioms_nixos_1/out.nix -+++ b/src/alejandra/tests/cases/idioms_nixos_1/out.nix -@@ -134,7 +134,7 @@ in { - boot.initrd.availableKernelModules = mkOption { - type = types.listOf types.str; - default = []; -- example = ["sata_nv" "ext3"]; -+ example = [ "sata_nv" "ext3" ]; - description = '' - The set of kernel modules in the initial ramdisk used during the - boot process. This set must include all modules necessary for -@@ -265,20 +265,20 @@ in { - (mkIf (!config.boot.isContainer) { - system.build = { inherit kernel; }; - -- system.modulesTree = [kernel] ++ config.boot.extraModulePackages; -+ system.modulesTree = [ kernel ] ++ config.boot.extraModulePackages; - - # Implement consoleLogLevel both in early boot and using sysctl - # (so you don't need to reboot to have changes take effect). - boot.kernelParams = -- ["loglevel=${toString config.boot.consoleLogLevel}"] -- ++ optionals config.boot.vesa ["vga=0x317" "nomodeset"]; -+ [ "loglevel=${toString config.boot.consoleLogLevel}" ] -+ ++ optionals config.boot.vesa [ "vga=0x317" "nomodeset" ]; - - boot.kernel.sysctl."kernel.printk" = mkDefault config.boot.consoleLogLevel; - -- boot.kernelModules = ["loop" "atkbd"]; -+ boot.kernelModules = [ "loop" "atkbd" ]; - - # The Linux kernel >= 2.6.27 provides firmware. -- hardware.firmware = [kernel]; -+ hardware.firmware = [ kernel ]; - - # Create /etc/modules-load.d/nixos.conf, which is read by - # systemd-modules-load.service to load required kernel modules. -@@ -287,8 +287,8 @@ in { - }; - - systemd.services.systemd-modules-load = { -- wantedBy = ["multi-user.target"]; -- restartTriggers = [kernelModulesConf]; -+ wantedBy = [ "multi-user.target" ]; -+ restartTriggers = [ kernelModulesConf ]; - serviceConfig = { - # Ignore failed module loads. Typically some of the - # modules in ‘boot.kernelModules’ are "nice to have but -diff --git a/src/alejandra/tests/cases/idioms_pkgs_1/out.nix b/src/alejandra/tests/cases/idioms_pkgs_1/out.nix -index dbee48d..129d59d 100644 ---- a/src/alejandra/tests/cases/idioms_pkgs_1/out.nix -+++ b/src/alejandra/tests/cases/idioms_pkgs_1/out.nix -@@ -11,7 +11,7 @@ stdenv.mkDerivation rec { - url = "example/${version}"; - }; - meta = with lib; { -- maintainers = with maintainers; [someone]; -+ maintainers = with maintainers; [ someone ]; - description = "something"; - }; - } -diff --git a/src/alejandra/tests/cases/idioms_pkgs_2/out.nix b/src/alejandra/tests/cases/idioms_pkgs_2/out.nix -index befac3b..2448b6e 100644 ---- a/src/alejandra/tests/cases/idioms_pkgs_2/out.nix -+++ b/src/alejandra/tests/cases/idioms_pkgs_2/out.nix -@@ -37,7 +37,7 @@ stdenv.mkDerivation rec { - homepage = "https://www.gnu.org/software/hello/manual/"; - changelog = "https://git.savannah.gnu.org/cgit/hello.git/plain/NEWS?h=v${version}"; - license = licenses.gpl3Plus; -- maintainers = [maintainers.eelco]; -+ maintainers = [ maintainers.eelco ]; - platforms = platforms.all; - }; - } -diff --git a/src/alejandra/tests/cases/idioms_pkgs_3/out.nix b/src/alejandra/tests/cases/idioms_pkgs_3/out.nix -index b2f555c..27f0329 100644 ---- a/src/alejandra/tests/cases/idioms_pkgs_3/out.nix -+++ b/src/alejandra/tests/cases/idioms_pkgs_3/out.nix -@@ -134,7 +134,7 @@ in { - boot.initrd.availableKernelModules = mkOption { - type = types.listOf types.str; - default = []; -- example = ["sata_nv" "ext3"]; -+ example = [ "sata_nv" "ext3" ]; - description = '' - The set of kernel modules in the initial ramdisk used during the - boot process. This set must include all modules necessary for -@@ -265,20 +265,20 @@ in { - (mkIf (!config.boot.isContainer) { - system.build = { inherit kernel; }; - -- system.modulesTree = [kernel] ++ config.boot.extraModulePackages; -+ system.modulesTree = [ kernel ] ++ config.boot.extraModulePackages; - - # Implement consoleLogLevel both in early boot and using sysctl - # (so you don't need to reboot to have changes take effect). - boot.kernelParams = -- ["loglevel=${toString config.boot.consoleLogLevel}"] -- ++ optionals config.boot.vesa ["vga=0x317" "nomodeset"]; -+ [ "loglevel=${toString config.boot.consoleLogLevel}" ] -+ ++ optionals config.boot.vesa [ "vga=0x317" "nomodeset" ]; - - boot.kernel.sysctl."kernel.printk" = mkDefault config.boot.consoleLogLevel; - -- boot.kernelModules = ["loop" "atkbd"]; -+ boot.kernelModules = [ "loop" "atkbd" ]; - - # The Linux kernel >= 2.6.27 provides firmware. -- hardware.firmware = [kernel]; -+ hardware.firmware = [ kernel ]; - - # Create /etc/modules-load.d/nixos.conf, which is read by - # systemd-modules-load.service to load required kernel modules. -@@ -287,8 +287,8 @@ in { - }; - - systemd.services.systemd-modules-load = { -- wantedBy = ["multi-user.target"]; -- restartTriggers = [kernelModulesConf]; -+ wantedBy = [ "multi-user.target" ]; -+ restartTriggers = [ kernelModulesConf ]; - serviceConfig = { - # Ignore failed module loads. Typically some of the - # modules in ‘boot.kernelModules’ are "nice to have but -diff --git a/src/alejandra/tests/cases/lists/out.nix b/src/alejandra/tests/cases/lists/out.nix -index dedee64..43a9de3 100644 ---- a/src/alejandra/tests/cases/lists/out.nix -+++ b/src/alejandra/tests/cases/lists/out.nix -@@ -1,11 +1,11 @@ - [ -- [1] -+ [ 1 ] - - [ - 1 - ] - -- [b d] -+ [ b d ] - [ - b - d -diff --git a/src/alejandra/tests/cases/monsters_3/out.nix b/src/alejandra/tests/cases/monsters_3/out.nix -index 25ff805..fd242fb 100644 ---- a/src/alejandra/tests/cases/monsters_3/out.nix -+++ b/src/alejandra/tests/cases/monsters_3/out.nix -@@ -45,7 +45,7 @@ stdenv.mkDerivation rec { - wrapGAppsHook4 - glib # for glib-compile-resources - ]; -- buildInputs = [cairo glib gtk4 libadwaita pango]; -+ buildInputs = [ cairo glib gtk4 libadwaita pango ]; - postPatch = '' - patchShebangs build-aux/meson_post_install.py - # https://gitlab.gnome.org/World/design/contrast/-/merge_requests/23 -@@ -56,7 +56,7 @@ stdenv.mkDerivation rec { - description = "Checks whether the contrast between two colors meet the WCAG requirements"; - homepage = "https://gitlab.gnome.org/World/design/contrast"; - license = licenses.gpl3Plus; -- maintainers = with maintainers; [jtojnar]; -+ maintainers = with maintainers; [ jtojnar ]; - platforms = platforms.unix; - }; - } - diff --git a/pkgs/alejandra-custom/package.nix b/pkgs/alejandra-custom/package.nix index e063cde..65e7c57 100644 --- a/pkgs/alejandra-custom/package.nix +++ b/pkgs/alejandra-custom/package.nix @@ -5,10 +5,7 @@ alejandra.overrideAttrs (prev: { patches = (prev.patches or []) - ++ [ - ./0001-no-ads.patch - ./0002-spaced-elements.patch # Courtesy of @soupglasses - ]; + ++ [./0001-no-ads.patch]; meta.description = '' Patched version of Alejandra that removes ads and adds spaces in attrsets & lists