# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.18) { description = "A trivia buzzer"; inputs = { flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*"; nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*"; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; }; outputs = { self, flake-schemas, nixpkgs, rust-overlay, }: let overlays = [ rust-overlay.overlays.default (final: _: { 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: f { pkgs = import nixpkgs {inherit overlays system;}; }); in { schemas = flake-schemas.schemas; devShells = forEachSupportedSystem ({pkgs}: { default = pkgs.mkShell { packages = with pkgs; [ rustToolchain cargo-bloat cargo-edit cargo-outdated cargo-udeps cargo-watch rust-analyzer cmake curl git jq wget nixpkgs-fmt pkg-config-unwrapped openssl.dev ]; env = { RUST_BACKTRACE = "1"; RUST_SRC_PATH = "${pkgs.rustToolchain}/lib/rustlib/src/rust/library"; PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig"; }; }; }); packages = forEachSupportedSystem ({ pkgs }: let pname = "hildebrand"; version = "master"; bot = pkgs.rustPlatform.buildRustPackage { inherit pname version; src = self; cargoLock = { lockFile = ./Cargo.lock; }; nativeBuildInputs = [pkgs.cmake]; meta = { description = "A Discord trivia buzzer bot"; mainProgram = "hildebrand"; homepage = "https://scm.wyattjmiller.com/wymiller/hildebrand"; maintainers = [ "wymillerlinux" ]; platforms = supportedSystems; }; }; in { default = bot; } // pkgs.lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux { 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 Discord trivia buzzer bot"; "org.opencontainers.image.source" = "https://scm.wyattjmiller.com/wymiller/hildebrand"; }; }; }; }); }; }