From 7265e57c9d643547368585895479e6ef6aa23622 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Mon, 5 Jun 2023 23:24:24 -0400 Subject: [PATCH] alejandra: Use overlay to remove ads --- overlays/alejandra-remove-ads.patch | 42 +++++++++++++++++++++++++++++ overlays/default.nix | 4 +++ 2 files changed, 46 insertions(+) create mode 100644 overlays/alejandra-remove-ads.patch diff --git a/overlays/alejandra-remove-ads.patch b/overlays/alejandra-remove-ads.patch new file mode 100644 index 00000000..7535eab9 --- /dev/null +++ b/overlays/alejandra-remove-ads.patch @@ -0,0 +1,42 @@ +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/overlays/default.nix b/overlays/default.nix index a18dc419..9f307ef7 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -16,6 +16,10 @@ outputHash = "sha256-cDy7sccuZj+RNjaDGjqczGl//zgmMAifjv/ZMEO/yyY="; }); }); + + alejandra = prev.alejandra.overrideAttrs (old: { + patches = (old.patches or []) ++ [./alejandra-remove-ads.patch]; + }); }) ]; }