From 44efab627f360093318cf475b7cc0ecfdcfdeebf Mon Sep 17 00:00:00 2001 From: Tadeo Kondrak Date: Mon, 28 Oct 2019 08:40:31 -0600 Subject: aerc: Fix store references in default config --- .../networking/mailreaders/aerc/default.nix | 4 ++ .../mailreaders/aerc/runtime-sharedir.patch | 43 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 pkgs/applications/networking/mailreaders/aerc/runtime-sharedir.patch (limited to 'pkgs/applications/networking') diff --git a/pkgs/applications/networking/mailreaders/aerc/default.nix b/pkgs/applications/networking/mailreaders/aerc/default.nix index b94ce2695662..98ab5f563521 100644 --- a/pkgs/applications/networking/mailreaders/aerc/default.nix +++ b/pkgs/applications/networking/mailreaders/aerc/default.nix @@ -18,6 +18,10 @@ buildGoModule rec { python3.pkgs.wrapPython ]; + patches = [ + ./runtime-sharedir.patch + ]; + pythonPath = [ python3.pkgs.colorama ]; diff --git a/pkgs/applications/networking/mailreaders/aerc/runtime-sharedir.patch b/pkgs/applications/networking/mailreaders/aerc/runtime-sharedir.patch new file mode 100644 index 000000000000..4ff1283b5e3d --- /dev/null +++ b/pkgs/applications/networking/mailreaders/aerc/runtime-sharedir.patch @@ -0,0 +1,43 @@ +From 7ea68a2eef026723903d72f54ca54b629881ec06 Mon Sep 17 00:00:00 2001 +From: Tadeo Kondrak +Date: Mon, 28 Oct 2019 08:36:36 -0600 +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. Fix this by not substituting +@SHAREDIR@ in the default config until runtime. +--- + Makefile | 2 +- + config/config.go | 3 +++ + 2 files changed, 4 insertions(+), 1 deletion(-) + +diff --git a/Makefile b/Makefile +index d3072d3..17ca0be 100644 +--- a/Makefile ++++ b/Makefile +@@ -24,7 +24,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 > $@ + + DOCS := \ + aerc.1 \ +diff --git a/config/config.go b/config/config.go +index bfcbecf..2f4e703 100644 +--- a/config/config.go ++++ b/config/config.go +@@ -377,6 +377,9 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) { + if err = config.LoadConfig(file); err != nil { + 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.23.0 + -- cgit 1.4.1