mod: added container build option, formatted flake

This commit is contained in:
2026-08-25 22:09:24 -04:00
parent a4da7263c5
commit 51bc0cc922
+56 -25
View File
@@ -1,4 +1,3 @@
# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.18)
{ {
description = "A dice roller bot"; description = "A dice roller bot";
@@ -11,12 +10,14 @@
}; };
}; };
outputs = { outputs =
{
self, self,
flake-schemas, flake-schemas,
nixpkgs, nixpkgs,
rust-overlay, rust-overlay,
}: let }:
let
overlays = [ overlays = [
rust-overlay.overlays.default rust-overlay.overlays.default
(final: _: { (final: _: {
@@ -24,16 +25,26 @@
}) })
]; ];
supportedSystems = ["x86_64-linux" "aarch64-darwin" "aarch64-linux"]; supportedSystems = [
forEachSupportedSystem = f: "x86_64-linux"
nixpkgs.lib.genAttrs supportedSystems (system: "aarch64-darwin"
"aarch64-linux"
];
forEachSupportedSystem =
f:
nixpkgs.lib.genAttrs supportedSystems (
system:
f { f {
pkgs = import nixpkgs { inherit overlays system; }; pkgs = import nixpkgs { inherit overlays system; };
}); }
in { );
in
{
schemas = flake-schemas.schemas; schemas = flake-schemas.schemas;
formatter = forEachSupportedSystem ({ pkgs }: pkgs.nixfmt-rfc-style);
devShells = forEachSupportedSystem ({pkgs}: { devShells = forEachSupportedSystem (
{ pkgs }:
{
default = pkgs.mkShell { default = pkgs.mkShell {
packages = with pkgs; [ packages = with pkgs; [
rustToolchain rustToolchain
@@ -47,7 +58,7 @@
git git
jq jq
wget wget
nixpkgs-fmt nixfmt-rfc-style
pkg-config-unwrapped pkg-config-unwrapped
openssl.dev openssl.dev
]; ];
@@ -58,30 +69,28 @@
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
}; };
}; };
}); }
);
packages = forEachSupportedSystem ({ pkgs }: { packages = forEachSupportedSystem (
default = let { pkgs }:
let
pname = "caitsith"; pname = "caitsith";
version = "master"; version = "master";
src = pkgs.fetchFromGitea { bot = pkgs.rustPlatform.buildRustPackage {
domain = "scm.wyattjmiller.com"; inherit pname version;
owner = "wymiller"; src = self;
repo = "caitsith"; cargoLock = {
rev = "${version}"; lockFile = ./Cargo.lock;
sha256 = "sha256-bNIzb57qPzzgwGVTjk2N59P7Rtt0MdyJY12sTAH05/s=";
}; };
in pkgs.rustPlatform.buildRustPackage {
inherit pname version src;
cargoLock = { lockFile = "${src}/Cargo.lock"; };
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
pkg-config-unwrapped pkg-config-unwrapped
openssl.dev openssl.dev
]; ];
meta = { meta = {
description = "A Discord/Matrix bot that deathrolls"; description = "A dice roller bot";
mainProgram = "caitsith"; mainProgram = "caitsith";
homepage = "https://scm.wyattjmiller.com/wymiller/caitsith"; homepage = "https://scm.wyattjmiller.com/wymiller/caitsith";
maintainers = [ "wymillerlinux" ]; maintainers = [ "wymillerlinux" ];
@@ -92,6 +101,28 @@
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
}; };
}; };
}); in
{
default = bot;
docker = pkgs.dockerTools.buildLayeredImage {
name = pname;
tag = "latest";
contents = [
bot
pkgs.cacert
];
config = {
Entrypoint = [ "${bot}/bin/${pname}" ];
Env = [ "SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" ];
Labels = {
"org.opencontainers.image.title" = pname;
"org.opencontainers.image.description" = "A dice roller bot";
"org.opencontainers.image.source" = "https://scm.wyattjmiller.com/wymiller/caitsith";
};
};
};
}
);
}; };
} }