tvl-depot/users/Profpatsch/aerc.nix
Profpatsch 2a6928fb4c feat(users/Profpatsch): init initial aerc config
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>
2022-05-05 20:18:36 +00:00

70 lines
1.5 KiB
Nix

{ 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