diff options
| author | Petri Hienonen <petri.hienonen@gmail.com> | 2025-12-30 17:15:55 +0200 |
|---|---|---|
| committer | Petri Hienonen <petri.hienonen@gmail.com> | 2025-12-30 17:15:55 +0200 |
| commit | cc9ab595bab3a76fe67d9e8ec88448b1e407a721 (patch) | |
| tree | bd6d11d0bee5c749964e6bfc91652c61faa72c64 /home/default.nix | |
| parent | fd6e6d96a8f9048676af65fa027f41de9fee9b95 (diff) | |
| download | nixos-cc9ab595bab3a76fe67d9e8ec88448b1e407a721.tar.zst | |
Split configurations into separate modules
Diffstat (limited to 'home/default.nix')
| -rw-r--r-- | home/default.nix | 209 |
1 files changed, 4 insertions, 205 deletions
diff --git a/home/default.nix b/home/default.nix index 21dbf53..7446be3 100644 --- a/home/default.nix +++ b/home/default.nix @@ -15,6 +15,7 @@ in imports = [ # ./quickshell (import ./nvim { inherit unstable; }) + ./bt.nix ./cargo.nix ./chromium.nix ./dav @@ -23,11 +24,14 @@ in ./firefox.nix ./fish.nix ./git.nix + ./goose.nix ./hyprland.nix ./hyprlock.nix ./mail ./mpv.nix ./newsboat.nix + ./nom.nix + ./ntfy.nix ./nushell.nix ./tenere.nix ./ticker.nix @@ -567,47 +571,6 @@ in startServices = "sd-switch"; }; - xdg.configFile."nom/config.yml".text = '' - autoread: true - ordering: desc - showread: false - openers: - - regex: "youtube" - cmd: "mpv %s" - - regex: ".*" - cmd: "${pkgs.firefox}/bin/firefox %s" - refreshinterval: 5 - filtering: - defaultIncludeFeedName: true - backends: - miniflux: - host: https://flux.tammi.cc - api_key: $(${pkgs.coreutils}/bin/cat ${config.age.secrets.miniflux_api_key.path}) - ''; - - systemd.user.services.ntfy-client = { - Unit = { - Description = "ntfy client subscriber"; - After = [ "graphical.target" ]; - }; - - Install = { - WantedBy = [ "default.target" ]; - }; - - Service = { - ExecStart = "${pkgs.ntfy-sh}/bin/ntfy subscribe --config /home/petri/.config/ntfy/client.yml --from-config"; - Restart = "on-failure"; - RestartSec = "10s"; - ProtectSystem = "strict"; - ProtectHome = "read-only"; - PrivateTmp = true; - NoNewPrivileges = true; - RestrictRealtime = true; - LockPersonality = true; - }; - }; - xdg.configFile."xdg-desktop-portal-termfilechooser/config".source = (pkgs.formats.toml { }).generate "termfilechooser-config" { @@ -667,168 +630,4 @@ in fi ''; }; - - systemd.user.services.bt-notify = { - Unit = { - Description = "Bluetooth Connection & Battery Notifications"; - After = [ "graphical-session.target" ]; - ConditionPathExists = "${config.home.homeDirectory}/.local/bin/bt-notify.sh"; - }; - Install = { - WantedBy = [ "graphical-session.target" ]; - }; - Service = { - Type = "simple"; - ExecStart = "${config.home.homeDirectory}/.local/bin/bt-notify.sh"; - Restart = "always"; - RestartSec = 5; - }; - }; - - home.file."/.local/bin/bt-notify.sh" = { - source = pkgs.writeShellScript "bt-notify" '' - set -euo pipefail - - # Temporary file to remember which devices were connected last loop - STATE_FILE="/tmp/bt-connected-state" - - # Ensure the file exists - touch "$STATE_FILE" - - # Listen to BlueZ D-Bus signals AND poll for battery (some devices only report on poll) - ( - # D-Bus listener (connection events) - ${pkgs.dbus}/bin/dbus-monitor "interface=org.bluez.Device1,member=PropertiesChanged" --system & - - # Polling loop for battery (runs in background) - while true; do - ${pkgs.bluez}/bin/bluetoothctl devices | cut -f2 -d' ' | while read -r mac; do - info=$(${pkgs.bluez}/bin/bluetoothctl info "$mac") - name=$(echo "$info" | grep -i "Alias" | cut -d' ' -f2-) - connected=$(echo "$info" | grep -i "Connected" | awk '{print $2}') - battery_line=$(echo "$info" | grep -i "Battery Percentage" || true) - battery=$(echo "$battery_line" | awk '{print $3}' | tr -d '()') - - # --- Connection change detection --- - if [[ "$connected" == "yes" ]] && ! grep -q "^$mac$" "$STATE_FILE"; then - ${pkgs.libnotify}/bin/notify-send -a "Bluetooth" "Connected" "$name" - echo "$mac" >> "$STATE_FILE" - elif [[ "$connected" == "no" ]] && grep -q "^$mac$" "$STATE_FILE"; then - ${pkgs.libnotify}/bin/notify-send -a "Bluetooth" "Disconnected" "$name" - sed -i "/^$mac$/d" "$STATE_FILE" - fi - - # --- Low battery warning --- - if [[ -n "$battery" && "$battery" -lt 20 ]]; then - ${pkgs.libnotify}/bin/notify-send -u critical -a "Bluetooth" "Low Battery" "$name: ''${battery}%" - fi - done - sleep 10 - done & - ) | while read -r line; do - # Parse D-Bus PropertiesChanged for Connected - if echo "$line" | grep -q '"Connected"'; then - path=$(echo "$line" | grep -oP 'path="\K[^"]+') - mac=$(basename "$path") - info=$(${pkgs.bluez}/bin/bluetoothctl info "$mac") - name=$(echo "$info" | grep -i "Alias" | cut -d' ' -f2-) - connected=$(echo "$info" | grep -i "Connected" | awk '{print $2}') - - if [[ "$connected" == "yes" ]] && ! grep -q "^$mac$" "$STATE_FILE"; then - ${pkgs.libnotify}/bin/notify-send -a "Bluetooth" "Connected" "$name" - echo "$mac" >> "$STATE_FILE" - elif [[ "$connected" == "no" ]] && grep -q "^$mac$" "$STATE_FILE"; then - ${pkgs.libnotify}/bin/notify-send -a "Bluetooth" "Disconnected" "$name" - sed -i "/^$mac$/d" "$STATE_FILE" - fi - fi - done - ''; - }; - - xdg.configFile."goose/config.yaml".source = (pkgs.formats.yaml { }).generate "goose-config" { - OPENAI_BASE_PATH = "v1/chat/completions"; - extensions = { - developer = { - available_tools = [ ]; - bundled = true; - description = null; - display_name = "Developer"; - enabled = true; - name = "developer"; - timeout = 300; - type = "builtin"; - }; - computercontroller = { - bundled = true; - display_name = "Computer Controller"; - enabled = true; - name = "computercontroller"; - timeout = 300; - type = "builtin"; - }; - memory = { - available_tools = [ ]; - bundled = true; - description = "Tools to save and retrieve durable memories"; - display_name = "Memory"; - enabled = true; - name = "memory"; - timeout = 80; - type = "builtin"; - }; - todo = { - available_tools = [ ]; - bundled = true; - description = "Enable a todo list for Goose so it can keep track of what it is doing"; - enabled = true; - name = "todo"; - type = "platform"; - }; - chatrecall = { - available_tools = [ ]; - bundled = true; - description = "Search past conversations and load session summaries for contextual memory"; - enabled = true; - name = "chatrecall"; - type = "platform"; - }; - extensionmanager = { - available_tools = [ ]; - bundled = true; - description = "Enable extension management tools for discovering, enabling, and disabling extensions"; - enabled = true; - name = "Extension Manager"; - type = "platform"; - }; - autovisualiser = { - available_tools = [ ]; - bundled = true; - description = "Data visualisation and UI generation tools"; - display_name = "Auto Visualiser"; - enabled = true; - name = "autovisualiser"; - timeout = 300; - type = "builtin"; - }; - }; - GOOSE_MODE = "auto"; - GOOSE_PROVIDER = "openai"; - GOOSE_MODEL = "gpt-4.1-mini"; - OPENAI_HOST = "https://api.openai.com"; - }; - - xdg.configFile."ntfy/client.yml".source = (pkgs.formats.yaml { }).generate "ntfy-client-config" { - "default-host" = "https://ntfy.tammi.cc"; - subscribe = [ - { - topic = "77WxlkfsTzGrbYFw"; - host = "https://ntfy.tammi.cc"; - since = "1h"; - persist = true; - keepalive = "45s"; - format = "markdown"; - } - ]; - }; } |
