diff options
author | Profpatsch <mail@profpatsch.de> | 2022-05-05T19·10+0200 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2022-05-05T20·18+0000 |
commit | 2a6928fb4cde593c530c3dd49cb9f80126c8df42 (patch) | |
tree | 04674c2c818f6acbbeb36a30d490fff590d4e98e /users/Profpatsch/aerc.nix | |
parent | f0e52f31cd33fd321f71eda0bc1d6cd965b5997c (diff) |
feat(users/Profpatsch): init initial aerc config r/4009
aerc is a mail client. It needs some ini files to work. This is an initial attempt at generating them. Change-Id: I087955f19d2c4527275500a1e13eeb071c98a7b9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5526 Tested-by: BuildkiteCI Reviewed-by: Profpatsch <mail@profpatsch.de>
Diffstat (limited to 'users/Profpatsch/aerc.nix')
-rw-r--r-- | users/Profpatsch/aerc.nix | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/users/Profpatsch/aerc.nix b/users/Profpatsch/aerc.nix new file mode 100644 index 000000000000..d37d10eb4626 --- /dev/null +++ b/users/Profpatsch/aerc.nix @@ -0,0 +1,70 @@ +{ depot, pkgs, lib, ... }: + +let + aerc-patched = pkgs.aerc.overrideAttrs (old: { + patches = old.patches or [ ] ++ [ + ./aerc-no-config-perms.patch + ]; + }); + + bins = depot.nix.getBins aerc-patched [ "aerc" ]; + + config = + depot.users.Profpatsch.importDhall.importDhall + { + root = ./.; + files = [ + "aerc.dhall" + ]; + main = "aerc.dhall"; + deps = [ ]; + } + { + concatNewline = lib.concatStringsSep "\n"; + aercFilter = name: "${aerc-patched}/share/aerc/filters/${name}"; + toIni = getSections: + lib.generators.toINIWithGlobalSection { } + (getSections { } toIniDhall); + }; + + toIniDhall = { + newSection = { }; + add = key: val: sect: sect // { ${key} = val; }; + addAll = keyVals: sect: sect // builtins.listToAttrs keyVals; + newSectionList = { }; + addSection = key: val: sect: sect // { ${key} = val; }; + }; + + + ini-file = name: ini: lib.pipe ini [ + (lib.generators.toINI { }) + (pkgs.writeText name) + ]; + + binds-file = name: binds: pkgs.writeText name binds; + + aerc-config = pkgs.linkFarm "alacritty-config" [ + { + name = "aerc/accounts.conf"; + path = pkgs.writeText "accounts.conf" config.accounts; + } + { + name = "aerc/aerc.conf"; + path = pkgs.writeText "aerc.conf" config.aerc; + } + { + name = "aerc/binds.conf"; + path = binds-file "binds.conf" config.binds; + } + ]; + + aerc = depot.nix.writeExecline "aerc" { } [ + "export" + "XDG_CONFIG_HOME" + aerc-config + bins.aerc + "$@" + ]; + +in +aerc |