From e41cdeb3b330bc0978e4d58ea328ca27f8dbfc3a Mon Sep 17 00:00:00 2001 From: TheWanderingCrow Date: Tue, 30 Dec 2025 21:14:08 -0500 Subject: [PATCH] actualbudget-report --- flake.lock | 109 ++++++++++++++++++---- flake.nix | 1 + modules/services/actualbudget/default.nix | 64 ++++++++++--- 3 files changed, 143 insertions(+), 31 deletions(-) diff --git a/flake.lock b/flake.lock index fca3bf5..193ed7e 100644 --- a/flake.lock +++ b/flake.lock @@ -1,8 +1,27 @@ { "nodes": { + "actualbudget-report": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1767150681, + "narHash": "sha256-7jwftrKGKHEec1hozqsL1v6KYPFTHKqSsOejiLhLGrY=", + "ref": "refs/heads/main", + "rev": "586e336cb885cbc87d2f296e995590385e9d60d9", + "revCount": 30, + "type": "git", + "url": "https://git.wanderingcrow.net/TheWanderingCrow/actualbudget-report" + }, + "original": { + "type": "git", + "url": "https://git.wanderingcrow.net/TheWanderingCrow/actualbudget-report" + } + }, "deferred-apps": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1766929169, @@ -55,6 +74,24 @@ } }, "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1762810396, + "narHash": "sha256-dxFVgQPG+R72dkhXTtqUm7KpxElw3u6E+YlQ2WaDgt8=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "0bdadb1b265fb4143a75bd1ec7d8c915898a9923", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": [ "nvix", @@ -133,7 +170,7 @@ "iamb-flake": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "rust-overlay": "rust-overlay" }, "locked": { @@ -203,14 +240,14 @@ }, "nix-secrets": { "inputs": { - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1765919359, - "narHash": "sha256-gUvmyGPzRf7skvhuwl6ose5SwvkdBtzgt7z9uYmGY/c=", + "lastModified": 1767150874, + "narHash": "sha256-F59DlANI2cCSEmDYdCGBxI5jlIq+g+6prZPvtX8mBeg=", "ref": "refs/heads/master", - "rev": "0cefdfc056fbfe8d6ab706c89675193fa5b59f77", - "revCount": 162, + "rev": "048111b8d221fbcefee6855ca6f8bde0b7d636bf", + "revCount": 164, "type": "git", "url": "ssh://git@github.com/TheWanderingCrow/nix-secrets" }, @@ -221,11 +258,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1766651565, - "narHash": "sha256-QEhk0eXgyIqTpJ/ehZKg9IKS7EtlWxF3N7DXy42zPfU=", + "lastModified": 1762596750, + "narHash": "sha256-rXXuz51Bq7DHBlfIjN7jO8Bu3du5TV+3DSADBX7/9YQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3e2499d5539c16d0d173ba53552a4ff8547f4539", + "rev": "b6a8526db03f735b89dd5ff348f53f752e7ddc8e", "type": "github" }, "original": { @@ -251,6 +288,21 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1761765539, + "narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "719359f4562934ae99f5443f20aa06c2ffff91fc", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1766201043, @@ -284,6 +336,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1766651565, + "narHash": "sha256-QEhk0eXgyIqTpJ/ehZKg9IKS7EtlWxF3N7DXy42zPfU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3e2499d5539c16d0d173ba53552a4ff8547f4539", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1736883708, "narHash": "sha256-uQ+NQ0/xYU0N1CnXsa2zghgNaOPxWpMJXSUJJ9W7140=", @@ -299,7 +367,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_4": { "locked": { "lastModified": 1736320768, "narHash": "sha256-nIYdTAiKIGnFNugbomgBJR+Xv5F1ZQU+HfaBqJKroC0=", @@ -315,7 +383,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_5": { "locked": { "lastModified": 1750605355, "narHash": "sha256-xT8cPLTxlktxI9vSdoBlAVK7dXgd8IK59j7ZwzkkhnI=", @@ -329,7 +397,7 @@ "type": "indirect" } }, - "nixpkgs_5": { + "nixpkgs_6": { "locked": { "lastModified": 1766201043, "narHash": "sha256-eplAP+rorKKd0gNjV3rA6+0WMzb1X1i16F5m5pASnjA=", @@ -345,7 +413,7 @@ "type": "github" } }, - "nixpkgs_6": { + "nixpkgs_7": { "locked": { "lastModified": 1757745802, "narHash": "sha256-hLEO2TPj55KcUFUU1vgtHE9UEIOjRcH/4QbmfHNF820=", @@ -361,7 +429,7 @@ "type": "github" } }, - "nixpkgs_7": { + "nixpkgs_8": { "locked": { "lastModified": 1756696532, "narHash": "sha256-6FWagzm0b7I/IGigOv9pr6LL7NQ86mextfE8g8Q6HBg=", @@ -380,9 +448,9 @@ "nvf": { "inputs": { "flake-compat": "flake-compat", - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "mnw": "mnw", - "nixpkgs": "nixpkgs_7", + "nixpkgs": "nixpkgs_8", "systems": "systems_2" }, "locked": { @@ -401,7 +469,7 @@ }, "nvix": { "inputs": { - "nixpkgs": "nixpkgs_6", + "nixpkgs": "nixpkgs_7", "nvf": "nvf" }, "locked": { @@ -435,6 +503,7 @@ }, "root": { "inputs": { + "actualbudget-report": "actualbudget-report", "deferred-apps": "deferred-apps", "disko": "disko", "hardware": "hardware", @@ -443,7 +512,7 @@ "impermanence": "impermanence", "nix-darwin": "nix-darwin", "nix-secrets": "nix-secrets", - "nixpkgs": "nixpkgs_5", + "nixpkgs": "nixpkgs_6", "nixpkgs-darwin": "nixpkgs-darwin", "nixpkgs-stable": "nixpkgs-stable", "nixpkgs-unstable": "nixpkgs-unstable", @@ -454,7 +523,7 @@ }, "rust-overlay": { "inputs": { - "nixpkgs": "nixpkgs_3" + "nixpkgs": "nixpkgs_4" }, "locked": { "lastModified": 1736994333, diff --git a/flake.nix b/flake.nix index 4157e84..66e27c9 100644 --- a/flake.nix +++ b/flake.nix @@ -121,5 +121,6 @@ # CrOS inputs nix-secrets.url = "git+ssh://git@github.com/TheWanderingCrow/nix-secrets"; nvix.url = "github:TheWanderingCrow/nvix"; + actualbudget-report.url = "git+https://git.wanderingcrow.net/TheWanderingCrow/actualbudget-report"; }; } diff --git a/modules/services/actualbudget/default.nix b/modules/services/actualbudget/default.nix index d1de565..ec86043 100644 --- a/modules/services/actualbudget/default.nix +++ b/modules/services/actualbudget/default.nix @@ -8,6 +8,12 @@ let sopsFolder = builtins.toString inputs.nix-secrets + "/sops"; in { + nixpkgs.overlays = [ inputs.actualbudget-report.overlays.default ]; + + imports = [ + inputs.actualbudget-report.nixosModules.default + ]; + systemd.tmpfiles.rules = [ "d ${volumePath}/actualbudget" "d ${volumePath}/actualbudget-api" @@ -24,22 +30,52 @@ in "actualbudget/client-id" = { sopsFile = "${sopsFolder}/services.yaml"; }; + "actualbudget/recipients" = { + sopsFile = "${sopsFolder}/services.yaml"; + }; "actualbudget/client-secret" = { sopsFile = "${sopsFolder}/services.yaml"; }; + "actualbudget/sync-id" = { + sopsFile = "${sopsFolder}/services.yaml"; + }; + "generic/smtp/server" = { + sopsFile = "${sopsFolder}/services.yaml"; + }; + "generic/smtp/port" = { + sopsFile = "${sopsFolder}/services.yaml"; + }; + "generic/smtp/user" = { + sopsFile = "${sopsFolder}/services.yaml"; + }; + "generic/smtp/pass" = { + sopsFile = "${sopsFolder}/services.yaml"; + }; }; - templates."actualbudget-env".content = '' - ACTUAL_OPENID_DISCOVERY_URL=https://auth.wanderingcrow.net/.well-known/openid-configuration - ACTUAL_OPENID_CLIENT_ID=${config.sops.placeholder."actualbudget/client-id"} - ACTUAL_OPENID_CLIENT_SECRET=${config.sops.placeholder."actualbudget/client-secret"} - ACTUAL_OPENID_SERVER_HOSTNAME=https://budget.wanderingcrow.net - ''; - templates."actualbudget-api-env".content = '' - ACTUAL_SERVER_URL=https://budget.wanderingcrow.net - ACTUAL_SERVER_PASSWORD=${config.sops.placeholder."actualbudget/pass"} - API_KEY=${config.sops.placeholder."actualbudget/key"} - ''; + templates = { + "actualbudget-env".content = '' + ACTUAL_OPENID_DISCOVERY_URL=https://auth.wanderingcrow.net/.well-known/openid-configuration + ACTUAL_OPENID_CLIENT_ID=${config.sops.placeholder."actualbudget/client-id"} + ACTUAL_OPENID_CLIENT_SECRET=${config.sops.placeholder."actualbudget/client-secret"} + ACTUAL_OPENID_SERVER_HOSTNAME=https://budget.wanderingcrow.net + ''; + "actualbudget-api-env".content = '' + ACTUAL_SERVER_URL=https://budget.wanderingcrow.net + ACTUAL_SERVER_PASSWORD=${config.sops.placeholder."actualbudget/pass"} + API_KEY=${config.sops.placeholder."actualbudget/key"} + ''; + "actualbudget-report-env".content = '' + BASE_URL=https://api.budget.wanderingcrow.net + API_KEY=${config.sops.placeholder."actualbudget/key"} + SYNC_ID=${config.sops.placeholder."actualbudget/sync-id"} + SMTP_USERNAME=${config.sops.placeholder."generic/smtp/user"} + SMTP_PASSWORD=${config.sops.placeholder."generic/smtp/pass"} + SMTP_HOST=${config.sops.placeholder."generic/smtp/server"} + SMTP_PORT=${config.sops.placeholder."generic/smtp/port"} + SMTP_RECIPIENTS=${config.sops.placeholder."actualbudget/recipients"} + ''; + }; }; services.caddy = { @@ -76,4 +112,10 @@ in }; }; }; + + services.actualbudget-report = { + enable = true; + interval = "Sun 12:00:00"; + environmentFile = config.sops.templates."actualbudget-report-env".path; + }; }