From 72ec35cb69a3725a7b069288585b8a58f2a5c44c Mon Sep 17 00:00:00 2001 From: Ingolf Wagner <contact@ingolf-wagner.de> Date: Wed, 8 Jan 2025 17:04:31 +1300 Subject: [PATCH] :sparkles: configure noti and tea timer in i3 bar to use pushover --- components/gui/default.nix | 2 +- components/gui/noti.nix | 54 +++++++++++++++++++++++--------------- homes/palo/i3.nix | 2 +- 3 files changed, 35 insertions(+), 23 deletions(-) diff --git a/components/gui/default.nix b/components/gui/default.nix index 40b8af5..ad386e3 100644 --- a/components/gui/default.nix +++ b/components/gui/default.nix @@ -17,7 +17,7 @@ with lib; ./cups.nix ./home-manager ./kmonad.nix - #./noti.nix # todo: make this different (use password store and such) + ./noti.nix # todo: make this different (use password store and such) ./pass.nix ./steam.nix ./suspend.nix diff --git a/components/gui/noti.nix b/components/gui/noti.nix index 2a298c9..84fd02f 100644 --- a/components/gui/noti.nix +++ b/components/gui/noti.nix @@ -16,29 +16,41 @@ with lib; # 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} - ''; + clan.core.facts.services.noti = { + secret."noti.yaml" = { }; + generator = { + prompt = "noti.yaml"; + path = with pkgs; [ coreutils ]; + script = '' + echo "$prompt_value" > "$secrets"/noti.yaml + ''; + }; + }; + + systemd.tmpfiles.settings.noti = { + # don't like to use a non tmpfs here, but does not work another way + "${config.users.users.mainUser.home}/.config/noti/noti.yaml"."C+" = { + user = config.users.users.mainUser.name; + group = config.users.users.mainUser.group; + mode = "400"; + argument = config.clan.core.facts.services.noti.secret."noti.yaml".path; + }; + }; + + # 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; + programs.noti.enable = true; + # xdg.configFile."noti/noti.yaml".target = "/run/facts/mainUser.noti.yaml"; }; + }; } diff --git a/homes/palo/i3.nix b/homes/palo/i3.nix index fe0b23a..b804039 100644 --- a/homes/palo/i3.nix +++ b/homes/palo/i3.nix @@ -125,7 +125,7 @@ in { block = "tea_timer"; format = " $icon {$minutes:$seconds |}"; - done_cmd = "${pkgs.noti}/bin/noti -t 'Timer Finished'"; + done_cmd = "${pkgs.noti}/bin/noti -o -t 'Timer Finished' || ${pkgs.noti}/bin/noti -t 'Timer Finished'"; } ]; };