it all works!
This commit is contained in:
parent
b5c4e9b594
commit
28e0f2bee7
27
flake.nix
27
flake.nix
|
@ -34,5 +34,32 @@
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nixosModule = { options, lib, config, pkgs, ... }:
|
||||||
|
let
|
||||||
|
serviceConfig = config.services.mossnet.dhyan;
|
||||||
|
options.enable = lib.mkEnableOption "Muneem weekly runner";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# TODO This won't work either because secrets aren't passed
|
||||||
|
options.services.mossnet.dhyan = options;
|
||||||
|
config = lib.mkIf serviceConfig.enable {
|
||||||
|
systemd.services."dhyan" = {
|
||||||
|
description = ''
|
||||||
|
My personal Accountant
|
||||||
|
'';
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
serviceConfig = { Type = "oneshot"; };
|
||||||
|
startAt = "*08:00:00";
|
||||||
|
path = with pkgs; [ babashka jdk11 self.packages.x86_64-linux.muneem ];
|
||||||
|
script = ''
|
||||||
|
set -ex
|
||||||
|
cd ${self.packages.x86_64-linux.muneem}
|
||||||
|
bb -m muneem.main
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
reverse)
|
reverse)
|
||||||
parse-year (-> (trans-date trans)
|
parse-year (-> (trans-date trans)
|
||||||
(jt/parse (pt/of-pattern "dd MMM uu"))
|
(jt/parse (pt/of-pattern "dd MMM uu"))
|
||||||
(jt/format (pt/of-pattern "YYYY-MM-dd")))]
|
(jt/format (pt/of-pattern "yyyy-MM-dd")))]
|
||||||
(if (and (not (nil? real-date)) (re-matches #"../.." real-date))
|
(if (and (not (nil? real-date)) (re-matches #"../.." real-date))
|
||||||
(conj statement (clojure.string/join "-" with-year))
|
(conj statement (clojure.string/join "-" with-year))
|
||||||
(conj statement parse-year))))
|
(conj statement parse-year))))
|
||||||
|
@ -376,7 +376,7 @@
|
||||||
date (-> (sh "date" "+%Y-%m-%d")
|
date (-> (sh "date" "+%Y-%m-%d")
|
||||||
:out
|
:out
|
||||||
(string/trim-newline))]
|
(string/trim-newline))]
|
||||||
(write-statement (str date " balance " account " " b " AUD"))))
|
(write-statement (vector (str date " balance " account " " b " AUD")))))
|
||||||
|
|
||||||
(defn main
|
(defn main
|
||||||
[csv checking? & _args]
|
[csv checking? & _args]
|
||||||
|
|
|
@ -10,10 +10,13 @@
|
||||||
(import/main "./documents/savings.csv" false)
|
(import/main "./documents/savings.csv" false)
|
||||||
(import/move-beancount-file))
|
(import/move-beancount-file))
|
||||||
|
|
||||||
(comment
|
(defn bootstrap
|
||||||
|
[]
|
||||||
(import/main "./documents/checking-last-year.csv" true)
|
(import/main "./documents/checking-last-year.csv" true)
|
||||||
(import/main "./documents/checking-this-year.csv" true)
|
(import/main "./documents/checking-this-year.csv" true)
|
||||||
(import/main "./documents/savings-last-year.csv" false)
|
(import/main "./documents/savings-last-year.csv" false)
|
||||||
(import/main "./documents/savings-this-year.csv" false)
|
(import/main "./documents/savings-this-year.csv" false))
|
||||||
|
|
||||||
(-main))
|
(comment
|
||||||
|
(-main)
|
||||||
|
(bootstrap))
|
||||||
|
|
Loading…
Reference in a new issue