From 43b19c16392b681f996a8b7929c075ca89e56bdd Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 25 Feb 2024 19:21:46 +0300 Subject: [PATCH] pkgs/alejandra-remove-ads: init at 3.0.0 --- README.md | 1 + patches/0003-alejandra-remove-ads.patch | 43 +++++++++++++++++++++++++ pkgs/default.nix | 8 +++-- 3 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 patches/0003-alejandra-remove-ads.patch diff --git a/README.md b/README.md index 3dcdecc..5edc130 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ There are several packages exposed by this flake. Each directory in `pkgs` conta | Package | Description | | :----------------- | :------------------------------------------------------------------------------------------------: | +| alejandra-no-ads | A patched version of the **Alejandra** Nix formatter, without the pesky ads. | | ani-cli | An up-to-date, auto updated version of ani-cli | | cloneit | A CLI tool to download specific GitHub directories or files | | foot-transparent | A patched version of the foot terminal emulator that brings back fullscreen transparency[^1] | diff --git a/patches/0003-alejandra-remove-ads.patch b/patches/0003-alejandra-remove-ads.patch new file mode 100644 index 0000000..eccee96 --- /dev/null +++ b/patches/0003-alejandra-remove-ads.patch @@ -0,0 +1,43 @@ +diff --git a/src/alejandra_cli/src/cli.rs b/src/alejandra_cli/src/cli.rs +index bab102c..b90bf1d 100644 +--- a/src/alejandra_cli/src/cli.rs ++++ b/src/alejandra_cli/src/cli.rs +@@ -7,7 +7,6 @@ use futures::future::RemoteHandle; + use futures::stream::FuturesUnordered; + use futures::task::SpawnExt; + +-use crate::ads::random_ad; + use crate::verbosity::Verbosity; + + /// The Uncompromising Nix Code Formatter. +@@ -203,11 +202,6 @@ pub fn main() -> std::io::Result<()> { + (true, false) => "requires formatting", + } + ); +- +- if in_place { +- eprintln!(); +- eprint!("{}", random_ad()); +- } + } + + std::process::exit(if in_place { 0 } else { 2 }); +@@ -218,8 +212,6 @@ pub fn main() -> std::io::Result<()> { + eprintln!( + "Congratulations! Your code complies with the Alejandra style." + ); +- eprintln!(); +- eprint!("{}", random_ad()); + } + + std::process::exit(0); +diff --git a/src/alejandra_cli/src/lib.rs b/src/alejandra_cli/src/lib.rs +index fd49ce8..258f656 100644 +--- a/src/alejandra_cli/src/lib.rs ++++ b/src/alejandra_cli/src/lib.rs +@@ -1,4 +1,3 @@ +-mod ads; + pub mod cli; + mod find; + mod verbosity; + diff --git a/pkgs/default.nix b/pkgs/default.nix index 45243e1..57ec9e2 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -19,7 +19,7 @@ }; packages = let - inherit (pkgs) callPackage foot; + inherit (pkgs) callPackage foot alejandra; pins = import ../npins; mkPackage = path: {__functor = self: self.override;} // (callPackage path {inherit pins;}); @@ -44,8 +44,12 @@ # patched packages foot-transparent = foot.overrideAttrs (prev: { mesonFlags = prev.mesonFlags ++ ["-Dfullscreen_alpha=true"]; - mainProgram = "foot"; patches = (prev.patches or []) ++ [../patches/0001-foot-transparent.patch]; + mainProgram = "foot"; + }); + + alejandra-no-ads = alejandra.overrideAttrs (prev: { + patches = (prev.patches or []) ++ [../patches/0003-alejandra-remove-ads.patch]; }); }; };