fix: make module work and add instructions for using

This commit is contained in:
TheWanderingCrow 2025-12-22 15:12:22 -05:00
parent 6636a7cb3a
commit 700659ff60
3 changed files with 54 additions and 44 deletions

View file

@ -12,6 +12,8 @@ inputs.actualbudget-report.url = "git+https://git.wanderingcrow.net/TheWandering
Then in your configuration (using sops-nix, you will need to adjust it if you use agenix or alternatives): Then in your configuration (using sops-nix, you will need to adjust it if you use agenix or alternatives):
```nix ```nix
nixpkgs.overlays = [ inputs.actualbudget-report.overlays.default ];
imports = [ imports = [
inputs.actualbudget-report.nixosModules.default; inputs.actualbudget-report.nixosModules.default;
]; ];

View file

@ -7,17 +7,24 @@
}; };
outputs = outputs =
inputs@{ flake-parts, ... }: inputs@{
flake-parts.lib.mkFlake { inherit inputs; } { self,
flake-parts,
...
}:
flake-parts.lib.mkFlake
{
inherit inputs;
}
{
imports = [ inputs.flake-parts.flakeModules.easyOverlay ];
systems = [ systems = [
"x86_64-linux" "x86_64-linux"
"aarch64-linux" "aarch64-linux"
"aarch64-darwin" "aarch64-darwin"
"x86_64-darwin" "x86_64-darwin"
]; ];
flake.nixosModules = { flake.nixosModules.default = ./modules/actualbudget-report;
default = ./modules/actualbudget-report;
};
perSystem = perSystem =
{ {
config, config,
@ -28,7 +35,8 @@
... ...
}: }:
{ {
packages.default = pkgs.buildGoModule { overlayAttrs = { inherit (config.packages) actualbudget-report; };
packages.actualbudget-report = pkgs.buildGoModule {
name = "actualbudget-report"; name = "actualbudget-report";
src = pkgs.fetchFromGitea { src = pkgs.fetchFromGitea {
domain = "git.wanderingcrow.net"; domain = "git.wanderingcrow.net";

View file

@ -1,8 +1,8 @@
{ {
pkgs,
config, config,
options, options,
lib, lib,
pkgs,
... ...
}: }:
let let
@ -10,8 +10,8 @@ let
opt = options.services.actualbudget-report; opt = options.services.actualbudget-report;
inherit (lib) inherit (lib)
mkEnableOption mkEnableOption
mkOption
mkPackageOption mkPackageOption
mkOption
mkIf mkIf
types types
; ;
@ -20,12 +20,12 @@ in
options = { options = {
services.actualbudget-report = { services.actualbudget-report = {
enable = mkEnableOption "Actualbudget email reports"; enable = mkEnableOption "Actualbudget email reports";
package = mkPackageOption pkgs.default; interval = mkOption {
interval = {
type = types.str; type = types.str;
default = "Sun 12:00:00"; default = "Sun 12:00:00";
description = "systemd-timer OnCalendar legal string for sending reports."; description = "systemd-timer OnCalendar legal string for sending reports.";
}; };
package = mkPackageOption pkgs "actualbudget-report" { };
environmentFile = mkOption { environmentFile = mkOption {
type = types.path; type = types.path;
default = ""; default = "";
@ -39,11 +39,11 @@ in
description = "Actualbudget report sender service"; description = "Actualbudget report sender service";
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = "${cfg.package}/bin/actualbudget-report"; ExecStart = "${pkgs.actualbudget-report}/bin/actualbudget-report";
EnvironmentFile = cfg.environmentFile; EnvironmentFile = cfg.environmentFile;
}; };
}; };
systemd.timers.flamesite-backup = { systemd.timers.actualbudget-report = {
enable = true; enable = true;
wantedBy = [ "timers.target" ]; wantedBy = [ "timers.target" ];
timerConfig = { timerConfig = {