muneem/flake.nix

66 lines
1.7 KiB
Nix
Raw Normal View History

{
description = "Beancount Importer";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
};
outputs = { self, nixpkgs }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
{
packages.x86_64-linux.muneem = pkgs.stdenv.mkDerivation {
name = "muneem";
src = ./.;
installPhase = ''
mkdir -p $out
cp -r src/ $out/
cp bb.edn $out/
cp deps.edn $out/
'';
};
defaultPackage.x86_64-linux = self.packages.x86_64-linux.muneem;
devShell.x86_64-linux = pkgs.mkShell {
buildInputs = with pkgs; [
jdk11
babashka
geckodriver
chromedriver
chromium
];
shellHook = ''
'';
};
2022-11-30 19:57:51 -08:00
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
'';
};
};
};
};
}