Add Element profiles

This commit is contained in:
Jakob Lechner 2024-05-23 19:15:21 +02:00
parent 9fd3c86cbb
commit 63d1a68672

View file

@ -1,7 +1,42 @@
{ nixosConfig, lib, pkgs, ... }:
let
profiles = {
"digitaler-dienst" = {
description = "Digitaler Dienst";
};
"private" = {
description = "private";
};
};
in
lib.mkIf nixosConfig.jalr.gui.enable {
home.packages = with pkgs; [
element-desktop
];
# Create an empty directory in nix store
# as we want to use Element only with `--profile-dir`
xdg.configFile.Element = {
source = pkgs.runCommand "empty-Element-directory" { } "mkdir $out";
target = "Element";
};
xdg.desktopEntries = lib.attrsets.mapAttrs'
(name: value: lib.attrsets.nameValuePair "element-desktop-${name}"
{
categories = [ "Network" "InstantMessaging" "Chat" ];
exec = toString (pkgs.writeShellScript "element-desktop-${name}" ''
exec element-desktop --profile-dir "$HOME/.config/element-profiles/${name}"
'');
genericName = "Matrix Client";
icon = "element";
mimeType = [ "x-scheme-handler/element" ];
name = "Element ${value.description}";
terminal = false;
type = "Application";
}
)
profiles;
}