nixos-config/components/gui/noti.nix
2024-06-07 22:56:52 +02:00

39 lines
1.3 KiB
Nix

# notify me when a command is finished
# todo : secret managment is shit
{ config, pkgs, lib, ... }:
with lib;
{
options.components.gui.noti.enable = mkOption {
type = lib.types.bool;
default = config.components.gui.enable;
};
# todo : put this in `/homes`
config = mkIf (config.components.gui.noti.enable) {
sops.secrets.pushover_user_key = { };
sops.secrets.pushover_api_key = { };
sops.templates."noti.yaml".owner = config.users.users.mainUser.name;
sops.templates."noti.yaml".group = config.users.users.mainUser.group;
sops.templates."noti.yaml".content = ''
pushover:
userKey: ${config.sops.placeholder.pushover_user_key}
apiToken: ${config.sops.placeholder.pushover_api_key}
'';
home-manager.users.mainUser = {
home.packages = [
(pkgs.writers.writeBashBin "noti" ''
${pkgs.noti}/bin/noti --file ${config.sops.templates."noti.yaml".path} "$@"
'')
(pkgs.writers.writeBashBin "noti-pushover" ''
${pkgs.noti}/bin/noti --pushover --file ${config.sops.templates."noti.yaml".path} "$@"
'')
];
## not working :(
#programs.noti.enable = true;
#xdg.configFile."noti/noti.yaml".source = toString config.sops.templates."noti.yaml".path;
};
};
}