Skip to content

Commit

Permalink
fix(nixos): updated configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Wittano committed Aug 21, 2024
1 parent 12d54e4 commit 0433cdc
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions nixos.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ in
description = "komputer package";
};
guildID = mkOption {
type = types.str;
type = types nullOr types.str;
default = null;
description = "Discord server id, that you deploy bot";
};
applicationID = mkOption {
Expand Down Expand Up @@ -43,29 +44,25 @@ in
assertion = cfg.token != "";
message = "Option komputer.token is empty";
}
{
assertion = cfg.guildID != "";
message = "Option komputer.guildID is empty";
}
{
assertion = cfg.applicationID != "";
message = "Option komputer.applicationID is empty";
}
{
assertion = cfg.mongodb != "";
assertion = cfg.mongodbURI != "";
message = "Option komputer.mongodbURI is empty";
}
];

systemd.services.komputer = {
description = "Komputer - Discord bot behave as like 'komputer'. One of character in Star Track parody series created by Dem3000";
wantedBy = [ "multi-user.target" ];
path = cfg.package.propagatedBuildInputs or [];
environment = {
DISCORD_BOT_TOKEN = cfg.token;
APPLICATION_ID = cfg.applicationID;
SERVER_GUID = cfg.guildID;
MONGODB_URI = cfg.mongodbURI;
};
} // attrsets.optionAtts (cfg.guildID != null) { SERVER_GUID = cfg.guildID; };
script = "${cfg.package}/bin/komputer";
};
};
Expand Down

0 comments on commit 0433cdc

Please sign in to comment.