update workflow
This commit is contained in:
parent
cce1c1f059
commit
dde441bf9f
@ -3,7 +3,9 @@ FROM alpine as build
|
||||
ENV RUSTFLAGS="-C target-feature=-crt-static"
|
||||
WORKDIR /usr/src/saysthbot
|
||||
COPY . .
|
||||
RUN apk add --no-cache rustup openssl-dev build-base && rustup-init -y --default-toolchain nightly && source ${HOME}/.cargo/env && cargo build --release
|
||||
RUN apk add --no-cache rustup openssl-dev build-base && \
|
||||
rustup-init -y --default-toolchain nightly && \
|
||||
source ${HOME}/.cargo/env && cargo build --release
|
||||
|
||||
FROM alpine
|
||||
|
||||
|
37
flake.nix
37
flake.nix
@ -39,6 +39,7 @@
|
||||
openssl
|
||||
];
|
||||
};
|
||||
|
||||
devShell = with pkgs; mkShell {
|
||||
buildInputs = [
|
||||
cargo
|
||||
@ -53,5 +54,41 @@
|
||||
];
|
||||
RUST_SRC_PATH = rustPlatform.rustLibSrc;
|
||||
};
|
||||
|
||||
nixosModule = {config, pkgs, lib, ...}: with lib;
|
||||
let
|
||||
cfg = config.services.hangitbot;
|
||||
in {
|
||||
options.services.hangitbot = {
|
||||
enable = mkEnableOption "hangitbot service";
|
||||
|
||||
token = mkOption {
|
||||
type = types.str;
|
||||
example = "12345678:AAAAAAAAAAAAAAAAAAAAAAAAATOKEN";
|
||||
description = lib.mdDoc "Telegram bot token";
|
||||
};
|
||||
|
||||
tgUri = mkOption {
|
||||
type = types.str;
|
||||
default = "https://api.telegram.org";
|
||||
example = "https://api.telegram.org";
|
||||
description = lib.mdDoc "Custom telegram api URI";
|
||||
};
|
||||
|
||||
extraOptions = mkOption {
|
||||
type = types.str;
|
||||
description = lib.mdDoc "Extra option for bot.";
|
||||
};
|
||||
};
|
||||
|
||||
config = let
|
||||
args = "${cfg.extraOptions} ${if isString cfg.tgUri then "--api-uri ${escapeShellArg cfg.tgUri}" else ""}";
|
||||
in mkIf cfg.enable {
|
||||
systemd.services.hangitbot = {
|
||||
wantedBy = ["multi-uesr.target"];
|
||||
serviceconfig.ExecStart = "${pkgs.hangitbot}/bin/hangitbot ${args} ${escapeShellArg cfg.token}";
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user