1
0
Fork 0
mirror of https://git.oat.zone/dark-firepit/dotfiles synced 2024-05-06 14:36:06 +02:00
git.oat.zone--dark-firepit-.../modules/services/jillo.nix
System administrator 9da0a143ae some refactoring
Co-authored-by: Jill Monoids <oatmealine@disroot.org>
2022-09-05 18:27:22 +02:00

51 lines
1.1 KiB
Nix

{ pkgs, lib, config, options, ... }:
with lib;
let
cfg = config.modules.services.jillo;
in {
options.modules.services.jillo = {
enable = mkOption {
type = types.bool;
default = false;
};
package = mkOption {
type = types.package;
default = pkgs._.jillo;
};
dataDir = mkOption {
type = types.either [types.path types.str];
};
};
config = mkIf cfg.enable {
users.users.jillo = {
group = "jillo";
home = cfg.dataDir;
createHome = true;
isSystemUser = true;
shell = "${pkgs.bash}/bin/bash";
};
users.groups.jillo = {};
environment.systemPackages = [ pkgs.nodejs-18_x ];
systemd.services.jillo = {
description = "Jillo Discord bot";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "notify";
User = "jillo";
Group = "jillo";
WorkingDirectory = cfg.dataDir;
ExecStart = "${pkgs.nodejs-18_x}/bin/npm run start";
Restart = "on-failure";
};
};
};
}