{ inputs = { nixpkgs.url = "github:nixos/nixpkgs/release-22.05"; flake-utils.url = "github:numtide/flake-utils/master"; rust-overlay = { url = "github:oxalica/rust-overlay/master"; inputs = { flake-utils.follows = "flake-utils"; nixpkgs.follows = "nixpkgs"; }; }; naersk = { url = "github:nmattia/naersk/master"; inputs.nixpkgs.follows = "nixpkgs"; }; }; description = "thulani discord bot"; outputs = { self, nixpkgs, flake-utils, ... } @ inputs: (flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; overlays = [ (import inputs.rust-overlay) ]; }; buildToolchain = pkgs.rust-bin.nightly."2022-11-20".minimal; devToolchain = buildToolchain.override { extensions = [ "rust-src" "rust-analyzer" "clippy" "rust-docs" "rustfmt" ]; }; naersk = pkgs.callPackage inputs.naersk { cargo = buildToolchain; rustc = buildToolchain; }; deps = with pkgs; [ openssl pkgconfig libopus postgresql ]; inherit (pkgs) lib; pkg = naersk.buildPackage { pname = "thulani"; version = self.rev or "dirty"; src = lib.cleanSource ./.; nativeBuildInputs = deps; remapPathPrefix = true; }; in { devShells.default = pkgs.mkShell { buildInputs = (with pkgs; [ devToolchain ]) ++ deps; RUST_SRC_PATH = "${devToolchain}/lib/rustlib/src/rust"; }; packages.default = pkg; apps.default = { type = "app"; program = "${pkg}/bin/thulani"; }; }) ); }