about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/mailreaders/aerc
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-12-06 19:57:55 +0000
committerAlyssa Ross <hi@alyssa.is>2023-02-08 13:48:30 +0000
commitbf3aadfdd39aa197e18bade671fab6726349ffa4 (patch)
tree698567af766ed441d757b57a7b21e68d4a342a2b /nixpkgs/pkgs/applications/networking/mailreaders/aerc
parentf4afc5a01d9539ce09e47494e679c51f80723d07 (diff)
parent99665eb45f58d959d2cb9e49ddb960c79d596f33 (diff)
downloadnixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.gz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.bz2
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.lz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.xz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.zst
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.zip
Merge commit '99665eb45f58d959d2cb9e49ddb960c79d596f33'
Diffstat (limited to 'nixpkgs/pkgs/applications/networking/mailreaders/aerc')
-rw-r--r--nixpkgs/pkgs/applications/networking/mailreaders/aerc/default.nix37
-rw-r--r--nixpkgs/pkgs/applications/networking/mailreaders/aerc/runtime-sharedir.patch142
2 files changed, 109 insertions, 70 deletions
diff --git a/nixpkgs/pkgs/applications/networking/mailreaders/aerc/default.nix b/nixpkgs/pkgs/applications/networking/mailreaders/aerc/default.nix
index 172cea3d061d..394120ef8b29 100644
--- a/nixpkgs/pkgs/applications/networking/mailreaders/aerc/default.nix
+++ b/nixpkgs/pkgs/applications/networking/mailreaders/aerc/default.nix
@@ -1,21 +1,27 @@
-{ lib, buildGoModule, fetchFromSourcehut
-, ncurses, notmuch, scdoc
-, python3, w3m, dante
+{ lib
+, buildGoModule
+, fetchFromSourcehut
+, ncurses
+, notmuch
+, scdoc
+, python3
+, w3m
+, dante
 }:
 
 buildGoModule rec {
   pname = "aerc";
-  version = "0.7.1";
+  version = "0.11.0";
 
   src = fetchFromSourcehut {
     owner = "~rjarry";
     repo = pname;
     rev = version;
-    sha256 = "sha256-wiylBBqnivDnMUyCg3Zateu4jcjicTfrQFALT8dg5No=";
+    sha256 = "sha256-w0h6BNuGwXV1CzyvXvsRs2MXHKLbK3EUaK4mKiuNBxc=";
   };
 
   proxyVendor = true;
-  vendorSha256 = "sha256-hpGd78PWk3tIwB+TPmPy0gKkU8+t5NTm9RzPuLae+Fk=";
+  vendorSha256 = "sha256-vw9lDIZMswh/vrF1g8FvZ/faN5jWWPwfgnm66EWaohw=";
 
   doCheck = false;
 
@@ -28,22 +34,25 @@ buildGoModule rec {
     ./runtime-sharedir.patch
   ];
 
+  postPatch = ''
+    substituteAllInPlace config/aerc.conf
+    substituteAllInPlace config/config.go
+    substituteAllInPlace doc/aerc-config.5.scd
+  '';
+
+  makeFlags = [ "PREFIX=${placeholder "out"}" ];
+
   pythonPath = [
     python3.pkgs.colorama
   ];
 
   buildInputs = [ python3 notmuch ];
 
-  buildPhase = "
-    runHook preBuild
-    # we use make instead of go build
-    runHook postBuild
-  ";
-
   installPhase = ''
     runHook preInstall
-    make PREFIX=$out GOFLAGS="$GOFLAGS -tags=notmuch" install
-    wrapPythonProgramsIn $out/share/aerc/filters "$out $pythonPath"
+
+    make $makeFlags GOFLAGS="$GOFLAGS -tags=notmuch" install
+
     runHook postInstall
   '';
 
diff --git a/nixpkgs/pkgs/applications/networking/mailreaders/aerc/runtime-sharedir.patch b/nixpkgs/pkgs/applications/networking/mailreaders/aerc/runtime-sharedir.patch
index e08161e61eb6..d5e40edeb661 100644
--- a/nixpkgs/pkgs/applications/networking/mailreaders/aerc/runtime-sharedir.patch
+++ b/nixpkgs/pkgs/applications/networking/mailreaders/aerc/runtime-sharedir.patch
@@ -1,60 +1,90 @@
-From c715a96c693baa0e6c8ab3c96b6c10e0a40bf7af Mon Sep 17 00:00:00 2001
-From: Tadeo Kondrak <me@tadeo.ca>
-Date: Thu, 21 Jan 2021 10:40:49 +0100
-Subject: [PATCH] Fix aerc breaking every time the package is rebuilt.
-
-On NixOS, the SHAREDIR changes on every rebuild to the package, but aerc
-fills it in as part of the default config and then installs that config
-to the users home folder. Fix this by not substituting @SHAREDIR@ in the
-default config until runtime.
----
- Makefile         |  2 +-
- config/config.go | 13 +++++++++++++
- 2 files changed, 14 insertions(+), 1 deletion(-)
-
-diff --git a/Makefile b/Makefile
-index 77f5e61..98cbc11 100644
---- a/Makefile
-+++ b/Makefile
-@@ -23,7 +23,7 @@ aerc: $(GOSRC)
- 		-o $@
-
- aerc.conf: config/aerc.conf.in
--	sed -e 's:@SHAREDIR@:$(SHAREDIR):g' > $@ < config/aerc.conf.in
-+	cat config/aerc.conf.in > $@
-
- debug: $(GOSRC)
- 	GOFLAGS="-tags=notmuch" \
+diff --git a/config/aerc.conf b/config/aerc.conf
+index fbbf587..ede1a03 100644
+--- a/config/aerc.conf
++++ b/config/aerc.conf
+@@ -107,8 +107,7 @@ next-message-on-delete=true
+ #
+ #   ${XDG_CONFIG_HOME:-~/.config}/aerc/stylesets
+ #   ${XDG_DATA_HOME:-~/.local/share}/aerc/stylesets
+-#   /usr/local/share/aerc/stylesets
+-#   /usr/share/aerc/stylesets
++#   @out@/share/aerc/stylesets
+ #
+ # default: ""
+ stylesets-dirs=
+@@ -254,8 +253,7 @@ new-email=
+ #
+ #   ${XDG_CONFIG_HOME:-~/.config}/aerc/templates
+ #   ${XDG_DATA_HOME:-~/.local/share}/aerc/templates
+-#   /usr/local/share/aerc/templates
+-#   /usr/share/aerc/templates
++#   @out@/share/aerc/templates
+ #
+ # default: ""
+ template-dirs=
 diff --git a/config/config.go b/config/config.go
-index 87d183a..cb6611a 100644
+index 2120310..92b7655 100644
 --- a/config/config.go
 +++ b/config/config.go
-@@ -470,6 +470,16 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) {
- 			return nil, err
- 		}
+@@ -331,8 +331,8 @@ func buildDefaultDirs() []string {
  	}
-+	if sec, err := file.GetSection("templates"); err == nil {
-+		if key, err := sec.GetKey("template-dirs"); err == nil {
-+			sec.NewKey("template-dirs", strings.ReplaceAll(key.String(), "@SHAREDIR@", sharedir))
-+		}
-+	}
-+	if sec, err := file.GetSection("ui"); err == nil {
-+		if key, err := sec.GetKey("stylesets-dirs"); err == nil {
-+			sec.NewKey("stylesets-dirs", strings.ReplaceAll(key.String(), "@SHAREDIR@", sharedir))
-+		}
-+	}
- 	file.NameMapper = mapName
- 	config := &AercConfig{
- 		Bindings: BindingConfig{
-@@ -547,6 +557,9 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) {
- 		return nil, err
- 	}
-
-+	for i, filter := range config.Filters {
-+		config.Filters[i].Command = strings.ReplaceAll(filter.Command, "@SHAREDIR@", sharedir)
-+	}
- 	if ui, err := file.GetSection("general"); err == nil {
- 		if err := ui.MapTo(&config.General); err != nil {
- 			return nil, err
---
-2.30.0
+ 
+ 	// Add fixed fallback locations
+-	defaultDirs = append(defaultDirs, "/usr/local/share/aerc")
+-	defaultDirs = append(defaultDirs, "/usr/share/aerc")
++	defaultDirs = append(defaultDirs, "@out@/local/share/aerc")
++	defaultDirs = append(defaultDirs, "@out@/share/aerc")
+ 
+ 	return defaultDirs
+ }
+diff --git a/doc/aerc-config.5.scd b/doc/aerc-config.5.scd
+index 885c4f8..77a853e 100644
+--- a/doc/aerc-config.5.scd
++++ b/doc/aerc-config.5.scd
+@@ -12,7 +12,7 @@ account credentials. We look for these files in your XDG config home plus
+ "aerc", which defaults to ~/.config/aerc.
+ 
+ Examples of these config files are typically included with your installation of
+-aerc and are usually installed in /usr/share/aerc.
++aerc and are usually installed in @out@/share/aerc.
+ 
+ Each file uses the _ini_ format, and consists of sections with keys and values.
+ A line beginning with # is considered a comment and ignored, as are empty lines.
+@@ -221,8 +221,7 @@ These options are configured in the *[ui]* section of aerc.conf.
+ 	```
+ 	${XDG_CONFIG_HOME:-~/.config}/aerc/stylesets
+ 	${XDG_DATA_HOME:-~/.local/share}/aerc/stylesets
+-	/usr/local/share/aerc/stylesets
+-	/usr/share/aerc/stylesets
++	@out@/share/aerc/stylesets
+ 	```
+ 
+ 	Default: ""
+@@ -381,7 +380,7 @@ against (non-case-sensitive) and a comma, e.g. subject,text will match a
+ subject which contains "text". Use header,~regex to match against a regex.
+ 
+ aerc ships with some default filters installed in the share directory (usually
+-_/usr/share/aerc/filters_). Note that these may have additional dependencies
++_@out@/share/aerc/filters_). Note that these may have additional dependencies
+ that aerc does not have alone.
+ 
+ ## TRIGGERS
+@@ -407,7 +406,7 @@ and forward commands can be called with the -T flag with the name of the
+ template name.
+ 
+ aerc ships with some default templates installed in the share directory (usually
+-_/usr/share/aerc/templates_).
++_@out@/share/aerc/templates_).
+ 
+ These options are configured in the *[templates]* section of aerc.conf.
+ 
+@@ -419,8 +418,7 @@ These options are configured in the *[templates]* section of aerc.conf.
+ 	```
+ 	${XDG_CONFIG_HOME:-~/.config}/aerc/templates
+ 	${XDG_DATA_HOME:-~/.local/share}/aerc/templates
+-	/usr/local/share/aerc/templates
+-	/usr/share/aerc/templates
++	@out@/share/aerc/templates
+ 	```
+ 
+ 	Default: ""