update to include java (eugh) and create a nixosModule
This commit is contained in:
parent
94097d905f
commit
e5dc7d83b1
29
flake.nix
29
flake.nix
|
@ -10,12 +10,39 @@
|
|||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||
in
|
||||
{
|
||||
nixosModule = { options, lib, config, pkgs, ... }:
|
||||
let
|
||||
serviceConfig = config.services.mossnet.dhyan;
|
||||
options.enable = lib.mkEnableOption "Dhyan daily runner";
|
||||
in
|
||||
{
|
||||
options.services.mossnet.dhyan = options;
|
||||
config = lib.mkIf serviceConfig.enable {
|
||||
systemd.services."dhyan" = {
|
||||
description = ''
|
||||
Various matrix bot integrations
|
||||
'';
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = { Type = "oneshot"; };
|
||||
startsAt = "*08:00:00";
|
||||
path = with pkgs; [ babashka jdk11 ];
|
||||
script = ''
|
||||
set -ex
|
||||
cd ~/usr/dhyan
|
||||
bb -m dhyan.main
|
||||
'';
|
||||
|
||||
};
|
||||
};
|
||||
};
|
||||
devShell.x86_64-linux = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
jdk11
|
||||
babashka
|
||||
];
|
||||
shellHook = ''
|
||||
[[ -z $token ]] && echo "::dhyan:: Necessary Env Var missing: token"
|
||||
[[ -z $SHAARLI_TOKEN ]] && echo "::dhyan:: Necessary Env Var missing: SHAARLI_TOKEN"
|
||||
[[ -z $MATRIX_PASSWORD ]] && echo "::dhyan:: Necessary Env Var missing: MATRIX_PASSWORD"
|
||||
[[ -z $folder ]] && echo "::dhyan:: Necessary Env Var missing: folder"
|
||||
'';
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue