mod: added container build option, formatted flake

This commit is contained in:
2026-08-25 22:09:24 -04:00
parent a4da7263c5
commit 51bc0cc922
+108 -77
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,87 +10,119 @@
}; };
}; };
outputs = { outputs =
self, {
flake-schemas, self,
nixpkgs, flake-schemas,
rust-overlay, nixpkgs,
}: let rust-overlay,
overlays = [ }:
rust-overlay.overlays.default let
(final: _: { overlays = [
rustToolchain = final.rust-bin.stable.latest.default.override {extensions = ["rust-src"];}; rust-overlay.overlays.default
}) (final: _: {
]; rustToolchain = final.rust-bin.stable.latest.default.override { extensions = [ "rust-src" ]; };
})
];
supportedSystems = ["x86_64-linux" "aarch64-darwin" "aarch64-linux"]; supportedSystems = [
forEachSupportedSystem = f: "x86_64-linux"
nixpkgs.lib.genAttrs supportedSystems (system: "aarch64-darwin"
f { "aarch64-linux"
pkgs = import nixpkgs {inherit overlays system;}; ];
}); forEachSupportedSystem =
in { f:
schemas = flake-schemas.schemas; nixpkgs.lib.genAttrs supportedSystems (
system:
f {
pkgs = import nixpkgs { inherit overlays system; };
}
);
in
{
schemas = flake-schemas.schemas;
formatter = forEachSupportedSystem ({ pkgs }: pkgs.nixfmt-rfc-style);
devShells = forEachSupportedSystem (
{ pkgs }:
{
default = pkgs.mkShell {
packages = with pkgs; [
rustToolchain
cargo-bloat
cargo-edit
cargo-outdated
cargo-udeps
cargo-watch
rust-analyzer
curl
git
jq
wget
nixfmt-rfc-style
pkg-config-unwrapped
openssl.dev
];
devShells = forEachSupportedSystem ({pkgs}: { env = {
default = pkgs.mkShell { RUST_BACKTRACE = "1";
packages = with pkgs; [ RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library";
rustToolchain PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
cargo-bloat };
cargo-edit };
cargo-outdated }
cargo-udeps );
cargo-watch
rust-analyzer
curl
git
jq
wget
nixpkgs-fmt
pkg-config-unwrapped
openssl.dev
];
env = { packages = forEachSupportedSystem (
RUST_BACKTRACE = "1"; { pkgs }:
RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library"; let
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; pname = "caitsith";
}; version = "master";
};
});
packages = forEachSupportedSystem ({ pkgs }: { bot = pkgs.rustPlatform.buildRustPackage {
default = let inherit pname version;
pname = "caitsith"; src = self;
version = "master"; cargoLock = {
lockFile = ./Cargo.lock;
};
nativeBuildInputs = with pkgs; [
pkg-config-unwrapped
openssl.dev
];
src = pkgs.fetchFromGitea { meta = {
domain = "scm.wyattjmiller.com"; description = "A dice roller bot";
owner = "wymiller"; mainProgram = "caitsith";
repo = "caitsith"; homepage = "https://scm.wyattjmiller.com/wymiller/caitsith";
rev = "${version}"; maintainers = [ "wymillerlinux" ];
sha256 = "sha256-bNIzb57qPzzgwGVTjk2N59P7Rtt0MdyJY12sTAH05/s="; platforms = [ "x86_64-linux" ];
}; };
in pkgs.rustPlatform.buildRustPackage {
inherit pname version src;
cargoLock = { lockFile = "${src}/Cargo.lock"; };
nativeBuildInputs = with pkgs; [
pkg-config-unwrapped
openssl.dev
];
meta = { env = {
description = "A Discord/Matrix bot that deathrolls"; PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
mainProgram = "caitsith"; };
homepage = "https://scm.wyattjmiller.com/wymiller/caitsith"; };
maintainers = [ "wymillerlinux" ]; in
platforms = [ "x86_64-linux" ]; {
}; default = bot;
docker = pkgs.dockerTools.buildLayeredImage {
name = pname;
tag = "latest";
contents = [
bot
pkgs.cacert
];
env = { config = {
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; 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";
};
};
};
}
);
};
} }