nix!: refactored nixosModules

This commit is contained in:
Primrose 2024-10-12 00:11:47 +02:00
parent 3753271d60
commit 18f7c70bc9
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
17 changed files with 25 additions and 32 deletions

View file

@ -1,56 +0,0 @@
{
pkgs,
lib,
config,
...
}:
let
cfg = config.services.parrot;
t = lib.types;
in
{
options = {
services.parrot = {
enable = lib.mkEnableOption "parrot";
environmentFile = lib.mkOption {
description = "Path to an environment file, you can set the token there";
type = t.path;
};
};
};
config = lib.mkIf cfg.enable {
users.users."parrot" = {
group = "parrot";
isSystemUser = true;
};
users.groups."parrot" = { };
systemd.services."parrot" = {
description = " A hassle-free, highly performant, self-hosted Discord music bot with YouTube and Spotify support. Powered by yt-dlp.";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = "parrot";
Group = "parrot";
EnvironmentFile = cfg.environmentFile;
ExecStart = "${lib.getExe pkgs.parrot}";
};
};
};
}