mod: added container build option, formatted flake
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.18)
|
||||
{
|
||||
description = "A dice roller bot";
|
||||
|
||||
@@ -11,29 +10,41 @@
|
||||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
flake-schemas,
|
||||
nixpkgs,
|
||||
rust-overlay,
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
overlays = [
|
||||
rust-overlay.overlays.default
|
||||
(final: _: {
|
||||
rustToolchain = final.rust-bin.stable.latest.default.override {extensions = ["rust-src"];};
|
||||
rustToolchain = final.rust-bin.stable.latest.default.override { extensions = [ "rust-src" ]; };
|
||||
})
|
||||
];
|
||||
|
||||
supportedSystems = ["x86_64-linux" "aarch64-darwin" "aarch64-linux"];
|
||||
forEachSupportedSystem = f:
|
||||
nixpkgs.lib.genAttrs supportedSystems (system:
|
||||
supportedSystems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-darwin"
|
||||
"aarch64-linux"
|
||||
];
|
||||
forEachSupportedSystem =
|
||||
f:
|
||||
nixpkgs.lib.genAttrs supportedSystems (
|
||||
system:
|
||||
f {
|
||||
pkgs = import nixpkgs {inherit overlays system;};
|
||||
});
|
||||
in {
|
||||
pkgs = import nixpkgs { inherit overlays system; };
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
schemas = flake-schemas.schemas;
|
||||
|
||||
devShells = forEachSupportedSystem ({pkgs}: {
|
||||
formatter = forEachSupportedSystem ({ pkgs }: pkgs.nixfmt-rfc-style);
|
||||
devShells = forEachSupportedSystem (
|
||||
{ pkgs }:
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
rustToolchain
|
||||
@@ -47,7 +58,7 @@
|
||||
git
|
||||
jq
|
||||
wget
|
||||
nixpkgs-fmt
|
||||
nixfmt-rfc-style
|
||||
pkg-config-unwrapped
|
||||
openssl.dev
|
||||
];
|
||||
@@ -58,30 +69,28 @@
|
||||
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
packages = forEachSupportedSystem ({ pkgs }: {
|
||||
default = let
|
||||
packages = forEachSupportedSystem (
|
||||
{ pkgs }:
|
||||
let
|
||||
pname = "caitsith";
|
||||
version = "master";
|
||||
|
||||
src = pkgs.fetchFromGitea {
|
||||
domain = "scm.wyattjmiller.com";
|
||||
owner = "wymiller";
|
||||
repo = "caitsith";
|
||||
rev = "${version}";
|
||||
sha256 = "sha256-bNIzb57qPzzgwGVTjk2N59P7Rtt0MdyJY12sTAH05/s=";
|
||||
bot = pkgs.rustPlatform.buildRustPackage {
|
||||
inherit pname version;
|
||||
src = self;
|
||||
cargoLock = {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
in pkgs.rustPlatform.buildRustPackage {
|
||||
inherit pname version src;
|
||||
cargoLock = { lockFile = "${src}/Cargo.lock"; };
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config-unwrapped
|
||||
openssl.dev
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "A Discord/Matrix bot that deathrolls";
|
||||
description = "A dice roller bot";
|
||||
mainProgram = "caitsith";
|
||||
homepage = "https://scm.wyattjmiller.com/wymiller/caitsith";
|
||||
maintainers = [ "wymillerlinux" ];
|
||||
@@ -92,6 +101,28 @@
|
||||
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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user